mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-17 18:12:43 +00:00
Populate packs in a metapack under extended
This commit is contained in:
parent
1912d8e34c
commit
3d66386f99
@ -62,14 +62,12 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
public void registerWorldTypes(BiConsumer<Identifier, WorldPreset> registerFunction) {
|
||||
HashSet<String> configPacksInMetaPack = new HashSet<>();
|
||||
getRawMetaConfigRegistry().forEach(pack -> {
|
||||
PresetUtil.createMetaPackPreset(pack, this).apply(registerFunction);
|
||||
PresetUtil.createMetaPackPreset(pack, this, false).apply(registerFunction);
|
||||
pack.packs().forEach((k, v) -> configPacksInMetaPack.add(v.getID()));
|
||||
});
|
||||
getRawConfigRegistry()
|
||||
.forEach(pack -> {
|
||||
if(!configPacksInMetaPack.contains(pack.getID())) {
|
||||
PresetUtil.createDefault(pack, this).apply(registerFunction);
|
||||
}
|
||||
PresetUtil.createDefault(pack, this, configPacksInMetaPack.contains(pack.getID())).apply(registerFunction);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,9 @@ import com.dfsek.terra.mod.generation.TerraBiomeSource;
|
||||
|
||||
public class PresetUtil {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PresetUtil.class);
|
||||
private static final List<Identifier> PRESETS = new ArrayList<>();
|
||||
private static final List<Pair<Identifier, Boolean>> PRESETS = new ArrayList<>();
|
||||
|
||||
public static Pair<Identifier, WorldPreset> createDefault(ConfigPack pack, ModPlatform platform) {
|
||||
public static Pair<Identifier, WorldPreset> createDefault(ConfigPack pack, ModPlatform platform, boolean extended) {
|
||||
Registry<DimensionType> dimensionTypeRegistry = platform.dimensionTypeRegistry();
|
||||
Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry = platform.chunkGeneratorSettingsRegistry();
|
||||
Registry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterLists =
|
||||
@ -51,7 +51,7 @@ public class PresetUtil {
|
||||
"terra:" + pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase(
|
||||
Locale.ROOT));
|
||||
|
||||
PRESETS.add(generatorID);
|
||||
PRESETS.add(Pair.of(generatorID, extended));
|
||||
|
||||
HashMap<RegistryKey<DimensionOptions>, DimensionOptions> dimensionMap = new HashMap<>();
|
||||
|
||||
@ -65,7 +65,7 @@ public class PresetUtil {
|
||||
return Pair.of(generatorID, preset);
|
||||
}
|
||||
|
||||
public static Pair<Identifier, WorldPreset> createMetaPackPreset(MetaPack metaPack, ModPlatform platform) {
|
||||
public static Pair<Identifier, WorldPreset> createMetaPackPreset(MetaPack metaPack, ModPlatform platform, boolean extended) {
|
||||
Registry<DimensionType> dimensionTypeRegistry = platform.dimensionTypeRegistry();
|
||||
Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry = platform.chunkGeneratorSettingsRegistry();
|
||||
Registry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterLists =
|
||||
@ -75,7 +75,7 @@ public class PresetUtil {
|
||||
metaPack.getID().toLowerCase(Locale.ROOT) + "/" + metaPack.getNamespace().toLowerCase(
|
||||
Locale.ROOT));
|
||||
|
||||
PRESETS.add(generatorID);
|
||||
PRESETS.add(Pair.of(generatorID, extended));
|
||||
|
||||
HashMap<RegistryKey<DimensionOptions>, DimensionOptions> dimensionMap = new HashMap<>();
|
||||
|
||||
@ -187,7 +187,7 @@ public class PresetUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Identifier> getPresets() {
|
||||
public static List<Pair<Identifier, Boolean>> getPresets() {
|
||||
return PRESETS;
|
||||
}
|
||||
}
|
||||
|
@ -36,16 +36,20 @@ public final class TagUtil {
|
||||
|
||||
PresetUtil
|
||||
.getPresets()
|
||||
.forEach(id -> MinecraftUtil
|
||||
.getEntry(registry, id)
|
||||
.forEach(pair -> MinecraftUtil
|
||||
.getEntry(registry, pair.getLeft())
|
||||
.ifPresentOrElse(
|
||||
preset -> collect
|
||||
.computeIfAbsent(WorldPresetTags.NORMAL, tag -> new ArrayList<>())
|
||||
.add(preset),
|
||||
() -> logger.error("Preset {} does not exist!", id)));
|
||||
preset -> {
|
||||
boolean useExtendedTag = pair.getRight(); // Get the boolean value from the pair
|
||||
collect
|
||||
.computeIfAbsent(useExtendedTag ? WorldPresetTags.EXTENDED : WorldPresetTags.NORMAL, tag -> new ArrayList<>())
|
||||
.add(preset);
|
||||
},
|
||||
() -> logger.error("Preset {} does not exist!", pair.getLeft())));
|
||||
|
||||
registry.startTagReload(new RegistryTags<>(registry.getKey(), collect)).apply();
|
||||
|
||||
|
||||
if(logger.isDebugEnabled()) {
|
||||
registry.streamEntries()
|
||||
.map(e -> e.registryKey().getValue() + ": " +
|
||||
|
Loading…
x
Reference in New Issue
Block a user