An simple core shader allows you make multiple layer text component.
There's some issues in minecraft font and text display component.
- Text's ascent value cannot be more than it's height.
- If two different images overlapped, z-fighting problem is occurred.
But, this core shader removes all of this problem!
Normal core shader, occurring z-fighting problem.
My shader. no z-fighting!
{"type":"bitmap","file":"betterhealthbar:default_layout/image/1/empty_empty.png","ascent":-8192,"height":4,"chars":[""]}
First, you should minuse -8192 to your font ascent.
{"type":"bitmap","file":"betterhealthbar:splitter.png","ascent":-9999,"height":-2,"chars":[""]}
Then, merge your image by space font.
{"type":"space","advances":{"":-8192,"":-8191,"":-8190,"":-8189,"":-8188,"":-8187}}
Don't forget to use spliitter!
val display = TextDisplay(EntityType.TEXT_DISPLAY, (player.world as CraftWorld).handle).apply {
billboardConstraints = Display.BillboardConstraints.CENTER //Must!!!!!!!
entityData.run {
set(Display.DATA_POS_ROT_INTERPOLATION_DURATION_ID, 1)
set(TextDisplay.DATA_BACKGROUND_COLOR_ID, 0)
set(TextDisplay.DATA_LINE_WIDTH_ID, Int.MAX_VALUE)
}
brightnessOverride = Brightness(15, 15)
text = PaperAdventure.asVanilla(component)
}
And, you can use display or amor stand. but don't forget to set the billboard of display to CENTER!
Now, you have to modify image's alpha value to 1~254 (the greater, the higher layer.)