diff --git a/paper-api/src/main/java/org/bukkit/entity/Piglin.java b/paper-api/src/main/java/org/bukkit/entity/Piglin.java
index eefe96c99..b96e57552 100644
--- a/paper-api/src/main/java/org/bukkit/entity/Piglin.java
+++ b/paper-api/src/main/java/org/bukkit/entity/Piglin.java
@@ -1,9 +1,14 @@
package org.bukkit.entity;
+import java.util.Set;
+import org.bukkit.Material;
+import org.bukkit.inventory.InventoryHolder;
+import org.jetbrains.annotations.NotNull;
+
/**
* Represents a Piglin.
*/
-public interface Piglin extends PiglinAbstract {
+public interface Piglin extends PiglinAbstract, InventoryHolder {
/**
* Get whether the piglin is able to hunt hoglins.
@@ -18,4 +23,71 @@ public interface Piglin extends PiglinAbstract {
* @param flag Whether the piglin is able to hunt hoglins.
*/
public void setIsAbleToHunt(boolean flag);
+
+ /**
+ * Adds a material to the allowed list of materials to barter with.
+ *
+ * @param material The material to add
+ *
+ * @return true if the item has been added successfully, false otherwise
+ */
+ public boolean addBarterMaterial(@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
+ * {@link org.bukkit.event.entity.PiglinBarterEvent}.
+ *
+ * @param material The material to remove
+ *
+ * @return true if the item has been removed successfully, false otherwise
+ */
+ public boolean removeBarterMaterial(@NotNull Material material);
+
+ /**
+ * Adds a material the piglin will pickup and store in his inventory.
+ *
+ * @param material The material you want the piglin to be interested in
+ *
+ * @return true if the item has been added successfully, false otherwise
+ */
+ public boolean addMaterialOfInterest(@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
+ * {@link org.bukkit.event.entity.EntityPickupItemEvent}.
+ *
+ * @param material The material you want removed from the interest list
+ * @return true if the item has been removed successfully, false otherwise
+ */
+ public boolean removeMaterialOfInterest(@NotNull Material material);
+
+ /**
+ * 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
+ * {@link org.bukkit.event.entity.EntityPickupItemEvent}.
+ *
+ * @return An immutable materials set
+ */
+ @NotNull
+ public Set getInterestList();
+
+ /**
+ * 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
+ * {@link org.bukkit.event.entity.PiglinBarterEvent}.
+ *
+ * @return An immutable materials set
+ */
+ @NotNull
+ public Set getBarterList();
}
diff --git a/paper-api/src/main/java/org/bukkit/event/entity/PiglinBarterEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/PiglinBarterEvent.java
new file mode 100644
index 000000000..c17ff41a6
--- /dev/null
+++ b/paper-api/src/main/java/org/bukkit/event/entity/PiglinBarterEvent.java
@@ -0,0 +1,76 @@
+package org.bukkit.event.entity;
+
+import java.util.List;
+import org.bukkit.entity.Piglin;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Stores all data related to the bartering interaction with a piglin.
+ *
+ * This event can be triggered by a piglin picking up an item that's on its
+ * bartering list.
+ */
+public class PiglinBarterEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private final List outcome;
+ private final ItemStack input;
+
+ public PiglinBarterEvent(@NotNull Piglin what, @NotNull ItemStack input, @NotNull List outcome) {
+ super(what);
+
+ this.input = input;
+ this.outcome = outcome;
+ }
+
+ @NotNull
+ @Override
+ public Piglin getEntity() {
+ return (Piglin) super.getEntity();
+ }
+
+ /**
+ * Gets the input of the barter.
+ *
+ * @return The item that was used to barter with
+ */
+ @NotNull
+ public ItemStack getInput() {
+ return input.clone();
+ }
+
+ /**
+ * Returns a mutable list representing the outcome of the barter.
+ *
+ * @return A mutable list of the item the player will receive
+ */
+ @NotNull
+ public List getOutcome() {
+ return outcome;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}