Skip to content

Commit bae52e7

Browse files
authored
Apply suggestions from code review
1 parent 1cefc02 commit bae52e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: patches/net/minecraft/world/entity/npc/VillagerTrades.java.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
private final int villagerXp;
55

66
public EmeraldsForVillagerTypeItem(int p_35669_, int p_35670_, int p_35671_, Map<VillagerType, Item> p_35672_) {
7-
+ if (false) // Neo: disable this check so that mods can add custom villager
7+
+ if (false) // Neo: disable this check so that mods can add custom villager types
88
BuiltInRegistries.VILLAGER_TYPE.stream().filter(p_35680_ -> !p_35672_.containsKey(p_35680_)).findAny().ifPresent(p_339515_ -> {
99
throw new IllegalStateException("Missing trade for villager type: " + BuiltInRegistries.VILLAGER_TYPE.getKey(p_339515_));
1010
});
@@ -14,7 +14,7 @@
1414
if (p_219685_ instanceof VillagerDataHolder villagerdataholder) {
1515
- ItemCost itemcost = new ItemCost(this.trades.get(villagerdataholder.getVillagerData().getType()), this.cost);
1616
+ Item item = this.trades.get(villagerdataholder.getVillagerData().getType());
17-
+ if (item == null) return null; // Neo: add a check for custom villager
17+
+ if (item == null) return null; // Neo: add a check for unknown villager types
1818
+ ItemCost itemcost = new ItemCost(item, this.cost);
1919
return new MerchantOffer(itemcost, new ItemStack(Items.EMERALD), this.maxUses, this.villagerXp, 0.05F);
2020
} else {

0 commit comments

Comments
 (0)