Paper/nms-patches/BlockRedstoneLamp.patch
2014-11-28 11:23:19 +00:00

48 lines
2.3 KiB
Diff

--- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneLamp.java 2014-11-28 11:22:55.762823167 +0000
+++ src/main/java/net/minecraft/server/BlockRedstoneLamp.java 2014-11-28 11:01:54.000000000 +0000
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLamp extends Block {
private final boolean a;
@@ -20,6 +22,11 @@
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
world.setTypeAndData(blockposition, Blocks.REDSTONE_LAMP.getBlockData(), 2);
} else if (!this.a && world.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, Blocks.LIT_REDSTONE_LAMP.getBlockData(), 2);
}
@@ -31,6 +38,11 @@
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
world.a(blockposition, (Block) this, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, Blocks.LIT_REDSTONE_LAMP.getBlockData(), 2);
}
@@ -40,6 +52,11 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isStatic) {
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, Blocks.REDSTONE_LAMP.getBlockData(), 2);
}