more metapack work

This commit is contained in:
Zoë Gidiere
2023-12-12 13:35:46 -07:00
parent c86faa44ec
commit db1e924246
5 changed files with 33 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ import com.dfsek.tectonic.api.exception.LoadException;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.sound.BiomeAdditionsSound;
import net.minecraft.sound.BiomeMoodSound;
@@ -27,6 +28,7 @@ import net.minecraft.world.gen.WorldPreset;
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.function.BiConsumer;
@@ -61,9 +63,17 @@ public abstract class ModPlatform extends AbstractPlatform {
public abstract MinecraftServer getServer();
public void registerWorldTypes(BiConsumer<Identifier, WorldPreset> registerFunction) {
HashSet<String> configPacksInMetaPack = new HashSet<>();
getRawMetaConfigRegistry().forEach(pack -> {
PresetUtil.createMetaPackPreset(pack, this).apply(registerFunction);
pack.packs().forEach((k, v) -> configPacksInMetaPack.add(v.getID()));
});
getRawConfigRegistry()
.forEach(pack -> PresetUtil.createDefault(pack, this).apply(registerFunction));
getRawMetaConfigRegistry().forEach(pack -> PresetUtil.createMetaPackPreset(pack, this).apply(registerFunction));
.forEach(pack -> {
if (!configPacksInMetaPack.contains(pack.getID())) {
PresetUtil.createDefault(pack, this).apply(registerFunction);
}
});
}
@Override

View File

@@ -10,7 +10,6 @@
"access.StructureAccessorAccessor",
"access.VillagerTypeAccessor",
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
"fix.NetherFossilOptimization",
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
"implementations.terra.BiomeMixin",
"implementations.terra.HandleImplementationMixin",

View File

@@ -35,12 +35,6 @@ public final class BiomeUtil {
pack.getCheckedRegistry(Biome.class)
.forEach((id, biome) -> registerBiome(biome, pack, id, biomeRegistry));
});
CommonPlatform.get().getMetaConfigRegistry().forEach(metaPack -> { // Register all Terra biomes.
metaPack.packs().forEach((k, pack) -> {
pack.getCheckedRegistry(Biome.class)
.forEach((id, biome) -> registerBiome(biome, pack, id, biomeRegistry));
});
});
logger.info("Terra biomes registered.");
}