0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 10:06:16 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/block/BlockCommand.patch
2024-10-23 02:15:00 +11:00

28 lines
1.2 KiB
Diff

--- a/net/minecraft/world/level/block/BlockCommand.java
+++ b/net/minecraft/world/level/block/BlockCommand.java
@@ -31,6 +31,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
public static final MapCodec<BlockCommand> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -78,6 +80,15 @@
private void setPoweredAndUpdate(World world, BlockPosition blockposition, TileEntityCommand tileentitycommand, boolean flag) {
boolean flag1 = tileentitycommand.isPowered();
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
if (flag != flag1) {
tileentitycommand.setPowered(flag);