Added try/catch around NBT dumping client side.

This commit is contained in:
Thomas Guimbretiere committed 2014-02-19 23:44:13 +01:00
1 parent bd675cee28
commit d355ec28bb
2 files changed
+17 -9

No files matched your search

@@ -78,9 +78,13 @@ public class MetaDataProvider{
PacketDispatcher.sendPacketToServer(Packet0x01TERequest.create(world, mop, keys));
} else if (accessor.getTileEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
NBTTagCompound tag = new NBTTagCompound();
accessor.getTileEntity().writeToNBT(tag);
accessor.remoteNbt = tag;
try{
NBTTagCompound tag = new NBTTagCompound();
accessor.getTileEntity().writeToNBT(tag);
accessor.remoteNbt = tag;
} catch (Exception e){
WailaExceptionHandler.handleErr(e, this.getClass().getName(), null);
}
}
/* Interface IWailaBlock */
@@ -173,9 +177,13 @@ public class MetaDataProvider{
} else if (accessor.getEntity() != null && !Waila.instance.serverPresent && accessor.isTimeElapsed(250)) {
NBTTagCompound tag = new NBTTagCompound();
accessor.getEntity().writeToNBT(tag);
accessor.remoteNbt = tag;
try{
NBTTagCompound tag = new NBTTagCompound();
accessor.getEntity().writeToNBT(tag);
accessor.remoteNbt = tag;
} catch (Exception e){
WailaExceptionHandler.handleErr(e, this.getClass().getName(), null);
}
}
headEntityProviders.clear();
@@ -43,10 +43,10 @@ public class HUDHandlerEntities implements IWailaEntityProvider {
nhearts = nhearts <= 0 ? 20 : nhearts;
float health = ((EntityLivingBase)entity).getHealth() / 2.0f;
float maxhp = ((EntityLivingBase)entity).getMaxHealth() / 2.0f;;
float maxhp = ((EntityLivingBase)entity).getMaxHealth() / 2.0f;
if (maxhp > 40.0f)
currenttip.add(String.format("HP : " + WHITE + "%.0f" + GRAY + " / " + WHITE + "%.0f", health, maxhp));
if (maxhp > 20.0f)
currenttip.add(String.format("HP : " + WHITE + "%.0f" + GRAY + " / " + WHITE + "%.0f", ((EntityLivingBase)entity).getHealth(), ((EntityLivingBase)entity).getMaxHealth()));
else{
for (int i = 0; i < MathHelper.floor_float(health); i++){