Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recalculateRecipe uses different dummy object for matching validation #7022

Closed
timber-they opened this issue Feb 24, 2021 · 2 comments
Closed

Comments

@timber-they
Copy link

Issue description:

In connection with the ImmersiveEngineering mod (e.g. in Valhelsia) it can come to an exception in server startup:

java.lang.NullPointerException
  at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770) ~[server-1.16.5-20210115.111550-extra.jar:?] {}
  at blusunrize.immersiveengineering.common.crafting.fluidaware.AbstractFluidAwareRecipe.getRemainingItems(AbstractFluidAwareRecipe.java:94) ~[immersiveengineering:?] {re:classloading}
  at blusunrize.immersiveengineering.common.crafting.fluidaware.AbstractFluidAwareRecipe.func_179532_b(AbstractFluidAwareRecipe.java:25) ~[immersiveengineering:?] {re:classloading}
  at mekanism.common.tile.machine.TileEntityFormulaicAssemblicator.recalculateRecipe(TileEntityFormulaicAssemblicator.java:303) ~[mekanism:10.0.19] {re:classloading}
  at mekanism.common.tile.machine.TileEntityFormulaicAssemblicator.onLoad(TileEntityFormulaicAssemblicator.java:177) ~[mekanism:10.0.19] {re:classloading}
  at net.minecraft.world.World.func_175700_a(World.java:444) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,xf:fml:observerlib:coremodmethod,xf:fml:astralsorcery:sun_brightness_server,pl:mixin:APP:performant.mixins.json:world.WorldMixin,pl:mixin:A,pl:runtimedistcleaner:A}
  at net.minecraft.world.World.func_147448_a(World.java:461) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,xf:fml:observerlib:coremodmethod,xf:fml:astralsorcery:sun_brightness_server,pl:mixin:APP:performant.mixins.json:world.WorldMixin,pl:mixin:A,pl:runtimedistcleaner:A}
  at net.minecraft.world.server.ChunkManager.lambda$null$25(ChunkManager.java:585) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:performant.mixins.json:world.chunk.ChunkManagerMixin,pl:mixin:APP:performant.mixins.json:world.chunk.ChunkManagerUpdatePlayerPosMixin,pl:mixin:APP:performant.mixins.json:world.chunk.ChunkManagerChunksAccessor,pl:mixin:A,pl:runtimedistcleaner:A}
  at com.mojang.datafixers.util.Either.lambda$mapLeft$0(Either.java:162) ~[?:?] {re:classloading,re:mixin}
  at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[?:?] {re:classloading}
  at com.mojang.datafixers.util.Either.mapLeft(Either.java:162) ~[?:?] {re:classloading,re:mixin}
  at net.minecraft.world.server.ChunkManager.lambda$func_219200_b$26(ChunkManager.java:569) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:performant.mixins.json:world.chunk.ChunkManagerMixin,pl:mixin:APP:performant.mixins.json:world.chunk.ChunkManagerUpdatePlayerPosMixin,pl:mixin:APP:performant.mixins.json:world.chunk.ChunkManagerChunksAccessor,pl:mixin:A,pl:runtimedistcleaner:A}
  at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616) ~[?:1.8.0_275] {}
  ... 35 more

This seems to be caused by the fact that getRemainingItems is called, even though formula.recipe.matches(dummyInv, world) would have returned null - the formula.matches method does validate this, but it uses a different dummy entity. This should be solved by replacing line 300 with:

isRecipe = formula.matches(world, craftingGridSlots) && formula.recipe.matches(dummyInv, world);

even though one might argue that that isn't such a clean solution.

Steps to reproduce:

  1. Craft 12 torches with this recipe
  2. ...in the Formulaic Assemblicator
  3. Login again / wait / ...

Version (make sure you are on the latest version before reporting):

Forge: forge-1.16.5-36.0.15.jar
Mekanism: Mekanism-1.16.4-10.0.19.446.jar
Other relevant version: ImmersiveEngineering-1.16.5-4.2.1-131.jar

Mods: https://pastebin.com/u0sLiUdJ -- this is exactly (without additions, deletions or replacements) the modlist included in Valhelsia 3.1.8a, see https://www.curseforge.com/minecraftmodpacks/valhelsia-3/files/3198587

Also, this corresponding issue for ImmersiveEngineering might be of interest.

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

pastebin

@Mooncat25
Copy link

Ah, just wanted to write a bug report related this issue but you beat me to it. The behavior on my side is vary with a different recipe, but I believe it is related as it also consists of the Formulaic Assemblicator and the Immersive Engineering mod.

I add the info here anyway, just in case I'm wrong.

The recipe:

[         ] [Glass    ] [         ]
[Iron Dust] [Green Dye] [Iron Dust] = Insulating Glass x2
[         ] [Glass    ] [         ]

It sometimes results in world load stuck at 100% instead of crash. Tested with the latest versions of Mekanism + Immersive Engineering:

  • Minecraft 1.16.5
  • Forge 36.0.42
  • Mekanism-1.16.5-10.0.21.448
  • MekanismAdditions-1.16.5-10.0.21.448
  • MekanismGenerators-1.16.5-10.0.21.448
  • MekanismTools-1.16.5-10.0.21.448
  • ImmersiveEngineering-1.16.5-4.2.1-131

Also happens in older versions:

  • Minecraft 1.16.4
  • Forge 35.1.28
  • Mekanism-1.16.4-10.0.18.445
  • MekanismAdditions-1.16.4-10.0.18.445
  • MekanismGenerators-1.16.4-10.0.18.445
  • MekanismTools-1.16.4-10.0.18.445
  • ImmersiveEngineering-1.16.4-4.1.2-129

@timber-they
Copy link
Author

The crash was prevented in IE by logging an error instead. It's still an error though.

pupnewfster added a commit that referenced this issue Jul 9, 2021
- Remove no longer needed brute force repair item recipe variant as the RepairItemRecipe matches just fine and ensures that curses don't get removed
- Fix formulas for fireworks or other special recipes not properly working depending on how the matches is implemented on the recipe #7262
- Fix the slot targets we define for transferring recipes in the formulaic assemblicator from JEI not working properly/lining up
- Fix using passing the wrong dummy inventory to recipes when crafting in auto mode on the formulaic assemblicator #7022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants