fix: do not bother with refraction for biomes/i field, this just fixes it now

This commit is contained in:
Jordan 2024-06-30 21:59:06 +02:00 committed by GitHub
parent e3fde6cf82
commit d9e69cfd58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,7 +141,14 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldTickingFluidCount.setAccessible(true);
fieldTickingBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingBlockCount", "f"));
fieldTickingBlockCount.setAccessible(true);
fieldBiomes = LevelChunkSection.class.getDeclaredField(Refraction.pickName("biomes", "i"));
Field tmpFieldBiomes;
try {
// Seems it's sometimes biomes and sometimes "i". Idk this is just easier than having to try to deal with it
tmpFieldBiomes = LevelChunkSection.class.getDeclaredField("biomes"); // apparently unobf
} catch (NoSuchFieldException ignored) {
tmpFieldBiomes = LevelChunkSection.class.getDeclaredField("i"); // apparently obf
}
fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(