Package org.bukkit.material

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


       
        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

        }

        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

    @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

    @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

        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

    }

    @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

    @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

        }

        super.placeBlock(player, state, face, holding, clickedLoc);

        if (face == BlockFace.DOWN || (face != BlockFace.UP && clickedLoc.getY() >= 8.0D)) {
            MaterialData data = state.getData();
            if ((data instanceof Step)) {
                ((Step) data).setInverted(true);
            } else if ((data instanceof WoodenStep)) {
                ((WoodenStep) data).setInverted(true);
            }
View Full Code Here

    }

    @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 Torch) {
            ((Torch) data).setFacingDirection(face);
        } else {
            warnMaterialData(Torch.class, data);
        }
View Full Code Here

TOP

Related Classes of org.bukkit.material.MaterialData

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.