Skip to content

Commit 25caa90

Browse files
committed
fix MC-263999 (thanks Microcontrollers #476)
1 parent e63f056 commit 25caa90

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

.bugs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ patched 268617 server basic
104104
patched 271899 server basic
105105
patched 272431 server basic
106106
patched 298066 server basic
107+
patched 263999 server basic
107108

108109
previous 2025 17w47a
109110
previous 53312 22w17a
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package dev.isxander.debugify.mixins.basic.mc263999;
2+
3+
import com.llamalad7.mixinextras.expression.Definition;
4+
import com.llamalad7.mixinextras.expression.Expression;
5+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
6+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
7+
import com.llamalad7.mixinextras.sugar.Share;
8+
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
9+
import dev.isxander.debugify.fixes.BugFix;
10+
import dev.isxander.debugify.fixes.FixCategory;
11+
import net.minecraft.core.BlockPos;
12+
import net.minecraft.world.entity.Mob;
13+
import net.minecraft.world.entity.ai.goal.BreakDoorGoal;
14+
import net.minecraft.world.entity.ai.goal.DoorInteractGoal;
15+
import net.minecraft.world.level.Level;
16+
import net.minecraft.world.level.block.state.BlockState;
17+
import org.spongepowered.asm.mixin.Mixin;
18+
import org.spongepowered.asm.mixin.injection.At;
19+
import org.spongepowered.asm.mixin.injection.Inject;
20+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
21+
22+
/**
23+
* removeBlock is called before querying the block state of the door,
24+
* which breaks the level event that causes particles
25+
*/
26+
@BugFix(id = "MC-263999", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "Zombies breaking doors do not show break particles")
27+
@Mixin(BreakDoorGoal.class)
28+
public class BreakDoorGoalMixin extends DoorInteractGoal {
29+
public BreakDoorGoalMixin(Mob mob) {
30+
super(mob);
31+
}
32+
33+
// Store the block state before removal
34+
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;removeBlock(Lnet/minecraft/core/BlockPos;Z)Z"))
35+
private void storeBlockStatePreRemoval(CallbackInfo ci, @Share("blockState") LocalRef<BlockState> blockStateRef) {
36+
blockStateRef.set(this.mob.level().getBlockState(this.doorPos));
37+
}
38+
39+
// Use the stored block state for the level event
40+
@Definition(id = "levelEvent", method = "Lnet/minecraft/world/level/Level;levelEvent(ILnet/minecraft/core/BlockPos;I)V")
41+
@Definition(id = "getId", method = "Lnet/minecraft/world/level/block/Block;getId(Lnet/minecraft/world/level/block/state/BlockState;)I")
42+
@Definition(id = "getBlockState", method = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;")
43+
@Definition(id = "doorPos", field = "Lnet/minecraft/world/entity/ai/goal/BreakDoorGoal;doorPos:Lnet/minecraft/core/BlockPos;")
44+
@Expression("?.levelEvent(2001, ?, getId(@(?.getBlockState(?.doorPos))))")
45+
@WrapOperation(method = "tick", at = @At("MIXINEXTRAS:EXPRESSION"))
46+
private BlockState injectCorrectBlockState(Level instance, BlockPos pos, Operation<BlockState> original, @Share("blockState") LocalRef<BlockState> blockStateRef) {
47+
return blockStateRef.get();
48+
}
49+
}

src/main/resources/debugify.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"basic.mc231743.FlowerPotBlockMixin",
5252
"basic.mc232869.StriderMixin",
5353
"basic.mc245394.RaidMixin",
54+
"basic.mc263999.BreakDoorGoalMixin",
5455
"basic.mc267125.MinecraftServerMixin",
5556
"basic.mc268617.FileUtilMixin",
5657
"basic.mc271899.StructureTemplateMixin",

0 commit comments

Comments
 (0)