Package kr.toxicity.model.api.tracker
Class Tracker
java.lang.Object
kr.toxicity.model.api.tracker.Tracker
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
DummyTracker,EntityTracker
Tracker of a model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassBundler setstatic enumstatic interfaceScheduled packet handler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMultiplier value for convert tracker tick to minecraft tickprotected final TrackerModifierprotected final RenderPipelineprotected ModelRotatorprotected ModelScalerstatic final intTracker tick interval -
Constructor Summary
ConstructorsConstructorDescriptionTracker(@NotNull RenderPipeline pipeline, @NotNull TrackerModifier modifier) Creates tracker -
Method Summary
Modifier and TypeMethodDescriptionbooleanPlayers this animation by oncebooleananimate(@NotNull String animation, AnimationModifier modifier) Players this animation by oncebooleananimate(@NotNull String animation, AnimationModifier modifier, Runnable removeTask) Players this animation by oncebooleananimate(@NotNull Predicate<RenderedBone> filter, @NotNull String animation, @NotNull AnimationModifier modifier, @NotNull Runnable removeTask) Players this animation by oncebooleananimate(@NotNull Predicate<RenderedBone> filter, @NotNull String animation, @NotNull AnimationModifier modifier, @NotNull AnimationEventHandler eventHandler) Players this animation by oncebooleananimate(@NotNull Predicate<RenderedBone> filter, @NotNull BlueprintAnimation animation, @NotNull AnimationModifier modifier, @NotNull Runnable removeTask) Players this animation by oncebooleananimate(@NotNull Predicate<RenderedBone> filter, @NotNull BlueprintAnimation animation, @NotNull AnimationModifier modifier, @NotNull AnimationEventHandler eventHandler) Players this animation by once@Nullable RenderedBoneGets bone by bone's name@Nullable RenderedBonebone(@NotNull Predicate<RenderedBone> predicate) Gets bone by bone's name@Nullable RenderedBoneGets bone by bone's name@NotNull @Unmodifiable Collection<RenderedBone> bones()Gets all bonesvoidclose()protected voidclose(@NotNull Tracker.CloseReason reason) booleancreateHitBox(@NotNull EntityAdapter entity, @NotNull BonePredicate predicate, @Nullable HitBoxListener listener) Creates hitbox based on some entitybooleancreateNametag(@NotNull BonePredicate predicate, @NotNull Consumer<ModelNametag> consumer) Creates nametagvoiddespawn()Despawns this tracker to all players@NotNull Stream<ModelDisplay> displays()Gets all model displaysbooleanbooleanforceUpdate(boolean force) Forces packet update.booleanChecks this tracker is for removalvoidforRemoval(boolean removal) Marks future will remove this trackervoidframe(@NotNull Tracker.ScheduledPacketHandler handler) Runs consumer on frame.voidhandleCloseEvent(@NotNull BiConsumer<Tracker, Tracker.CloseReason> consumer) inthashCode()doubleheight()Gets tracker model's heightbooleanhide(@NotNull org.bukkit.entity.Player player) Hides this tracker to some playerbooleanisClosed()Checks this tracker is closedbooleanisHide(@NotNull org.bukkit.entity.Player player) Checks this player is marked as hidebooleanReturns this model is being scheduled.booleanChecks this player is spawned in this trackerbooleanisSpawned(@NotNull org.bukkit.entity.Player player) Checks this player is spawned in this trackerabstract @NotNull org.bukkit.Locationlocation()Gets location of a model.@NotNull TrackerModifiermodifier()Gets tracker modifier@NotNull Stringname()Gets tracker namebooleanpause(boolean pause) Pauses this tracker's tickvoidperPlayerTick(@NotNull BiConsumer<Tracker, org.bukkit.entity.Player> perPlayerHandler) Runs consumer on tick per player.intGets number of viewed players.booleanremove(@NotNull org.bukkit.entity.Player player) Removes model from player@NotNull ModelRendererrenderer()Gets the renderer of this trackerbooleanreplace(@NotNull String target, @NotNull String animation, @NotNull AnimationModifier modifier) Replaces some animation by loopbooleanreplace(@NotNull Predicate<RenderedBone> filter, @NotNull String target, @NotNull String animation, @NotNull AnimationModifier modifier) Replaces some animation by loopbooleanreplace(@NotNull Predicate<RenderedBone> filter, @NotNull String target, @NotNull BlueprintAnimation animation, @NotNull AnimationModifier modifier) Replaces some animation by loop@NotNull ModelRotationrotation()Gets model rotation.final voidrotation(@NotNull Supplier<ModelRotation> supplier) final voidrotator(@NotNull ModelRotator rotator) @NotNull ModelScalerscaler()voidscaler(@NotNull ModelScaler scaler) voidschedule(long period, @NotNull Tracker.ScheduledPacketHandler handler) Schedules some task.booleanshow(@NotNull org.bukkit.entity.Player player) Shows this tracker to some playerprotected booleanspawn(@NotNull org.bukkit.entity.Player player, @NotNull PacketBundler bundler) Creates model spawn packet and registers player.booleanstopAnimation(@NotNull String animation) Stops some animationbooleanstopAnimation(@NotNull Predicate<RenderedBone> filter, @NotNull String animation) Stops some animationbooleanstopAnimation(@NotNull Predicate<RenderedBone> filter, @NotNull String animation, @Nullable org.bukkit.entity.Player player) Stops some animationvoidRegister this task on next tickvoidtick(long tick, @NotNull Tracker.ScheduledPacketHandler handler) Runs consumer on tick.voidtick(@NotNull Tracker.ScheduledPacketHandler handler) Runs consumer on tick.voidtint(int rgb) Toggles red tint of a model.booleantint(@NotNull BonePredicate predicate, int rgb) Toggles red tint of a model.booleantryUpdate(@NotNull BiPredicate<RenderedBone, BonePredicate> action, @NotNull BonePredicate predicate) Update data of this tracker.protected voidupdate()<T extends TrackerUpdateAction>
voidupdate(T action) Forces update of this tracker.<T extends TrackerUpdateAction>
voidupdate(T action, @NotNull Predicate<RenderedBone> predicate) Forces update of this tracker.<T extends TrackerUpdateAction>
voidupdate(T action, @NotNull BonePredicate predicate) Forces update of this tracker.voidupdateDisplay(@NotNull Predicate<RenderedBone> predicate) Updates itemvoidupdateDisplay(@NotNull BonePredicate predicate) Updates item@NotNull Stream<org.bukkit.entity.Player> Gets viewed players.
-
Field Details
-
TRACKER_TICK_INTERVAL
public static final int TRACKER_TICK_INTERVALTracker tick interval- See Also:
-
MINECRAFT_TICK_MULTIPLIER
public static final int MINECRAFT_TICK_MULTIPLIERMultiplier value for convert tracker tick to minecraft tick- See Also:
-
pipeline
-
modifier
-
rotator
-
scaler
-
-
Constructor Details
-
Tracker
public Tracker(@NotNull @NotNull RenderPipeline pipeline, @NotNull @NotNull TrackerModifier modifier) Creates tracker- Parameters:
pipeline- target instancemodifier- modifier
-
-
Method Details
-
isScheduled
public boolean isScheduled()Returns this model is being scheduled.- Returns:
- is scheduled
-
rotation
Gets model rotation.- Returns:
- rotation
-
rotation
-
rotator
-
scaler
-
scaler
-
task
Register this task on next tick- Parameters:
runnable- task
-
frame
Runs consumer on frame.- Parameters:
handler- handler
-
tick
Runs consumer on tick.- Parameters:
handler- handler
-
tick
Runs consumer on tick.- Parameters:
tick- tickhandler- handler
-
perPlayerTick
public void perPlayerTick(@NotNull @NotNull BiConsumer<Tracker, org.bukkit.entity.Player> perPlayerHandler) Runs consumer on tick per player.- Parameters:
perPlayerHandler- player
-
schedule
Schedules some task.- Parameters:
period- periodhandler- handler
-
update
protected void update() -
name
Gets tracker name- Returns:
- name
-
height
public double height()Gets tracker model's height- Returns:
- height
-
isClosed
public boolean isClosed()Checks this tracker is closed- Returns:
- is closed
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
close
-
despawn
public void despawn()Despawns this tracker to all players -
modifier
Gets tracker modifier- Returns:
- tracker modifier
-
pause
public boolean pause(boolean pause) Pauses this tracker's tick- Parameters:
pause- pause- Returns:
- success
-
forceUpdate
public boolean forceUpdate(boolean force) Forces packet update.- Parameters:
force- force- Returns:
- success
-
spawn
protected boolean spawn(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull PacketBundler bundler) Creates model spawn packet and registers player.- Parameters:
player- target playerbundler- bundler- Returns:
- success
-
remove
public boolean remove(@NotNull @NotNull org.bukkit.entity.Player player) Removes model from player- Parameters:
player- player- Returns:
- success
-
playerCount
public int playerCount()Gets number of viewed players.- Returns:
- viewed player amount
-
viewedPlayer
Gets viewed players.- Returns:
- viewed players list
-
location
@NotNull public abstract @NotNull org.bukkit.Location location()Gets location of a model.- Returns:
- location
-
animate
Players this animation by once- Parameters:
animation- animation's name- Returns:
- success
-
animate
Players this animation by once- Parameters:
animation- animation's namemodifier- modifier- Returns:
- success
-
animate
public boolean animate(@NotNull @NotNull String animation, AnimationModifier modifier, Runnable removeTask) Players this animation by once- Parameters:
animation- animation's namemodifier- modifierremoveTask- remove task- Returns:
- success
-
animate
public boolean animate(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull String animation, @NotNull @NotNull AnimationModifier modifier, @NotNull @NotNull Runnable removeTask) Players this animation by once- Parameters:
filter- bone predicateanimation- animation's namemodifier- modifierremoveTask- remove task- Returns:
- success
-
animate
public boolean animate(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull String animation, @NotNull @NotNull AnimationModifier modifier, @NotNull @NotNull AnimationEventHandler eventHandler) Players this animation by once- Parameters:
filter- bone predicateanimation- animation's namemodifier- modifiereventHandler- event handler- Returns:
- success
-
animate
public boolean animate(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull BlueprintAnimation animation, @NotNull @NotNull AnimationModifier modifier, @NotNull @NotNull Runnable removeTask) Players this animation by once- Parameters:
filter- bone predicateanimation- animationmodifier- modifierremoveTask- remove task- Returns:
- success
-
animate
public boolean animate(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull BlueprintAnimation animation, @NotNull @NotNull AnimationModifier modifier, @NotNull @NotNull AnimationEventHandler eventHandler) Players this animation by once- Parameters:
filter- bone predicateanimation- animationmodifier- modifiereventHandler- event handler- Returns:
- success
-
stopAnimation
Stops some animation- Parameters:
animation- animation's name- Returns:
- success
-
stopAnimation
public boolean stopAnimation(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull String animation) Stops some animation- Parameters:
filter- bone predicateanimation- animation's name- Returns:
- success
-
stopAnimation
public boolean stopAnimation(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull String animation, @Nullable @Nullable org.bukkit.entity.Player player) Stops some animation- Parameters:
filter- bone predicateanimation- animation's nameplayer- player- Returns:
- success
-
replace
public boolean replace(@NotNull @NotNull String target, @NotNull @NotNull String animation, @NotNull @NotNull AnimationModifier modifier) Replaces some animation by loop- Parameters:
target- old animation's nameanimation- new animation's namemodifier- modifier- Returns:
- success
-
replace
public boolean replace(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull String target, @NotNull @NotNull String animation, @NotNull @NotNull AnimationModifier modifier) Replaces some animation by loop- Parameters:
filter- bone predicatetarget- old animation's nameanimation- new animation's namemodifier- modifier- Returns:
- success
-
replace
public boolean replace(@NotNull @NotNull Predicate<RenderedBone> filter, @NotNull @NotNull String target, @NotNull @NotNull BlueprintAnimation animation, @NotNull @NotNull AnimationModifier modifier) Replaces some animation by loop- Parameters:
filter- bone predicatetarget- old animation's nameanimation- new animationmodifier- modifier- Returns:
- success
-
tint
public void tint(int rgb) Toggles red tint of a model.- Parameters:
rgb- toggle
-
tint
Toggles red tint of a model.- Parameters:
predicate- predicatergb- toggle
-
createHitBox
public boolean createHitBox(@NotNull @NotNull EntityAdapter entity, @NotNull @NotNull BonePredicate predicate, @Nullable @Nullable HitBoxListener listener) Creates hitbox based on some entity- Parameters:
entity- entity basepredicate- predicatelistener- listener- Returns:
- success
-
createNametag
public boolean createNametag(@NotNull @NotNull BonePredicate predicate, @NotNull @NotNull Consumer<ModelNametag> consumer) Creates nametag- Parameters:
predicate- predicateconsumer- nametag consumer- Returns:
- success
-
updateDisplay
Updates item- Parameters:
predicate- predicate
-
updateDisplay
Updates item- Parameters:
predicate- predicate
-
update
Forces update of this tracker.- Type Parameters:
T- action type- Parameters:
action- action
-
update
public <T extends TrackerUpdateAction> void update(@NotNull T action, @NotNull @NotNull Predicate<RenderedBone> predicate) Forces update of this tracker.- Type Parameters:
T- action type- Parameters:
action- actionpredicate- predicate
-
update
public <T extends TrackerUpdateAction> void update(@NotNull T action, @NotNull @NotNull BonePredicate predicate) Forces update of this tracker.- Type Parameters:
T- action type- Parameters:
action- actionpredicate- predicate
-
tryUpdate
public boolean tryUpdate(@NotNull @NotNull BiPredicate<RenderedBone, BonePredicate> action, @NotNull @NotNull BonePredicate predicate) Update data of this tracker.- Parameters:
action- actionpredicate- predicate
-
bone
Gets bone by bone's name- Parameters:
name- bone's name- Returns:
- bone or null
-
bone
Gets bone by bone's name- Parameters:
name- bone's name- Returns:
- bone or null
-
bone
Gets bone by bone's name- Parameters:
predicate- bone's predicate- Returns:
- bone or null
-
bones
Gets all bones- Returns:
- all bones
-
displays
Gets all model displays- Returns:
- all model displays
-
hide
public boolean hide(@NotNull @NotNull org.bukkit.entity.Player player) Hides this tracker to some player- Parameters:
player- target player- Returns:
- success
-
isHide
public boolean isHide(@NotNull @NotNull org.bukkit.entity.Player player) Checks this player is marked as hide- Parameters:
player- target player- Returns:
- hide
-
show
public boolean show(@NotNull @NotNull org.bukkit.entity.Player player) Shows this tracker to some player- Parameters:
player- target player- Returns:
- success
-
handleCloseEvent
-
isSpawned
Checks this player is spawned in this tracker- Parameters:
uuid- uuid- Returns:
- is spawned
-
isSpawned
public boolean isSpawned(@NotNull @NotNull org.bukkit.entity.Player player) Checks this player is spawned in this tracker- Parameters:
player- player- Returns:
- is spawned
-
renderer
Gets the renderer of this tracker- Returns:
- renderer
-
forRemoval
@Internal public void forRemoval(boolean removal) Marks future will remove this tracker- Parameters:
removal- removal
-
forRemoval
@Internal public boolean forRemoval()Checks this tracker is for removal- Returns:
- for removal
-
equals
-
hashCode
public int hashCode()
-