aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0583-Villager-resetOffers.patch
blob: 5c18995906b6d314e71ae54fc450805d4d1f9d32 (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
41
42
43
44
45
46
47
48
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/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
index 3dd80fcf9237f15bb3bf38d1529340e178f09388..a614f5d5817bf999aca0f0b50f343031c8168392 100644
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
@@ -113,6 +113,13 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP
         return this.tradingPlayer != null;
     }
 
+    // Paper start
+    public void resetOffers() {
+        this.trades = new MerchantRecipeList();
+        this.updateTrades();
+    }
+    // Paper end
+
     @Override
     public MerchantRecipeList getOffers() {
         if (this.trades == null) {
@@ -235,6 +242,7 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP
         return this.world;
     }
 
+    protected final void updateTrades() { eW(); } // Paper - OBFHELPER
     protected abstract void eW();
 
     protected void a(MerchantRecipeList merchantrecipelist, VillagerTrades.IMerchantRecipeOption[] avillagertrades_imerchantrecipeoption, int i) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
index 01285d555ed084fa2e818e1f02955f8aa28002b3..ee751ed4f9f386bf9926347fe2f0958015aecffa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
@@ -71,4 +71,11 @@ public class CraftAbstractVillager extends CraftAgeable implements AbstractVilla
     public HumanEntity getTrader() {
         return getMerchant().getTrader();
     }
+
+    // Paper start
+    @Override
+    public void resetOffers() {
+        getHandle().resetOffers();
+    }
+    // Paper end
 }