Package org.bukkit.material

Examples of org.bukkit.material.MaterialData


      } else if (type.equalsIgnoreCase("charged")){
        Creeper creep = (Creeper) entity1;
        creep.setPowered(true);
      } else if (toSpawn == EntityType.ENDERMAN && ClosestMatches.material(type).size() > 0){
        Enderman enderman = (Enderman) entity1;
        enderman.setCarriedMaterial(new MaterialData(ClosestMatches.material(type).get(0)));
      } else if (toSpawn == EntityType.VILLAGER && ClosestMatches.villagerProfessions(type).size() > 0){
        Villager villager = (Villager) entity1;
        villager.setProfession(ClosestMatches.villagerProfessions(type).get(0));
      } else if (type.startsWith("item:") && toSpawn == EntityType.DROPPED_ITEM){
View Full Code Here


          } else if (type.equalsIgnoreCase("saddle")){
            Pig pig = (Pig) entity1;
            pig.setSaddle(true);
          } else if (toSpawn == EntityType.ENDERMAN && ClosestMatches.material(type).size() > 0){
            Enderman enderman = (Enderman) entity1;
            enderman.setCarriedMaterial(new MaterialData(ClosestMatches.material(type).get(0)));
          } else if (toSpawn == EntityType.VILLAGER && ClosestMatches.villagerProfessions(type).size() > 0){
            Villager villager = (Villager) entity1;
            villager.setProfession(ClosestMatches.villagerProfessions(type).get(0));
          } else if (type.startsWith("item:") && toSpawn == EntityType.DROPPED_ITEM){
View Full Code Here

    this.ownerTeam = null;
    int x = this.location.getBlockX();
    int y = this.location.getBlockY();
    int z = this.location.getBlockZ();
    final Material main = this.warzone.getWarzoneMaterials().getMainBlock().getType();
    final MaterialData mainData = this.warzone.getWarzoneMaterials().getMainBlock().getData();
    final Material light = this.warzone.getWarzoneMaterials().getLightBlock().getType();
    final MaterialData lightData = this.warzone.getWarzoneMaterials().getLightBlock().getData();

    // center
    BlockState current = this.warzone.getWorld().getBlockAt(x, y - 1, z).getState();
    current.setType(main);
    current.setData(mainData);
View Full Code Here

    String[] itemsStrSplit = invString.split(";;");
    for (String itemStr : itemsStrSplit) {
      String[] itemStrSplit = itemStr.split(";");
      if (itemStrSplit.length == 4) {
        ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
        stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
        short durability = (short) Integer.parseInt(itemStrSplit[2]);
        stack.setDurability(durability);
        items.add(stack);
      } else if (itemStrSplit.length == 3) {
        ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
View Full Code Here

      String[] itemsStrSplit = invString.split(";;");
      for (String itemStr : itemsStrSplit) {
        String[] itemStrSplit = itemStr.split(";");
        if (itemStrSplit.length == 5) {
          ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
          stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
          short durability = (short) Integer.parseInt(itemStrSplit[2]);
          stack.setDurability(durability);

          // enchantments
          String[] enchantmentsSplit = itemStrSplit[4].split("::");
          for (String enchantmentStr : enchantmentsSplit) {
            if (!enchantmentStr.equals("")) {
              String[] enchantmentSplit = enchantmentStr.split(":");
              int enchantId = Integer.parseInt(enchantmentSplit[0]);
              int level = Integer.parseInt(enchantmentSplit[1]);
              War.war.safelyEnchant(stack, Enchantment.getById(enchantId), level);
            }
          }
         
          items.add(stack);
        } else if (itemStrSplit.length == 4) {
          ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
          stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
          short durability = (short) Integer.parseInt(itemStrSplit[2]);
          stack.setDurability(durability);
          items.add(stack);
        } else if (itemStrSplit.length == 3) {
          ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
View Full Code Here

    }
   
    private boolean restoreLast(Repairable r)
    {
        Material t = r.getType();
        MaterialData m = r.getState().getData();
       
        return (m instanceof Attachable || m instanceof Redstone || m instanceof Door || m instanceof Bed || t == Material.STATIONARY_LAVA || t == Material.STATIONARY_WATER || t == Material.FIRE);
    }
View Full Code Here

    if (MaterialUtil.ISSOLID.get(type)) {
      return true;
    }
    // Special block types that only support one face at a time
    int rawData = MaterialUtil.getRawData(block);
    MaterialData data = BlockUtil.getData(type, rawData);

    // Steps only support TOP or BOTTOM
    if (MaterialUtil.isType(type, Material.WOOD_STEP, Material.STEP)) {
      return face == FaceUtil.getVertical((rawData & 0x8) == 0x8);
    }
View Full Code Here

       
        // <item> part
        String type = stack.getType().toString().toLowerCase();

        // <data> part
        MaterialData md = stack.getData();
        short data = (md != null ? md.getData() : 0);
       
        // Take wool into account
        if (stack.getType() == Material.WOOL) {
            data = (byte) (15 - data);
        }
View Full Code Here

        // Else, return matched itemType/materialType
        else return material == data.getItemType();
    }

    public MaterialData getMaterialData() {
        return new MaterialData(material, data != null ? data : 0);
    }
View Full Code Here

    public InventoryMenuItem(ItemStack item) {
        this.item = item;
    }

    public InventoryMenuItem(String text) {
        this(text, new MaterialData(Material.PAPER));
    }
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.