Crash due to TradeOffersTypeAwareBuyForOneEmeraldFactoryMixin
incorrectly assuming null trade items will create empty item stacks
#4456
Labels
bug
Something isn't working
This method in the mixin assumes that an empty item stack will be created due to
null
being passed in the constructor.Unfortunately, at least in 1.20.1, item stack constructors take
ItemConvertible
and callasItem
on the input.Which causes a null pointer exception if a
null
item is given.I imagine this was not noticed until now because in vanilla, the only type aware trade is when a fisherman is at its maximum level and a mod has added a custom villager type. My custom villager type also has its own type aware trades at a lower level though, so this crash happened without max level - but I don't think this could have ever worked, at least with how
TypeOffersTypeAwareBuyForOneEmeraldFactory
is implemented in 1.20.1.I suppose to fix this the mixin will have to add a condition before the item stack is created in
TypeOffersTypeAwareBuyForOneEmeraldFactory#create
, since the mixin disables vanilla's crash in theTypeOffersTypeAwareBuyForOneEmeraldFactory
constructor for missing trades.The text was updated successfully, but these errors were encountered: