Paper/Spigot-Server-Patches/0584-Villager-resetOffers.patch

49 lines
2.1 KiB
Diff
Raw Normal View History

2020-10-04 06:20:10 +02:00
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/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java
index f5865052261cb49c3f853e4d65e21831c83c2ea0..790df2be9cbbc359ba354ed272dbf6dda71951f0 100644
2020-10-04 06:20:10 +02:00
--- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java
@@ -86,6 +86,13 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP
2020-10-04 06:20:10 +02:00
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) {
@@ -208,6 +215,7 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP
2020-10-04 06:20:10 +02:00
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 18520fec054b3bcdf73aaca95c665e7a1254b76f..e9c5c26818cc42e67db90809263dab184501af75 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
}