diff --git a/MAIN/nms-patches/1.12.2/BlockObserver.patch b/MAIN/nms-patches/1.12.2/BlockObserver.patch new file mode 100644 index 0000000..4fb0a16 --- /dev/null +++ b/MAIN/nms-patches/1.12.2/BlockObserver.patch @@ -0,0 +1,31 @@ +--- a/minecraft/server/BlockObserver.java ++++ b/minecraft/server/BlockObserver.java +@@ -2,6 +2,8 @@ + + import java.util.Random; + ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++ + public class BlockObserver extends BlockDirectional { + + public static final BlockStateBoolean a = BlockStateBoolean.of("powered"); +@@ -26,8 +28,18 @@ + + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + if (((Boolean) iblockdata.get(BlockObserver.a)).booleanValue()) { ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // CraftBukkit end + world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(false)), 2); + } else { ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // CraftBukkit end + world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(true)), 2); + world.a(blockposition, (Block) this, 2); + } + diff --git a/MAIN/nms-patches/1.12.2/BlockRedstoneComparator.patch b/MAIN/nms-patches/1.12.2/BlockRedstoneComparator.patch new file mode 100644 index 0000000..6a00125 --- /dev/null +++ b/MAIN/nms-patches/1.12.2/BlockRedstoneComparator.patch @@ -0,0 +1,31 @@ +--- a/minecraft/server/BlockRedstoneComparator.java ++++ b/minecraft/server/BlockRedstoneComparator.java +@@ -5,6 +5,8 @@ + import java.util.Random; + import javax.annotation.Nullable; + ++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit ++ + public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity { + + public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered"); +@@ -164,8 +166,18 @@ + boolean flag1 = this.A(iblockdata); + + if (flag1 && !flag) { ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // CraftBukkit end + world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(false)), 2); + } else if (!flag1 && flag) { ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // CraftBukkit end + world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(true)), 2); + } + + diff --git a/MAIN/nms-patches/1.12.2/README.md b/MAIN/nms-patches/1.12.2/README.md new file mode 100644 index 0000000..4423ff2 --- /dev/null +++ b/MAIN/nms-patches/1.12.2/README.md @@ -0,0 +1,11 @@ +**Add Observer and Comparator support for spigot 1.12.2** +1. Download [BuildTools](https://hub.spigotmc.org/jenkins/job/BuildTools) +2. run ``java -jar BuildTools.jar --rev 1.12.2`` +3. Download this two patches : [BlockObserver](./BlockObserver.patch) , [BlockRedstoneComparator](./BlockRedstoneComparator.patch) +4. go into ``CraftBukkit/nms-patches`` and place both ``.patch`` file into it +5. go back on the BuildTools.jar folder and run ``java -jar BuildTools.jar --dont-update`` +6. You spigot is now patched to support Observer and Comparator + +More info about BuildTools and Spigot installation: +https://www.spigotmc.org/wiki/spigot-installation +https://www.spigotmc.org/wiki/buildtools \ No newline at end of file