Fixed some minor issues with creative mode interaction with crates

This commit is contained in:
Robert S 2014-05-27 03:11:34 -04:00
parent a3e04fe15a
commit d93d4b2fce

View file

@ -68,8 +68,8 @@ public class BlockCrate extends BlockTile
if (!world.isRemote && world.getBlockTileEntity(x, y, z) instanceof TileCrate) if (!world.isRemote && world.getBlockTileEntity(x, y, z) instanceof TileCrate)
{ {
TileCrate tileEntity = (TileCrate) world.getBlockTileEntity(x, y, z); TileCrate tileEntity = (TileCrate) world.getBlockTileEntity(x, y, z);
this.tryEject(tileEntity, player, world.getWorldTime() - tileEntity.prevClickTime < 10); this.tryEject(tileEntity, player, (System.currentTimeMillis() - tileEntity.prevClickTime) < 10);
tileEntity.prevClickTime = world.getWorldTime(); tileEntity.prevClickTime = System.currentTimeMillis();
} }
} }
@ -139,28 +139,31 @@ public class BlockCrate extends BlockTile
ItemStack current = player.inventory.getCurrentItem(); ItemStack current = player.inventory.getCurrentItem();
if (player.capabilities.isCreativeMode) if (player.capabilities.isCreativeMode)
{ {
if (side == 1 && current != null && tile.getSampleStack() == null) if (side == 1)
{ {
ItemStack cStack = current.copy(); if (current != null && tile.getSampleStack() == null)
cStack.stackSize = TileCrate.getSlotCount(world.getBlockMetadata(x, y, z)) * 64; {
addStackToCrate(tile, cStack); ItemStack cStack = current.copy();
cStack.stackSize = TileCrate.getSlotCount(world.getBlockMetadata(x, y, z)) * 64;
addStackToCrate(tile, cStack);
}
} }
else if (hitY >= 0.5) else if (hitY <= 0.5)
{ {
tryEject(tile, player, world.getWorldTime() - tile.prevClickTime < 10); tryEject(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10);
} }
else else
{ {
tryInsert(tile, player, world.getWorldTime() - tile.prevClickTime < 10); tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10);
} }
} }
else else
{ {
tryInsert(tile, player, world.getWorldTime() - tile.prevClickTime < 10); tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10);
} }
} }
tile.prevClickTime = world.getWorldTime(); tile.prevClickTime = System.currentTimeMillis();
} }
return true; return true;
} }