3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00
Paper/nms-patches/BlockRedstoneWire.patch

30 Zeilen
1.3 KiB
Diff

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,16 @@
2020-06-25 02:00:00 +02:00
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();
+ }
+ if (oldPower != i) {
2020-06-25 02:00:00 +02:00
+ // CraftBukkit end
if (world.getType(blockposition) == iblockdata) {
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2);
}