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

[Bug Report?] Auto-position slots are misaligned by 1 pixel on some inventories #4

Open
Abbanon opened this issue May 15, 2021 · 1 comment
Labels
wontfix This will not be worked on

Comments

@Abbanon
Copy link

Abbanon commented May 15, 2021

Using auto-positioning, I've noticed that the slots applied to the following Screen Classes are offset by 1 pixel (being 1 pixel lower than the rest of the GUI):

  • net.minecraft.class_476 (Chest, Large Chest, Ender Chest, Barrel)
  • net.minecraft.class_495 (Shulker Box)

Example of class_476 and class_495 misalignment:
Screenshot_5

Example of every other inventory:
Screenshot_8

@deirn
Copy link
Member

deirn commented May 15, 2021

You can blame Mojang for this, a snippet of class_476's draw method:

protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
    RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.client.getTextureManager().bindTexture(TEXTURE);
    int i = (this.width - this.backgroundWidth) / 2;
    int j = (this.height - this.backgroundHeight) / 2;
    this.drawTexture(matrices, i, j, 0, 0, this.backgroundWidth, this.rows * 18 + 17);
    this.drawTexture(matrices, i, j + this.rows * 18 + 17, 0, 126, this.backgroundWidth, 96);
}

The second drawTexture v is supposed to be 125 and the height is 97

-   this.drawTexture(matrices, i, j + this.rows * 18 + 17, 0, 126, this.backgroundWidth, 96);
+   this.drawTexture(matrices, i, j + this.rows * 18 + 17, 0, 125, this.backgroundWidth, 97);

this wrong value resulted in this line not rendered

texture in-game screenshot
mojank0 mojank1

Since cpas use backgroundHeight to determine the placement, which is the correct height texture wise, it placed the slot in the correct place.

@deirn deirn added the wontfix This will not be worked on label May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Development

No branches or pull requests

2 participants