mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-17 22:00:08 +00:00
refactor createBlockState to use new error API
This commit is contained in:
@@ -24,6 +24,8 @@ import com.dfsek.tectonic.api.TypeRegistry;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.block.BlockType;
|
||||
@@ -61,9 +63,9 @@ public class GenericLoaders implements LoaderRegistrar {
|
||||
if(platform != null) {
|
||||
registry.registerLoader(BaseAddon.class, platform.getAddons())
|
||||
.registerLoader(BlockType.class, (type, object, configLoader, depthTracker) -> platform
|
||||
.getWorldHandle().createBlockState((String) object).blockType())
|
||||
.getWorldHandle().createBlockState((String) object).collectThrow(left -> new LoadException(left.message(), depthTracker)).blockType())
|
||||
.registerLoader(BlockState.class, (type, object, configLoader, depthTracker) -> platform
|
||||
.getWorldHandle().createBlockState((String) object));
|
||||
.getWorldHandle().createBlockState((String) object).collectThrow(left -> new LoadException("Invalid BlockState \"" + object + "\": " + left.message(), depthTracker)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user