Package org.getspout.spoutapi.material

Examples of org.getspout.spoutapi.material.CustomItem


    }
  }

  @Override
  public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) {
    CustomItem item = MaterialData.getCustomItem(itemstack.getData());
    if (item instanceof Food) {
      --itemstack.count;
      entityhuman.getFoodData().eat(((Food) item).getHungerRestored(), 0.6F);
    }
    return itemstack;
View Full Code Here


    return itemstack;
  }

  @Override
  public EnumAnimation c_(ItemStack itemstack) {
    CustomItem item = MaterialData.getCustomItem(itemstack.getData());
    if (item instanceof Food) {
      return EnumAnimation.EAT;
    }
    return super.c_(itemstack);
  }
View Full Code Here

    return super.c_(itemstack);
  }

  @Override
  public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
    CustomItem item = MaterialData.getCustomItem(itemstack.getData());
    if (item instanceof Food) {
      Bukkit.getScheduler().scheduleSyncDelayedTask(Spout.getInstance(), new FoodUpdate(entityhuman, itemstack), 2);
    }

    return itemstack;
View Full Code Here

  @EventHandler(priority = EventPriority.LOWEST)
  public void onPlayerDrop(PlayerDropItemEvent e) {
    SpoutItemStack sis = new SpoutItemStack(e.getItemDrop().getItemStack());
    if (!sis.containsEnchantment(SpoutEnchantment.UNSTACKABLE) && sis.isCustomItem()) {
      CustomItem ci = (CustomItem)sis.getMaterial();
      if (!ci.isStackable()) {
        sis.addEnchantment(SpoutEnchantment.UNSTACKABLE, 1000);
      }
    }
    e.getItemDrop().setItemStack(sis);
  }
View Full Code Here

  @EventHandler(priority = EventPriority.LOWEST)
  public void onPlayerPickupItem(PlayerPickupItemEvent e) {
    SpoutItemStack sis = new SpoutItemStack(e.getItem().getItemStack());
    if (!sis.containsEnchantment(SpoutEnchantment.UNSTACKABLE) && sis.isCustomItem()) {
      CustomItem ci = (CustomItem)sis.getMaterial();
      if (!ci.isStackable()) {
        sis.addEnchantment(SpoutEnchantment.UNSTACKABLE, 1000);
      }
    }
    e.getItem().setItemStack(sis);
  }
View Full Code Here

    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

TOP

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

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.