summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0419-Villager-resetOffers.patch
blob: ce8f9949cd512eb4317276d587c71f83ec4f9354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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 89e14bb2662fe03b4661aaa54fd65af41b1d438b..fcb3b66617150ad503bffe65de4900b1e3af8764 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -114,6 +114,13 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
         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) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
index e5f733a765068b5640e811abf9fda945a9e91c7c..3199f04d00836a0a51547c679f3f3c80d00da502 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
+++ b/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
 }