PaperMC/nms-patches/BlockRedstoneLamp.patch

36 lines
1.5 KiB
Diff
Raw Normal View History

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;
@@ -33,6 +35,11 @@
if (flag) {
2018-08-26 04:00:00 +02:00
world.J().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);
}
}
2018-07-15 02:00:00 +02:00
@@ -43,6 +50,11 @@
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
2015-02-26 23:41:06 +01:00
if (!world.isClientSide) {
2018-07-15 02:00:00 +02:00
if (((Boolean) iblockdata.get(BlockRedstoneLamp.a)).booleanValue() && !world.isBlockIndirectlyPowered(blockposition)) {
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
2018-07-15 02:00:00 +02:00
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
2015-02-26 23:41:06 +01:00
+ return;
+ }
+ // CraftBukkit end
2018-07-15 02:00:00 +02:00
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}