diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-29 22:26:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-29 22:26:27 -0500 |
commit | ee572114dd5bc0d1c15962300fe4715766731c06 (patch) | |
tree | e4325ef8e9a344ef390579c4c50127a206cfbadc /src/main | |
parent | 377be0a79ed8a49ecac6fdfd8221fbe33d653150 (diff) | |
download | craftbukkit-ee572114dd5bc0d1c15962300fe4715766731c06.tar craftbukkit-ee572114dd5bc0d1c15962300fe4715766731c06.tar.gz craftbukkit-ee572114dd5bc0d1c15962300fe4715766731c06.tar.lz craftbukkit-ee572114dd5bc0d1c15962300fe4715766731c06.tar.xz craftbukkit-ee572114dd5bc0d1c15962300fe4715766731c06.zip |
Add Beacon block state for hopper events. Fixes BUKKIT-3932
Diffstat (limited to 'src/main')
3 files changed, 40 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java index 69379293..4ceb57e5 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java @@ -22,7 +22,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory { private int maxStack = MAX_STACK; public ItemStack[] getContents() { - return null; + return new ItemStack[] { this.h }; // Should be inventorySlot } public void onOpen(CraftHumanEntity who) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java new file mode 100644 index 00000000..c39857ec --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java @@ -0,0 +1,37 @@ +package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityBeacon; + +import org.bukkit.block.Block; +import org.bukkit.block.Beacon; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.inventory.Inventory; + +public class CraftBeacon extends CraftBlockState implements Beacon { + private final CraftWorld world; + private final TileEntityBeacon beacon; + + public CraftBeacon(final Block block) { + super(block); + + world = (CraftWorld) block.getWorld(); + beacon = (TileEntityBeacon) world.getTileEntityAt(getX(), getY(), getZ()); + } + + public Inventory getInventory() { + return new CraftInventory(beacon); + } + + @Override + public boolean update(boolean force) { + boolean result = super.update(force); + + if (result) { + beacon.update(); + } + + return result; + } +} + diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 2334fb62..9afe6aef 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -265,6 +265,8 @@ public class CraftBlock implements Block { return new CraftSkull(this); case COMMAND: return new CraftCommandBlock(this); + case BEACON: + return new CraftBeacon(this); default: return new CraftBlockState(this); } |