Class ItemCustomEdible

java.lang.Object
cn.nukkit.item.Item
cn.nukkit.item.ItemEdible
cn.nukkit.item.customitem.ItemCustomEdible
All Implemented Interfaces:
BlockID, CustomItem, ItemID, StringItem, Cloneable

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public abstract class ItemCustomEdible extends ItemEdible implements CustomItem
Author:
lt_name
  • Constructor Details

    • ItemCustomEdible

      public ItemCustomEdible(@NotNull String id, @Nullable String name)
    • ItemCustomEdible

      public ItemCustomEdible(@NotNull String id, @Nullable String name, @NotNull String textureName)
  • Method Details

    • onClickAir

      public boolean onClickAir(Player player, Vector3 directionVector)
      Description copied from class: Item
      当玩家对着空中使用物品时调用,例如投掷物品。返回物品是否已更改,例如数量减少或耐久度更改。

      Called when a player uses the item on air, for example throwing a projectile. Returns whether the item was changed, for example count decrease or durability change.

      Overrides:
      onClickAir in class ItemEdible
      Parameters:
      player - player
      directionVector - 点击的方向向量
      The direction vector of the click
      Returns:
      item changed
    • getTextureName

      public String getTextureName()
      Description copied from interface: CustomItem
      定义该自定义物品的材质

      Define the texture of this custom item

      Specified by:
      getTextureName in interface CustomItem
      Returns:
      the texture name
    • getNamespaceId

      @Since("1.4.0.0-PN") @PowerNukkitOnly public String getNamespaceId()
      Specified by:
      getNamespaceId in interface StringItem
      Overrides:
      getNamespaceId in class Item
    • getId

      public final int getId()
      Specified by:
      getId in interface StringItem
      Overrides:
      getId in class Item
    • getFood

      @Since("1.19.60-r1") public abstract Map.Entry<Plugin,Food> getFood()
    • isDrink

      public boolean isDrink()
    • canAlwaysEat

      public boolean canAlwaysEat()