Add FaceAttachable interface to handle Grindstone facing in common with Switches

This commit is contained in:
md_5 2020-04-01 09:14:29 +11:00
parent 95bd4238fb
commit 3075579f61
5 changed files with 78 additions and 4 deletions

View File

@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.FaceAttachable;
public abstract class CraftFaceAttachable extends CraftBlockData implements FaceAttachable {
private static final net.minecraft.server.BlockStateEnum<?> ATTACH_FACE = getEnum("face");
@Override
public AttachedFace getAttachedFace() {
return get(ATTACH_FACE, AttachedFace.class);
}
@Override
public void setAttachedFace(AttachedFace face) {
set(ATTACH_FACE, face);
}
}

View File

@ -3,7 +3,7 @@
*/ */
package org.bukkit.craftbukkit.block.impl; package org.bukkit.craftbukkit.block.impl;
public final class CraftGrindstone extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional { public final class CraftGrindstone extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Grindstone, org.bukkit.block.data.Directional, org.bukkit.block.data.FaceAttachable {
public CraftGrindstone() { public CraftGrindstone() {
super(); super();
@ -31,4 +31,18 @@ public final class CraftGrindstone extends org.bukkit.craftbukkit.block.data.Cra
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.CraftFaceAttachable
private static final net.minecraft.server.BlockStateEnum<?> ATTACH_FACE = getEnum(net.minecraft.server.BlockGrindstone.class, "face");
@Override
public AttachedFace getAttachedFace() {
return get(ATTACH_FACE, AttachedFace.class);
}
@Override
public void setAttachedFace(AttachedFace face) {
set(ATTACH_FACE, face);
}
} }

View File

@ -3,7 +3,7 @@
*/ */
package org.bukkit.craftbukkit.block.impl; package org.bukkit.craftbukkit.block.impl;
public final class CraftLever extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable { public final class CraftLever extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.FaceAttachable, org.bukkit.block.data.Powerable {
public CraftLever() { public CraftLever() {
super(); super();
@ -46,6 +46,20 @@ public final class CraftLever extends org.bukkit.craftbukkit.block.data.CraftBlo
return getValues(FACING, org.bukkit.block.BlockFace.class); return getValues(FACING, org.bukkit.block.BlockFace.class);
} }
// org.bukkit.craftbukkit.block.data.CraftFaceAttachable
private static final net.minecraft.server.BlockStateEnum<?> ATTACH_FACE = getEnum(net.minecraft.server.BlockLever.class, "face");
@Override
public AttachedFace getAttachedFace() {
return get(ATTACH_FACE, AttachedFace.class);
}
@Override
public void setAttachedFace(AttachedFace face) {
set(ATTACH_FACE, face);
}
// org.bukkit.craftbukkit.block.data.CraftPowerable // org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockLever.class, "powered"); private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockLever.class, "powered");

View File

@ -3,7 +3,7 @@
*/ */
package org.bukkit.craftbukkit.block.impl; package org.bukkit.craftbukkit.block.impl;
public final class CraftStoneButton extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable { public final class CraftStoneButton extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.FaceAttachable, org.bukkit.block.data.Powerable {
public CraftStoneButton() { public CraftStoneButton() {
super(); super();
@ -46,6 +46,20 @@ public final class CraftStoneButton extends org.bukkit.craftbukkit.block.data.Cr
return getValues(FACING, org.bukkit.block.BlockFace.class); return getValues(FACING, org.bukkit.block.BlockFace.class);
} }
// org.bukkit.craftbukkit.block.data.CraftFaceAttachable
private static final net.minecraft.server.BlockStateEnum<?> ATTACH_FACE = getEnum(net.minecraft.server.BlockStoneButton.class, "face");
@Override
public AttachedFace getAttachedFace() {
return get(ATTACH_FACE, AttachedFace.class);
}
@Override
public void setAttachedFace(AttachedFace face) {
set(ATTACH_FACE, face);
}
// org.bukkit.craftbukkit.block.data.CraftPowerable // org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockStoneButton.class, "powered"); private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockStoneButton.class, "powered");

View File

@ -3,7 +3,7 @@
*/ */
package org.bukkit.craftbukkit.block.impl; package org.bukkit.craftbukkit.block.impl;
public final class CraftWoodButton extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable { public final class CraftWoodButton extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Switch, org.bukkit.block.data.Directional, org.bukkit.block.data.FaceAttachable, org.bukkit.block.data.Powerable {
public CraftWoodButton() { public CraftWoodButton() {
super(); super();
@ -46,6 +46,20 @@ public final class CraftWoodButton extends org.bukkit.craftbukkit.block.data.Cra
return getValues(FACING, org.bukkit.block.BlockFace.class); return getValues(FACING, org.bukkit.block.BlockFace.class);
} }
// org.bukkit.craftbukkit.block.data.CraftFaceAttachable
private static final net.minecraft.server.BlockStateEnum<?> ATTACH_FACE = getEnum(net.minecraft.server.BlockWoodButton.class, "face");
@Override
public AttachedFace getAttachedFace() {
return get(ATTACH_FACE, AttachedFace.class);
}
@Override
public void setAttachedFace(AttachedFace face) {
set(ATTACH_FACE, face);
}
// org.bukkit.craftbukkit.block.data.CraftPowerable // org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockWoodButton.class, "powered"); private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockWoodButton.class, "powered");