-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package grondag.canvas.compat; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
|
||
import net.minecraft.client.render.WorldRenderer; | ||
|
||
import grondag.canvas.CanvasMod; | ||
|
||
public class ClassInspector { | ||
public static void inspect() { | ||
final Class<WorldRenderer> clazz = WorldRenderer.class; | ||
|
||
CanvasMod.LOG.info(""); | ||
CanvasMod.LOG.info("WorldRenderer Class Summary - For Developer Use"); | ||
CanvasMod.LOG.info("============================================="); | ||
CanvasMod.LOG.info(""); | ||
CanvasMod.LOG.info("FIELDS"); | ||
|
||
for(final Field f : clazz.getDeclaredFields()) { | ||
CanvasMod.LOG.info(f.toGenericString()); | ||
} | ||
|
||
CanvasMod.LOG.info(""); | ||
CanvasMod.LOG.info("METHODS"); | ||
|
||
for(final Method m : clazz.getDeclaredMethods()) { | ||
CanvasMod.LOG.info(m.toGenericString()); | ||
} | ||
|
||
CanvasMod.LOG.info(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//package grondag.canvas.compat; | ||
// | ||
//import java.lang.invoke.MethodHandle; | ||
//import java.lang.invoke.MethodHandles; | ||
//import java.lang.reflect.Method; | ||
// | ||
//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
// | ||
//import net.minecraft.client.render.Camera; | ||
//import net.minecraft.client.render.GameRenderer; | ||
//import net.minecraft.client.render.LightmapTextureManager; | ||
//import net.minecraft.client.render.VertexConsumerProvider; | ||
//import net.minecraft.client.render.WorldRenderer; | ||
//import net.minecraft.client.util.math.MatrixStack; | ||
//import net.minecraft.util.math.Matrix4f; | ||
//import net.minecraft.util.math.Vec3d; | ||
//import net.minecraft.util.profiler.Profiler; | ||
// | ||
//import net.fabricmc.loader.api.FabricLoader; | ||
// | ||
//import grondag.canvas.CanvasMod; | ||
// | ||
// TODO: On hold until have response to CSB #20 | ||
|
||
//public class CsbHolder { | ||
// private static boolean warnRender = true; | ||
// | ||
// public static CsbRender handler = (MatrixStack matrices, float delta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci) -> {}; | ||
// | ||
// static { | ||
// if (FabricLoader.getInstance().isModLoaded("dynocaps")) { | ||
// | ||
// final MethodHandles.Lookup lookup = MethodHandles.lookup(); | ||
// | ||
// try { | ||
// final Class<?> clazz = WorldRenderer.class; | ||
// | ||
// Method render = null; | ||
// | ||
// final Method render = clazz.getDeclaredMethod("handler$zeh000$renderWorldBorder", MatrixStack.class, float.class, long.class, boolean.class, Camera.class, GameRenderer.class, LightmapTextureManager.class, Matrix4f.class, CallbackInfo.class); | ||
// final MethodHandle renderHandler = lookup.unreflect(render); | ||
// | ||
// handler = (profiler, matrixStack, immediate, camPos) -> { | ||
// try { | ||
// profiler.swap("dynocaps"); | ||
// renderHandler.invokeExact(matrixStack, immediate, 1, camPos); | ||
// } catch (final Throwable e) { | ||
// if (warnRender) { | ||
// CanvasMod.LOG.warn("Unable to call DynoCaps BoxRenderer.render hook due to exception:", e); | ||
// CanvasMod.LOG.warn("Subsequent errors will be suppressed"); | ||
// warnRender = false; | ||
// } | ||
// } | ||
// }; | ||
// | ||
// CanvasMod.LOG.info("Found DynoCaps - compatibility hook enabled"); | ||
// } catch (final Exception e) { | ||
// CanvasMod.LOG.warn("Unable to find DynoCaps render hook due to exception:", e); | ||
// } | ||
// } | ||
// } | ||
// | ||
// public interface CsbRender { | ||
// void render(MatrixStack matrices, float delta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci); | ||
// } | ||
// | ||
// | ||
// private void net.minecraft.class_761.handler$zeh000$renderWorldBorder(net.minecraft.class_4587,float,long,boolean,net.minecraft.class_4184,net.minecraft.class_757,net.minecraft.class_765,net.minecraft.class_1159,org.spongepowered.asm.mixin.injection.callback.CallbackInfo) | ||
// | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters