[Fix] Crash when a second world is loaded
This commit is contained in:
parent
4259c704a2
commit
a2956a4cba
2 changed files with 39 additions and 24 deletions
|
@ -1210,6 +1210,7 @@ public class EndFeatures {
|
|||
}
|
||||
|
||||
public static void addBiomeFeatures(ResourceLocation id, Holder<Biome> biome) {
|
||||
if (!BetterEnd.MOD_ID.equals(id.getNamespace())) {
|
||||
BiomeAPI.addBiomeFeature(biome, FLAVOLITE_LAYER);
|
||||
BiomeAPI.addBiomeFeature(biome, THALLASIUM_ORE);
|
||||
BiomeAPI.addBiomeFeature(biome, ENDER_ORE);
|
||||
|
@ -1221,10 +1222,6 @@ public class EndFeatures {
|
|||
BiomeAPI.addBiomeFeature(biome, feature);
|
||||
}
|
||||
|
||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasCaves = bclbiome.getCustomData("has_caves", true) && !(bclbiome instanceof EndCaveBiome);
|
||||
//TODO: 1.19 Test Cave generation
|
||||
if (hasCaves && !BiomeAPI.wasRegisteredAsEndVoidBiome(id) /*!BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(id)*/) {
|
||||
|
@ -1234,10 +1231,19 @@ public class EndFeatures {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static BCLFeature<BuildingListFeature, BuildingListFeatureConfig> getBiomeStructures(BCLBiome biome) {
|
||||
String ns = biome.getID().getNamespace();
|
||||
String nm = biome.getID().getPath();
|
||||
return getBiomeStructures(biome.getID());
|
||||
}
|
||||
|
||||
private static BCLFeature<BuildingListFeature, BuildingListFeatureConfig> getBiomeStructures(ResourceLocation loc) {
|
||||
String ns = loc.getNamespace();
|
||||
String nm = loc.getPath();
|
||||
return getBiomeStructures(ns, nm);
|
||||
}
|
||||
|
||||
private static BCLFeature<BuildingListFeature, BuildingListFeatureConfig> getBiomeStructures(String ns, String nm) {
|
||||
ResourceLocation id = new ResourceLocation(ns, nm + "_structures");
|
||||
|
||||
if (BuiltinRegistries.PLACED_FEATURE.containsKey(id)) {
|
||||
|
@ -1282,12 +1288,21 @@ public class EndFeatures {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static BCLBiomeBuilder addDefaultFeatures(BCLBiomeBuilder builder, boolean hasCaves) {
|
||||
public static BCLBiomeBuilder addDefaultFeatures(
|
||||
ResourceLocation biomeID,
|
||||
BCLBiomeBuilder builder,
|
||||
boolean hasCaves
|
||||
) {
|
||||
builder.feature(FLAVOLITE_LAYER);
|
||||
builder.feature(THALLASIUM_ORE);
|
||||
builder.feature(ENDER_ORE);
|
||||
builder.feature(CRASHED_SHIP);
|
||||
|
||||
BCLFeature<BuildingListFeature, BuildingListFeatureConfig> feature = getBiomeStructures(biomeID);
|
||||
if (feature != null) {
|
||||
builder.feature(feature);
|
||||
}
|
||||
|
||||
if (hasCaves) {
|
||||
builder.feature(ROUND_CAVE);
|
||||
builder.feature(TUNEL_CAVE);
|
||||
|
|
|
@ -117,7 +117,7 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
.surface(biomeConfig.surfaceMaterial().surface().build());
|
||||
|
||||
biomeConfig.addCustomBuildData(builder);
|
||||
EndFeatures.addDefaultFeatures(builder, biomeConfig.hasCaves());
|
||||
EndFeatures.addDefaultFeatures(biomeConfig.ID, builder, biomeConfig.hasCaves());
|
||||
|
||||
|
||||
EndBiome biome = builder.build(biomeConfig.getSupplier());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue