Skip to content

Commit

Permalink
Fix logged error upon loading a world
Browse files Browse the repository at this point in the history
  • Loading branch information
xCollateral committed Sep 23, 2024
1 parent 61e44bd commit fbed533
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private void setLevel(ClientLevel clientLevel, CallbackInfo ci) {
}

@Inject(method = "allChanged", at = @At("RETURN"))
private void allChanged(CallbackInfo ci) {
private void onAllChanged(CallbackInfo ci) {
this.worldRenderer.allChanged();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.vulkanmod.mixin.chunk;

import net.minecraft.client.renderer.chunk.SectionRenderDispatcher;
import net.minecraft.util.thread.ProcessorMailbox;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(SectionRenderDispatcher.class)
public class SectionRenderDispatcherM {

@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/thread/ProcessorMailbox;tell(Ljava/lang/Object;)V"))
private void redirectTask(ProcessorMailbox instance, Object object) {}
}
22 changes: 22 additions & 0 deletions src/main/java/net/vulkanmod/mixin/chunk/ViewAreaM.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.vulkanmod.mixin.chunk;

import net.minecraft.client.renderer.ViewArea;
import net.minecraft.client.renderer.chunk.SectionRenderDispatcher;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ViewArea.class)
public class ViewAreaM {

@Shadow public SectionRenderDispatcher.RenderSection[] sections;

@Inject(method = "createSections", at = @At("HEAD"), cancellable = true)
private void skipAllocation(SectionRenderDispatcher sectionRenderDispatcher, CallbackInfo ci) {
this.sections = new SectionRenderDispatcher.RenderSection[0];

ci.cancel();
}
}
6 changes: 4 additions & 2 deletions src/main/resources/vulkanmod.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
"window.WindowMixin",
"window.WindowAccessor",

"chunk.ClientPacketListenerM",
"chunk.ClientChunkCacheM",
"chunk.DirectionMixin",
"chunk.FrustumMixin",
"chunk.LevelRendererMixin",
"chunk.RenderBuffersM",
"chunk.SectionRenderDispatcherM",
"chunk.ViewAreaM",
"chunk.VisibilitySetMixin",
"chunk.ClientPacketListenerM",
"chunk.ClientChunkCacheM",

"compatibility.EffectInstanceM",
"compatibility.ProgramM",
Expand Down

0 comments on commit fbed533

Please sign in to comment.