Immersive Engineering

Immersive Engineering

134M Downloads

[1.16.4] Workbench renderer for manual Workbench stuck in infinite loop if output is not drawable

kindlich opened this issue ยท 0 comments

commented

Description of the issue:

When AutoWorkbenchRenderer.getBlueprintDrawable(Recipe, World) returns null, then the loop counter inside ModWorkbenchRenderer#render is not updated and the game will get stuck there.

Here's a link to the code in question (line 88 is the aforementioned loop counter increment)

for(int i = 0; i < l; )
{
BlueprintCraftingRecipe recipe = recipes[i%recipes.length];
BlueprintLines blueprint = recipe==null?null: AutoWorkbenchRenderer.getBlueprintDrawable(recipe, te.getWorldNonnull());
if(blueprint!=null)
{
double dX = i < perRow?(.93725/scale-perRow*16.6)+i*16.6: (.70375/scale-i%perRow*16.6);
double dY = i < perRow?0: -.15625;
matrixStack.translate(dX, dY/scale, 0);
//Width depends on distance
float texScale = blueprint.textureScale/16f;
matrixStack.scale(1/texScale, 1/texScale, 1/texScale);
blueprint.draw(lineWidth, matrixStack, bufferIn);
matrixStack.scale(texScale, texScale, texScale);
matrixStack.translate(-dX, -dY/scale, 0);
i++;
}
}

This is due to the loop counter also being used as position for the renderer.
Moving the increment of the counter out solves the rendering loop but can cause gaps in the rendered outputs.

This image is after moving the i++ out of the if block.
image

Crashlog:

None - game gets stuck, but does not crash.

Versions & Modlist

Development instance (based on commit 0d13b23).
No other mods than the ones listed in the build.gradle (plus a maven dep for CraftTweaker, version 7.1.0.77)

Reproduction Steps

Add a recipe with an output that has no BlueprintDrawable associated with it.
In my case, I created a recipe Bedrock -> Iron Block via the CraftTweaker integration I'm working on.

Only happens in the manual workbench, the renderer for the Automatic workbench and the ItemFrame handle this case more gracefully (same blueprint as above, both set to the iron block result):
image