PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/BlockObserver.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

30 lines
1.4 KiB
Diff

--- a/net/minecraft/world/level/block/BlockObserver.java
+++ b/net/minecraft/world/level/block/BlockObserver.java
@@ -14,6 +14,8 @@
import net.minecraft.world.level.block.state.properties.BlockProperties;
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockObserver extends BlockDirectional {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -41,8 +43,18 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if ((Boolean) iblockdata.getValue(BlockObserver.POWERED)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockObserver.POWERED, false), 2);
} else {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockObserver.POWERED, true), 2);
worldserver.scheduleTick(blockposition, (Block) this, 2);
}