Class Snapshot<S>
java.lang.Object
privbot.ui.overlay.Snapshot<S>
- Type Parameters:
S- the published value; make it immutable (a record-style class or a copied bean)
- All Implemented Interfaces:
Supplier<S>
State published on the game tick and read on the render thread.
On Impact the overlay renderer runs on the game's render thread, where a client hook
(GameThread.ensure) times out; the working overlays all follow the same idiom — copy what
the overlay needs into plain fields on the tick, read only those in render. This type is
that idiom with a name: a plugin publishes an immutable value from its tick
handler and hands the same holder to PrivBotOverlays, whose composers receive the value and
nothing else.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Forget the value; overlays composed from this snapshot stop rendering until the next publish.static <S> Snapshot<S> empty()A snapshot with nothing published yet; overlays reading it draw nothing until the first publish.get()The current value, or null when nothing has been published (render thread).booleanisEmpty()True when nothing is published (never published, or cleared).static <S> Snapshot<S> of(S initial) A snapshot that starts withinitial(may be null).voidReplace the published value (tick thread).
-
Method Details
-
empty
A snapshot with nothing published yet; overlays reading it draw nothing until the first publish. -
of
A snapshot that starts withinitial(may be null). -
publish
Replace the published value (tick thread). -
clear
public void clear()Forget the value; overlays composed from this snapshot stop rendering until the next publish. -
get
-
isEmpty
public boolean isEmpty()True when nothing is published (never published, or cleared).
-