mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-16 15:45:23 +01:00
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/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
|
|
index a614f5d5817bf999aca0f0b50f343031c8168392..10067731e6289211cb11b2b368527a1c45603314 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
|
|
@@ -273,7 +273,11 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP
|
|
Bukkit.getPluginManager().callEvent(event);
|
|
}
|
|
if (!event.isCancelled()) {
|
|
- merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
|
+ // Paper start
|
|
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
|
|
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
|
|
+ merchantrecipelist.add(craftMerchantRecipe.toMinecraft());
|
|
+ // Paper end
|
|
}
|
|
// CraftBukkit end
|
|
}
|