From f8411ea1e5865e6d512e4673f4d59255a078e169 Mon Sep 17 00:00:00 2001 From: Senmori Date: Mon, 12 Feb 2018 10:29:51 +1100 Subject: Expand Structure Block API --- nms-patches/TileEntityStructure.patch | 36 +++++ .../craftbukkit/block/CraftStructureBlock.java | 172 ++++++++++++++++++++- 2 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 nms-patches/TileEntityStructure.patch diff --git a/nms-patches/TileEntityStructure.patch b/nms-patches/TileEntityStructure.patch new file mode 100644 index 00000000..f7f05e4c --- /dev/null +++ b/nms-patches/TileEntityStructure.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/server/TileEntityStructure.java ++++ b/net/minecraft/server/TileEntityStructure.java +@@ -10,20 +10,20 @@ + + public class TileEntityStructure extends TileEntity { + +- private String a = ""; +- private String f = ""; +- private String g = ""; +- private BlockPosition h = new BlockPosition(0, 1, 0); +- private BlockPosition i; +- private EnumBlockMirror j; +- private EnumBlockRotation k; +- private TileEntityStructure.UsageMode l; +- private boolean m; ++ private String a = ""; // PAIL: rename name ++ public String f = ""; // PAIL: private -> public ++ public String g = ""; // PAIL: private -> public ++ public BlockPosition h = new BlockPosition(0, 1, 0); // PAIL: private -> public ++ public BlockPosition i; // PAIL: private -> public ++ public EnumBlockMirror j; // PAIL: private -> public ++ public EnumBlockRotation k; // PAIL: private -> public ++ private TileEntityStructure.UsageMode l; // PAIL: rename ++ public boolean m; // PAIL: private -> public + private boolean n; +- private boolean o; +- private boolean p; +- private float q; +- private long r; ++ public boolean o; // PAIL: private -> public ++ public boolean p; // PAIL: private -> public ++ public float q; // PAIL: private -> public ++ public long r; // PAIL: private -> public + + public TileEntityStructure() { + this.i = BlockPosition.ZERO; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java index ecf12ee3..536c8131 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftStructureBlock.java @@ -1,10 +1,24 @@ package org.bukkit.craftbukkit.block; +import com.google.common.base.Preconditions; +import net.minecraft.server.BlockPosition; +import net.minecraft.server.EnumBlockMirror; +import net.minecraft.server.EnumBlockRotation; import net.minecraft.server.TileEntityStructure; +import org.apache.commons.lang3.Validate; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.block.Structure; +import org.bukkit.block.structure.Mirror; +import org.bukkit.block.structure.StructureRotation; +import org.bukkit.block.structure.UsageMode; +import org.bukkit.craftbukkit.entity.CraftLivingEntity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.util.BlockVector; -public class CraftStructureBlock extends CraftBlockEntityState { +public class CraftStructureBlock extends CraftBlockEntityState implements Structure { + + private static final int MAX_SIZE = 32; public CraftStructureBlock(Block block) { super(block, TileEntityStructure.class); @@ -13,4 +27,160 @@ public class CraftStructureBlock extends CraftBlockEntityState= min && num <= max; + } + + private static boolean isBetween(float num, float min, float max) { + return num >= min && num <= max; + } } -- cgit v1.2.3