diff --git a/PATCHED.md b/PATCHED.md index 9023064e..e20f2f33 100644 --- a/PATCHED.md +++ b/PATCHED.md @@ -110,6 +110,7 @@ | Basic | [MC-245394](https://bugs.mojang.com/browse/MC-245394) | The sounds of raid horns blaring aren't controlled by the correct sound slider | | Basic | [MC-251068](https://bugs.mojang.com/browse/MC-251068) | If you delete your only world, then you are no longer automatically thrown into the menu of creating a new world | | Basic | [MC-267125](https://bugs.mojang.com/browse/MC-267125) | Command suggestions for reloadable content are not affected by /reload | +| Basic | [MC-263999](https://bugs.mojang.com/browse/MC-263999) | Zombies breaking doors do not show break particles | | Basic | [MC-268617](https://bugs.mojang.com/browse/MC-268617) | Structures can't be saved if the game directory is named in a certain way | | Basic | [MC-271899](https://bugs.mojang.com/browse/MC-271899) | StructureTemplate Palette's caches are not thread safe | | Basic | [MC-272431](https://bugs.mojang.com/browse/MC-272431) | Ender Dragon incorrect vertical velocity causes erratic behavior | diff --git a/src/main/java/dev/isxander/debugify/mixins/basic/mc263999/BreakDoorGoalMixin.java b/src/main/java/dev/isxander/debugify/mixins/basic/mc263999/BreakDoorGoalMixin.java new file mode 100644 index 00000000..4b0c3d7e --- /dev/null +++ b/src/main/java/dev/isxander/debugify/mixins/basic/mc263999/BreakDoorGoalMixin.java @@ -0,0 +1,37 @@ +package dev.isxander.debugify.mixins.basic.mc263999; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import dev.isxander.debugify.fixes.BugFix; +import dev.isxander.debugify.fixes.FixCategory; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.goal.BreakDoorGoal; +import net.minecraft.world.entity.ai.goal.DoorInteractGoal; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@BugFix(id = "MC-263999", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "Zombies breaking doors do not show break particles") +@Mixin(BreakDoorGoal.class) +public class BreakDoorGoalMixin extends DoorInteractGoal { + public BreakDoorGoalMixin(Mob mob) { + super(mob); + } + + /** + * Minecraft removes the door block before finding the door's position. + * Instead, we make a copy of the block state prior to removing the door block to supply the block state check + */ + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;removeBlock(Lnet/minecraft/core/BlockPos;Z)Z")) + private void getOldBlockState(CallbackInfo ci, @Share("doorBlockState") LocalRef blockStateRef) { + blockStateRef.set(this.mob.level().getBlockState(this.doorPos)); + } + + @ModifyExpressionValue(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;")) + private BlockState setBlockState(BlockState original, @Share("doorBlockState") LocalRef blockStateRef) { + return blockStateRef.get(); + } +} diff --git a/src/main/resources/debugify.mixins.json b/src/main/resources/debugify.mixins.json index cf77856d..d59d2303 100644 --- a/src/main/resources/debugify.mixins.json +++ b/src/main/resources/debugify.mixins.json @@ -54,6 +54,7 @@ "basic.mc231743.FlowerPotBlockMixin", "basic.mc232869.StriderMixin", "basic.mc245394.RaidMixin", + "basic.mc263999.BreakDoorGoalMixin", "basic.mc267125.MinecraftServerMixin", "basic.mc268617.FileUtilMixin", "basic.mc271899.StructureTemplateMixin",