mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
[Bleeding] Implementation of the brewing stand.
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
parent
64a5086437
commit
c2bf4d0844
2 changed files with 45 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue