Paper/nms-patches/BlockObserver.patch

31 lines
1.3 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/BlockObserver.java
+++ b/net/minecraft/server/BlockObserver.java
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockObserver extends BlockDirectional {
2019-04-23 04:00:00 +02:00
public static final BlockStateBoolean b = BlockProperties.w;
@@ -29,8 +31,18 @@
@Override
2020-06-25 02:00:00 +02:00
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
2018-12-06 00:00:00 +01:00
if ((Boolean) iblockdata.get(BlockObserver.b)) {
+ // CraftBukkit start
2019-12-10 23:00:00 +01:00
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
2019-12-10 23:00:00 +01:00
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, false), 2);
} else {
+ // CraftBukkit start
2019-12-10 23:00:00 +01:00
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
2019-12-10 23:00:00 +01:00
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2);
worldserver.getBlockTickList().a(blockposition, this, 2);
}