Class ProjectileItem

java.lang.Object
cn.nukkit.item.Item
cn.nukkit.item.ProjectileItem
All Implemented Interfaces:
BlockID, ItemID, Cloneable
Direct Known Subclasses:
ItemEgg, ItemEnderPearl, ItemExpBottle, ItemPotionLingering, ItemPotionSplash, ItemSnowball

public abstract class ProjectileItem extends Item
Author:
CreeperFace
  • Constructor Details

    • ProjectileItem

      public ProjectileItem(int id, Integer meta, int count, String name)
  • Method Details

    • getProjectileEntityType

      public abstract String getProjectileEntityType()
    • getThrowForce

      public abstract float getThrowForce()
    • 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 Item
      Parameters:
      player - player
      directionVector - 点击的方向向量
      The direction vector of the click
      Returns:
      item changed
    • addThrowSound

      @PowerNukkitOnly protected void addThrowSound(Player player)
    • correctProjectile

      @PowerNukkitOnly protected Entity correctProjectile(Player player, Entity projectile)
    • correctNBT

      protected void correctNBT(CompoundTag nbt)