diff options
author | Amosar <[email protected]> | 2018-12-01 20:04:38 +0000 |
---|---|---|
committer | Shane Freeder <[email protected]> | 2018-12-01 20:04:38 +0000 |
commit | ea0646b6f6cb3c7d699470242387dab626c62c02 (patch) | |
tree | c80becd408ce2d0c90eae66f56b0de77e95d25b1 | |
parent | cedf38aac061173a5f055f7c2acf089627c440c1 (diff) | |
download | Paper-ea0646b6f6cb3c7d699470242387dab626c62c02.tar.gz Paper-ea0646b6f6cb3c7d699470242387dab626c62c02.zip |
backport: SPIGOT-2719: Comparator and Observer don't trigger BlockRedstoneEvent
-rw-r--r-- | Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch | 72 | ||||
-rwxr-xr-x | scripts/importmcdev.sh | 2 |
2 files changed, 74 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch b/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch new file mode 100644 index 0000000000..e412e02214 --- /dev/null +++ b/Spigot-Server-Patches/0372-backport-SPIGOT-2719-Comparator-and-Observer-don-t-t.patch @@ -0,0 +1,72 @@ +From 778d563e5b2d8141a1df1c4b3fc074928f6552c2 Mon Sep 17 00:00:00 2001 +From: Amosar <[email protected]> +Date: Sat, 1 Dec 2018 20:00:22 +0000 +Subject: [PATCH] backport: SPIGOT-2719: Comparator and Observer don't trigger + BlockRedstoneEvent + + +diff --git a/src/main/java/net/minecraft/server/BlockObserver.java b/src/main/java/net/minecraft/server/BlockObserver.java +index 59e93e6f6..5836a7637 100644 +--- a/src/main/java/net/minecraft/server/BlockObserver.java ++++ b/src/main/java/net/minecraft/server/BlockObserver.java +@@ -1,6 +1,7 @@ + package net.minecraft.server; + + import java.util.Random; ++import org.bukkit.craftbukkit.event.CraftEventFactory; // Paper + + public class BlockObserver extends BlockDirectional { + +@@ -26,8 +27,18 @@ public class BlockObserver extends BlockDirectional { + + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + if (((Boolean) iblockdata.get(BlockObserver.a)).booleanValue()) { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(false)), 2); + } else { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(true)), 2); + world.a(blockposition, (Block) this, 2); + } +diff --git a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java +index 78ad3374d..04d973d9a 100644 +--- a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java ++++ b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java +@@ -4,6 +4,7 @@ import com.google.common.base.Predicate; + import java.util.List; + import java.util.Random; + import javax.annotation.Nullable; ++import org.bukkit.craftbukkit.event.CraftEventFactory; //Paper + + public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity { + +@@ -164,8 +165,18 @@ public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITile + boolean flag1 = this.A(iblockdata); + + if (flag1 && !flag) { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(false)), 2); + } else if (!flag1 && flag) { ++ // Paper start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // Paper end + world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(true)), 2); + } + +-- +2.19.2 + diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 39d34bfdd3..16fdcab66f 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -48,7 +48,9 @@ import BlockChest import BlockFalling import BlockFurnace import BlockIceFrost +import BlockObserver import BlockPosition +import BlockRedstoneComparator import BlockSnowBlock import BlockStateEnum import ChunkCache |