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

Unhardcode quad constants #652

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public void processInPlace(BakedQuad quad) {
uv0[0] = (uv0[0] - quad.getSprite().getU0()) * newSprite.contents().width() / quad.getSprite().contents().width() + newSprite.getU0();
uv0[1] = (uv0[1] - quad.getSprite().getV0()) * newSprite.contents().height() / quad.getSprite().contents().height() + newSprite.getV0();
int[] packedTextureData = RenderUtil.packUV(uv0[0], uv0[1]);
quad.getVertices()[4 + i * 8] = packedTextureData[0];
quad.getVertices()[5 + i * 8] = packedTextureData[1];
quad.getVertices()[IQuadTransformer.UV0 + i * IQuadTransformer.STRIDE] = packedTextureData[0];
quad.getVertices()[IQuadTransformer.UV0 + 1 + i * IQuadTransformer.STRIDE] = packedTextureData[1];
}

quad.sprite = newSprite;
}

private static TextureAtlas blockAtlas() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ public void processInPlace(BakedQuad quad) {
uv0[0] = (uv0[0] - quad.getSprite().getU0()) * sprite.contents().width() / quad.getSprite().contents().height() + sprite.getU0();
uv0[1] = (uv0[1] - quad.getSprite().getV0()) * sprite.contents().width() / quad.getSprite().contents().height() + sprite.getV0();
int[] packedTextureData = RenderUtil.packUV(uv0[0], uv0[1]);
quad.getVertices()[4 + i * STRIDE] = packedTextureData[0];
quad.getVertices()[5 + i * STRIDE] = packedTextureData[1];
quad.getVertices()[IQuadTransformer.UV0 + i * IQuadTransformer.STRIDE] = packedTextureData[0];
quad.getVertices()[IQuadTransformer.UV0 + 1 + i * IQuadTransformer.STRIDE] = packedTextureData[1];
RenderUtil.putColorARGB(quad.getVertices(), i, clientExtension.getTintColor());
}
quad.sprite = sprite;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ protected BakedQuad paintQuad(BakedQuad toCopy, TextureAtlasSprite sprite, boole
uv0[0] = (uv0[0] - toCopy.getSprite().getU0()) * sprite.contents().width() / toCopy.getSprite().contents().width() + sprite.getU0();
uv0[1] = (uv0[1] - toCopy.getSprite().getV0()) * sprite.contents().height() / toCopy.getSprite().contents().height() + sprite.getV0();
int[] packedTextureData = RenderUtil.packUV(uv0[0], uv0[1]);
copied.getVertices()[4 + i * 8] = packedTextureData[0];
copied.getVertices()[5 + i * 8] = packedTextureData[1];
copied.getVertices()[IQuadTransformer.UV0 + i * IQuadTransformer.STRIDE] = packedTextureData[0];
copied.getVertices()[IQuadTransformer.UV0 + 1 + i * IQuadTransformer.STRIDE] = packedTextureData[1];
}
return copied;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ public void processInPlace(BakedQuad quad) {
uv0[0] = (uv0[0] - quad.getSprite().getU0()) * sprite.contents().width() / quad.getSprite().contents().width() + sprite.getU0();
uv0[1] = (uv0[1] - quad.getSprite().getV0()) * sprite.contents().height() / quad.getSprite().contents().height() + sprite.getV0();
int[] packedTextureData = RenderUtil.packUV(uv0[0], uv0[1]);
quad.getVertices()[4 + i * STRIDE] = packedTextureData[0];
quad.getVertices()[5 + i * STRIDE] = packedTextureData[1];
quad.getVertices()[IQuadTransformer.UV0 + i * IQuadTransformer.STRIDE] = packedTextureData[0];
quad.getVertices()[IQuadTransformer.UV0 + 1 + i * IQuadTransformer.STRIDE] = packedTextureData[1];
}
quad.sprite = sprite;
}

private TextureAtlasSprite getSpriteForDirection(Direction direction) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ public net.minecraft.client.renderer.RenderStateShard name # name
public net.minecraft.world.inventory.AbstractContainerMenu doClick(IILnet/minecraft/world/inventory/ClickType;Lnet/minecraft/world/entity/player/Player;)V # doClick
# GhostSlot rendering for AbstractContainerScreen
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen renderSlot(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/inventory/Slot;)V # renderSlot

# Set quad sprite after changing it for conduits and painted blocks
public-f net.minecraft.client.renderer.block.model.BakedQuad sprite
Loading