3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00
Paper/nms-patches/BlockRedstoneWire.patch
2020-06-25 10:00:00 +10:00

28 Zeilen
1.2 KiB
Diff

--- a/net/minecraft/server/BlockRedstoneWire.java
+++ b/net/minecraft/server/BlockRedstoneWire.java
@@ -9,6 +9,8 @@
import java.util.Set;
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneWire extends Block {
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);
- if ((Integer) iblockdata.get(BlockRedstoneWire.POWER) != i) {
+ // CraftBukkit start
+ 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);
+
+ i = event.getNewCurrent();
+ // CraftBukkit end
if (world.getType(blockposition) == iblockdata) {
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2);
}