13
0
geforkt von Mirrors/Paper
Paper/nms-patches/BlockRedstoneLamp.patch

36 Zeilen
1.5 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockRedstoneLamp.java
+++ b/net/minecraft/server/BlockRedstoneLamp.java
2018-07-15 02:00:00 +02:00
@@ -3,6 +3,8 @@
import java.util.Random;
2018-07-15 02:00:00 +02:00
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLamp extends Block {
2018-07-15 02:00:00 +02:00
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
2020-06-25 02:00:00 +02:00
@@ -27,6 +29,11 @@
2019-04-23 04:00:00 +02:00
if (flag1) {
2018-12-13 01:00:00 +01:00
world.getBlockTickList().a(blockposition, this, 4);
2018-07-15 02:00:00 +02:00
} else {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}
}
2020-06-25 02:00:00 +02:00
@@ -37,6 +44,11 @@
2019-12-10 23:00:00 +01:00
@Override
2020-06-25 02:00:00 +02:00
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
2019-12-10 23:00:00 +01:00
if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !worldserver.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}