Package org.terasology.asset

Examples of org.terasology.asset.AssetUri


        elementsLookup.put(uri, new HUDElement(widget, region));
        return widget;
    }

    public ControlWidget getHUDElement(String uri) {
        return getHUDElement(new AssetUri(AssetType.UI_ELEMENT, uri));
    }
View Full Code Here


        }
        return null;
    }

    public <T extends ControlWidget> T getHUDElement(String uri, Class<T> type) {
        return getHUDElement(new AssetUri(AssetType.UI_ELEMENT, uri), type);
    }
View Full Code Here

        popup.startOperation(operation, true);
    }

    private Texture createTexture(int width, int height, ByteBuffer buf) {
        ByteBuffer[] data = new ByteBuffer[]{buf};
        AssetUri uri = new AssetUri(AssetType.TEXTURE, "engine:terrainPreview");
        TextureData texData = new TextureData(width, height, data, Texture.WrapMode.CLAMP, Texture.FilterMode.LINEAR);

        return Assets.generateAsset(uri, texData, Texture.class);
    }
View Full Code Here

        // TODO: This should be elsewhere
        // Create gelatinousCubeMesh
        Tessellator tessellator = new Tessellator();
        TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1.0f, 1.0f, 1.0f, 1.0f), 0.8f, 0.8f, 0.6f, 0f, 0f, 0f);
        TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1.0f, 1.0f, 1.0f, 0.6f), 1.0f, 1.0f, 0.8f, 0f, 0f, 0f);
        tessellator.generateMesh(new AssetUri(AssetType.MESH, TerasologyConstants.ENGINE_MODULE, "gelatinousCube"));
        return true;
    }
View Full Code Here

        this(new Name(moduleName), new Name(familyName), new Name(shapeModuleName), new Name(shapeName));
    }

    public BlockUri(Name moduleName, Name familyName, Name shapeModuleName, Name shapeName) {
        this(moduleName, familyName);
        this.shape = new AssetUri(AssetType.SHAPE, shapeModuleName, shapeName);
    }
View Full Code Here

        if (split.length == 4) {
            familyName = new Name(split[1]);
            String shapeModuleName = split[2];
            split = split[3].split(IDENTIFIER_SEPARATOR_REGEX, 2);
            if (split.length > 1) {
                shape = new AssetUri(AssetType.SHAPE, shapeModuleName, split[0]);
                blockIdentifier = new Name(split[1]);
            } else if (split.length == 1) {
                shape = new AssetUri(AssetType.SHAPE, shapeModuleName, split[0]);
            }
        } else if (split.length == 2) {
            split = split[1].split(IDENTIFIER_SEPARATOR_REGEX, 2);
            if (split.length > 1) {
                familyName = new Name(split[0]);
View Full Code Here

            super(node);
        }

        @Override
        public void onInitialize() {
            AssetUri uri = getNode().sound;
            if (uri != null) {
                StaticSound snd = assetManager.loadAsset(uri, StaticSound.class);
                if (snd != null) {
                    if (actor().hasLocation()) {
                        Vector3f worldPosition = actor().location().getWorldPosition();
View Full Code Here

    public BlockFamily loadWithShape(BlockUri uri) {
        try (ModuleContext.ContextSpan ignored = ModuleContext.setContext(uri.getModuleName())) {
            BlockShape shape = cubeShape;
            if (uri.hasShape()) {
                AssetUri shapeUri = uri.getShapeUri();
                if (!shapeUri.isValid()) {
                    return null;
                }
                shape = (BlockShape) Assets.get(shapeUri);
                if (shape == null) {
                    return null;
                }
            }
            AssetUri blockDefUri = new AssetUri(AssetType.BLOCK_DEFINITION, uri.getModuleName(), uri.getFamilyName());
            BlockDefinition def;
            if (assetManager.getAssetURLs(blockDefUri).isEmpty()) {
                // An auto-block
                def = new BlockDefinition();
            } else {
View Full Code Here

    }

    private JsonObject inheritData(AssetUri rootAssetUri, JsonObject blockDefJson) {
        JsonObject parentObj = blockDefJson;
        while (parentObj.has("basedOn")) {
            AssetUri parentUri = Assets.resolveAssetUri(AssetType.BLOCK_DEFINITION, parentObj.get("basedOn").getAsString());
            if (rootAssetUri.equals(parentUri)) {
                logger.error("Circular inheritance detected in {}", rootAssetUri);
                break;
            } else if (!parentUri.isValid()) {
                logger.error("{} based on invalid uri: {}", rootAssetUri, parentObj.get("basedOn").getAsString());
                break;
            }
            JsonObject parent = readJson(parentUri).getAsJsonObject();
            JsonMergeUtil.mergeOnto(parent, blockDefJson);
View Full Code Here

        return block;
    }

    private Map<BlockPart, AssetUri> prepareTiles(BlockDefinition blockDef, AssetUri uri) {
        AssetUri tileUri = getDefaultTile(blockDef, uri);

        Map<BlockPart, AssetUri> tileUris = Maps.newEnumMap(BlockPart.class);
        for (BlockPart part : BlockPart.values()) {
            tileUris.put(part, tileUri);
        }
View Full Code Here

TOP

Related Classes of org.terasology.asset.AssetUri

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.