`recalculateRecipe` uses different dummy object for matching validation
timber-they opened this issue ยท 2 comments
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:
- Craft 12 torches with this recipe
- ...in the Formulaic Assemblicator
- 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)
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