Class AbstractExplorerPanel

Direct Known Subclasses:
FileExplorerPanel, ResourceExplorerPanel

public abstract class AbstractExplorerPanel extends EditorPanel
Abstract base for browser panels (ResourceBrowserPanel, FileExplorerPanel). Provides common rendering logic for tree-based resource browsing.
  • Field Details

    • LOGGER

      protected static final org.slf4j.Logger LOGGER
    • initialized

      protected boolean initialized
  • Constructor Details

    • AbstractExplorerPanel

      protected AbstractExplorerPanel(Panel.Builder builder)
  • Method Details

    • refresh

      protected abstract void refresh()
      Refresh the browser tree structure. Implement to populate nodes.
    • renderBrowser

      protected abstract void renderBrowser()
      Render the main browsing tree. Override for custom layout.
    • openResource

      protected abstract void openResource(net.minecraft.resources.Identifier id)
      Handle opening/editing a resource identified by an Identifier.
    • content

      public final void content()
      Overrides:
      content in class Panel
    • renderSection

      protected void renderSection(String label, String id, Runnable body)
      Renders a collapsible section with a bold framed header. The body runnable is called only when the section is open.
      Parameters:
      label - display label (may include an icon prefix)
      id - unique ImGui ID string (prefix with ##)
      body - content to render inside the section
    • renderNamespaceNode

      protected void renderNamespaceNode(ExplorerNode.ResourceExplorerNode ns)
      Renders a namespace/root resource node and recurses into its children. The node is shown with a cube icon and the namespace name.
    • renderResourceFolder

      protected void renderResourceFolder(ExplorerNode.ResourceExplorerNode folder)
      Renders the contents of a resource folder: sub-folders first, then leaf files.
    • renderResourceFile

      protected void renderResourceFile(net.minecraft.resources.Identifier id)
      Renders a single resource file leaf node. Double-clicking opens the resource; subclasses may override for custom behaviour.
    • generateEditorId

      protected net.minecraft.resources.Identifier generateEditorId(String prefix, String resourcePath)
      Builds a stable, filesystem-safe Identifier for an editor tab from an arbitrary resource path string.
      Parameters:
      prefix - short type hint, e.g. "res" or "res_tex"
      resourcePath - raw resource path (colons, slashes, etc. are sanitised)
    • isResourceOpen

      protected boolean isResourceOpen(net.minecraft.resources.Identifier editorId)
      Returns true if an editor for the given ID is already registered and open.
    • getExistingEditor

      protected @Nullable CodeEditor getExistingEditor(net.minecraft.resources.Identifier editorId)
      If a CodeEditor for editorId already exists, focuses it and returns it. Returns null if no such editor exists yet.