Paper/Spigot-Server-Patches/0584-Villager-resetOffers.patch
Riley Park 4e958e229f
We're going on an Adventure! (#4842)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-02-21 20:45:33 +01:00

49 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/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java
index 74ca39067e7538eac5d70031564d0508846204a5..1fddf7c77488a5e53fc48d0db0a7b8acc71e2f42 100644
--- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java
@@ -85,6 +85,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) {
@@ -207,6 +214,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 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
}