PaperMC/patches/server/0450-Fix-crash-from-invalid-ingredient-lists-in-VillagerA.patch

25 lines
1.4 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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] Fix crash from invalid ingredient lists in
2021-06-11 14:02:28 +02:00
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
2024-06-13 22:57:13 +02:00
index 80fe2e3e5b97e9b6af98b73f19f8c2f5fca279fe..6139361c0e733f981506abdd7101e5ca20eeb88f 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
2024-06-13 22:57:13 +02:00
@@ -275,7 +275,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
2021-06-11 14:02:28 +02:00
Bukkit.getPluginManager().callEvent(event);
}
if (!event.isCancelled()) {
- recipeList.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
+ // Paper start - Fix crash from invalid ingredient list
2021-06-11 14:02:28 +02:00
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
+ recipeList.add(craftMerchantRecipe.toMinecraft());
+ // Paper end - Fix crash from invalid ingredient list
2021-06-11 14:02:28 +02:00
}
// CraftBukkit end
++j;