Skip to content

feat: introduce MiniMessageContext to distinguish MiniMessage when rendering - #1437

Open
kashike wants to merge 1 commit into
main/5from
feat/minimessage-context
Open

feat: introduce MiniMessageContext to distinguish MiniMessage when rendering#1437
kashike wants to merge 1 commit into
main/5from
feat/minimessage-context

Conversation

@kashike

@kashike kashike commented Jul 22, 2026

Copy link
Copy Markdown
Member

We currently prevent rendering VirtualComponents through TranslatableComponentRenderer when they are used as arguments to a TranslatableComponent. Supporting them requires extending the renderer and overriding renderTranslatable to restore that behavior, which is not ideal.

@Pablete1234

Copy link
Copy Markdown

Resolves #1299

@masmc05

masmc05 commented Jul 22, 2026

Copy link
Copy Markdown

Maybe instead a VirtualComponentRenderer#translatable() returning a boolean would be better? Then other api usages could indicate if the component is translatable, with a default method always returning true, while minimessage always returning false

@Pablete1234

Copy link
Copy Markdown

Thing is, more than if the virtual component is translatable or not, the thing in question is if it can be rendered at all, or if its just a piece of context that shall remain untouched when inside translatable components, so that a translator (minimessage's translator in this case) can take care of it.

In these cases, it does make sense that the context type is a dummy class because its explicitly being marked as cannot-and-shouldnot-render-this, the context type isnt needed.

I do think a more generic name for this context type could be used but i can't come up with anything better.

@masmc05

masmc05 commented Jul 22, 2026

Copy link
Copy Markdown

I still consider that forcing a specific context type for virtual components that are such data holders is wrong. Some may want this renderer to ignore the component, while a different non-adventure renderer to still render it. And also in the future if a new adventure renderer would need to handle them differently again this approach would force either both ignored or none.
A different solution to this if the method isn't good would be a marker interface. If the renderer implements it then it would be ignored (and all minimessage ones would implement it)

@kashike

kashike commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

The naming of such a marker interface is difficult - do you have any suggestions? Keep in mind that this is, currently, only applicable when the VirtualComponent is a TranslatableComponent argument.

@masmc05

masmc05 commented Jul 23, 2026

Copy link
Copy Markdown

TranslationOpaque sounds like a good fit

@kashike

kashike commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

What about just adding a method to VirtualComponentRenderer? Something like:

  default boolean skipRenderingWhenUsedAsTranslationArgument(final VirtualComponent component) {
    return false;
  }

…lationArgument to control skipping in translatable renderers
@kashike
kashike force-pushed the feat/minimessage-context branch from d9844df to f5690d3 Compare July 24, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants