Class BillboardStrategy

java.lang.Object
cromveil.combatnumbers.client.render.BillboardStrategy
All Implemented Interfaces:
Strategy
Direct Known Subclasses:
ScreenStrategy, WorldStrategy

public abstract sealed class BillboardStrategy extends Object implements Strategy permits WorldStrategy, ScreenStrategy
Shared base for strategies related to world space rendered text. Both WorldStrategy and ScreenStrategy cull against the view frustum and emit glyphs with an identical face-camera / offset / rotate / scale transform; they differ only in how the glyph anchor is placed and which depth drives the GUI-pixel-to-world scale.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface Strategy

    Strategy.GlyphPlacement
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final net.minecraft.client.renderer.state.level.CameraRenderState
     
    protected final net.minecraft.client.renderer.SubmitNodeCollector
     
    protected final com.mojang.blaze3d.vertex.PoseStack
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BillboardStrategy(com.mojang.blaze3d.vertex.PoseStack ps, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState cam)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract float
    anchor(net.minecraft.world.phys.Vec3 worldPos)
    Translate the pose to this text's anchor and return the GUI-pixel-to-world factor used for the subsequent offset and scale steps.
    net.minecraft.world.phys.Vec3
    Camera position used by the shared driver for distance-based fade and scaling.
    create(RenderOption option, com.mojang.blaze3d.vertex.PoseStack ps, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState cam)
     
    boolean
    Per-text visibility test.
    void
    draw(FloatingText text, int charIndex, boolean perChar, Strategy.GlyphPlacement placement)
    Emit a single glyph (the whole text, or one staggered character).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ps

      protected final com.mojang.blaze3d.vertex.PoseStack ps
    • collector

      protected final net.minecraft.client.renderer.SubmitNodeCollector collector
    • cam

      protected final net.minecraft.client.renderer.state.level.CameraRenderState cam
  • Constructor Details

    • BillboardStrategy

      protected BillboardStrategy(com.mojang.blaze3d.vertex.PoseStack ps, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState cam)
  • Method Details

    • create

      public static BillboardStrategy create(RenderOption option, com.mojang.blaze3d.vertex.PoseStack ps, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState cam)
    • camPos

      public net.minecraft.world.phys.Vec3 camPos()
      Description copied from interface: Strategy
      Camera position used by the shared driver for distance-based fade and scaling.
      Specified by:
      camPos in interface Strategy
    • cull

      public boolean cull(FloatingText text)
      Description copied from interface: Strategy
      Per-text visibility test. Implementations may stash strategy-specific data (e.g. projected screen coordinates) as a side effect.
      Specified by:
      cull in interface Strategy
      Returns:
      true to skip this text
    • draw

      public void draw(FloatingText text, int charIndex, boolean perChar, Strategy.GlyphPlacement placement)
      Description copied from interface: Strategy
      Emit a single glyph (the whole text, or one staggered character).
      Specified by:
      draw in interface Strategy
    • anchor

      protected abstract float anchor(net.minecraft.world.phys.Vec3 worldPos)
      Translate the pose to this text's anchor and return the GUI-pixel-to-world factor used for the subsequent offset and scale steps.