SPIGOT-5886: Missing BlockData

This commit is contained in:
md_5 2020-06-30 10:01:45 +10:00
parent 32acc26217
commit 89c0a5c34d
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
3 changed files with 37 additions and 1 deletions

View File

@ -5,10 +5,21 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftWall extends CraftBlockData implements Wall { public abstract class CraftWall extends CraftBlockData implements Wall {
private static final net.minecraft.server.BlockStateBoolean UP = getBoolean("up");
private static final net.minecraft.server.BlockStateEnum<?>[] HEIGHTS = new net.minecraft.server.BlockStateEnum[]{ private static final net.minecraft.server.BlockStateEnum<?>[] HEIGHTS = new net.minecraft.server.BlockStateEnum[]{
getEnum("north"), getEnum("east"), getEnum("south"), getEnum("west") getEnum("north"), getEnum("east"), getEnum("south"), getEnum("west")
}; };
@Override
public boolean isUp() {
return get(UP);
}
@Override
public void setUp(boolean up) {
set(UP, up);
}
@Override @Override
public Height getHeight(org.bukkit.block.BlockFace face) { public Height getHeight(org.bukkit.block.BlockFace face) {
return get(HEIGHTS[face.ordinal()], Height.class); return get(HEIGHTS[face.ordinal()], Height.class);

View File

@ -3,7 +3,7 @@
*/ */
package org.bukkit.craftbukkit.block.impl; package org.bukkit.craftbukkit.block.impl;
public final class CraftBell extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Bell, org.bukkit.block.data.Directional { public final class CraftBell extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Bell, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable {
public CraftBell() { public CraftBell() {
super(); super();
@ -45,4 +45,18 @@ public final class CraftBell extends org.bukkit.craftbukkit.block.data.CraftBloc
public java.util.Set<org.bukkit.block.BlockFace> getFaces() { public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class); return getValues(FACING, org.bukkit.block.BlockFace.class);
} }
// org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockBell.class, "powered");
@Override
public boolean isPowered() {
return get(POWERED);
}
@Override
public void setPowered(boolean powered) {
set(POWERED, powered);
}
} }

View File

@ -15,10 +15,21 @@ public final class CraftCobbleWall extends org.bukkit.craftbukkit.block.data.Cra
// org.bukkit.craftbukkit.block.data.type.CraftWall // org.bukkit.craftbukkit.block.data.type.CraftWall
private static final net.minecraft.server.BlockStateBoolean UP = getBoolean(net.minecraft.server.BlockCobbleWall.class, "up");
private static final net.minecraft.server.BlockStateEnum<?>[] HEIGHTS = new net.minecraft.server.BlockStateEnum[]{ private static final net.minecraft.server.BlockStateEnum<?>[] HEIGHTS = new net.minecraft.server.BlockStateEnum[]{
getEnum(net.minecraft.server.BlockCobbleWall.class, "north"), getEnum(net.minecraft.server.BlockCobbleWall.class, "east"), getEnum(net.minecraft.server.BlockCobbleWall.class, "south"), getEnum(net.minecraft.server.BlockCobbleWall.class, "west") getEnum(net.minecraft.server.BlockCobbleWall.class, "north"), getEnum(net.minecraft.server.BlockCobbleWall.class, "east"), getEnum(net.minecraft.server.BlockCobbleWall.class, "south"), getEnum(net.minecraft.server.BlockCobbleWall.class, "west")
}; };
@Override
public boolean isUp() {
return get(UP);
}
@Override
public void setUp(boolean up) {
set(UP, up);
}
@Override @Override
public Height getHeight(org.bukkit.block.BlockFace face) { public Height getHeight(org.bukkit.block.BlockFace face) {
return get(HEIGHTS[face.ordinal()], Height.class); return get(HEIGHTS[face.ordinal()], Height.class);