use of io.xol.chunkstories.api.content.Asset in project chunkstories by Hugobros3.
the class ConfigurationImplementation method reload.
public void reload() {
options.clear();
Iterator<Asset> i = content.modsManager().getAllAssetsByExtension("options");
while (i.hasNext()) {
Asset f = i.next();
logger().debug("Reading options definitions in : " + f);
readOptionsDefinitions(f);
}
options.values().forEach(o -> System.out.println(o.getName()));
bake();
}
use of io.xol.chunkstories.api.content.Asset in project chunkstories by Hugobros3.
the class TexturesHandler method reloadAll.
public static void reloadAll() {
for (Texture2DGL texture : loadedTextures.values()) {
if (texture instanceof Texture2DAsset) {
Asset newAsset = Client.getInstance().getContent().getAsset(((Texture2DAsset) texture).getName());
if (newAsset != null) {
((Texture2DAsset) texture).setAsset(newAsset);
((Texture2DAsset) texture).loadTextureFromAsset();
} else // If the asset is no longer avaible, don't update the texture and delete it
{
texture.destroy();
loadedTextures.remove(((Texture2DAsset) texture).getName());
}
} else if (texture instanceof Texture2DFile) {
((Texture2DFile) texture).loadTextureFromFile();
}
}
for (CubemapGL cubemap : loadedCubemaps.values()) {
cubemap.loadCubemapFromDisk();
// Asset newAsset = Mods.getAsset(cubemap.getName());
// cubemap.setAsset(newAsset);
}
}
use of io.xol.chunkstories.api.content.Asset in project chunkstories by Hugobros3.
the class ModsManagerImplementation method getAllAssetsByPrefix.
@Override
public Iterator<Asset> getAllAssetsByPrefix(String prefix) {
return new Iterator<Asset>() {
Iterator<ModsAssetHierarchy> base = avaibleAssets.values().iterator();
Asset next = null;
@Override
public boolean hasNext() {
if (next != null)
return true;
// If next == null, try to set it
while (base.hasNext()) {
AssetHierarchy entry = base.next();
if (entry.getName().startsWith(prefix)) {
next = entry.topInstance();
break;
}
}
// Did we suceed etc
return next != null;
}
@Override
public Asset next() {
// Try loading
if (next == null)
hasNext();
// Null out reference and return it
Asset ret = next;
next = null;
return ret;
}
};
}
use of io.xol.chunkstories.api.content.Asset in project chunkstories by Hugobros3.
the class ModsManagerImplementation method getAllAssetsByExtension.
@Override
public Iterator<Asset> getAllAssetsByExtension(String extension) {
return new Iterator<Asset>() {
Iterator<ModsAssetHierarchy> base = avaibleAssets.values().iterator();
Asset next = null;
@Override
public boolean hasNext() {
if (next != null)
return true;
// If next == null, try to set it
while (base.hasNext()) {
AssetHierarchy entry = base.next();
if (entry.getName().endsWith(extension)) {
next = entry.topInstance();
break;
}
}
// Did we suceed etc
return next != null;
}
@Override
public Asset next() {
// Try loading
if (next == null)
hasNext();
// Null out reference and return it
Asset ret = next;
next = null;
return ret;
}
};
}
use of io.xol.chunkstories.api.content.Asset in project chunkstories by Hugobros3.
the class EntityDefinitionsStore method reload.
public void reload() {
// EntityDefinitionsById.clear();
EntityDefinitionsByName.clear();
Iterator<Asset> i = content.modsManager().getAllAssetsByExtension("entities");
while (i.hasNext()) {
Asset f = i.next();
readEntitiesDefinitions(f);
}
// this.entityComponents.reload();
}
Aggregations