Prevent crashes with incorrectly initialized armor stuff #1668

This commit is contained in:
Bernhard Bonigl committed 2015-06-28 10:44:56 +02:00
1 parent 13db0488b5
commit 83e71312c4
3 files changed
+11 -4

No files matched your search

@@ -65,8 +65,12 @@ public class TinkerArmorEvents
return;
ItemStack glove = TPlayerStats.get(event.entityPlayer).armor.getStackInSlot(1);
if(event.entityPlayer.worldObj.isRemote) // todo: sync extended inventory with clients so this stuff and rendering is done properly...
glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
if(event.entityPlayer.worldObj.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done properly...
if(ArmorProxyClient.armorExtended != null)
glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
else
glove = null;
}
if(glove == null || !glove.hasTagCompound())
return;
@@ -38,7 +38,8 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
public TPlayerStats()
{
this.armor = new ArmorExtended();
this.knapsack = new KnapsackInventory();
}
public TPlayerStats(EntityPlayer entityplayer)
@@ -20,6 +20,8 @@ public class InventoryTabKnapsack extends AbstractTab
@Override
public boolean shouldAddToList ()
{
return ArmorProxyClient.armorExtended.inventory[2] != null && ArmorProxyClient.armorExtended.inventory[2].getItem() == TinkerArmor.knapsack;
return ArmorProxyClient.armorExtended != null
&& ArmorProxyClient.armorExtended.inventory[2] != null
&& ArmorProxyClient.armorExtended.inventory[2].getItem() == TinkerArmor.knapsack;
}
}