mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
29 lines
1.3 KiB
Diff
29 lines
1.3 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,16 @@
|
|
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();
|
|
+ }
|
|
+ if (oldPower != i) {
|
|
+ // CraftBukkit end
|
|
if (world.getType(blockposition) == iblockdata) {
|
|
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2);
|
|
}
|