Hydrogen biome array fox (#237)

This commit is contained in:
paulevsGitch 2021-07-12 07:18:39 +03:00
parent 01238800ed
commit 7ba38c4b27

View file

@ -35,7 +35,7 @@ public class ChunkBiomeContainerMixin implements IBiomeArray {
int biomeZ = pos.getZ() >> 2;
int index = be_getArrayIndex(biomeX, biomeY, biomeZ);
if (Integrations.hasHydrogen()) {
if (Integrations.hasHydrogen() && be_shouldWriteToHydrogen()) {
try {
ChunkBiomeContainer self = (ChunkBiomeContainer) (Object) this;
BitStorage storage = be_getHydrogenStorage(self);
@ -80,6 +80,16 @@ public class ChunkBiomeContainerMixin implements IBiomeArray {
@Final
private int quartHeight;
private boolean be_shouldWriteToHydrogen() {
try {
Field field = ChunkBiomeContainer.class.getDeclaredField("intArray");
return field != null;
}
catch (NoSuchFieldException e) {
return false;
}
}
private int be_getArrayIndex(int biomeX, int biomeY, int biomeZ) {
int i = biomeX & HORIZONTAL_MASK;
int j = Mth.clamp(biomeY - this.quartMinY, 0, this.quartHeight);