From ede443234e0fa807c7180e10e590f618fc36d024 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Fri, 2 Mar 2012 20:05:23 +0000 Subject: [PATCH] Minor optimization getting chest inventories --- src/main/java/org/bukkit/craftbukkit/block/CraftChest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index 0c07bd2cab..face2c8f38 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -23,11 +23,10 @@ public class CraftChest extends CraftBlockState implements Chest { } public Inventory getInventory() { + int x = getX(); + int y = getY(); + int z = getZ(); // The logic here is basically identical to the logic in BlockChest.interact - Location loc = getLocation(); - int x = loc.getBlockX(); - int y = loc.getBlockY(); - int z = loc.getBlockZ(); CraftInventory inventory = new CraftInventory(chest); if (world.getBlockTypeIdAt(x - 1, y, z) == Material.CHEST.getId()) { CraftInventory left = new CraftInventory((TileEntityChest)world.getHandle().getTileEntity(x - 1, y, z));