diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CPlaySoundCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CPlaySoundCommand.java index 68df0274d..f67ee92cd 100644 --- a/src/main/java/net/earthcomputer/clientcommands/command/CPlaySoundCommand.java +++ b/src/main/java/net/earthcomputer/clientcommands/command/CPlaySoundCommand.java @@ -38,8 +38,8 @@ private static LiteralArgumentBuilder buildArguments( .executes(ctx -> playSound(ctx.getSource(), getId(ctx, "sound"), source, getVec3(ctx, "pos"), 1, 1)) .then(argument("volume", floatArg(0)) .executes(ctx -> playSound(ctx.getSource(), getId(ctx, "sound"), source, getVec3(ctx, "pos"), getFloat(ctx, "volume"), 1)) - .then(argument("pitch", floatArg(0, 2))) - .executes(ctx -> playSound(ctx.getSource(), getId(ctx, "sound"), source, getVec3(ctx, "pos"), getFloat(ctx, "volume"), getFloat(ctx, "pitch"))))); + .then(argument("pitch", floatArg(0, 2)) + .executes(ctx -> playSound(ctx.getSource(), getId(ctx, "sound"), source, getVec3(ctx, "pos"), getFloat(ctx, "volume"), getFloat(ctx, "pitch")))))); } private static int playSound(FabricClientCommandSource source, Identifier sound, SoundSource soundSource, Vec3 pos, float volume, float pitch) { diff --git a/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/EntityRendererDispatcherMixin.java b/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/EntityRendererDispatcherMixin.java index 41e1a575c..91e1655d0 100644 --- a/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/EntityRendererDispatcherMixin.java +++ b/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/EntityRendererDispatcherMixin.java @@ -12,7 +12,6 @@ @Mixin(EntityRenderDispatcher.class) public class EntityRendererDispatcherMixin { - @Inject(method = "prepare", at = @At("HEAD")) public void onPrepare(Camera camera, Entity entity, CallbackInfo ci) { RenderSettings.preRenderEntities(); @@ -20,11 +19,6 @@ public void onPrepare(Camera camera, Entity entity, CallbackInfo ci) { @ModifyReturnValue(method = "shouldRender", at = @At("RETURN")) public boolean redirectShouldRender(boolean original, Entity entity) { - if (original && !RenderSettings.shouldRenderEntity(entity)) { - return false; - } - - return original; + return original && RenderSettings.shouldRenderEntity(entity); } - } diff --git a/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/LevelRendererMixin.java b/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/LevelRendererMixin.java new file mode 100644 index 000000000..82bee1e28 --- /dev/null +++ b/src/main/java/net/earthcomputer/clientcommands/mixin/commands/render/LevelRendererMixin.java @@ -0,0 +1,18 @@ +package net.earthcomputer.clientcommands.mixin.commands.render; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Local; +import net.earthcomputer.clientcommands.features.RenderSettings; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.world.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; + +@Mixin(LevelRenderer.class) +public class LevelRendererMixin { + @ModifyExpressionValue(method = "extractVisibleEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;hasIndirectPassenger(Lnet/minecraft/world/entity/Entity;)Z")) + private boolean hasIndirectPassengersAndClientCommandsShouldRender(boolean original, @Local(name = "entity") Entity entity) { + return original && RenderSettings.shouldRenderEntity(entity); + } +} diff --git a/src/main/resources/mixins.clientcommands.json b/src/main/resources/mixins.clientcommands.json index cf3af39c3..d1743a5dd 100644 --- a/src/main/resources/mixins.clientcommands.json +++ b/src/main/resources/mixins.clientcommands.json @@ -75,6 +75,7 @@ "commands.fps.MinecraftMixin", "commands.generic.CommandSuggestionsMixin", "commands.glow.LivingEntityRenderStateMixin", + "commands.render.LevelRendererMixin", "commands.reply.ClientPacketListenerMixin", "commands.snap.MinecraftMixin", "commands.time.ClientClockManagerMixin",