Examples of MaterialData


Examples of org.bukkit.material.MaterialData

          }
          s.setAmount(stackSize + room);
          result -= room;
        }
      } else {
        MaterialData materialData = new MaterialData(material, data);
        ItemStack newone = materialData.toItemStack(curAmount);
        result -= curAmount;
        inventory.setItem(sI, newone);
      }
    }
    return result;
View Full Code Here

Examples of org.bukkit.material.MaterialData

       
        private ItemStack parseStack(int i, String[] dchunks) {
            ItemStack stack=new ItemStack(Integer.valueOf(dchunks[i]));
            stack.setAmount(Integer.valueOf(dchunks[i++]));
            stack.setDurability(Short.valueOf(dchunks[i++]));
            stack.setData(new MaterialData(Byte.valueOf(dchunks[i++])));
            return stack;
        }
View Full Code Here

Examples of org.bukkit.material.MaterialData

        }

        private ItemStack fixStack(ItemStack stack) {
            if(stack==null) {
                stack = new ItemStack(0);
                stack.setData(new MaterialData(0));
            }
           
            // If air, data, durability, and damage are always 0.
            if(stack.getType().equals(Material.AIR))
            {
                stack.setAmount(0);
                stack.setData(new MaterialData(0));
                stack.setDurability((byte)0);
            }
            return stack;
        }
View Full Code Here

Examples of org.bukkit.material.MaterialData

    @Override
    public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
        super.placeBlock(player, state, face, holding, clickedLoc);

        MaterialData data = state.getData();
        if (data instanceof Tree) {
            ((Tree) data).setDirection(face);
            ((Tree) data).setSpecies(TreeSpecies.getByData((byte) holding.getDurability()));
        } else {
            warnMaterialData(Tree.class, data);
View Full Code Here

Examples of org.bukkit.material.MaterialData

    @Override
    public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
        BlockFace direction = getOppositeBlockFace(player.getLocation(), false).getOppositeFace();
        if (state.getBlock().getRelative(direction).getType() == Material.AIR && state.getBlock().getRelative(direction).getRelative(BlockFace.DOWN).getType().isSolid()) {
            super.placeBlock(player, state, face, holding, clickedLoc);
            final MaterialData data = state.getData();
            if (data instanceof Bed) {
                ((Bed) data).setFacingDirection(direction);
                state.setData(data);
            } else {
                warnMaterialData(Bed.class, data);
View Full Code Here

Examples of org.bukkit.material.MaterialData

        if (block.getType() == Material.BED_BLOCK) {
            BlockFace direction = ((Bed) block.getState().getData()).getFacing();
            GlowBlock headBlock = block.getRelative(direction);
            headBlock.setType(Material.BED_BLOCK);
            GlowBlockState headBlockState = headBlock.getState();
            MaterialData data = headBlockState.getData();
            ((Bed) data).setHeadOfBed(true);
            ((Bed) data).setFacingDirection(direction);
            headBlockState.setData(data);
            headBlockState.update(true);
        }
View Full Code Here

Examples of org.bukkit.material.MaterialData

    }

    @Override
    public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
        super.placeBlock(player, state, face, holding, clickedLoc);
        final MaterialData data = state.getData();
        if (data instanceof Dispenser) {
            ((Dispenser) data).setFacingDirection(getOppositeBlockFace(player.getLocation(), true));
            state.setData(data);
        } else {
            warnMaterialData(Dispenser.class, data);
View Full Code Here

Examples of org.bukkit.material.MaterialData

    @Override
    public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) {
        super.placeBlock(player, state, face, holding, clickedLoc);

        MaterialData data = state.getData();
        if (data instanceof Vine) {
            if (face == BlockFace.DOWN || face == BlockFace.UP) {
                return;
            } else {
                ((Vine) data).putOnFace(face.getOppositeFace());
View Full Code Here

Examples of org.terasology.rendering.assets.material.MaterialData

    }

    @Command(shortDescription = "Reloads a material")
    public String reloadMaterial(@CommandParam("material") String material) {
        AssetUri uri = new AssetUri(AssetType.MATERIAL, material);
        MaterialData materialData = CoreRegistry.get(AssetManager.class).loadAssetData(uri, MaterialData.class);
        if (materialData != null) {
            CoreRegistry.get(AssetManager.class).generateAsset(uri, materialData);
            return "Success";
        } else {
            return "Unable to resolve material '" + material + "'";
View Full Code Here

Examples of org.terasology.rendering.assets.material.MaterialData

    private GLSLMaterial prepareAndStoreShaderProgramInstance(String title, ShaderParameters params) {
        String uri = "engine:" + title;
        Shader shader = Assets.getShader(uri);
        checkNotNull(shader, "Failed to resolve %s", uri);
        shader.recompile();
        GLSLMaterial material = Assets.generateAsset(new AssetUri(AssetType.MATERIAL, "engine:prog." + title), new MaterialData(shader), GLSLMaterial.class);
        material.setShaderParameters(params);

        return material;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.