From 7d1077e387ffb355d4ecc9b74bbe831b1144cd69 Mon Sep 17 00:00:00 2001 From: marcus8448 Date: Sat, 14 Dec 2024 23:07:16 -0800 Subject: [PATCH] fix: rocket workbench screen texture references shuffle textured Graphics parameters shift rocket render with gui height also fix encoding of rocket workbench item data closes #373 --- .../screen/ingame/RocketWorkbenchScreen.java | 12 ++++++----- .../mod/client/util/Graphics.java | 20 +++++++++---------- .../storage/VariableSizedContainer.java | 4 +--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/RocketWorkbenchScreen.java b/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/RocketWorkbenchScreen.java index eedbc298d..77c10e13a 100644 --- a/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/RocketWorkbenchScreen.java +++ b/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/RocketWorkbenchScreen.java @@ -111,7 +111,7 @@ public class RocketWorkbenchScreen extends AbstractContainerScreen 0) { @@ -200,7 +200,7 @@ protected void renderBg(GuiGraphics guiGraphics, float delta, int mouseX, int mo } } - renderEntityInInventory(guiGraphics, this.leftPos + ROCKET_PREVIEW_X, this.topPos + ROCKET_PREVIEW_Y, 15, SmithingScreen.ARMOR_STAND_ANGLE, null, this.entity); + renderEntityInInventory(guiGraphics, this.leftPos + ROCKET_PREVIEW_X, this.topPos + ROCKET_PREVIEW_Y + this.menu.additionalHeight, 15, SmithingScreen.ARMOR_STAND_ANGLE, null, this.entity); } @Override @@ -285,7 +285,7 @@ private void drawSelection(GuiGraphics guiGraphics, int mouseX, int mouseY, floa int size = this.recipes != null ? this.recipes.size() : 0; try (Graphics graphics = Graphics.managed(guiGraphics, this.font)) { - try (Graphics.Texture texture = graphics.texture(Constant.ScreenTexture.ROCKET_WORKBENCH_SCREEN, 512, 512)) { + try (Graphics.Texture texture = graphics.texture(Constant.ScreenTexture.ROCKET_SELECTION, 256, 256)) { texture.blit(0, 0, 0, 0, SELECTION_SCREEN_WIDTH, SELECTION_SCREEN_HEIGHT); { @@ -331,10 +331,12 @@ private void drawSelection(GuiGraphics guiGraphics, int mouseX, int mouseY, floa int y = 8; for (Tab tab : Tab.values()) { if (tab == Tab.COLOR) { - continue; // graphics.renderFakeItem(new ItemStack(Items.RED_DYE), -TAB_WIDTH + TAB_ICON_OFFSET, y); + continue; } else { + guiGraphics.pose().translate(0, 0, 100); RocketPartRendererRegistry.INSTANCE.getRenderer(tab.part).renderGUI(guiGraphics, -TAB_WIDTH + TAB_ICON_OFFSET, y, mouseX, mouseY, delta); + guiGraphics.pose().translate(0, 0, -100); } y += TAB_SPACING + TAB_HEIGHT; } diff --git a/src/main/java/dev/galacticraft/mod/client/util/Graphics.java b/src/main/java/dev/galacticraft/mod/client/util/Graphics.java index e5a21d4ba..3b7811478 100644 --- a/src/main/java/dev/galacticraft/mod/client/util/Graphics.java +++ b/src/main/java/dev/galacticraft/mod/client/util/Graphics.java @@ -314,15 +314,15 @@ private Texture(int texture, int textureWidth, int textureHeight) { Graphics.this.renderers.add(this); } - public void blit(int x, int y, int width, int height, int z, int u, int v) { - this.blit(x, y, width, height, z, u, v, width, height); + public void blit(int x, int y, int z, int u, int v, int width, int height) { + this.blit(x, y, z, width, height, u, v, width, height); } - public void blit(int x, int y, int width, int height, int z, int u, int v, int uWidth, int vHeight) { + public void blit(int x, int y, int z, int width, int height, int u, int v, int uWidth, int vHeight) { this.blitRaw(x, y, x + width, y + height, z, (float) u / this.textureWidth, (float) v / this.textureHeight, (float) (u + uWidth) / this.textureWidth, (float) (v + vHeight) / this.textureHeight); } - public void blit(float x, float y, float width, float height, float z, float u, float v, float uWidth, float vHeight) { + public void blit(float x, float y, float z, float width, float height, float u, float v, float uWidth, float vHeight) { this.blitRaw(x, y, x + width, y + height, z, u / this.textureWidth, v / this.textureHeight, (u + uWidth) / this.textureWidth, (v + vHeight) / this.textureHeight); } @@ -337,20 +337,20 @@ public void blitRaw(float x1, float y1, float x2, float y2, float z, float u1, f .addVertex(matrix, x2, y1, z).setUv(u2, v1); } - public void blit(int x, int y, int width, int height, int u, int v) { - this.blit(x, y, width, height, 0, u, v, width, height); + public void blit(int x, int y, int u, int v, int width, int height) { + this.blit(x, y, 0, width, height, u, v, width, height); } public void blit(int x, int y, int width, int height, int u, int v, int uWidth, int vHeight) { - this.blit(x, y, width, height, 0, u, v, uWidth, vHeight); + this.blit(x, y, 0, width, height, u, v, uWidth, vHeight); } - public void blit(float x, float y, float width, float height, float u, float v) { - this.blit(x, y, width, height, 0.0f, u, v, width, height); + public void blit(float x, float y, float u, float v, float width, float height) { + this.blit(x, y, 0.0f, width, height, u, v, width, height); } public void blit(float x, float y, float width, float height, float u, float v, float uWidth, float vHeight) { - this.blit(x, y, width, height, 0.0f, u, v, uWidth, vHeight); + this.blit(x, y, 0.0f, width, height, u, v, uWidth, vHeight); } private void ensureOpen() { diff --git a/src/main/java/dev/galacticraft/mod/machine/storage/VariableSizedContainer.java b/src/main/java/dev/galacticraft/mod/machine/storage/VariableSizedContainer.java index 0ddb4a54c..591980388 100644 --- a/src/main/java/dev/galacticraft/mod/machine/storage/VariableSizedContainer.java +++ b/src/main/java/dev/galacticraft/mod/machine/storage/VariableSizedContainer.java @@ -178,9 +178,7 @@ public CompoundTag toTag(HolderLookup.Provider provider) { tag.putInt("TargetSize", this.targetSize); ListTag list = new ListTag(); for (ItemStack stack : this.stacks) { - CompoundTag item = new CompoundTag(); - stack.save(provider, item); - list.add(item); + list.add(stack.saveOptional(provider)); } tag.put("Items", list); return tag;