3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
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;
2019-04-23 04:00:00 +02:00
@@ -37,6 +39,11 @@
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);
}
}
2019-12-10 23:00:00 +01:00
@@ -47,6 +54,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
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);
}