Commit e532c664 authored by Amosar's avatar Amosar

Add patch and tutorial for spigot 1.12.2

parent a483e861
--- 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);
}
--- 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);
}
**Add Observer and Comparator support for spigot 1.12.2**
1. Download this two patches : [BlockObserver](./BlockObserver.patch) , [BlockRedstoneComparator](./BlockRedstoneComparator.patch)
2. java -jar BuildTools.jar --rev 1.12.2
3. go into CraftBukkit -> nms-patches and place both .patch file
4. java -jar BuildTools.jar --dont-update
5. You spigot is now patched to support Observer and Comparator
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment