Package org.getspout.spoutapi.material

Examples of org.getspout.spoutapi.material.Material


      data[i] = shape[i];
    }
    for (char c : ingred.keySet()) {
      data[i] = c;
      i++;
      Material mdata = ingred.get(c);

      int id = mdata.getRawId();
      int dmg = mdata.getRawData();

      data[i] = new net.minecraft.server.v1_6_R3.ItemStack(id, 1, dmg);
      i++;
    }
        CraftingManager.getInstance().registerShapedRecipe(CraftItemStack.asNMSCopy(getResult())/*Convert SpoutItemStack to MC ItemStack*/, data);
View Full Code Here


    }
    ItemStack inHand = event.getItem();
    if (inHand == null) {
      return;
    }
    Material mat = MaterialData.getMaterial(inHand.getTypeId(), inHand.getDurability());
    if (mat instanceof CustomItem) {
      CustomItem item = (CustomItem)mat;
      event.setCancelled(!item.onItemInteract((SpoutPlayer)event.getPlayer(), (SpoutBlock)event.getClickedBlock(), event.getBlockFace()) || event.isCancelled());
    }
  }
View Full Code Here

  @EventHandler(priority=EventPriority.LOWEST)
  public void onItemCraft(CraftItemEvent e) {
    ItemStack res = e.getCurrentItem();
    res.removeEnchantment(SpoutEnchantment.UNSTACKABLE);
    Material m = MaterialData.getMaterial(res.getTypeId(), res.getDurability());
    if (m instanceof CustomItem) {
      if (!((CustomItem) m).isStackable() && e.isShiftClick()) {
        e.setCancelled(true); // Shift clicking causes... issues with unstackable Spout items.
      }
    }
View Full Code Here

import org.getspout.spoutapi.material.Tool;

public class SpoutItemStack extends ItemStack {
  public SpoutItemStack(int typeId, int amount, short data, ItemMeta meta) {
    super(typeId, amount, data);
    Material m = getMaterial();
    if (m instanceof GenericCustomTool) {
      if (!getEnchantments().containsKey(SpoutEnchantment.MAX_DURABILITY)) {
        addUnsafeEnchantment(SpoutEnchantment.MAX_DURABILITY, ((Tool) m).getMaxDurability());
      }
      if (!getEnchantments().containsKey(SpoutEnchantment.DURABILITY)) {
View Full Code Here

  public int getVersion() {
    return super.getVersion() + 0;
  }

  public static short getDurability(ItemStack is) {
    Material m = MaterialData.getMaterial(is.getTypeId(), is.getDurability());
    if (!(m instanceof Tool)) {
      throw new IllegalArgumentException("Itemstack must be a tool!");
    }
    return (short) is.getEnchantmentLevel(SpoutEnchantment.DURABILITY);
  }
View Full Code Here

    }
    return (short) is.getEnchantmentLevel(SpoutEnchantment.DURABILITY);
  }

  public static void setDurability(ItemStack is, short durability) {
    Material m = MaterialData.getMaterial(is.getTypeId(), is.getDurability());
    if (!(m instanceof Tool)) {
      throw new IllegalArgumentException("Itemstack must be a tool!");
    }
    is.removeEnchantment(SpoutEnchantment.DURABILITY);
    is.addUnsafeEnchantment(SpoutEnchantment.DURABILITY, durability);
View Full Code Here

TOP

Related Classes of org.getspout.spoutapi.material.Material

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.