Interface Piglin

All Superinterfaces:
Ageable, Attributable, Audience, CommandSender, Creature, Damageable, Enemy, Entity, Frictional, HoverEventSource<HoverEvent.ShowEntity>, InventoryHolder, Leashable, LivingEntity, Lootable, Metadatable, Mob, Monster, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, PiglinAbstract, Pointered, ProjectileSource, RangedEntity, ServerOperator, Sound.Emitter

public interface Piglin extends PiglinAbstract, InventoryHolder, RangedEntity
Represents a Piglin.
  • Method Details

    • isAbleToHunt

      boolean isAbleToHunt()
      Get whether the piglin is able to hunt hoglins.
      Returns:
      Whether the piglin is able to hunt hoglins
    • setIsAbleToHunt

      void setIsAbleToHunt(boolean flag)
      Sets whether the piglin is able to hunt hoglins.
      Parameters:
      flag - Whether the piglin is able to hunt hoglins.
    • addBarterMaterial

      boolean addBarterMaterial(@NotNull @NotNull Material material)
      Adds a material to the allowed list of materials to barter with.
      Parameters:
      material - The material to add
      Returns:
      true if the item has been added successfully, false otherwise
    • removeBarterMaterial

      boolean removeBarterMaterial(@NotNull @NotNull Material material)
      Removes a material from the allowed list of materials to barter with. Note: It's not possible to override the default bartering item gold_ingots as payment. To block gold_ingots see PiglinBarterEvent.
      Parameters:
      material - The material to remove
      Returns:
      true if the item has been removed successfully, false otherwise
    • addMaterialOfInterest

      boolean addMaterialOfInterest(@NotNull @NotNull Material material)
      Adds a material the piglin will pickup and store in his inventory.
      Parameters:
      material - The material you want the piglin to be interested in
      Returns:
      true if the item has been added successfully, false otherwise
    • removeMaterialOfInterest

      boolean removeMaterialOfInterest(@NotNull @NotNull Material material)
      Removes a material from the list of materials the piglin will pickup. Note: It's not possible to override the default list of item the piglin will pickup. To cancel pickup see EntityPickupItemEvent.
      Parameters:
      material - The material you want removed from the interest list
      Returns:
      true if the item has been removed successfully, false otherwise
    • getInterestList

      @NotNull @NotNull Set<Material> getInterestList()
      Returns a immutable set of materials the piglins will pickup.
      Note: This set will not include the items that are set by default. To interact with those items see EntityPickupItemEvent.
      Returns:
      An immutable materials set
    • getBarterList

      @NotNull @NotNull Set<Material> getBarterList()
      Returns a immutable set of materials the piglins will barter with. Note: This set will not include the items that are set by default. To interact with those items see PiglinBarterEvent.
      Returns:
      An immutable materials set
    • setChargingCrossbow

      void setChargingCrossbow(boolean chargingCrossbow)
      Causes the piglin to appear as if they are charging a crossbow.

      This works with any item currently held in the piglin's hand.

      Parameters:
      chargingCrossbow - is charging
    • isChargingCrossbow

      boolean isChargingCrossbow()
      Gets if the piglin is currently charging the item in their hand.
      Returns:
      is charging
    • setDancing

      void setDancing(boolean dancing)
      Sets whether the Piglin is dancing or not
      Parameters:
      dancing - is dancing
    • setDancing

      void setDancing(long duration)
      Causes the piglin to dance for a specified amount of time
      Parameters:
      duration - duration of the dance in ticks
    • isDancing

      boolean isDancing()
      Gets if the piglin is currently dancing
      Returns:
      is dancing