2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockRedstoneLamp.java
|
|
|
|
+++ b/net/minecraft/server/BlockRedstoneLamp.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -2,6 +2,8 @@
|
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockRedstoneLamp extends Block {
|
|
|
|
|
|
|
|
private final boolean a;
|
2017-12-07 00:59:30 +01:00
|
|
|
@@ -18,8 +20,18 @@
|
|
|
|
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
|
|
|
if (!world.isClientSide) {
|
2014-11-25 22:32:16 +01:00
|
|
|
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
|
2017-12-07 00:59:30 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2017-12-07 00:59:30 +01:00
|
|
|
@@ -31,6 +43,11 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2017-12-07 00:59:30 +01:00
|
|
|
@@ -40,6 +57,11 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
2015-02-26 23:41:06 +01:00
|
|
|
if (!world.isClientSide) {
|
2014-11-25 22:32:16 +01:00
|
|
|
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
|
2015-02-26 23:41:06 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
world.setTypeAndData(blockposition, Blocks.REDSTONE_LAMP.getBlockData(), 2);
|
|
|
|
}
|
|
|
|
|