Fixed caves crash with non-be biome source (issue #148)
This commit is contained in:
parent
16b02e15bf
commit
9999abf945
3 changed files with 21 additions and 7 deletions
|
@ -112,7 +112,9 @@ public class EndBiomes {
|
|||
public static final EndCaveBiome EMPTY_AURORA_CAVE = registerCaveBiome(new EmptyAuroraCaveBiome());
|
||||
public static final EndCaveBiome LUSH_AURORA_CAVE = registerCaveBiome(new LushAuroraCaveBiome());
|
||||
|
||||
public static void register() {}
|
||||
public static void register() {
|
||||
CAVE_BIOMES.rebuild();
|
||||
}
|
||||
|
||||
public static void mutateRegistry(Registry<Biome> biomeRegistry) {
|
||||
EndBiomes.biomeRegistry = biomeRegistry;
|
||||
|
@ -407,6 +409,15 @@ public class EndBiomes {
|
|||
public static EndBiome getBiome(ResourceLocation biomeID) {
|
||||
return ID_MAP.getOrDefault(biomeID, END);
|
||||
}
|
||||
|
||||
public static Biome getActualBiome(EndBiome biome) {
|
||||
Biome actual = biome.getActualBiome();
|
||||
if (actual == null) {
|
||||
biome.updateActualBiomes(biomeRegistry);
|
||||
actual = biome.getActualBiome();
|
||||
}
|
||||
return actual;
|
||||
}
|
||||
|
||||
public static List<EndBiome> getModBiomes() {
|
||||
List<EndBiome> result = Lists.newArrayList();
|
||||
|
|
|
@ -117,7 +117,8 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
private void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
|
||||
IBiomeArray array = (IBiomeArray) world.getChunk(pos).getBiomes();
|
||||
if (array != null) {
|
||||
array.be_setBiome(biome.getActualBiome(), pos);
|
||||
Biome bio = EndBiomes.getActualBiome(biome);
|
||||
array.be_setBiome(bio, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,12 +89,13 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
mapVoid.clearCache();
|
||||
}
|
||||
|
||||
EndBiome endBiome = null;
|
||||
if (GeneratorOptions.useNewGenerator()) {
|
||||
if (TerrainGenerator.isLand(biomeX, biomeZ)) {
|
||||
return mapLand.getBiome(biomeX << 2, biomeZ << 2).getActualBiome();
|
||||
endBiome = mapLand.getBiome(biomeX << 2, biomeZ << 2);
|
||||
}
|
||||
else {
|
||||
return mapVoid.getBiome(biomeX << 2, biomeZ << 2).getActualBiome();
|
||||
endBiome = mapVoid.getBiome(biomeX << 2, biomeZ << 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -104,9 +105,10 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
return barrens;
|
||||
}
|
||||
|
||||
EndBiome endBiome = height < -10F ? mapVoid.getBiome(biomeX << 2, biomeZ << 2) : mapLand.getBiome(biomeX << 2, biomeZ << 2);
|
||||
return endBiome.getActualBiome();
|
||||
endBiome = height < -10F ? mapVoid.getBiome(biomeX << 2, biomeZ << 2) : mapLand.getBiome(biomeX << 2, biomeZ << 2);
|
||||
}
|
||||
|
||||
return EndBiomes.getActualBiome(endBiome);
|
||||
}
|
||||
|
||||
public Biome getLandBiome(int biomeX, int biomeY, int biomeZ) {
|
||||
|
@ -124,7 +126,7 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
return this.centerBiome;
|
||||
}
|
||||
}
|
||||
return mapLand.getBiome(biomeX << 2, biomeZ << 2).getActualBiome();
|
||||
return EndBiomes.getActualBiome(mapLand.getBiome(biomeX << 2, biomeZ << 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue