From 82a86ab04a701c038341799db07c63444a6851fe Mon Sep 17 00:00:00 2001 From: "Joseph T. McQuigg" Date: Mon, 20 Jan 2025 08:57:59 -0500 Subject: [PATCH] Update Patch to match suggestion --- .../world/entity/npc/VillagerTrades.java.patch | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/patches/net/minecraft/world/entity/npc/VillagerTrades.java.patch b/patches/net/minecraft/world/entity/npc/VillagerTrades.java.patch index 615a9b1e58..1d5fb7bb84 100644 --- a/patches/net/minecraft/world/entity/npc/VillagerTrades.java.patch +++ b/patches/net/minecraft/world/entity/npc/VillagerTrades.java.patch @@ -1,22 +1,18 @@ --- a/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/net/minecraft/world/entity/npc/VillagerTrades.java -@@ -1484,9 +_,6 @@ +@@ -1484,6 +_,7 @@ private final int villagerXp; public EmeraldsForVillagerTypeItem(int p_35669_, int p_35670_, int p_35671_, Map p_35672_) { -- BuiltInRegistries.VILLAGER_TYPE.stream().filter(p_35680_ -> !p_35672_.containsKey(p_35680_)).findAny().ifPresent(p_339515_ -> { -- throw new IllegalStateException("Missing trade for villager type: " + BuiltInRegistries.VILLAGER_TYPE.getKey(p_339515_)); -- }); - this.trades = p_35672_; - this.cost = p_35669_; - this.maxUses = p_35670_; -@@ -1498,6 +_,9 @@ ++ if (false) // Neo: disable this check so that mods can add custom villager + BuiltInRegistries.VILLAGER_TYPE.stream().filter(p_35680_ -> !p_35672_.containsKey(p_35680_)).findAny().ifPresent(p_339515_ -> { + throw new IllegalStateException("Missing trade for villager type: " + BuiltInRegistries.VILLAGER_TYPE.getKey(p_339515_)); + }); +@@ -1498,6 +_,7 @@ public MerchantOffer getOffer(Entity p_219685_, RandomSource p_219686_) { if (p_219685_ instanceof VillagerDataHolder villagerdataholder) { ItemCost itemcost = new ItemCost(this.trades.get(villagerdataholder.getVillagerData().getType()), this.cost); -+ if (itemcost.itemStack().isEmpty()) { -+ return null; -+ } ++ if (itemcost.itemStack().isEmpty()) return null; // Neo: add a check for custom villager return new MerchantOffer(itemcost, new ItemStack(Items.EMERALD), this.maxUses, this.villagerXp, 0.05F); } else { return null;