Added compatibility with a 1.16.5 changed field name.

This commit is contained in:
Brianna 2021-02-22 09:50:14 -06:00
parent fdbe0da191
commit 6b9380fd50

View File

@ -141,8 +141,13 @@ public enum CompatibleBiome {
methodGetBiomeIndex = classChunk.getMethod("getBiomeIndex"); methodGetBiomeIndex = classChunk.getMethod("getBiomeIndex");
methodSetBiome = classBiomeStorage.getMethod("setBiome", int.class, int.class, int.class, classBiomeBase); methodSetBiome = classBiomeStorage.getMethod("setBiome", int.class, int.class, int.class, classBiomeBase);
try {
fieldStorageRegistry = classBiomeStorage.getDeclaredField("g"); // If 1.16.5
fieldStorageRegistry = classBiomeStorage.getDeclaredField("registry");
} catch (NoSuchFieldException e) {
// If less than 1.16.5
fieldStorageRegistry = classBiomeStorage.getDeclaredField("g");
}
fieldStorageRegistry.setAccessible(true); fieldStorageRegistry.setAccessible(true);
} catch (NoSuchMethodException | NoSuchFieldException e) { } catch (NoSuchMethodException | NoSuchFieldException e) {
e.printStackTrace(); e.printStackTrace();