mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
29 lines
1.4 KiB
Diff
29 lines
1.4 KiB
Diff
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
|
|
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
|
|
@@ -36,6 +36,8 @@
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
|
import net.minecraft.world.phys.shapes.VoxelShapes;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockRedstoneWire extends Block {
|
|
|
|
public static final MapCodec<BlockRedstoneWire> CODEC = simpleCodec(BlockRedstoneWire::new);
|
|
@@ -260,7 +262,16 @@
|
|
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
|
int i = this.calculateTargetStrength(world, blockposition);
|
|
|
|
- if ((Integer) iblockdata.getValue(BlockRedstoneWire.POWER) != i) {
|
|
+ // CraftBukkit start
|
|
+ int oldPower = (Integer) iblockdata.getValue(BlockRedstoneWire.POWER);
|
|
+ if (oldPower != i) {
|
|
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i);
|
|
+ world.getCraftServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ i = event.getNewCurrent();
|
|
+ }
|
|
+ if (oldPower != i) {
|
|
+ // CraftBukkit end
|
|
if (world.getBlockState(blockposition) == iblockdata) {
|
|
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneWire.POWER, i), 2);
|
|
}
|