Skip to content

Commit

Permalink
WIP: Improve Instrument and MusicVenueTool overlays.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeronica committed Mar 19, 2024
1 parent 194758d commit 18c2e58
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/generated/resources/assets/mxtune/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"gui.mxtune.button.help.help03": "SHIFT-Hoover over buttons for tips.",
"gui.mxtune.button.import": "Import",
"gui.mxtune.button.import.help01": "Supports 3MLE .mml, Maple Story 2 .ms2mml, and zipped .ms2mml multipart files.",
"gui.mxtune.button.inst_y_pos_slider": "Instrument YPos",
"gui.mxtune.button.left_rs_out.disabled": "Output Disabled",
"gui.mxtune.button.left_rs_out.enabled": "Output Enabled",
"gui.mxtune.button.left_rs_out.help01": "Left Side Redstone Output Toggle",
Expand Down Expand Up @@ -121,6 +122,7 @@
"gui.mxtune.button.save.help03": "A Title and at least one instrument tab must have a melody line. Empty instrument tabs are not allowed.",
"gui.mxtune.button.select": "Select",
"gui.mxtune.button.stop": "Stop",
"gui.mxtune.button.tool_y_pos_slider": "Venue Tool YPos",
"gui.mxtune.button.upload": "Upload",
"gui.mxtune.button.write_music_score": "Make Music Score",
"gui.mxtune.button.write_sheet_music": "Make Sheet Music",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ private void addGuiTexts()
addGuiText("button.member_remove.help01", "Remove: ");
addGuiText("button.member_remove.help02", "Remove the member from the group.");
addGuiText("button.member_remove.help03", "Only the member themselves or the leader may remove. If the leader is the only member, then if the leader removes themself the group is removed too.");

// OverlayManagerScreen
addGuiText("button.inst_y_pos_slider", "Instrument YPos");
addGuiText("button.tool_y_pos_slider", "Venue Tool YPos");
}

private void addChats()
Expand Down
30 changes: 19 additions & 11 deletions src/main/java/aeronicamc/mods/mxtune/gui/OverlayManagerScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -41,23 +42,26 @@ public OverlayManagerScreen(@Nullable Screen parent) {
@Override
protected void init() {
super.init();
setBlitOffset(900);
setBlitOffset(1000);
getMinecraft().keyboardHandler.setSendRepeatsToGui(true);
MXButton doneButton = new MXButton(((width/2) - 25), height-24, 50, 20,
new TranslationTextComponent("gui.done"), done -> onClose());
MXButton doneButton = new MXButton(((width/2)-25), height-24-20, 50, 20,
new TranslationTextComponent("gui.done").withStyle(TextFormatting.GREEN), done -> onDone());
MXButton cancelButton = new MXButton(((width/2)-25), height-24, 50, 20,
new TranslationTextComponent("gui.cancel").withStyle(TextFormatting.YELLOW), cancel -> onClose());
addButton(doneButton);
instYPosSlider.setLayout(doneButton.getLeft() - 150 - 4, height-24, 150, 20);
addButton(cancelButton);
instYPosSlider.setLayout(doneButton.getLeft() - 150 - 4, height-24-20, 150, 20);
instYPosSlider.forceValue(yPosInstrument /100D);
instYPosSlider.setMessage(new StringTextComponent("Instrument VPos"));
instYPosSlider.setMessage(new TranslationTextComponent("gui.mxtune.button.inst_y_pos_slider"));
addButton(instYPosSlider);
instXPosButton.setLayout(instYPosSlider.getLeft() - 54, height-24, 50, 20);
instXPosButton.setLayout(instYPosSlider.getLeft(), height-24, 50, 20);
instXPosButton.setMessage(new TranslationTextComponent(xPosInstrument.getPositionKey()));
addButton(instXPosButton);
toolYPosSlider.setLayout( doneButton.getRight() + 4, height-24, 150, 20);
toolYPosSlider.setLayout( doneButton.getRight() + 4, height-24-20, 150, 20);
toolYPosSlider.forceValue(yPosVenueTool /100D);
toolYPosSlider.setMessage(new StringTextComponent("Venue Tool VPos"));
toolYPosSlider.setMessage(new TranslationTextComponent("gui.mxtune.button.tool_y_pos_slider"));
addButton(toolYPosSlider);
toolXPosButton.setLayout(toolYPosSlider.getRight() + 4, height-24, 50, 20);
toolXPosButton.setLayout(toolYPosSlider.getRight()-50, height-24, 50, 20);
toolXPosButton.setMessage(new TranslationTextComponent(xPosVenueTool.getPositionKey()));
addButton(toolXPosButton);
}
Expand Down Expand Up @@ -115,12 +119,16 @@ public boolean isPauseScreen()
return false;
}

@Override
public void onClose() {
private void onDone() {
MXTuneConfig.CLIENT.instrumentOverlayXPosition.set(xPosInstrument);
MXTuneConfig.CLIENT.instrumentOverlayYPercent.set(yPosInstrument);
MXTuneConfig.CLIENT.venueToolOverlayXPosition.set(xPosVenueTool);
MXTuneConfig.CLIENT.venueToolOverlayYPercent.set(yPosVenueTool);
onClose();
}

@Override
public void onClose() {
getMinecraft().keyboardHandler.setSendRepeatsToGui(false);
if (parent != null)
getMinecraft().setScreen(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public boolean render(int scaledWidth, int scaledHeight, int instIndex, MatrixSt

RenderSystem.pushMatrix();

RenderSystem.translatef(xPos, yPos, 800F + instIndex);
RenderSystem.translatef(xPos, yPos, 0F + instIndex);
RenderSystem.scalef(this.getVisibility(ms), this.getVisibility(ms), 1F);

IOverlayItem.Visibility overlayVisibility = this.overlayItem.render(pPoseStack, ms - this.visibleTime);
Expand Down

0 comments on commit 18c2e58

Please sign in to comment.