Search in sources :

Example 6 with AssetRepository

use of org.lanternpowered.server.asset.AssetRepository in project LanternServer by LanternPowered.

the class LanternScriptGameRegistry method construct.

public <T extends CatalogType> T construct(Object plugin, String asset, String id, Class<T> objectType) {
    final AssetRepository assetRepository = Lantern.getAssetRepository();
    final Asset theAsset = assetRepository.get(plugin, asset).orElseThrow(() -> new IllegalArgumentException("There is no asset with the specified id: " + asset));
    return construct(theAsset, id, objectType);
}
Also used : AssetRepository(org.lanternpowered.server.asset.AssetRepository) Asset(org.spongepowered.api.asset.Asset)

Aggregations

AssetRepository (org.lanternpowered.server.asset.AssetRepository)6 Asset (org.spongepowered.api.asset.Asset)4 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 JsonArray (com.google.gson.JsonArray)1 JsonDeserializationContext (com.google.gson.JsonDeserializationContext)1 JsonDeserializer (com.google.gson.JsonDeserializer)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 JsonParseException (com.google.gson.JsonParseException)1 IOException (java.io.IOException)1 Type (java.lang.reflect.Type)1 URL (java.net.URL)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Locale (java.util.Locale)1 Consumer (java.util.function.Consumer)1 LanternClassLoader (org.lanternpowered.launch.LanternClassLoader)1 ClassLoaderAssetRepository (org.lanternpowered.server.asset.ClassLoaderAssetRepository)1 DirectoryAssetRepository (org.lanternpowered.server.asset.DirectoryAssetRepository)1