aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch
new file mode 100644
index 0000000000..93f0237c6f
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch
@@ -0,0 +1,40 @@
+--- a/net/minecraft/world/level/block/CommandBlock.java
++++ b/net/minecraft/world/level/block/CommandBlock.java
+@@ -30,6 +30,8 @@
+ import net.minecraft.world.phys.BlockHitResult;
+ import org.slf4j.Logger;
+
++import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
++
+ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
+
+ public static final MapCodec<CommandBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
+@@ -69,13 +68,22 @@
+ if (!level.isClientSide) {
+ BlockEntity blockentity = level.getBlockEntity(blockpos);
+
+- if (blockentity instanceof CommandBlockEntity) {
+- CommandBlockEntity commandblockentity = (CommandBlockEntity) blockentity;
+- boolean flag1 = level.hasNeighborSignal(blockpos);
+- boolean flag2 = commandblockentity.isPowered();
++ if (tileentity instanceof CommandBlockEntity) {
++ CommandBlockEntity tileentitycommand = (CommandBlockEntity) tileentity;
++ boolean flag1 = level.hasNeighborSignal(pos);
++ boolean flag2 = tileentitycommand.isPowered();
++ // CraftBukkit start
++ org.bukkit.block.Block bukkitBlock = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
++ int old = flag2 ? 15 : 0;
++ int current = flag1 ? 15 : 0;
+
+- commandblockentity.setPowered(flag1);
+- if (!flag2 && !commandblockentity.isAutomatic() && commandblockentity.getMode() != CommandBlockEntity.Mode.SEQUENCE) {
++ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
++ level.getCraftServer().getPluginManager().callEvent(eventRedstone);
++ flag1 = eventRedstone.getNewCurrent() > 0;
++ // CraftBukkit end
++
++ tileentitycommand.setPowered(flag1);
++ if (!flag2 && !tileentitycommand.isAutomatic() && tileentitycommand.getMode() != CommandBlockEntity.Type.SEQUENCE) {
+ if (flag1) {
+ commandblockentity.markConditionMet();
+ level.scheduleTick(blockpos, (Block) this, 1);