diff options
author | Erik Broes <erikbroes@grum.nl> | 2012-01-17 17:08:54 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2012-01-17 19:50:29 +0100 |
commit | edbb7358fc8837218768d584c28f75ea3dedbadc (patch) | |
tree | 5cc4b4c34df772eb59381e8c810b353ceb6486d8 /src/main/java/org | |
parent | 387d7319bc81c31eb4e394447af6e7abb2d7bbdb (diff) | |
download | craftbukkit-edbb7358fc8837218768d584c28f75ea3dedbadc.tar craftbukkit-edbb7358fc8837218768d584c28f75ea3dedbadc.tar.gz craftbukkit-edbb7358fc8837218768d584c28f75ea3dedbadc.tar.lz craftbukkit-edbb7358fc8837218768d584c28f75ea3dedbadc.tar.xz craftbukkit-edbb7358fc8837218768d584c28f75ea3dedbadc.zip |
[Bleeding] Implementation of the brewing stand.
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 2 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java | 43 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index e44eb377..a9030a5d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -231,6 +231,8 @@ public class CraftBlock implements Block { return new CraftNoteBlock(this); case JUKEBOX: return new CraftJukebox(this); + case BREWING_STAND: + return new CraftBrewingStand(this); default: return new CraftBlockState(this); } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java new file mode 100644 index 00000000..55b2d49e --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java @@ -0,0 +1,43 @@ +package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityBrewingStand; +import org.bukkit.block.Block; +import org.bukkit.block.BrewingStand; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.inventory.Inventory; + +public class CraftBrewingStand extends CraftBlockState implements BrewingStand { + private final CraftWorld world; + private final TileEntityBrewingStand brewingStand; + + public CraftBrewingStand(Block block) { + super(block); + + world = (CraftWorld) block.getWorld(); + brewingStand = (TileEntityBrewingStand) world.getTileEntityAt(getX(), getY(), getZ()); + } + + public Inventory getInventory() { + return new CraftInventory(brewingStand); + } + + @Override + public boolean update(boolean force) { + boolean result = super.update(force); + + if (result) { + brewingStand.update(); + } + + return result; + } + + public int getBrewingTime() { + return brewingStand.b; + } + + public void setBrewingTime(int brewTime) { + brewingStand.b = brewTime; + } +} |