PaperMC/patches/server-remapped/0583-Villager-resetOffers.patch
Mariell Hoversholm a207d14a0e
Rename all patches to correct numbering scheme
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-06-11 15:46:44 +02:00

48 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Mon, 7 Oct 2019 00:15:37 -0500
Subject: [PATCH] Villager#resetOffers
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 9eee68a5a84e121698d26bd54212a72c75e16251..407a68edf6408400f1a6c5bb1a6cbbfae08ac2cd 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -111,6 +111,13 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
return this.tradingPlayer != null;
}
+ // Paper start
+ public void resetOffers() {
+ this.offers = new MerchantOffers();
+ this.updateTrades();
+ }
+ // Paper end
+
@Override
public MerchantOffers getOffers() {
if (this.offers == null) {
@@ -232,6 +239,7 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
return this.level;
}
+ protected final void updateTrades() { updateTrades(); } // Paper - OBFHELPER
protected abstract void updateTrades();
protected void addOffersFromItemListings(MerchantOffers recipeList, VillagerTrades.ItemListing[] pool, int count) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
index 8ffdfe3e8229b556838eab18dcb6bfb0c05a6063..7f887e883a87f2df7ae428ffddb072724d602d62 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
@@ -70,4 +70,11 @@ public class CraftAbstractVillager extends CraftAgeable implements AbstractVilla
public HumanEntity getTrader() {
return getMerchant().getTrader();
}
+
+ // Paper start
+ @Override
+ public void resetOffers() {
+ getHandle().resetOffers();
+ }
+ // Paper end
}