#Add splash text without overwriting the existing?

80 messages · Page 1 of 1 (latest)

glass ingot
#

I was wanting to add new splash text without edits to the original in a way integrated into a minecraft mod

thin nymph
#

find wherever the splashes.txt file is loaded and add your own entries there

glass ingot
#

or other mods doing the same

thin nymph
#

it wouldn’t if you do it from the code

glass ingot
#

so minecraft does not have datagen for it?

thin nymph
#

it has to get loaded at some point, and likely gets put into a list or something you can add your splashes to

#

what does datagen have to do with this?

glass ingot
#

it seems like a data pack feature

#

like how textures are assigned

thin nymph
#

it’s not, datapacks don’t exist if you aren’t in a world (technically they sort of do, but anyway)

#

it’s part of resourcepacks, but like I said you don’t need to use a resourcepack necessarily

glass ingot
#

so resourcepacks do not have a feature to add new entries not touched by mods or other resource packs?

thin nymph
#

what?

#

im confused now

mental heart
#

i think the splash text is a txt file

thin nymph
#

it is

mental heart
#

theres no replace: false

ocean vigil
#

you'll fully replace it

thin nymph
ocean vigil
#

exactly

#

you can load it from a texture pack, but from a different file

glass ingot
#

I do not wish to overwrite splash.txt or whatever the file is as that would break compatibility with resource packs

mental heart
#

botania has code

#

that appends splash

glass ingot
ocean vigil
#

write a resource loader

thin nymph
#

ok, so what I said then

glass ingot
thin nymph
#

pretty much

ocean vigil
#

that's the easy part

mental heart
#

I Love ❤️ Botania tiny_potato

glass ingot
#
  • Botania is Open Source and distributed under the
  • Botania License: http://botaniamod.net/license.php
    gonna read their license to ensure I can do a copy paste of the mixn
    well with different splash
ocean vigil
#

adding your own resource pack handling might take some work

mental heart
#

True...

#

truth

ocean vigil
#

that mixin is too simple to copyright lol

glass ingot
#

gonna have to mod this mixin a bit as it seems things were renamed lol

glass ingot
#

Hmm gonna make my own mixin setup
want to do something unique

glass ingot
# ocean vigil that mixin is too simple to copyright lol
package com.skycatdev.nopeacefuldespawn.mixin;

import net.minecraft.client.gui.screen.SplashTextRenderer;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(SplashTextRenderer.class)
public class SplashExtraMixin {
    public static final SplashTextRenderer SLIMES_COOL = new SplashTextRenderer("Baby slimes are your friend!");
    public static final SplashTextRenderer HUG_CREEPER = new SplashTextRenderer("Don't hug that creeper!");
}``` Would this work?
#

It seems like Mojang heavily refactored their code
in
public class SplashTextRendere there is
public static final SplashTextRenderer MERRY_X_MAS_ = new SplashTextRenderer("Merry X-mas!");
So I would assume this mixin is correct based on
https://www.youtube.com/watch?v=U7j4bl_UAII&t=384s

In this Minecraft Modding Tutorial, I try to explain the fairly complex and intense topic of Mixins for Fabric 1.18.1

== ASSETS & DOWNLOAD LINKS ==
GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.18.1/tree/28-mixins
Gist: https://url.kaupenjoe.net/yt236/gist
Mixin Wiki: https://github.com/SpongePowered/Mixin/wiki

== TI...

▶ Play video
#

"this is actually all there is to it" is what Kaupenjoe said when adding persistentData

#

Big note that I am not messing with NBT and that system itself is already been heavily rewritten by Mojang

glass ingot
#

Note that Intellij could not find usages for what I was trying to copy

thin nymph
#

read what the actual code is doing, and add your own splashes where neccesary like what botania does

glass ingot
#

well that is why I looked for usages

#

I know that the text in what I referenced shows up in game

#

I am confused to why intellij cannot find usages

#

I also checked the "Libraries"

#

same thing

thin nymph
#

did you generate sources?

glass ingot
#

I may have forgotten to do so

#

doing so now

thin nymph
ocean vigil
#

just add your text to SplashTextResourceSupplier

glass ingot
ocean vigil
#

that will return one in random like vanilla

glass ingot
#

Seems there is an outage

#

Oh wait

#

I already set to 1.21.6

#

?????

thin nymph
#

thats just intellij trying to download it, you can ignore that

glass ingot
#

Gotcha weird intellij garbage

#

Yeah I did already set to 1.21.6 and ran in game

ocean vigil
#

you can turn that off

thin nymph
#

it fails cuz minecraft source obv isnt public, theres a setting for it somewhere

glass ingot
#

I hit "don't show again for this project"

glass ingot
#

I made my own way

#

it seems to work!

thin nymph
#

that mixin can be better, id probably WrapOperation the this.splashes.addAll(List) call in apply, and return a new list containing your splashes + whatever was in the original, also wouldn’t have to deal with manually making SplashTextRenderers this way

#

what you have now does work technically, but will likely break if another mod wants to do something similar

#

generally you want to avoid Inject + setReturnValue and use other injectors that are stack if multiple mods target the same thing

glass ingot
#

I want to thank you for merging for 1.21.6

tight gazelle