Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ private static LiteralArgumentBuilder<FabricClientCommandSource> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@

@Mixin(EntityRenderDispatcher.class)
public class EntityRendererDispatcherMixin {

@Inject(method = "prepare", at = @At("HEAD"))
public void onPrepare(Camera camera, Entity entity, CallbackInfo ci) {
RenderSettings.preRenderEntities();
}

@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);
}

}
Original file line number Diff line number Diff line change
@@ -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);
}
}
1 change: 1 addition & 0 deletions src/main/resources/mixins.clientcommands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading