use of meteordevelopment.meteorclient.mixininterface.ICapabilityTracker in project meteor-client by MeteorDevelopment.
the class GL method getTracker.
private static ICapabilityTracker getTracker(String fieldName) {
try {
Class<?> glStateManager = GlStateManager.class;
Field field = glStateManager.getDeclaredField(fieldName);
field.setAccessible(true);
Object state = field.get(null);
String trackerName = FabricLoader.getInstance().getMappingResolver().mapClassName("intermediary", "com.mojang.blaze3d.platform.GlStateManager$class_1018");
Field capStateField = null;
for (Field f : state.getClass().getDeclaredFields()) {
if (f.getType().getName().equals(trackerName)) {
capStateField = f;
break;
}
}
capStateField.setAccessible(true);
return (ICapabilityTracker) capStateField.get(state);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
return null;
}
}
Aggregations