Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
25 Zeilen
1.4 KiB
Diff
25 Zeilen
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 407a68edf6408400f1a6c5bb1a6cbbfae08ac2cd..335000713279b7964c5172937483678c671bfed1 100644
|
||
|
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||
|
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||
|
@@ -270,7 +270,11 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
|
||
|
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
|
||
|
}
|