Fix crash on exiting personal pocket dimension #185

Closed
notabadminer wants to merge 67 commits from master into master
Showing only changes of commit c72a03b558 - Show all commits

View File

@@ -87,7 +87,7 @@ public class EventHookContainer
public void onSoundEffectResult(PlaySoundEvent17 event) public void onSoundEffectResult(PlaySoundEvent17 event)
{ {
ResourceLocation playingSound = event.sound.getPositionedSoundLocation(); ResourceLocation playingSound = event.sound.getPositionedSoundLocation();
if (playingSound != null && playingSound.getResourceDomain().equals("minecraft") && playingSound.getResourcePath().equals("music.game")) { 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) { if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID) {
ResourceLocation sound = new ResourceLocation(mod_pocketDim.modid + ":creepy"); ResourceLocation sound = new ResourceLocation(mod_pocketDim.modid + ":creepy");
@@ -145,11 +145,8 @@ public class EventHookContainer
PocketManager.load(); PocketManager.load();
} }
if (FMLClientHandler.instance().getClient().thePlayer == null) if (event.world.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID &&
return; event.world.isRemote && !Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(limboMusic)) {
if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID &&
!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(limboMusic)) {
Minecraft.getMinecraft().getSoundHandler().playSound(limboMusic); Minecraft.getMinecraft().getSoundHandler().playSound(limboMusic);
} }
} }