aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch
new file mode 100644
index 0000000000..4df7027985
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/CommandBlock.java.patch
@@ -0,0 +1,47 @@
+--- a/net/minecraft/world/level/block/CommandBlock.java
++++ b/net/minecraft/world/level/block/CommandBlock.java
+@@ -31,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 -> instance.group(Codec.BOOL.fieldOf("automatic").forGetter(commandBlock -> commandBlock.automatic), propertiesCodec())
+@@ -62,14 +66,27 @@
+ @Override
+ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
+ if (!level.isClientSide) {
+- if (level.getBlockEntity(pos) instanceof CommandBlockEntity commandBlockEntity) {
+- boolean hasNeighborSignal = level.hasNeighborSignal(pos);
+- boolean isPowered = commandBlockEntity.isPowered();
+- commandBlockEntity.setPowered(hasNeighborSignal);
+- if (!isPowered && !commandBlockEntity.isAutomatic() && commandBlockEntity.getMode() != CommandBlockEntity.Mode.SEQUENCE) {
+- if (hasNeighborSignal) {
+- commandBlockEntity.markConditionMet();
+- level.scheduleTick(pos, this, 1);
++ BlockEntity tileentity = level.getBlockEntity(pos);
++
++ 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;
++
++ 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) {
++ tileentitycommand.markConditionMet();
++ level.scheduleTick(pos, (Block) this, 1);
+ }
+ }
+ }