Handling for Datapack overrides (#20)

This commit is contained in:
Frank 2022-07-09 04:38:57 +02:00
parent 72e8d8ff0f
commit c56c15fc02
2 changed files with 12 additions and 9 deletions

View file

@ -57,7 +57,7 @@ public class LevelGenEvents {
//make sure we include Tags registered by the deprecated API
TagAPI.apply(directory, tagsMap);
if (directory.equals(TagManager.BIOMES.directory)) {
InternalBiomeAPI._runBiomeTagAdders();
}
@ -79,8 +79,6 @@ public class LevelGenEvents {
//We probably loaded a Datapack for the End
if (!(endStem.generator().getBiomeSource() instanceof BCLibEndBiomeSource)) {
if (currentPreset.isPresent()) {
if (currentPreset.get().value() instanceof TogetherWorldPreset worldPreset) {
ResourceKey worldPresetKey = currentPreset.get().unwrapKey().orElse(null);

View file

@ -245,13 +245,18 @@ public class WorldGenUtil {
ChunkGenerator referenceGenerator = dimensions.get(key);
if (referenceGenerator instanceof EnforceableChunkGenerator enforcer) {
// This list contains the vanilla default level stem (only available if a new world is loaded) as well as
// The currently loaded stem
var vanillaDimensionMap = WorldGenUtil.getDimensionsWithModData(net.minecraft.world.level.levelgen.presets.WorldPresets.NORMAL);
LevelStem vanillaDefaultStem = vanillaDimensionMap.get(key);
if (vanillaDefaultStem != null) {
loadedStem = vanillaDefaultStem;
// probably not a datapack, so we need to check what other mods would have
// added to the vanilla settings
if (loadedStem.generator() instanceof EnforceableChunkGenerator) {
// This list contains the vanilla default level stem (only available if a new world is loaded) as well as
// The currently loaded stem
var vanillaDimensionMap = WorldGenUtil.getDimensionsWithModData(net.minecraft.world.level.levelgen.presets.WorldPresets.NORMAL);
LevelStem vanillaDefaultStem = vanillaDimensionMap.get(key);
if (vanillaDefaultStem != null) {
loadedStem = vanillaDefaultStem;
}
}