mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-04 23:47:00 +01:00
40 lines
998 B
Java
40 lines
998 B
Java
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.d();
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|