diff --git a/PATCHED.md b/PATCHED.md index 9023064e..8ea2737f 100644 --- a/PATCHED.md +++ b/PATCHED.md @@ -107,6 +107,7 @@ | Basic | [MC-227337](https://bugs.mojang.com/browse/MC-227337) | When a shulker bullet hits an entity, the explodes sound is not played and particles are not produced | | Basic | [MC-231743](https://bugs.mojang.com/browse/MC-231743) | minecraft.used:minecraft.POTTABLE_PLANT doesn't increase when placing plants into flower pots | | Basic | [MC-232869](https://bugs.mojang.com/browse/MC-232869) | Adult striders can spawn with saddles in peaceful mode | +| Basic | [MC-232968](https://bugs.mojang.com/browse/MC-232968) | Spectators can prevent the closing animation of a chest/barrel when viewing it at the same time as a non-spectator | | 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 | diff --git a/src/main/java/dev/isxander/debugify/mixins/basic/mc232968/ContainerOpenersCounterMixin.java b/src/main/java/dev/isxander/debugify/mixins/basic/mc232968/ContainerOpenersCounterMixin.java new file mode 100644 index 00000000..5a162d42 --- /dev/null +++ b/src/main/java/dev/isxander/debugify/mixins/basic/mc232968/ContainerOpenersCounterMixin.java @@ -0,0 +1,28 @@ +package dev.isxander.debugify.mixins.basic.mc232968; + +import com.llamalad7.mixinextras.expression.Definition; +import com.llamalad7.mixinextras.expression.Expression; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import dev.isxander.debugify.fixes.BugFix; +import dev.isxander.debugify.fixes.FixCategory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.entity.ContainerOpenersCounter; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; + +import java.util.function.Predicate; + +@BugFix(id = "MC-232968", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "Spectators can prevent the closing animation of a chest/barrel when viewing it at the same time as a non-spectator") +@Mixin(ContainerOpenersCounter.class) +public abstract class ContainerOpenersCounterMixin { + @Shadow + protected abstract boolean isOwnContainer(Player player); + + @Definition(id = "isOwnContainer", method = "Lnet/minecraft/world/level/block/entity/ContainerOpenersCounter;isOwnContainer(Lnet/minecraft/world/entity/player/Player;)Z") + @Expression("?::isOwnContainer") + @ModifyExpressionValue(method = "getPlayersWithContainerOpen", at = @At("MIXINEXTRAS:EXPRESSION")) + private Predicate fixSpectatorContainerOpen(Predicate original) { + return player -> isOwnContainer(player) && !player.isSpectator(); + } +} diff --git a/src/main/resources/debugify.mixins.json b/src/main/resources/debugify.mixins.json index cf77856d..c1a3e02f 100644 --- a/src/main/resources/debugify.mixins.json +++ b/src/main/resources/debugify.mixins.json @@ -53,6 +53,7 @@ "basic.mc227337.ShulkerBulletMixin", "basic.mc231743.FlowerPotBlockMixin", "basic.mc232869.StriderMixin", + "basic.mc232968.ContainerOpenersCounterMixin", "basic.mc245394.RaidMixin", "basic.mc267125.MinecraftServerMixin", "basic.mc268617.FileUtilMixin",