@@ -0,0 +1,32 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.TileEntityBeehive;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Beehive;
|
||||
|
||||
public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> implements Beehive {
|
||||
|
||||
public CraftBeehive(final Block block) {
|
||||
super(block, TileEntityBeehive.class);
|
||||
}
|
||||
|
||||
public CraftBeehive(final Material material, final TileEntityBeehive te) {
|
||||
super(material, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getFlower() {
|
||||
BlockPosition flower = getSnapshot().flowerPos;
|
||||
return (flower == null) ? null : new Location(getWorld(), flower.getX(), flower.getY(), flower.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlower(Location location) {
|
||||
Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Flower must be in same world");
|
||||
getSnapshot().flowerPos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
}
|
||||
@@ -457,6 +457,8 @@ public class CraftBlock implements Block {
|
||||
return new CraftLectern(this);
|
||||
case SMOKER:
|
||||
return new CraftSmoker(this);
|
||||
case BEEHIVE:
|
||||
return new CraftBeehive(this);
|
||||
default:
|
||||
TileEntity tileEntity = world.getTileEntity(position);
|
||||
if (tileEntity != null) {
|
||||
@@ -613,7 +615,7 @@ public class CraftBlock implements Block {
|
||||
net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.b(iblockdata)) {
|
||||
if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
|
||||
return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), null, nms)
|
||||
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
||||
} else {
|
||||
|
||||
@@ -392,6 +392,7 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockBannerWall.class, org.bukkit.craftbukkit.block.impl.CraftBannerWall::new);
|
||||
register(net.minecraft.server.BlockBarrel.class, org.bukkit.craftbukkit.block.impl.CraftBarrel::new);
|
||||
register(net.minecraft.server.BlockBed.class, org.bukkit.craftbukkit.block.impl.CraftBed::new);
|
||||
register(net.minecraft.server.BlockBeehive.class, org.bukkit.craftbukkit.block.impl.CraftBeehive::new);
|
||||
register(net.minecraft.server.BlockBeetroot.class, org.bukkit.craftbukkit.block.impl.CraftBeetroot::new);
|
||||
register(net.minecraft.server.BlockBell.class, org.bukkit.craftbukkit.block.impl.CraftBell::new);
|
||||
register(net.minecraft.server.BlockBlastFurnace.class, org.bukkit.craftbukkit.block.impl.CraftBlastFurnace::new);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.bukkit.craftbukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.type.Beehive;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
|
||||
public abstract class CraftBeehive extends CraftBlockData implements Beehive {
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger HONEY_LEVEL = getInteger("honey_level");
|
||||
|
||||
@Override
|
||||
public int getHoneyLevel() {
|
||||
return get(HONEY_LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHoneyLevel(int honeyLevel) {
|
||||
set(HONEY_LEVEL, honeyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumHoneyLevel() {
|
||||
return getMax(HONEY_LEVEL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftBeehive extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Beehive, org.bukkit.block.data.Directional {
|
||||
|
||||
public CraftBeehive() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftBeehive(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.type.CraftBeehive
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger HONEY_LEVEL = getInteger(net.minecraft.server.BlockBeehive.class, "honey_level");
|
||||
|
||||
@Override
|
||||
public int getHoneyLevel() {
|
||||
return get(HONEY_LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHoneyLevel(int honeyLevel) {
|
||||
set(HONEY_LEVEL, honeyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumHoneyLevel() {
|
||||
return getMax(HONEY_LEVEL);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftDirectional
|
||||
|
||||
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockBeehive.class, "facing");
|
||||
|
||||
@Override
|
||||
public org.bukkit.block.BlockFace getFacing() {
|
||||
return get(FACING, org.bukkit.block.BlockFace.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(org.bukkit.block.BlockFace facing) {
|
||||
set(FACING, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
|
||||
return getValues(FACING, org.bukkit.block.BlockFace.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user