Interface Piglin

All Superinterfaces:
Ageable, Attributable, Audience, CommandSender, Creature, Damageable, Entity, HoverEventSource<HoverEvent.ShowEntity>, InventoryHolder, LivingEntity, Lootable, Metadatable, Mob, Monster, Nameable, Permissible, PersistentDataHolder, 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