diff --git a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java index dbc987e4..697bb928 100644 --- a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java @@ -590,6 +590,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci // ensure active lava tank verifyFuelTank(); + if (activeLavaTank == null) + return; // checks are all done before in verifyFuelTank. Don't do this without checks! IFluidHandler tankContainer = (IFluidHandler) worldObj.getTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z); @@ -650,6 +652,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci activeLavaTank = tank; return; } + + // possibly assign default empty tank here (tanks.get(0)) so we don't have a null activeLavaTank if all are empty } @SideOnly(Side.CLIENT) diff --git a/src/main/java/tconstruct/tools/TinkerToolEvents.java b/src/main/java/tconstruct/tools/TinkerToolEvents.java index de760763..6296e734 100644 --- a/src/main/java/tconstruct/tools/TinkerToolEvents.java +++ b/src/main/java/tconstruct/tools/TinkerToolEvents.java @@ -13,6 +13,7 @@ import net.minecraft.init.Items; import net.minecraft.item.*; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; +import net.minecraft.world.EnumDifficulty; import net.minecraftforge.event.entity.living.*; import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.oredict.*; @@ -385,12 +386,22 @@ public class TinkerToolEvents } + @SubscribeEvent public void damageToolsOnDeath (PlayerDropsEvent event) { if(!PHConstruct.deathPenality) return; - + + EnumDifficulty difficulty = event.entityPlayer.worldObj.difficultySetting; + // easy and peaceful don't punish + if(difficulty == EnumDifficulty.PEACEFUL || difficulty == EnumDifficulty.EASY) + return; + + int punishment = 20; // normal has 5% + if(difficulty == EnumDifficulty.HARD) + punishment = 10; // hard has 10% + for(EntityItem drop : event.drops) { // we're only interested in tools @@ -400,7 +411,7 @@ public class TinkerToolEvents // damage tools by 10% of their total durability! NBTTagCompound tags = drop.getEntityItem().getTagCompound().getCompoundTag("InfiTool"); int dur = tags.getInteger("TotalDurability"); - dur /= 10; + dur /= punishment; AbilityHelper.damageTool(drop.getEntityItem(), dur, event.entityPlayer, true); }