Make sure all Biomes are merged
This commit is contained in:
parent
080541345c
commit
4732aa7ff8
2 changed files with 35 additions and 11 deletions
|
@ -140,7 +140,8 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
}
|
}
|
||||||
final BCLBiome bclBiome;
|
final BCLBiome bclBiome;
|
||||||
if (!BiomeAPI.hasBiome(biomeID)) {
|
if (!BiomeAPI.hasBiome(biomeID)) {
|
||||||
bclBiome = new BCLBiome(biomeID, biome.value());
|
bclBiome = new BCLBiome(biomeID, biome.value(), BiomeAPI.BiomeType.END_LAND);
|
||||||
|
BiomeAPI.registerBiome(bclBiome);
|
||||||
} else {
|
} else {
|
||||||
bclBiome = BiomeAPI.getBiome(biomeID);
|
bclBiome = BiomeAPI.getBiome(biomeID);
|
||||||
}
|
}
|
||||||
|
@ -232,11 +233,20 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BCLBiomeSource cloneForDatapack(Set<Holder<Biome>> datapackBiomes) {
|
protected BCLBiomeSource cloneForDatapack(Set<Holder<Biome>> datapackBiomes) {
|
||||||
datapackBiomes.addAll(getBclBiomes(this.biomeRegistry));
|
datapackBiomes.addAll(getNonVanillaBiomes(this.biomeRegistry));
|
||||||
|
datapackBiomes.addAll(possibleBiomes().stream()
|
||||||
|
.filter(h -> !h.unwrapKey()
|
||||||
|
.orElseThrow()
|
||||||
|
.location()
|
||||||
|
.getNamespace()
|
||||||
|
.equals("minecraft"))
|
||||||
|
.toList());
|
||||||
|
|
||||||
return new BCLibEndBiomeSource(
|
return new BCLibEndBiomeSource(
|
||||||
this.biomeRegistry,
|
this.biomeRegistry,
|
||||||
datapackBiomes.stream()
|
datapackBiomes.stream()
|
||||||
.filter(b -> b.unwrapKey().orElse(null) != BCLBiomeRegistry.EMPTY_BIOME.getBiomeKey())
|
.filter(b -> b.isValidInRegistry(biomeRegistry) && b.unwrapKey()
|
||||||
|
.orElse(null) != BCLBiomeRegistry.EMPTY_BIOME.getBiomeKey())
|
||||||
.toList(),
|
.toList(),
|
||||||
this.currentSeed,
|
this.currentSeed,
|
||||||
this.config,
|
this.config,
|
||||||
|
@ -244,7 +254,7 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Holder<Biome>> getBclBiomes(Registry<Biome> biomeRegistry) {
|
private static List<Holder<Biome>> getNonVanillaBiomes(Registry<Biome> biomeRegistry) {
|
||||||
return getBiomes(
|
return getBiomes(
|
||||||
biomeRegistry,
|
biomeRegistry,
|
||||||
Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END),
|
Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END),
|
||||||
|
@ -272,13 +282,15 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidNonVanillaEndBiome(Holder<Biome> biome, ResourceLocation location) {
|
private static boolean isValidNonVanillaEndBiome(Holder<Biome> biome, ResourceLocation location) {
|
||||||
if (BiomeAPI.wasRegisteredAs(location, BiomeAPI.BiomeType.END_IGNORE)) return false;
|
if (BiomeAPI.wasRegisteredAs(location, BiomeAPI.BiomeType.END_IGNORE) || biome.unwrapKey()
|
||||||
|
.orElseThrow()
|
||||||
|
.location()
|
||||||
|
.getNamespace()
|
||||||
|
.equals("minecraft"))
|
||||||
|
return false;
|
||||||
|
|
||||||
return biome.is(BiomeTags.IS_END) ||
|
return biome.is(BiomeTags.IS_END) ||
|
||||||
BiomeAPI.wasRegisteredAs(location, BiomeAPI.BiomeType.BCL_END_LAND) ||
|
BiomeAPI.wasRegisteredAsEndBiome(location) ||
|
||||||
BiomeAPI.wasRegisteredAs(location, BiomeAPI.BiomeType.BCL_END_VOID) ||
|
|
||||||
BiomeAPI.wasRegisteredAs(location, BiomeAPI.BiomeType.BCL_END_CENTER) ||
|
|
||||||
BiomeAPI.wasRegisteredAs(location, BiomeAPI.BiomeType.BCL_END_BARRENS) ||
|
|
||||||
TheEndBiomesHelper.canGenerateInEnd(biome.unwrapKey().orElse(null));
|
TheEndBiomesHelper.canGenerateInEnd(biome.unwrapKey().orElse(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Optional;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,9 +243,20 @@ public class BCLBiome extends BCLBiomeSettings implements BiomeData {
|
||||||
* @param biomeID Teh ResoureLocation for this Biome
|
* @param biomeID Teh ResoureLocation for this Biome
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true)
|
||||||
//this constructor should become package private and not get removed
|
|
||||||
public BCLBiome(ResourceLocation biomeID, Biome biomeToRegister) {
|
public BCLBiome(ResourceLocation biomeID, Biome biomeToRegister) {
|
||||||
this(biomeID, biomeToRegister, null);
|
this(biomeID, biomeToRegister, (BCLBiomeSettings) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create wrapper for existing biome using biome instance from {@link BuiltinRegistries}.
|
||||||
|
*
|
||||||
|
* @param biomeToRegister {@link Biome} to wrap.
|
||||||
|
* @param biomeID Teh ResoureLocation for this Biome
|
||||||
|
*/
|
||||||
|
@ApiStatus.Internal
|
||||||
|
public BCLBiome(ResourceLocation biomeID, Biome biomeToRegister, BiomeAPI.BiomeType type) {
|
||||||
|
this(biomeID, biomeToRegister, (BCLBiomeSettings) null);
|
||||||
|
setIntendedType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue