Class WorldLabelComp

java.lang.Object
mindustry.entities.comp.WorldLabelComp
All Implemented Interfaces:
arc.math.geom.Position, mindustry.gen.Drawc, mindustry.gen.Entityc, mindustry.gen.Posc, mindustry.gen.Syncc

public abstract class WorldLabelComp extends Object implements mindustry.gen.Posc, mindustry.gen.Drawc, mindustry.gen.Syncc
Component/entity for labels in world space. Useful for servers. Does not save in files - create only on world load.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
    Duration in seconds.
     
    static final byte
     
    static final byte
     
    static final byte
     
    static final byte
     
    static final byte
     
    byte
    Flags are packed into a byte for sync efficiency; see the flag static values.
    float
     
    mindustry.gen.Posc
    If not null, this label gets set to the parent position with x, y used as offsets.
     
    float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float
     
    void
     
    static void
    drawAt(String text, float x, float y, float layer, int flags, float fontSize, int align, int lineAlign)
     
    void
    This MUST be called instead of remove()!
    void
    hide(mindustry.gen.Player player)
    Hides this player-specific label.
    void
    show(mindustry.gen.Player player)
    Makes this label visible only to the specific player.
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface mindustry.gen.Entityc

    add, afterRead, afterReadAll, as, beforeWrite, classId, id, id, isAdded, isLocal, isRemote, read, self, serialize, write

    Methods inherited from interface mindustry.gen.Posc

    blockOn, buildOn, floorOn, getX, getY, onSolid, set, set, tileOn, tileX, tileY, trns, trns, x, x, y, y

    Methods inherited from interface arc.math.geom.Position

    angleTo, angleTo, dst, dst, dst2, dst2, within, within

    Methods inherited from interface mindustry.gen.Syncc

    afterSync, handleSyncHidden, interpolate, isSyncHidden, lastUpdated, lastUpdated, readSync, readSyncManual, remove, snapInterpolation, snapSync, updateSpacing, updateSpacing, writeSync, writeSyncManual
  • Field Details

    • flagBackground

      public static final byte flagBackground
      See Also:
    • flagOutline

      public static final byte flagOutline
      See Also:
    • flagAlignLeft

      public static final byte flagAlignLeft
      See Also:
    • flagAlignRight

      public static final byte flagAlignRight
      See Also:
    • flagAutoscale

      public static final byte flagAutoscale
      See Also:
    • text

      public String text
    • fontSize

      public float fontSize
    • z

      public float z
    • flags

      public byte flags
      Flags are packed into a byte for sync efficiency; see the flag static values.
    • parent

      @Nullable public mindustry.gen.Posc parent
      If not null, this label gets set to the parent position with x, y used as offsets.
    • duration

      public transient float duration
      Duration in seconds. Ignored if negative
    • expired

      @Nullable public transient Runnable expired
  • Constructor Details

    • WorldLabelComp

      public WorldLabelComp()
  • Method Details

    • clipSize

      public float clipSize()
      Specified by:
      clipSize in interface mindustry.gen.Drawc
    • update

      public void update()
      Specified by:
      update in interface mindustry.gen.Entityc
      Specified by:
      update in interface mindustry.gen.Syncc
    • draw

      public void draw()
      Specified by:
      draw in interface mindustry.gen.Drawc
    • drawAt

      public static void drawAt(String text, float x, float y, float layer, int flags, float fontSize, int align, int lineAlign)
    • show

      public void show(mindustry.gen.Player player)
      Makes this label visible only to the specific player. This must be called instead of add().
    • hide

      public void hide(mindustry.gen.Player player)
      Hides this player-specific label. If you used show(Player) previously, you must call this method instead of hide()!
    • hide

      public void hide()
      This MUST be called instead of remove()!