Skip to content

Commit

Permalink
Move WorldRenderer#updateRenderer hooks inside if(needsUpdate) block
Browse files Browse the repository at this point in the history
Fixes Phosphor incompat (#19)
  • Loading branch information
makamys committed Mar 19, 2024
1 parent d1b9f63 commit bbe5d3a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -40,8 +41,9 @@ abstract class MixinWorldRenderer implements IWorldRenderer {

private List<ChunkMesh> nd$chunkMeshes;

// Inject before first instruction inside if(needsUpdate) block
@Inject(method = {"updateRenderer"},
at = @At(value = "HEAD"),
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/WorldRenderer;needsUpdate:Z", ordinal = 0),
require = 1)
private void preUpdateRenderer(CallbackInfo ci) {
preUpdateRenderer(false);
Expand All @@ -67,8 +69,9 @@ private void preUpdateRenderer(boolean sort) {
}
}

// Inject after last instruction inside if(needsUpdate) block
@Inject(method = {"updateRenderer"},
at = @At(value = "RETURN"),
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/WorldRenderer;isInitialized:Z", ordinal = 0, shift = Shift.AFTER),
require = 1)
private void postUpdateRenderer(CallbackInfo ci) {
postUpdateRenderer(false);
Expand Down

0 comments on commit bbe5d3a

Please sign in to comment.