Roughly Enough Items Fabric/Forge/NeoForge (REI)

Roughly Enough Items Fabric/Forge/NeoForge (REI)

38M Downloads

[Bug] Recipe Exporting not working

Noaaan opened this issue ยท 5 comments

commented

What happened?

Recipe exports do not produce real images, and do not throw any errors.
Example recipe:
image

Should produce the recipe, instead produces image linked below:
https://github.com/shedaniel/RoughlyEnoughItems/assets/4163353/f275cbea-7a7b-400f-8893-c9acd771bce9

What mod loaders are you seeing the problem on?

Fabric

What do you think this bug is of?

  • Visual
  • Recipe Lookup
  • Cheat Mode
  • Plugin Integration / JEI Plugin Compatibility
  • Others

Relevant log output

No relevant log output, the action is completed without errors.

Anything else?

Tested with REI build 12.0.622 and 12.0.625, running architechtury 9.0.5 and cloth 11.0.99

By submitting this issue, I have included the necessary logs by pasting the contents into the correct location or attaching the file as an upload.

  • Yes, and I did not use any paste services other than GitHub Gists.

By submitting this issue, I have confirmed my REI and REI's dependencies are up to date.

  • Yes
commented

Same here with version 12.0.626 with architectury 9.1.10 and cloth config 11.1.106

commented

+1 on REI 12.0.645 + Architectury 9.1.12

commented

also on architectury-fabric:9.1.12 cloth-config-fabric:11.1.106 RoughlyEnoughItems-fabric:12.0.652

commented

+1

commented

While I do not have a solution currently, I have identified that the issue is caused by the common code present in the RecipeDisplayExporter. This can be confirmed by the fact that this doesn't work on Forge either. Messing around with it it seems that the items are now being flipped and translated off-screen, and not correctly aligned. Simply put - the items and GUI for the recipe aren't inside the buffer, so they are not drawn correctly before exporting.

The code for copying the image is fine, so the culprit is in the attached source code below:

private static void exportRecipe(Rectangle rectangle, DisplaySpec display, List<Widget> widgets) {
Minecraft client = Minecraft.getInstance();
Window window = client.getWindow();
RenderTarget renderTarget = new TextureTarget(window.getWidth(), window.getHeight(), true, false);
renderTarget.bindWrite(true);
RenderSystem.clear(256, Minecraft.ON_OSX);
Matrix4f matrix4f = new Matrix4f().setOrtho(0.0F, (float) ((double) window.getWidth() / window.getGuiScale()), 0.0F, (float) ((double) window.getHeight() / window.getGuiScale()), 1000.0F, 3000.0F);
RenderSystem.setProjectionMatrix(matrix4f);
PoseStack poseStack = RenderSystem.getModelViewStack();
poseStack.pushPose();
poseStack.setIdentity();
poseStack.translate(0.0D, 0.0D, -2000.0D);
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
PoseStack matrices = new PoseStack();
for (Widget widget : widgets) {
widget.render(matrices, -1, -1, 0);
}
NativeImage nativeImage = new NativeImage(renderTarget.width, renderTarget.height, false);
RenderSystem.bindTexture(renderTarget.getColorTextureId());
nativeImage.downloadTexture(0, false);
nativeImage.flipY();
int outWidth = (int) (rectangle.width * window.getGuiScale());
int outHeight = (int) (rectangle.height * window.getGuiScale());
NativeImage strippedImage = new NativeImage(outWidth, outHeight, false);