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;
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() {
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() {
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;
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() {
super();
@ -46,6 +46,20 @@ public final class CraftLever extends org.bukkit.craftbukkit.block.data.CraftBlo
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
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;
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() {
super();
@ -46,6 +46,20 @@ public final class CraftStoneButton extends org.bukkit.craftbukkit.block.data.Cr
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
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;
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() {
super();
@ -46,6 +46,20 @@ public final class CraftWoodButton extends org.bukkit.craftbukkit.block.data.Cra
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
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockWoodButton.class, "powered");