Effective Screen Image
Base class for an image shown on a player's screen. ⚠️ Experimental. The core-shader technique, this API and its behaviour may change; not guaranteed across clients or with shader packs. Registers itself on construction under getNamespacedName (<plugin>:<name>) and refuses duplicates; its PNG is added to the plugin's generated pack as a font glyph (glyph).
The PNG may be any shape — it is padded to a square automatically. Coordinates are screen fractions from the top-left corner (0.0..1.0); getSize is the width as a fraction of the screen width.
object Logo : EffectiveScreenImage() {
override fun getNamespacedData() = ExamplePlugin.instance to "logo"
override fun getTexturePath() = "textures/screen/logo.png"
override fun getX() = 0.05f
override fun getY() = 0.05f
override fun getSize() = 0.25f
fun init() {}
}
Logo.show(player) // until hide()
Logo.show(player, durationTicks = 100)
Logo.hide(player)Notes:
Rendering goes through the framework's
text.vshcore shader in the plugin's pack, so the plugin must enable its pack (EffectiveResourcepack.addServerResourcepackinonEnable, afterinit()).show uses the title slot: one element per player at a time — an image, a text or a fade replaces the previous one. To show several at once, join their getComponents into a single title.
Shader packs (Iris, OptiFine) replace core shaders: for those players the image lands at the raw glyph position instead. EffectiveScreenEffects fade and shake are unaffected.
Properties
The font glyph backing this image; its EffectiveGlyph.charGlyph is the character to send.
Functions
The glyph with the default placement encoded in its color; put it in a title, action bar, boss bar, …
The glyph with an explicit placement encoded in its color (screen fractions, top-left origin).
Owning plugin and a plugin-unique id; together they form the getNamespacedName.
Unique identity as "<plugin-name>:<id>", both lowercased.
Resource path of the PNG inside the plugin jar.
Whether the element stays on player's screen permanently (re-shown automatically on join/respawn/world change).