Paper/nms-patches/BlockRedstoneLamp.patch

48 lines
2.2 KiB
Diff
Raw Normal View History

2015-05-25 18:37:24 +08:00
--- a/net/minecraft/server/BlockRedstoneLamp.java
+++ b/net/minecraft/server/BlockRedstoneLamp.java
2016-05-10 19:47:39 +08:00
@@ -3,6 +3,8 @@
import java.util.Random;
2016-05-10 19:47:39 +08:00
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLamp extends Block {
private final boolean a;
2016-05-10 19:47:39 +08:00
@@ -21,6 +23,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);
}
2016-05-10 19:47:39 +08:00
@@ -32,6 +39,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);
}
2016-05-10 19:47:39 +08:00
@@ -41,6 +53,11 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
2015-02-27 06:41:06 +08:00
if (!world.isClientSide) {
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
2015-02-27 06:41:06 +08:00
+ // 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);
}