Switch back to the way 1.7.10 did chest upgrades, you do not have to hold shift to upgrade them now, but holding shift will still open the chest after upgrading it. Should fix #75 somewhat.

This commit is contained in:
alexbegt 2016-07-03 14:39:21 -04:00
parent cc78de2c6d
commit 7c8d3986e7
1 changed files with 7 additions and 1 deletions

View File

@ -38,13 +38,14 @@ public class ItemChestChanger extends Item
@Override @Override
//@formatter:off //@formatter:off
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, EnumHand hand)
//@formatter:on //@formatter:on
{ {
if (worldIn.isRemote) if (worldIn.isRemote)
{ {
return EnumActionResult.PASS; return EnumActionResult.PASS;
} }
if (this.type.canUpgrade(IronChestType.WOOD)) if (this.type.canUpgrade(IronChestType.WOOD))
{ {
if (!(worldIn.getBlockState(pos).getBlock() instanceof BlockChest)) if (!(worldIn.getBlockState(pos).getBlock() instanceof BlockChest))
@ -61,10 +62,12 @@ public class ItemChestChanger extends Item
return EnumActionResult.PASS; return EnumActionResult.PASS;
} }
} }
TileEntity te = worldIn.getTileEntity(pos); TileEntity te = worldIn.getTileEntity(pos);
TileEntityIronChest newchest = new TileEntityIronChest(); TileEntityIronChest newchest = new TileEntityIronChest();
ItemStack[] chestContents = new ItemStack[27]; ItemStack[] chestContents = new ItemStack[27];
EnumFacing chestFacing = EnumFacing.DOWN; EnumFacing chestFacing = EnumFacing.DOWN;
if (te != null) if (te != null)
{ {
if (te instanceof TileEntityIronChest) if (te instanceof TileEntityIronChest)
@ -101,6 +104,7 @@ public class ItemChestChanger extends Item
} }
te.updateContainingBlockInfo(); te.updateContainingBlockInfo();
if (te instanceof TileEntityChest) if (te instanceof TileEntityChest)
{ {
((TileEntityChest) te).checkForAdjacentChests(); ((TileEntityChest) te).checkForAdjacentChests();
@ -117,6 +121,7 @@ public class ItemChestChanger extends Item
worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3); worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
TileEntity te2 = worldIn.getTileEntity(pos); TileEntity te2 = worldIn.getTileEntity(pos);
if (te2 instanceof TileEntityIronChest) if (te2 instanceof TileEntityIronChest)
{ {
((TileEntityIronChest) te2).setContents(chestContents); ((TileEntityIronChest) te2).setContents(chestContents);
@ -124,6 +129,7 @@ public class ItemChestChanger extends Item
} }
stack.stackSize = playerIn.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1; stack.stackSize = playerIn.capabilities.isCreativeMode ? stack.stackSize : stack.stackSize - 1;
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }
} }