mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-02 17:01:38 +01:00
72e87abc2d
Co-authored-by: Paul Sauve <paul@technove.co>
25 lines
1.4 KiB
Diff
25 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Sun, 27 Dec 2020 11:31:06 +0000
|
|
Subject: [PATCH] Do not crash from invalid ingredient lists in
|
|
VillagerAcquireTradeEvent
|
|
|
|
|
|
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 0a62cf36a95d7bf1287acdd17464fc677c7a4b7d..fe003c42f002e229111c46a79ac6a961c60db912 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
@@ -275,7 +275,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
|
Bukkit.getPluginManager().callEvent(event);
|
|
}
|
|
if (!event.isCancelled()) {
|
|
- recipeList.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
|
+ // Paper start
|
|
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
|
|
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
|
|
+ recipeList.add(craftMerchantRecipe.toMinecraft());
|
|
+ // Paper end
|
|
}
|
|
// CraftBukkit end
|
|
}
|