Skip to content

Commit

Permalink
Improved backwards compatibility with 1.20.1 and 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
r8420 committed Feb 2, 2024
1 parent bcd3d68 commit 989860a
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Field;


public class ChunkBoundsHandler {
Expand Down Expand Up @@ -69,9 +70,18 @@ public void onOverlayRender(CustomizeGuiOverlayEvent.DebugText event) {
if (mc.getDebugOverlay().showDebugScreen()) {
return;
}
}
catch (NoSuchMethodError e) {
// ignore since only 1.20.2+ has this method
} catch (NoSuchMethodError e) {
try {
// Use reflection to check if the renderDebug field exists in mc.options. Note: remove this for future versions
Field renderDebugField = mc.options.getClass().getField("renderDebug");
boolean renderDebug = renderDebugField.getBoolean(mc.options);

if (renderDebug) {
return;
}
} catch(Exception f){
// Ignore
}
}

int y = 0;
Expand Down

0 comments on commit 989860a

Please sign in to comment.