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
@@ -95,7 +95,7 @@ public final class TerraMinestomPlatform extends AbstractPlatform {
MinecraftServer.getInstanceManager().getInstances().forEach(world -> {
if(world.generator() instanceof MinestomChunkGeneratorWrapper wrapper) {
getConfigRegistry().get(wrapper.getPack().getRegistryKey()).ifPresent(pack -> {
getConfigRegistry().get(wrapper.getPack().getRegistryKey()).consume(pack -> {
wrapper.setPack(pack);
LOGGER.info("Replaced pack in chunk generator for instance {}", world.getUuid());
});
@@ -39,14 +39,14 @@ public class TerraMinestomWorldBuilder {
}
public TerraMinestomWorldBuilder packById(String id) {
this.pack = platform.getConfigRegistry().getByID(id).orElseThrow();
this.pack = platform.getConfigRegistry().getByID(id).collectThrow(RuntimeException::new);
return this;
}
public TerraMinestomWorldBuilder packByMeta(String metaPack, RegistryKey<@NonNull DimensionType> dimensionType) {
this.pack = platform.getMetaConfigRegistry()
.getByID(metaPack)
.orElseThrow(() -> new RuntimeException("MetaPack " + metaPack + " could not be found"))
.collectThrow(left -> new RuntimeException("MetaPack " + metaPack + " could not be found: " + left))
.packs()
.get(dimensionType.key().asString());
return this;