Interface Piglin

All Superinterfaces:
Ageable, Attributable, CommandSender, Creature, Damageable, Entity, InventoryHolder, LivingEntity, Lootable, Metadatable, Mob, Monster, Nameable, Permissible, PersistentDataHolder, PiglinAbstract, ProjectileSource, ServerOperator

public interface Piglin extends PiglinAbstract, InventoryHolder
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 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 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 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 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 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 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