Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a033ffb
Show full script paths when hovering the script list
claude Oct 17, 2026
7d277e6
Don't let file watcher reloads discard unflushed script changes
claude Oct 17, 2026
3d79397
Allow renaming scripts in the scripting terminal
claude Oct 17, 2026
1e17d8c
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 17, 2026
3882807
Add a focus mode to enlarge the script editor
claude Oct 17, 2026
3af9b5b
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
768523d
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
c4f390e
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
eb3b61e
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
c89ddef
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
5b283b6
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
3635125
Show the focus mode button in the editor toolbar
claude Oct 18, 2026
e7fbd3e
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
eff9318
Keep the full English terminal title next to the toolbar
claude Oct 18, 2026
5355c8b
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
db61a8e
Document focus mode and renaming keys in the info book
claude Oct 18, 2026
3f198b1
Merge branch 'terminal-ux/5-highlighting-performance' into terminal-u…
claude Oct 18, 2026
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 @@ -5,6 +5,7 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.narration.NarratedElementType;
import net.minecraft.client.gui.narration.NarrationElementOutput;
Expand All @@ -16,6 +17,8 @@
import org.cyclops.cyclopscore.helper.Helpers;
import org.cyclops.integratedscripting.Reference;

import javax.annotation.Nullable;

/**
* Shows a confirm/cancel dialog
* @author rubensworks
Expand All @@ -32,10 +35,21 @@ public class WidgetDialog extends AbstractWidget implements GuiEventListener {
private final Component message;
private final ButtonText buttonConfirm;
private final ButtonText buttonCancel;
@Nullable
private final EditBox input;

public WidgetDialog(Font font, int x, int y, Screen parent,
Component title, Component message, Component confirm, Component cancel,
Button.OnPress confirmCallback, Button.OnPress cancelCallback) {
this(font, x, y, parent, title, message, confirm, cancel, confirmCallback, cancelCallback, null);
}

/**
* @param inputValue If not null, a text input is shown with this initial value.
*/
public WidgetDialog(Font font, int x, int y, Screen parent,
Component title, Component message, Component confirm, Component cancel,
Button.OnPress confirmCallback, Button.OnPress cancelCallback, @Nullable String inputValue) {
super(x, y, WIDTH, HEIGHT, message);
this.font = font;
this.parent = parent;
Expand All @@ -44,6 +58,14 @@ public WidgetDialog(Font font, int x, int y, Screen parent,

this.buttonConfirm = new ButtonText(x + 50, y + HEIGHT - 15 - 5, 50, 15, confirm, confirm, confirmCallback, true);
this.buttonCancel = new ButtonText(x + WIDTH - 50 - 50, y + HEIGHT - 15 - 5, 50, 15, cancel, cancel, cancelCallback, true);
if (inputValue != null) {
this.input = new EditBox(font, x + 10, y + 31, WIDTH - 20, 12, message);
this.input.setMaxLength(256);
this.input.setValue(inputValue);
this.input.setFocused(true);
} else {
this.input = null;
}
}

protected void drawBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
Expand All @@ -65,16 +87,33 @@ protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, flo

guiGraphics.drawCenteredString(font, title, this.getX() + this.width / 2, this.getY() + 4, 16777215);
FormattedCharSequence formattedcharsequence = message.getVisualOrderText();
guiGraphics.drawString(font, message, (this.getX() + this.width / 2 - font.width(formattedcharsequence) / 2), (this.getY() + 25), 4210752, false);
guiGraphics.drawString(font, message, (this.getX() + this.width / 2 - font.width(formattedcharsequence) / 2), (this.getY() + (this.input != null ? 19 : 25)), 4210752, false);
if (this.input != null) {
this.input.render(guiGraphics, mouseX, mouseY, partialTicks);
}
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
return this.buttonConfirm.mouseClicked(mouseX, mouseY, mouseButton)
|| this.buttonCancel.mouseClicked(mouseX, mouseY, mouseButton)
|| (this.input != null && this.input.mouseClicked(mouseX, mouseY, mouseButton))
|| super.mouseClicked(mouseX, mouseY, mouseButton);
}

@Nullable
public EditBox getInput() {
return input;
}

public void confirm() {
this.buttonConfirm.onPress();
}

public void cancel() {
this.buttonCancel.onPress();
}

@Override
protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) {
narrationElementOutput.add(NarratedElementType.TITLE, message);
Expand Down
Loading
Loading