Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.craftbukkit.block;
2
3import net.minecraft.server.TileEntityChest;
4import org.bukkit.block.Block;
5import org.bukkit.block.Chest;
6import org.bukkit.craftbukkit.CraftWorld;
7import org.bukkit.craftbukkit.inventory.CraftInventory;
8import org.bukkit.inventory.Inventory;
9
10public class CraftChest extends CraftBlockState implements Chest {
11 private final CraftWorld world;
12 private final TileEntityChest chest;
13
14 public CraftChest(final Block block) {
15 super(block);
16
17 world = (CraftWorld) block.getWorld();
18 chest = (TileEntityChest) world.getTileEntityAt(getX(), getY(), getZ());
19 }
20
21 public Inventory getInventory() {
22 return new CraftInventory(chest);
23 }
24
25 @Override
26 public boolean update(boolean force) {
27 boolean result = super.update(force);
28
29 if (result) {
30 chest.update();
31 }
32
33 return result;
34 }
35}