Villager#resetOffers

This commit is contained in:
William Blake Galbreath 2019-10-07 00:15:37 -05:00
parent f24af9bc9c
commit 691c4ee7b6
2 changed files with 23 additions and 2 deletions

View File

@ -31,7 +31,21 @@
public AbstractVillager(EntityType<? extends AbstractVillager> 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) {

View File

@ -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
}