@@ -296,6 +296,8 @@ public class CraftBlock implements Block {
|
||||
case WALL_BANNER:
|
||||
case STANDING_BANNER:
|
||||
return new CraftBanner(this);
|
||||
case FLOWER_POT:
|
||||
return new CraftFlowerPot(this);
|
||||
default:
|
||||
return new CraftBlockState(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityFlowerPot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.FlowerPot;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
||||
|
||||
private final TileEntityFlowerPot pot;
|
||||
|
||||
public CraftFlowerPot(Block block) {
|
||||
super(block);
|
||||
|
||||
pot = (TileEntityFlowerPot) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public CraftFlowerPot(Material material, TileEntityFlowerPot pot) {
|
||||
super(material);
|
||||
|
||||
this.pot = pot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData getContents() {
|
||||
return (pot.d() == null) ? null : CraftMagicNumbers.getMaterial(pot.d()).getNewData((byte) pot.e()); // PAIL: rename
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContents(MaterialData item) {
|
||||
if (item == null) {
|
||||
pot.a(null, 0);
|
||||
} else {
|
||||
pot.a(CraftMagicNumbers.getItem(item.getItemType()), item.getData()); // PAIL: rename
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user