Search in sources :

Example 1 with PathModule

use of org.terasology.module.PathModule in project Terasology by MovingBlocks.

the class AbstractEditorScreen method getPath.

protected Path getPath(AssetDataFile source) {
    List<String> path = source.getPath();
    Name moduleName = new Name(path.get(0));
    if (moduleManager.getEnvironment().get(moduleName) instanceof PathModule) {
        path.add(source.getFilename());
        String[] pathArray = path.toArray(new String[path.size()]);
        // Copy all the elements after the first to a separate array for getPath().
        String first = pathArray[0];
        String[] more = Arrays.copyOfRange(pathArray, 1, pathArray.length);
        return moduleManager.getEnvironment().getFileSystem().getPath(first, more);
    }
    return null;
}
Also used : PathModule(org.terasology.module.PathModule) Name(org.terasology.naming.Name)

Aggregations

PathModule (org.terasology.module.PathModule)1 Name (org.terasology.naming.Name)1