diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/GenshinConsentScreen.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/GenshinConsentScreen.java index ddc4572..371d7ea 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/GenshinConsentScreen.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/GenshinConsentScreen.java @@ -4,9 +4,9 @@ import java.util.List; import com.cstav.genshinstrument.client.config.ModClientConfigs; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.ChatFormatting; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.multiplayer.WarningScreen; @@ -92,8 +92,8 @@ protected void init() { } @Override - protected void renderTitle(GuiGraphics gui) { - gui.drawCenteredString(font, title, width/2, 30, Color.WHITE.getRGB()); + protected void renderTitle(PoseStack poseStack) { + drawCenteredString(poseStack, font, title, width/2, 30, Color.WHITE.getRGB()); } diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteButton.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteButton.java index deab928..10b772a 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteButton.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteButton.java @@ -291,7 +291,7 @@ protected void renderAccidentals(final PoseStack poseStack) { } protected void renderAccidental(final PoseStack poseStack, int index) { - renderAccidental(pos, index, 0, 0); + renderAccidental(poseStack, index, 0, 0); } protected void renderAccidental(PoseStack poseStack, int index, int offsetX, int offsetY) { final int textureWidth = (int)(width * FLAT_TEXTURE_WIDTH_MULTIPLIER * ( @@ -303,7 +303,10 @@ protected void renderAccidental(PoseStack poseStack, int index, int offsetX, int final int spritePartHeight = textureHeight/3; - gui.blit(accidentalsLocation, + + ClientUtil.displaySprite(accidentalsLocation); + + blit(poseStack, getX() - 9 + offsetX, getY() - 6 + offsetY, // Handle sharp imperfections isPlaying() ? textureWidth/2 : 0, (spritePartHeight) * index - index, diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGrid.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGrid.java index a3aa8ca..29575ee 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGrid.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGrid.java @@ -108,9 +108,9 @@ public AbstractWidget initNoteGridWidget(final float vertAlignment, final int sc final RowHelper rowHelper = grid.createRowHelper(rows); forEach(rowHelper::addChild); - grid.arrangeElements(); - FrameLayout.alignInRectangle(grid, 0, 0, screenWidth, screenHeight, 0.5f, vertAlignment); - grid.arrangeElements(); + grid.pack(); + FrameWidget.alignInRectangle(grid, 0, 0, screenWidth, screenHeight, 0.5f, vertAlignment); + grid.pack(); // Initialize all the notes forEach(NoteButton::init); diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/options/instrument/AbstractInstrumentOptionsScreen.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/options/instrument/AbstractInstrumentOptionsScreen.java index 5363a44..6a11a55 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/options/instrument/AbstractInstrumentOptionsScreen.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/options/instrument/AbstractInstrumentOptionsScreen.java @@ -132,13 +132,13 @@ protected void init() { initOptionsGrid(grid, rowHelper); + grid.pack(); - - FrameLayout.alignInRectangle(grid, 0, 0, width, height, 0.5f, 0); - grid.visitWidgets(this::addRenderableWidget); - - grid.arrangeElements(); + FrameWidget.alignInRectangle(grid, 0, 0, width, height, 0.5f, 0); grid.setY(40); + + grid.pack(); + addRenderableWidget(grid); final Button doneBtn = Button.builder(CommonComponents.GUI_DONE, (btn) -> onClose()) @@ -150,7 +150,7 @@ protected void init() { } - protected void initAudioSection(final GridLayout grid, final RowHelper rowHelper) { + protected void initAudioSection(final GridWidget grid, final RowHelper rowHelper) { final CycleButton instrumentChannel = CycleButton.builder((soundType) -> Component.translatable(SOUND_CHANNEL_KEY +"."+ soundType.toString().toLowerCase()) ) @@ -211,7 +211,7 @@ private static double divisibleBy5(double number) { rowHelper.addChild(stopMusic); } - protected void initVisualsSection(final GridLayout grid, final RowHelper rowHelper) { + protected void initVisualsSection(final GridWidget grid, final RowHelper rowHelper) { final CycleButton emitRing = CycleButton.booleanBuilder(CommonComponents.OPTION_ON, CommonComponents.OPTION_OFF) .withInitialValue(ModClientConfigs.EMIT_RING_ANIMATION.get()) @@ -258,10 +258,10 @@ protected void initVisualsSection(final GridLayout grid, final RowHelper rowHelp * @param grid The settings grid to add the widgets to * @param rowHelper A row helper for the specified {@code grid} */ - protected void initOptionsGrid(final GridLayout grid, final RowHelper rowHelper) { + protected void initOptionsGrid(final GridWidget grid, final RowHelper rowHelper) { initAudioSection(grid, rowHelper); - rowHelper.addChild(SpacerElement.height(15), 2); + rowHelper.addChild(SpacerWidget.height(15), 2); initVisualsSection(grid, rowHelper); } diff --git a/src/main/java/com/cstav/genshinstrument/networking/ModPacketHandler.java b/src/main/java/com/cstav/genshinstrument/networking/ModPacketHandler.java index b6bfa90..6019474 100644 --- a/src/main/java/com/cstav/genshinstrument/networking/ModPacketHandler.java +++ b/src/main/java/com/cstav/genshinstrument/networking/ModPacketHandler.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.function.Consumer; -import com.cstav.genshinstrument.GInstrumentMod; import com.cstav.genshinstrument.networking.buttonidentifier.DrumNoteIdentifier; import com.cstav.genshinstrument.networking.buttonidentifier.NoteButtonIdentifier; import com.cstav.genshinstrument.networking.buttonidentifier.NoteGridButtonIdentifier;