[Bleeding] Implementation of the brewing stand.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
CraftBukkit/Spigot 2012-01-17 17:08:54 +01:00
parent 64a5086437
commit c2bf4d0844
2 changed files with 45 additions and 0 deletions

View file

@ -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);
}

View file

@ -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;
}
}