Skip to content

Add support for multiline splash text#18

Open
OffsetMonkey538 wants to merge 3 commits intoMoSadie:mainfrom
OffsetMods538:main
Open

Add support for multiline splash text#18
OffsetMonkey538 wants to merge 3 commits intoMoSadie:mainfrom
OffsetMods538:main

Conversation

@OffsetMonkey538
Copy link
Contributor

I'm not sure if this is something that's in scope for this project, but I needed it lol.

I'm not 100% sure if returning an array of texts is the best way to do this though as it creates a bit of boilerplate for just adding basic single line ones...

- return Text.literal("Hello!");
+ return new Text[] { Text.literal("Hello!") };

and with my other project I now need to use a 2d array for getting a random splash...

- private static final Component[] splashes = new Component[] {
-	Component.literal("Hello!"),
- 	Component.literal("Goodbye!")
-};
+ private static final Component[][] splashes = new Component[][] {
+ 	new Component[] { Component.literal("Hello!") },
+ 	new Component[] {
+ 		Component.literal("Goodbye,"),
+ 		Component.literal("cruel World!")
+ 	}
+ };

but I'm sure it's fineeeeeeee, this is Java, we love boilerplate!

@MoSadie
Copy link
Owner

MoSadie commented Mar 5, 2026

Honestly not sure if in scope either but will look at this over the weekend!

@MoSadie MoSadie added the enhancement New feature or request label Mar 5, 2026
@MoSadie MoSadie self-assigned this Mar 5, 2026
@OffsetMonkey538
Copy link
Contributor Author

I think it probably is in scope? Or at least it'd be a bit stupid trying to make a srparate mod for this while having compat with this mod. I guess I'd have to fully overwrite the splashes added by anything (including themes) and just get the multiline ones from a separate source? Would be much better if somehow one could return multiline things from the smm theme.

Maybe a custom SplashText record and builder could be an alternative for the text array? So one could return for example SplashText.builder(Text.whatever()) for a single line text and something like

SplashText.builder()
  .addLine(line1)
  .addLine(line2);

or

SplashText.builder(line1)
  .addLine(line2)

depening on how they like their code formatted.

This would also allow for not forcing people to manually create Text instances with the default yellow color by adding overloads for the builder and addLine methods like SplashText.builder("Hello!")

I may take a look at implementing this later today

@OffsetMonkey538
Copy link
Contributor Author

OffsetMonkey538 commented Mar 6, 2026

okay yes I think this is much better than having it return an array of Text

A simple thing wanting to add a single line splash with no fancy formatting is much simpler than before with an array:

- new Text[] { Text.literal("Very cool splash!").setStyle(Util.DEFAULT_WHATEVEr) }
+ SplashText.builder("Very cool splash!").build()

@MoSadie
Copy link
Owner

MoSadie commented Mar 10, 2026

A builder isn't a bad idea... I do have a thought: If you don't mind, I'd like to save this multi-line change until the next major update (happening soon:tm: with Minecraft 26.1 and the big SMM rebrand) since people will have to update their theme mods anyways!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants