Package org.bukkit.material

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 Button)) {
            warnMaterialData(Button.class, data);
            return;
        }
View Full Code Here


                    int itemID = profile.getInt(temp + ".item.id");
                    int amount = profile.getInt(temp + ".item.amount");
                    if (itemID != 0 && amount > 0) {
                        ItemStack item = null;
                        item = new ItemStack(itemID, amount);
                        item.setData(new MaterialData(itemID, (byte) profile.getInt(temp + ".item.data")));
                        questProgress.setLastItem(item);
                    }
                    if (profile.pathExists(temp + ".location")) {
                        questProgress.setLastLocation(LocationUtils.loadLocation(profile, temp, true));
                    }
View Full Code Here

      } else {
        p.destdisplayname = lines[3];
      }
      // Set portal locatiol using sign location and orientation
      p.location = signblock.getLocation();
      MaterialData data = signblock.getState().getData();
      float yaw = 0;
      if (data instanceof Directional) {
        yaw = FaceUtil.faceToYaw(((Directional) data).getFacing()) + 90;
      }
      p.location.setYaw(yaw);
View Full Code Here

  @Override
  public final void setBlock(int x, int y, int z, Material material) {
    if (doClearData) {
      BlockState state = getActualBlock(x, y, z).getState();
      state.setType(material);
      state.setData(new MaterialData(material));
      state.update(true, doPhysics);
    } else
      getActualBlock(x, y, z).setType(material);
  }
View Full Code Here

  }
 
  private void setBlockTypeAndColor(int x, int y, int z, Material material, DyeColor color) {
    BlockState state = getActualBlock(x, y, z).getState();
    state.setType(material);
    MaterialData data = state.getData();
    if (data instanceof Colorable)
      ((Colorable)state.getData()).setColor(color);
    else
      BlackMagic.setBlockStateColor(state, color); //BUKKIT: none of the newly colorable blocks materials are colorable
    state.update(true, doPhysics);
View Full Code Here

  }
 
  private void setBlockIfTypeThenColor(int x, int y, int z, Material material, DyeColor color) {
    BlockState state = getActualBlock(x, y, z).getState();
    if (state.getType() == material) {
      MaterialData data = state.getData();
      if (data instanceof Colorable)
        ((Colorable)state.getData()).setColor(color);
      else
        BlackMagic.setBlockStateColor(state, color); //BUKKIT: none of the newly colorable blocks materials are colorable
      state.update(true, doPhysics);
View Full Code Here

  }
 
  public void setBlockTypeAndDirection(int x, int y, int z, Material material, BlockFace facing) {
    BlockState state = getActualBlock(x, y, z).getState();
    state.setType(material);
    MaterialData data = state.getData();
    if (data instanceof Directional)
      ((Directional)state.getData()).setFacingDirection(facing);
    state.update(true, doPhysics);
  }
View Full Code Here

  }
 
  public void setBlockTypeAndTexture(int x, int y, int z, Material material, Material texture) {
    BlockState state = getActualBlock(x, y, z).getState();
    state.setType(material);
    MaterialData data = state.getData();
    if (data instanceof TexturedMaterial)
      ((TexturedMaterial)state.getData()).setMaterial(texture);
    state.update(true, doPhysics);
  }
View Full Code Here

    if (!event.getBlock().isLiquid()) return;

    Location loc = event.getToBlock().getLocation();
    BlockState from = event.getBlock().getState();
    BlockState to = event.getToBlock().getState();
    MaterialData data = from.getData();

    //Lava
    if (from.getTypeId() == 10 || from.getTypeId() == 11) {

      //Flowing into a normal block
      if (fluidBlocks.contains(to.getTypeId())) {
        data.setData((byte)(from.getRawData() + 1));
        from.setData(data);
      }

      //Flowing into water
      else if (to.getTypeId() == 8 || to.getTypeId() == 9) {
        from.setTypeId(event.getFace() == BlockFace.DOWN?10:4);
        data.setData((byte)0);
        from.setData(data);
      }
      DataManager.addEntry(new BlockChangeEntry("Environment", DataType.LAVA_FLOW, loc, to, from));

    }

    //Water
    else if (from.getTypeId() == 8 || from.getTypeId() == 9) {

      //Normal block
      if (fluidBlocks.contains(to.getTypeId())) {
        data.setData((byte)(from.getRawData() + 1));
        from.setData(data);
        DataManager.addEntry(new BlockChangeEntry("Environment", DataType.WATER_FLOW, loc, to, from));
      }

      //If we are flowing over lava, cobble or obsidian will form
View Full Code Here

   */
  public static ItemStack itemStringToStack(String item, Integer amount) {
    String[] itemArr = item.split(":");
    ItemStack stack = new ItemStack(Integer.parseInt(itemArr[0]), amount);
    if (itemArr.length > 1)
      stack.setData(new MaterialData(Integer.parseInt(itemArr[0]), Byte.parseByte(itemArr[1])));
    return stack;
  }
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.