Package org.bukkit.entity

# Interface Piglin

All Superinterfaces:
  `Ageable`, `Attributable`, `Audience`, `CommandSender`, `Creature`, `Damageable`, `Entity`, `Frictional`, `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.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.bukkit.entity.Entity

`Entity.Spigot`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`addBarterMaterial(@NotNull Material material)`
Adds a material to the allowed list of materials to barter with.
`boolean`
`addMaterialOfInterest(@NotNull Material material)`
Adds a material the piglin will pickup and store in his inventory.
`@NotNull Set<Material>`
`getBarterList()`
Returns a immutable set of materials the piglins will barter with.
`@NotNull Set<Material>`
`getInterestList()`
Returns a immutable set of materials the piglins will pickup.
`boolean`
`isAbleToHunt()`
Get whether the piglin is able to hunt hoglins.
`boolean`
`isChargingCrossbow()`
Gets if the piglin is currently charging the item in their hand.
`boolean`
`removeBarterMaterial(@NotNull Material material)`
Removes a material from the allowed list of materials to barter with.
`boolean`
`removeMaterialOfInterest(@NotNull Material material)`
Removes a material from the list of materials the piglin will pickup.
`void`
`setChargingCrossbow(boolean chargingCrossbow)`
Causes the piglin to appear as if they are charging a crossbow.
`void`
`setIsAbleToHunt(boolean flag)`
Sets whether the piglin is able to hunt hoglins.

### Methods inherited from interface org.bukkit.entity.Ageable

`canBreed, getAge, getAgeLock, isAdult, setAdult, setAge, setAgeLock, setBaby, setBreed`

### Methods inherited from interface org.bukkit.attribute.Attributable

`getAttribute, registerAttribute`

### Methods inherited from interface net.kyori.adventure.audience.Audience

`clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, showTitle, stopSound, stopSound`

### Methods inherited from interface org.bukkit.command.CommandSender

`getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage`

### Methods inherited from interface org.bukkit.entity.Damageable

`damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth`

### Methods inherited from interface org.bukkit.entity.Entity

`addPassenger, addScoreboardTag, asHoverEvent, collidesAt, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isInBubbleColumn, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isOnGround, isPersistent, isSilent, isTicking, isUnderWater, isValid, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisualFire, spawnAt, spawnAt, spigot, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, wouldCollideUsing`

### Methods inherited from interface io.papermc.paper.entity.Frictional

`getFrictionState, setFrictionState`

### Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource

`asHoverEvent`

### Methods inherited from interface org.bukkit.inventory.InventoryHolder

`getInventory`

### Methods inherited from interface org.bukkit.entity.LivingEntity

`addPotionEffect, addPotionEffect, addPotionEffects, attack, broadcastSlotBreak, broadcastSlotBreak, canBreatheUnderwater, clearActiveItem, damageItemStack, damageItemStack, getActiveItem, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getArrowsStuck, getBeeStingerCooldown, getBeeStingersInBody, getCanPickupItems, getCategory, getCollidableExemptions, getDeathSound, getDrinkingSound, getEatingSound, getEyeHeight, getEyeHeight, getEyeLocation, getFallDamageSound, getFallDamageSoundBig, getFallDamageSoundSmall, getHandRaised, getHandRaisedTime, getHurtDirection, getHurtSound, getItemUseRemainingTime, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getShieldBlockingDelay, getTargetBlock, getTargetBlock, getTargetBlock, getTargetBlockExact, getTargetBlockExact, getTargetBlockFace, getTargetBlockFace, getTargetBlockInfo, getTargetBlockInfo, getTargetEntity, getTargetEntity, getTargetEntityInfo, getTargetEntityInfo, hasAI, hasLineOfSight, hasLineOfSight, hasPotionEffect, isClimbing, isCollidable, isGliding, isHandRaised, isInvisible, isJumping, isLeashed, isRiptiding, isSleeping, isSwimming, knockback, playPickupItemAnimation, playPickupItemAnimation, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setArrowsStuck, setBeeStingerCooldown, setBeeStingersInBody, setCanPickupItems, setCollidable, setGliding, setHurtDirection, setInvisible, setJumping, setKiller, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setShieldBlockingDelay, setSwimming, swingHand, swingMainHand, swingOffHand`

### Methods inherited from interface org.bukkit.loot.Lootable

`clearLootTable, getLootTable, getSeed, hasLootTable, setLootTable, setLootTable, setSeed`

### Methods inherited from interface org.bukkit.metadata.Metadatable

`getMetadata, hasMetadata, removeMetadata, setMetadata`

### Methods inherited from interface org.bukkit.entity.Mob

`getAmbientSound, getEquipment, getHeadRotationSpeed, getMaxHeadPitch, getPathfinder, getTarget, isAware, isInDaylight, isLeftHanded, lookAt, lookAt, lookAt, lookAt, lookAt, lookAt, setAware, setLeftHanded, setTarget`

### Methods inherited from interface org.bukkit.Nameable

`customName, customName, getCustomName, setCustomName`

### Methods inherited from interface org.bukkit.permissions.Permissible

`addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment`

### Methods inherited from interface org.bukkit.persistence.PersistentDataHolder

`getPersistentDataContainer`

### Methods inherited from interface org.bukkit.entity.PiglinAbstract

`getConversionTime, isBaby, isConverting, isImmuneToZombification, setBaby, setConversionTime, setImmuneToZombification`

### Methods inherited from interface net.kyori.adventure.pointer.Pointered

`get, getOrDefault, getOrDefaultFrom, pointers`

### Methods inherited from interface org.bukkit.projectiles.ProjectileSource

`launchProjectile, launchProjectile, launchProjectile`

### Methods inherited from interface com.destroystokyo.paper.entity.RangedEntity

`isChargingAttack, rangedAttack, setChargingAttack`

### Methods inherited from interface org.bukkit.permissions.ServerOperator

`isOp, setOp`

## 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