Documentation Index
Fetch the complete documentation index at: https://mintlify.com/toxicity188/BetterModel/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The TrackerUpdateAction sealed interface represents an action that updates the state of a RenderedBone. Actions can modify display properties like brightness, glow, item stack, billboard mode, and more. They are applied to bones matching a specific predicate.
Package: kr.toxicity.model.api.tracker
Since: 1.15.2
Interface Methods
test
boolean test(@NotNull RenderedBone bone, @NotNull BonePredicate predicate)
Applies the action to a bone if it matches the predicate.
Parameters:
bone - The target bone
predicate - The predicate to check against
Returns: true if the bone was updated
then
default @NotNull TrackerUpdateAction then(@NotNull TrackerUpdateAction action)
Chains this action with another action.
Parameters:
Returns: The combined action
stream
default @NotNull Stream<TrackerUpdateAction> stream()
Returns a stream of actions (useful for flattening composites).
Returns: The stream of actions
Factory Methods
brightness
static @NotNull Brightness brightness(int block, int sky)
Creates an action to update display brightness.
Parameters:
block - The block light level (0-15)
sky - The skylight level (0-15)
Returns: The brightness action
glow
static @NotNull Glow glow(boolean glow)
Creates an action to toggle the glowing effect.
Parameters:
glow - true to enable glow
Returns: The glow action
glowColor
static @NotNull GlowColor glowColor(int glowColor)
Creates an action to set the glow color.
Parameters:
glowColor - The RGB glow color (hex format)
Returns: The glow color action
viewRange
static @NotNull ViewRange viewRange(float viewRange)
Creates an action to set the view range.
Parameters:
viewRange - The view range in blocks
Returns: The view range action
tint
static @NotNull Tint tint(int rgb)
Creates an action to apply a tint color.
Parameters:
rgb - The RGB tint color (hex format)
Returns: The tint action
previousTint
static @NotNull PreviousTint previousTint()
Creates an action to revert to the previous tint.
Returns: The previous tint action
enchant
static @NotNull Enchant enchant(boolean enchant)
Creates an action to toggle the enchanted glint effect.
Parameters:
enchant - true to enable glint
Returns: The enchant action
togglePart
static @NotNull TogglePart togglePart(boolean toggle)
Creates an action to toggle the visibility of a part.
Parameters:
toggle - true to show, false to hide
Returns: The toggle part action
itemStack
static @NotNull ItemStack itemStack(@NotNull TransformedItemStack itemStack)
Creates an action to update the displayed item stack.
Parameters:
itemStack - The new item stack
Returns: The item stack action
billboard
static @NotNull Billboard billboard(@NotNull PlatformBillboard billboard)
Creates an action to set the billboard constraint.
Parameters:
billboard - The billboard type (FIXED, VERTICAL, HORIZONTAL, CENTER)
Returns: The billboard action
itemMapping
static @NotNull ItemMapping itemMapping()
Creates an action to update the item mapping.
Returns: The item mapping action
moveDuration
static @NotNull MoveDuration moveDuration(int moveDuration)
Creates an action to set the movement interpolation duration.
Parameters:
moveDuration - The duration in ticks
Returns: The move duration action
composite
static @NotNull TrackerUpdateAction composite(@NotNull TrackerUpdateAction... actions)
Combines multiple actions into a single composite action.
Parameters:
actions - The actions to combine
Returns: The composite action
perBone
static @NotNull PerBone perBone(@NotNull Function<RenderedBone, TrackerUpdateAction> builder)
Creates an action that generates a specific action for each bone.
Parameters:
builder - The function to generate actions
Returns: The per-bone action
none
static @NotNull None none()
Returns a no-op action.
Returns: The none action
Action Types
Brightness
record Brightness(int block, int sky)
Updates the display brightness (light levels).
Glow
enum Glow { TRUE, FALSE }
Toggles the glowing effect.
GlowColor
record GlowColor(int glowColor)
Sets the glow color (RGB hex).
ViewRange
record ViewRange(float viewRange)
Sets the view range in blocks.
Enchant
enum Enchant { TRUE, FALSE }
Toggles the enchantment glint effect.
Tint
Applies a color tint (RGB hex).
PreviousTint
enum PreviousTint { INSTANCE }
Reverts to the previous tint.
TogglePart
enum TogglePart { TRUE, FALSE }
Toggles part visibility (show/hide).
ItemStack
record ItemStack(@NotNull TransformedItemStack itemStack)
Updates the displayed item stack.
Billboard
record Billboard(@NotNull PlatformBillboard billboard)
Sets the billboard constraint mode.
ItemMapping
enum ItemMapping { INSTANCE }
Updates the item mapping.
MoveDuration
record MoveDuration(int moveDuration)
Sets movement interpolation duration.
Composite
record Composite(@NotNull @Unmodifiable List<TrackerUpdateAction> actions)
Combines multiple actions.
PerBone
record PerBone(@NotNull Function<RenderedBone, TrackerUpdateAction> builder)
Generates dynamic actions per bone.
None
No-op action.
Usage Examples
Basic Updates
import kr.toxicity.model.api.tracker.Tracker;
import kr.toxicity.model.api.tracker.TrackerUpdateAction;
Tracker tracker = ...;
// Set brightness to full
tracker.update(TrackerUpdateAction.brightness(15, 15));
// Enable glow effect
tracker.update(TrackerUpdateAction.glow(true));
// Set glow color to red
tracker.update(TrackerUpdateAction.glowColor(0xFF0000));
// Apply red tint
tracker.update(TrackerUpdateAction.tint(0xFF0000));
// Remove tint
tracker.update(TrackerUpdateAction.previousTint());
// Enable enchant glint
tracker.update(TrackerUpdateAction.enchant(true));
// Hide part
tracker.update(TrackerUpdateAction.togglePart(false));
Filtered Updates
import kr.toxicity.model.api.util.function.BonePredicate;
// Update specific bones
tracker.update(
TrackerUpdateAction.glow(true),
BonePredicate.name("weapon")
);
// Update bones with tag
tracker.update(
TrackerUpdateAction.brightness(15, 15),
BonePredicate.tag("glowing_part")
);
// Update using custom predicate
tracker.update(
TrackerUpdateAction.tint(0x00FF00),
bone -> bone.name().toString().contains("armor")
);
Composite Actions
// Combine multiple actions
TrackerUpdateAction action = TrackerUpdateAction.composite(
TrackerUpdateAction.glow(true),
TrackerUpdateAction.glowColor(0xFF0000),
TrackerUpdateAction.brightness(15, 15)
);
tracker.update(action);
// Chain actions using then()
TrackerUpdateAction chained = TrackerUpdateAction.glow(true)
.then(TrackerUpdateAction.glowColor(0xFF0000))
.then(TrackerUpdateAction.brightness(15, 15));
tracker.update(chained);
Per-Bone Dynamic Actions
// Different action for each bone
TrackerUpdateAction perBone = TrackerUpdateAction.perBone(bone -> {
String name = bone.name().toString();
if (name.contains("weapon")) {
return TrackerUpdateAction.glow(true);
} else if (name.contains("armor")) {
return TrackerUpdateAction.tint(0x0000FF);
} else {
return TrackerUpdateAction.none();
}
});
tracker.update(perBone);
Billboard Modes
import kr.toxicity.model.api.platform.PlatformBillboard;
// Make bone always face player
tracker.update(
TrackerUpdateAction.billboard(PlatformBillboard.CENTER),
BonePredicate.name("nameplate")
);
// Vertical billboard (rotates on Y axis only)
tracker.update(
TrackerUpdateAction.billboard(PlatformBillboard.VERTICAL),
BonePredicate.name("healthbar")
);
Item Stack Updates
import kr.toxicity.model.api.util.TransformedItemStack;
// Change displayed item
TransformedItemStack newItem = TransformedItemStack.of(
Material.DIAMOND_SWORD,
1
);
tracker.update(
TrackerUpdateAction.itemStack(newItem),
BonePredicate.name("weapon_bone")
);
Movement Interpolation
// Smooth movement (10 ticks interpolation)
tracker.update(TrackerUpdateAction.moveDuration(10));
// Instant movement (no interpolation)
tracker.update(TrackerUpdateAction.moveDuration(0));
// Slower movement (20 ticks)
tracker.update(TrackerUpdateAction.moveDuration(20));
Visibility Control
// Hide specific parts
tracker.update(
TrackerUpdateAction.togglePart(false),
BonePredicate.name("helmet")
);
// Show all parts
tracker.update(
TrackerUpdateAction.togglePart(true),
BonePredicate.TRUE
);
View Range Control
// Increase view range for important model
tracker.update(TrackerUpdateAction.viewRange(128.0F));
// Decrease view range for detail model
tracker.update(TrackerUpdateAction.viewRange(32.0F));
Advanced Examples
Damage Effect
public void applyDamageEffect(Tracker tracker) {
// Red tint + glow effect
TrackerUpdateAction damageEffect = TrackerUpdateAction.composite(
TrackerUpdateAction.tint(0xFF0000),
TrackerUpdateAction.glow(true),
TrackerUpdateAction.glowColor(0xFF0000)
);
tracker.update(damageEffect);
// Revert after 10 ticks
scheduler.runLater(() -> {
TrackerUpdateAction revert = TrackerUpdateAction.composite(
TrackerUpdateAction.previousTint(),
TrackerUpdateAction.glow(false)
);
tracker.update(revert);
}, 10);
}
Glowing Outline
public void addGlowingOutline(Tracker tracker, int color) {
tracker.update(TrackerUpdateAction.composite(
TrackerUpdateAction.glow(true),
TrackerUpdateAction.glowColor(color)
));
}
public void removeGlowingOutline(Tracker tracker) {
tracker.update(TrackerUpdateAction.glow(false));
}
// Usage
addGlowingOutline(tracker, 0x00FF00); // Green outline
Equipment Display
public void updateEquipment(Tracker tracker, ItemStack helmet, ItemStack chestplate) {
// Update helmet
if (helmet != null) {
tracker.update(
TrackerUpdateAction.itemStack(TransformedItemStack.of(helmet)),
BonePredicate.name("helmet_bone")
);
tracker.update(TrackerUpdateAction.togglePart(true), BonePredicate.name("helmet_bone"));
} else {
tracker.update(TrackerUpdateAction.togglePart(false), BonePredicate.name("helmet_bone"));
}
// Update chestplate
if (chestplate != null) {
tracker.update(
TrackerUpdateAction.itemStack(TransformedItemStack.of(chestplate)),
BonePredicate.name("chestplate_bone")
);
tracker.update(TrackerUpdateAction.togglePart(true), BonePredicate.name("chestplate_bone"));
} else {
tracker.update(TrackerUpdateAction.togglePart(false), BonePredicate.name("chestplate_bone"));
}
}
Night Vision Effect
public void applyNightVision(Tracker tracker, boolean enable) {
if (enable) {
// Make model fully bright in darkness
tracker.update(TrackerUpdateAction.brightness(15, 15));
} else {
// Use ambient lighting
tracker.update(TrackerUpdateAction.brightness(0, 0));
}
}
Best Practices
- Combine Actions: Use
composite() or then() to apply multiple changes atomically
- Use Predicates: Filter bones efficiently with
BonePredicate instead of updating all bones
- Revert Changes: Store previous states when making temporary changes
- Performance: Batch updates together rather than calling
update() multiple times
- None Action: Use
none() for conditional logic instead of null checks
See Also