From 691c4ee7b62e2adfec537089d2af5ab3069e81c9 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Mon, 7 Oct 2019 00:15:37 -0500 Subject: [PATCH] Villager#resetOffers --- .../entity/npc/AbstractVillager.java.patch | 18 ++++++++++++++++-- .../entity/CraftAbstractVillager.java | 7 +++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/npc/AbstractVillager.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/npc/AbstractVillager.java.patch index ffa2d446de..2ee4a021d8 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/npc/AbstractVillager.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/npc/AbstractVillager.java.patch @@ -31,7 +31,21 @@ public AbstractVillager(EntityType type, Level world) { super(type, world); -@@ -179,7 +192,7 @@ +@@ -101,6 +114,13 @@ + return this.tradingPlayer != null; + } + ++ // Paper start - Villager#resetOffers ++ public void resetOffers() { ++ this.offers = new MerchantOffers(); ++ this.updateTrades(); ++ } ++ // Paper end - Villager#resetOffers ++ + @Override + public MerchantOffers getOffers() { + if (this.level().isClientSide) { +@@ -179,7 +199,7 @@ public void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); if (nbt.contains("Offers")) { @@ -40,7 +54,7 @@ Logger logger = AbstractVillager.LOGGER; Objects.requireNonNull(logger); -@@ -246,7 +259,16 @@ +@@ -246,7 +266,16 @@ MerchantOffer merchantrecipe = ((VillagerTrades.ItemListing) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random); if (merchantrecipe != null) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java index e5f733a765..3199f04d00 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java @@ -34,4 +34,11 @@ public class CraftAbstractVillager extends CraftAgeable implements CraftMerchant public Inventory getInventory() { return new CraftInventory(this.getHandle().getInventory()); } + + // Paper start - Villager#resetOffers + @Override + public void resetOffers() { + getHandle().resetOffers(); + } + // Paper end - Villager#resetOffers }