2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockObserver.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockObserver.java
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -15,6 +15,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.level.block.state.properties.BlockProperties;
|
|
|
|
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
2018-08-09 14:44:57 +02:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockObserver extends BlockDirectional {
|
|
|
|
|
2023-12-05 17:40:00 +01:00
|
|
|
public static final MapCodec<BlockObserver> CODEC = simpleCodec(BlockObserver::new);
|
|
|
|
@@ -48,8 +50,18 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2024-04-23 17:15:00 +02:00
|
|
|
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
2021-11-21 23:00:00 +01:00
|
|
|
if ((Boolean) iblockdata.getValue(BlockObserver.POWERED)) {
|
2018-08-09 14:44:57 +02:00
|
|
|
+ // CraftBukkit start
|
2019-12-10 23:00:00 +01:00
|
|
|
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
2018-08-09 14:44:57 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockObserver.POWERED, false), 2);
|
2018-08-09 14:44:57 +02:00
|
|
|
} else {
|
|
|
|
+ // CraftBukkit start
|
2019-12-10 23:00:00 +01:00
|
|
|
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
|
2018-08-09 14:44:57 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockObserver.POWERED, true), 2);
|
|
|
|
worldserver.scheduleTick(blockposition, (Block) this, 2);
|
2018-08-09 14:44:57 +02:00
|
|
|
}
|