mirror of
https://github.com/dje4321/TerrafirmaPunk-Tweaks.git
synced 2024-09-28 14:50:52 +00:00
Issue with control flow would cause line 128 to crash. After placing your final boiler, the item count gets set to 0 and the item is removed from your inventory. That item in your hand is then used again to verify if it was a chest. Minimal changes made to the code to prevent other bugs from popping up. Added control flow to check to verify the item is null before being used again
This commit is contained in:
parent
de035c4647
commit
20a63c75cb
@ -1,6 +1,6 @@
|
||||
minecraft_version=1.7.10
|
||||
forge_version=10.13.4.1566-1.7.10
|
||||
tfc_version=0.79.27
|
||||
mod_version=1.21
|
||||
mod_version=1.22
|
||||
mod_id=TerraFirmaPunkTweaks
|
||||
group_name=com.JAWolfe.TerraFirmaPunkTweaks
|
||||
|
@ -90,9 +90,7 @@ public class PlayerInteractionHandler
|
||||
if (event.entityPlayer.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
ItemStack itemInHand = event.entityPlayer.getCurrentEquippedItem();
|
||||
|
||||
if(itemInHand == null)
|
||||
if(event.entityPlayer.getCurrentEquippedItem() == null)
|
||||
return;
|
||||
|
||||
if(event.action == Action.RIGHT_CLICK_BLOCK && event.getResult() != Result.DENY)
|
||||
@ -124,15 +122,17 @@ public class PlayerInteractionHandler
|
||||
event.entityPlayer.getCurrentEquippedItem().stackSize--;
|
||||
}
|
||||
}
|
||||
|
||||
if(event.entityPlayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(Blocks.chest))
|
||||
if(event.entityPlayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
if(event.entityPlayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(Blocks.chest))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
|
||||
if(event.entityPlayer.getCurrentEquippedItem().stackSize == 1)
|
||||
event.entityPlayer.setCurrentItemOrArmor(0, null);
|
||||
else
|
||||
event.entityPlayer.getCurrentEquippedItem().stackSize--;
|
||||
if(event.entityPlayer.getCurrentEquippedItem().stackSize == 1)
|
||||
event.entityPlayer.setCurrentItemOrArmor(0, null);
|
||||
else
|
||||
event.entityPlayer.getCurrentEquippedItem().stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user