convert a bunch of stuff to new APIs

This commit is contained in:
dfsek
2025-12-29 21:11:11 -07:00
parent 16705057e0
commit 9a16336f53
29 changed files with 167 additions and 87 deletions

View File

@@ -42,7 +42,7 @@ public class AllayPlatform extends AbstractPlatform {
boolean succeed = loadConfigPacks();
GENERATOR_WRAPPERS.forEach(wrapper -> {
getConfigRegistry().get(wrapper.getConfigPack().getRegistryKey()).ifPresent(pack -> {
getConfigRegistry().get(wrapper.getConfigPack().getRegistryKey()).consume(pack -> {
wrapper.setConfigPack(pack);
var dimension = wrapper.getAllayWorldGenerator().getDimension();
TerraAllayPlugin.instance.getPluginLogger().info(

View File

@@ -1,5 +1,7 @@
package com.dfsek.terra.allay.generator;
import com.dfsek.terra.api.util.function.FunctionUtils;
import com.google.common.base.Preconditions;
import org.allaymc.api.utils.AllayStringUtils;
import org.allaymc.api.world.biome.BiomeType;
@@ -24,6 +26,8 @@ import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage;
import com.dfsek.terra.api.world.chunk.generation.util.GeneratorWrapper;
import com.dfsek.terra.api.world.info.WorldProperties;
import java.util.function.Function;
/**
* @author daoge_cmd
@@ -91,14 +95,16 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
return TerraAllayPlugin.platform
.getConfigRegistry()
.getByID(packId)
.orElseThrow(() -> new IllegalArgumentException("Cant find terra config pack named " + packId));
.collectThrow(
left -> new IllegalArgumentException("Cant find terra config pack named " + packId + ": " + left));
}
protected static ConfigPack getConfigPackByMeta(String metaPackId, DimensionInfo dimensionInfo) {
return TerraAllayPlugin.platform
.getMetaConfigRegistry()
.getByID(metaPackId)
.orElseThrow(() -> new IllegalArgumentException("Cant find terra meta pack named " + metaPackId))
.collectThrow(
left -> new IllegalArgumentException("Cant find terra meta pack named " + metaPackId + ": " + left))
.packs()
.get(Mapping.dimensionIdBeToJe(dimensionInfo.toString()));
}