Paper/nms-patches/BlockRedstoneWire.patch

28 lines
1.2 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockRedstoneWire.java
+++ b/net/minecraft/server/BlockRedstoneWire.java
2020-06-25 02:00:00 +02:00
@@ -9,6 +9,8 @@
import java.util.Set;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneWire extends Block {
2020-06-25 02:00:00 +02:00
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.X;
@@ -213,7 +215,14 @@
private void a(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = this.a(world, blockposition);
2015-02-26 23:41:06 +01:00
2020-06-25 02:00:00 +02:00
- if ((Integer) iblockdata.get(BlockRedstoneWire.POWER) != i) {
+ // CraftBukkit start
2020-06-25 02:00:00 +02:00
+ int oldPower = (Integer) iblockdata.get(BlockRedstoneWire.POWER);
+ if (oldPower != i) {
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i);
+ world.getServer().getPluginManager().callEvent(event);
+
2020-06-25 02:00:00 +02:00
+ i = event.getNewCurrent();
+ // CraftBukkit end
if (world.getType(blockposition) == iblockdata) {
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2);
}