Immersive Engineering

Immersive Engineering

134M Downloads

Villagers Trades with Air on tagged offers when passed null entity

pietro-lopes opened this issue ยท 0 comments

commented

Minecraft Version

1.21.1

Immersive Engineering Version

12.0.0-182

Expected Behavior

This function should at least try to get registryAccess from server if level is null.

public TradeListing(@Nonnull TradeOutline outline, @Nonnull TagKey<Item> tag, @Nonnull PriceInterval buyAmounts, int maxUses, int xp)
{
this(outline, l -> l!=null?IEApi.getPreferredTagStack(l.registryAccess(), tag): ItemStack.EMPTY, buyAmounts, maxUses, xp);
}

Actual Behavior

PneumaticCraft AmadronOfferManager calls offer with a null entity and causes tags to not be resolved.
https://github.com/TeamPneumatic/pnc-repressurized/blob/7d0872ed4abcd612081cbab06658df9c92108950/src/main/java/me/desht/pneumaticcraft/common/amadron/AmadronOfferManager.java#L349-L358

public MerchantOffer getOffer(@Nullable Entity trader, @Nonnull RandomSource rand)
{
ItemStack buying = this.lazyItem.apply(trader!=null?trader.level(): null);
return this.outline.generateOffer(buying, priceInfo, rand, maxUses, xp, priceMultiplier);
}

Steps to reproduce

  1. Install IE with PneumaticCraft
  2. Try to get a Machinist to trade
  3. Coal Coke (which uses #c:coal_coke) will be air

Debug Crash Log

no log needed