Skip to content

Commit

Permalink
change: Don't distinguish block entities in profiler when using entit…
Browse files Browse the repository at this point in the history
…y culling
  • Loading branch information
mrmangohands committed Sep 19, 2021
1 parent 9c05c65 commit b2dd2ae
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,8 @@ public void scheduleRebuildForChunk(int x, int y, int z, boolean important) {
public ChunkRenderBackend<?> getChunkRenderer() {
return this.chunkRenderBackend;
}

public boolean getUseEntityCulling() {
return this.useEntityCulling;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package me.jellysquid.mods.sodium.mixin.features.entity.smooth_lighting;

import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.util.profiler.Profiler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.Objects;

@Mixin(WorldRenderer.class)
public class MixinWorldRenderer {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V"))
void doNothing(Profiler profiler, String location) {
if (!Objects.equals(location, "blockentities") || !SodiumWorldRenderer.getInstance().getUseEntityCulling()) {
profiler.swap(location);
}
}
}

1 change: 1 addition & 0 deletions src/main/resources/sodium.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"features.entity.fast_render.MixinModelPart",
"features.entity.smooth_lighting.MixinEntityRenderer",
"features.entity.smooth_lighting.MixinPaintingEntityRenderer",
"features.entity.smooth_lighting.MixinWorldRenderer",
"features.gui.MixinDebugHud",
"features.gui.fast_loading_screen.MixinLevelLoadingScreen",
"features.gui.font.MixinGlyphRenderer",
Expand Down

0 comments on commit b2dd2ae

Please sign in to comment.