Class CodeEditor


public class CodeEditor extends EditorPanel
InGame Code editor. May be replaced with MonacoFx at some point IDK yet.
  • Field Details

    • customLangOverride

      public boolean customLangOverride
    • forceReadOnly

      public boolean forceReadOnly
  • Constructor Details

    • CodeEditor

      public CodeEditor(net.minecraft.resources.Identifier id, String fileName, String source)
      Creates a new CodeEditor panel.
      Parameters:
      id - Unique resource identifier for the panel.
      fileName - Display name shown in the title bar and status bar.
      source - Initial source text to populate the editor.
  • Method Details

    • load

      public void load(String fileName, String source)
      Replaces the current file content with new data and resets editor state. Error markers and unsaved-changes flag are cleared.
      Parameters:
      fileName - New display name.
      source - New source text.
    • isDirty

      public boolean isDirty()
      Returns true if the editor content differs from the last saved state.
    • content

      public void content()
      Overrides:
      content in class Panel
    • onClosed

      public void onClosed()
      Overrides:
      onClosed in class Panel
    • setSaveCallback

      public void setSaveCallback(CodeEditor.SaveCallback saveCallback)
      Registers a new save callback, replacing any previously set one.
    • getTextEditor

      public imgui.extension.texteditor.TextEditor getTextEditor()
      Returns the underlying TextEditor for advanced configuration.
    • getFontScale

      public float getFontScale()
      Returns the current font-scale multiplier (default 1.0f).
    • setFontScale

      public void setFontScale(float fontScale)
      Directly sets the font-scale multiplier.
      Parameters:
      fontScale - Value clamped to [FONT_SCALE_MIN, FONT_SCALE_MAX].