Don't crash server on startup trying to use sounds

This commit is contained in:
CannibalVox
2015-03-10 10:48:36 -05:00
parent 585b0685d0
commit 43e67bdbd3
5 changed files with 69 additions and 29 deletions

View File

@@ -51,12 +51,9 @@ public class EventHookContainer
private DDWorldProperties worldProperties;
private RiftRegenerator regenerator;
private ISound limboMusic;
public EventHookContainer(DDProperties properties)
{
this.properties = properties;
this.limboMusic = PositionedSoundRecord.func_147673_a(new ResourceLocation(mod_pocketDim.modid + ":creepy"));
}
public void setSessionFields(DDWorldProperties worldProperties, RiftRegenerator regenerator)
@@ -82,24 +79,6 @@ public class EventHookContainer
*/
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onSoundEffectResult(PlaySoundEvent17 event)
{
ResourceLocation playingSound = event.sound.getPositionedSoundLocation();
if (playingSound != null && playingSound.getResourceDomain().equals("minecraft") && (playingSound.getResourcePath().equals("music.game") || playingSound.getResourcePath().equals("music.game.creative"))) {
if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID) {
ResourceLocation sound = new ResourceLocation(mod_pocketDim.modid + ":creepy");
if (!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(limboMusic)) {
event.result = limboMusic;
} else {
event.setResult(Event.Result.DENY);
}
}
}
}
@SubscribeEvent
public void onPlayerEvent(PlayerInteractEvent event)
{
@@ -144,11 +123,6 @@ public class EventHookContainer
{
PocketManager.load();
}
if (event.world.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID &&
event.world.isRemote && !Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(limboMusic)) {
Minecraft.getMinecraft().getSoundHandler().playSound(limboMusic);
}
}
@SubscribeEvent