3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00
Paper/nms-patches/BlockRedstoneLamp.patch
2019-04-23 12:00:00 +10:00

36 Zeilen
1.5 KiB
Diff

--- a/net/minecraft/server/BlockRedstoneLamp.java
+++ b/net/minecraft/server/BlockRedstoneLamp.java
@@ -3,6 +3,8 @@
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLamp extends Block {
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
@@ -37,6 +39,11 @@
if (flag1) {
world.getBlockTickList().a(blockposition, this, 4);
} 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);
}
}
@@ -48,6 +55,11 @@
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!world.isClientSide) {
if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !world.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}