From 4ebf11ed5a5274cd495b92e673a135957e8542dd Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Mon, 9 Dec 2013 07:19:16 -0500 Subject: [PATCH] Fix crash --- common/mekanism/client/ClientProxy.java | 6 +++- common/mekanism/client/ClientTickHandler.java | 30 +++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/common/mekanism/client/ClientProxy.java b/common/mekanism/client/ClientProxy.java index 62309c9ac..2aeaab02e 100644 --- a/common/mekanism/client/ClientProxy.java +++ b/common/mekanism/client/ClientProxy.java @@ -135,7 +135,7 @@ public class ClientProxy extends CommonProxy Mekanism.configuration.load(); MekanismClient.enableSounds = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSounds", true).getBoolean(true); MekanismClient.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true); - MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "baseSoundVolume", 1).getDouble(1); + MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SoundVolume", 1).getDouble(1); Mekanism.configuration.save(); } @@ -324,6 +324,7 @@ public class ClientProxy extends CommonProxy return new GuiTeleporter(player.inventory, (TileEntityTeleporter)tileEntity); case 14: ItemStack itemStack = player.getCurrentEquippedItem(); + if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter) { return new GuiPortableTeleporter(player, itemStack); @@ -342,6 +343,7 @@ public class ClientProxy extends CommonProxy return new GuiPasswordModify((TileEntityElectricChest)tileEntity); case 21: EntityRobit robit = (EntityRobit)world.getEntityByID(x); + if(robit != null) { return new GuiRobitMain(player.inventory, robit); @@ -350,12 +352,14 @@ public class ClientProxy extends CommonProxy return new GuiRobitCrafting(player.inventory, world, x); case 23: EntityRobit robit1 = (EntityRobit)world.getEntityByID(x); + if(robit1 != null) { return new GuiRobitInventory(player.inventory, robit1); } case 24: EntityRobit robit2 = (EntityRobit)world.getEntityByID(x); + if(robit2 != null) { return new GuiRobitSmelting(player.inventory, robit2); diff --git a/common/mekanism/client/ClientTickHandler.java b/common/mekanism/client/ClientTickHandler.java index 0780aa6a3..d5eb342f9 100644 --- a/common/mekanism/client/ClientTickHandler.java +++ b/common/mekanism/client/ClientTickHandler.java @@ -8,8 +8,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.lwjgl.input.Keyboard; - import mekanism.api.IClientTicker; import mekanism.client.sound.GasMaskSound; import mekanism.client.sound.JetpackSound; @@ -19,17 +17,20 @@ import mekanism.common.PacketHandler; import mekanism.common.PacketHandler.Transmission; import mekanism.common.item.ItemGasMask; import mekanism.common.item.ItemJetpack; -import mekanism.common.item.ItemScubaTank; import mekanism.common.item.ItemJetpack.JetpackMode; +import mekanism.common.item.ItemScubaTank; import mekanism.common.network.PacketJetpackData; -import mekanism.common.network.PacketScubaTankData; import mekanism.common.network.PacketJetpackData.PacketType; +import mekanism.common.network.PacketScubaTankData; import mekanism.common.util.MekanismUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StringUtils; + +import org.lwjgl.input.Keyboard; + import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; @@ -201,19 +202,22 @@ public class ClientTickHandler implements ITickHandler PacketHandler.sendPacket(Transmission.SERVER, new PacketScubaTankData().setParams(PacketType.UPDATE, mc.thePlayer, isGasMaskOn(mc.thePlayer))); } - for(EntityPlayer entry : Mekanism.jetpackOn) + if(MekanismClient.audioHandler != null) { - if(MekanismClient.audioHandler.getFrom(entry) == null) + for(EntityPlayer entry : Mekanism.jetpackOn) { - new JetpackSound(MekanismClient.audioHandler.getIdentifier(), entry); + if(MekanismClient.audioHandler.getFrom(entry) == null) + { + new JetpackSound(MekanismClient.audioHandler.getIdentifier(), entry); + } } - } - - for(EntityPlayer entry : Mekanism.gasmaskOn) - { - if(MekanismClient.audioHandler.getFrom(entry) == null) + + for(EntityPlayer entry : Mekanism.gasmaskOn) { - new GasMaskSound(MekanismClient.audioHandler.getIdentifier(), entry); + if(MekanismClient.audioHandler.getFrom(entry) == null) + { + new GasMaskSound(MekanismClient.audioHandler.getIdentifier(), entry); + } } }