Skip to content

Commit

Permalink
已经没救了。
Browse files Browse the repository at this point in the history
  • Loading branch information
3TUSK committed Sep 15, 2024
1 parent 21fe2fb commit 2b388f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.teacon.powertool.mixin.client;

import net.minecraft.client.renderer.chunk.SectionRenderDispatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

@Mixin(SectionRenderDispatcher.class)
public class SectionRenderDispatcherMixin {

@Unique
private static final Logger powerTool$LOGGER = LoggerFactory.getLogger("NamelessBugHunter");
@Unique
private static final Marker powerTool$MARKER = MarkerFactory.getMarker("SectionRenderDispatcher");

/**
* Tracing the exception thrown when batching all sections.
* It is not a @Inject mixin because of a non-public class.
* @param t The exception
* @return The exception verbatim; we are only tracing it, not modifying it
*/
@ModifyArg(method = "lambda$runTask$3", at = @At(value = "INVOKE", target = "Lnet/minecraft/CrashReport;forThrowable(Ljava/lang/Throwable;Ljava/lang/String;)Lnet/minecraft/CrashReport;"))
private Throwable tracingStackTrace(Throwable t) {
powerTool$LOGGER.error(powerTool$MARKER, "SectionRenderDispatcher encounters error!", t);
return t;
}


}
3 changes: 2 additions & 1 deletion src/main/resources/powertool.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"client": [
"client.GameModeSwitcherScreenMixin",
"client.KeyboardHandlerMixin",
"client.PlayerMixin"
"client.PlayerMixin",
"client.SectionRenderDispatcherMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 2b388f0

Please sign in to comment.