blob: c389d3a2f255f2bd7e46eaa87e0ee2c67d1e79f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityChest;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory;
/**
* Represents a chest.
*
* @author sk89q
*/
public class CraftChest extends CraftBlockState implements Chest {
private final CraftWorld world;
private final TileEntityChest chest;
public CraftChest(final Block block) {
super(block);
world = (CraftWorld)block.getWorld();
chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ());
}
public Inventory getInventory() {
return new CraftInventory(chest);
}
@Override
public boolean update(boolean force) {
boolean result = super.update(force);
if (result) {
chest.i();
}
return result;
}
}
|