Skip to content

Commit

Permalink
Fixed slot drawing for the drawbridge slot
Browse files Browse the repository at this point in the history
  • Loading branch information
fuj1n committed Jan 11, 2025
1 parent 6e7f895 commit 6520677
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings channel: 'parchment', version: "${mappings_version}-${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

runs {
client {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,6 @@ private void drawSlicedBox(PoseStack stack, int x, int y, int width, int height,
}

public static void blit(PoseStack stack, int x, int y, int w, int h, int minU, int maxU, int minV, int maxV) {
blit(stack, x, y, w, h, minU, maxU, minV, maxV, 256F, 256F);
}

public static void blit(PoseStack stack, int x, int y, int w, int h, int minU, int maxU, int minV, int maxV, float tw, float th) {
innerBlit(stack.last().pose(), x, x + w, y, y + h, 0, minU / tw, maxU / tw, minV / th, maxV / th);
}

private static void innerBlit(Matrix4f matrix, int x1, int x2, int y1, int y2, int blitOffset, float minU, float maxU, float minV, float maxV) {
BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
bufferbuilder.vertex(matrix, (float)x1, (float)y2, (float)blitOffset).uv(minU, maxV).endVertex();
bufferbuilder.vertex(matrix, (float)x2, (float)y2, (float)blitOffset).uv(maxU, maxV).endVertex();
bufferbuilder.vertex(matrix, (float)x2, (float)y1, (float)blitOffset).uv(maxU, minV).endVertex();
bufferbuilder.vertex(matrix, (float)x1, (float)y1, (float)blitOffset).uv(minU, minV).endVertex();
BufferUploader.draw(bufferbuilder.end());
innerBlit(stack.last().pose(), x, x + w, y, y + h, 0, minU / 256F, maxU / 256F, minV / 256F, maxV / 256F);
}
}
1 change: 1 addition & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public net.minecraft.client.gui.GuiComponent m_93112_(Lcom/mojang/math/Matrix4f;IIIIIFFFF)V # innerBlit

0 comments on commit 6520677

Please sign in to comment.