mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
Add Beacon block state for hopper events. Fixes BUKKIT-3932
By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
f84dc2d381
commit
504a6af6e8
2 changed files with 39 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue