refactor createBlockState to use new error API

This commit is contained in:
dfsek
2025-12-29 22:33:07 -07:00
parent cb08401536
commit c4a366112e
6 changed files with 28 additions and 7 deletions
@@ -1,6 +1,7 @@
package com.dfsek.terra.minestom;
import com.dfsek.tectonic.api.TypeRegistry;
import com.dfsek.tectonic.api.exception.LoadException;
import com.dfsek.tectonic.api.loader.type.TypeLoader;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.util.RGBLike;
@@ -81,7 +82,7 @@ public final class TerraMinestomPlatform extends AbstractPlatform {
.registerLoader(EntityType.class,
(TypeLoader<EntityType>) (annotatedType, o, configLoader, depthTracker) -> new MinestomEntityType((String) o))
.registerLoader(BlockState.class,
(TypeLoader<BlockState>) (annotatedType, o, configLoader, depthTracker) -> worldHandle.createBlockState((String) o))
(TypeLoader<BlockState>) (annotatedType, o, configLoader, depthTracker) -> worldHandle.createBlockState((String) o).collectThrow(left -> new LoadException("Invalid BlockState \"" + o + "\": " + left.message(), depthTracker)))
.registerLoader(BiomeEffects.Particle.class, BiomeParticleConfigTemplate::new)
.registerLoader(BiomeEffects.MoodSound.class, BiomeMoodSoundTemplate::new)
.registerLoader(BiomeEffects.AdditionsSound.class, BiomeAdditionsSoundTemplate::new)