PlayerDisguiseEntity

public class PlayerDisguiseEntity extends ModeledEntity

A modeled entity that visually replaces a player. The disguised Player is held as a direct reference — this class does NOT set the player as the underlyingEntity, so the modeled-entity-with-underlying registry, packet interaction entity, and RegisterModelEntity PDC tagging are all bypassed naturally (no special-casing needed in shared code).

Lifecycle is owned by DisguiseManager; instances should not be created or destroyed directly outside the manager or the public API.

Properties

Link copied to clipboard
public final Player disguisedPlayer

Inherited properties

Link copied to clipboard
Link copied to clipboard
public volatile Quaterniondc bodyTilt
Link copied to clipboard
protected Location cachedBoneTransformLocation
Link copied to clipboard
protected Location currentLocation
Link copied to clipboard
Link copied to clipboard
public String displayName
Link copied to clipboard
public final String entityID
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public boolean isDying
Whether the entity is currently dying.
Link copied to clipboard
public volatile boolean isRemoved
Link copied to clipboard
public final static Set<ModeledEntity> loadedModeledEntities
Link copied to clipboard
public final UUID modelInstanceId
Stable identity for this logical model instance.
Link copied to clipboard
Link copied to clipboard
public final StackedText nameplate
Link copied to clipboard
Link copied to clipboard
public double scaleModifier
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected Location spawnLocation
Link copied to clipboard
protected Entity underlyingEntity

Functions

Link copied to clipboard
protected void displayInitializer()
Disguises must not spawn a packet interaction entity — the model is decorative and clicks should pass through to the underlying player.
Link copied to clipboard
public Player getDisguisedPlayer()
Link copied to clipboard
public Location getLocation()
Link copied to clipboard
public void hideEquipmentFor(Player viewer)
Sends an empty-equipment override to viewer so the disguised player's armor / held items don't render on the viewer's screen.
Link copied to clipboard
Re-applies the invisibility potion effect if this disguise originally applied it.
Link copied to clipboard
public void remove()
Link copied to clipboard
public void restoreEquipmentFor(Player viewer)
Re-sends the disguised player's actual equipment to viewer so the client picks up what they're really wearing.
Link copied to clipboard
public void tick(AbstractPacketBundle bundle)

Inherited functions

Link copied to clipboard
public void attack(LivingEntity target)
Performs an attack on the specified living entity target.
public void attack(LivingEntity target, double damage)
Attacks the specified target entity with a specified amount of damage.
Link copied to clipboard
protected double bodyHeight()
Height of the entity the model is on, in blocks, or 0 without one.
Link copied to clipboard
protected boolean bonesCanRideUnderlyingEntity()
Whether the bones ride the underlying entity for viewers that track it.
Link copied to clipboard
Drops the fixed light set by setBrightnessOverride, so the bones take the light where they are again.
Link copied to clipboard
public void damage(double amount)
Inflicts damage on the entity based on the specified amount.
public void damage(Entity damager)
Applies damage to this entity as inflicted by the specified damager.
public boolean damage(Projectile projectile)
Applies damage to the current entity based on the attributes of the provided projectile (impact speed, base damage, and bow enchantments such as Power and Piercing).
public void damage(Entity damager, double amount)
Inflicts damage on this entity by a specified amount, attributed to the given damager.
Link copied to clipboard
protected Location deathLocation()
Where the model stays while its death animation plays.
Link copied to clipboard
public double getBodyOffset()
Blocks the model is drawn above its entity's feet: none while it stands on them; for a model centred on its body, whatever puts the middle of its cubes on the body's middle, below the feet when the model is the taller.
Link copied to clipboard
@Nullable()
public @Nullable() Quaterniondc getBodyTilt()
The world-space lean the whole model takes about its middle, or null while it stands upright.
Link copied to clipboard
public double getBodyTiltPivotHeight()
Blocks above the entity's feet that a body tilt turns about: the middle of the model's cubes at its current scale, where it is drawn.
Link copied to clipboard
public Location getBoneTransformLocation()
Gets the location to use for bone transforms.
Link copied to clipboard
public double getBoxLift(double height)
Blocks above the entity's feet where a box of this height standing for the model starts: at the feet, or for a model centred on its body, wherever centres the box on the body too.
Link copied to clipboard
The fixed block light of the bones, or -1 without an override.
Link copied to clipboard
The fixed sky light of the bones, or -1 without an override.
Link copied to clipboard
public String getDisplayName()
Link copied to clipboard
Returns the effective view distance for this entity.
Link copied to clipboard
public String getEntityID()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public double getModelBottomHeight()
Blocks above the entity's feet of the model's lowest cube as drawn, at its current scale.
Link copied to clipboard
public static ModeledEntity getModeledEntity(Entity entity)
O(1) single-entity lookup against the live underlying-entity registry.
Link copied to clipboard
public UUID getModelInstanceId()
Stable identity for this logical model instance.
Link copied to clipboard
public double getModelMiddleHeight()
Blocks above the model's own feet of the middle of its cubes, at its current scale.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public Location getNameplateLocation()
Authored nametag position, or a fallback above the model's hitbox.
Link copied to clipboard
public List<Bone> getNametagBones()
Returns the name tag locations.
Link copied to clipboard
Link copied to clipboard
@Nullable()
public @Nullable() Entity getRiddenBody()
The entity this model's display bones ride, or null when they are placed freely.
Link copied to clipboard
public double getScaleModifier()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public Location getSpawnLocation()
Link copied to clipboard
public Color getTintColor()
Returns the persistent tint set via setTintColor, or null if no persistent tint has been applied.
Link copied to clipboard
public Entity getUnderlyingEntity()
Link copied to clipboard
public HashSet<UUID> getViewers()
Gets the set of UUIDs of all viewers (players who can see the entity)
Link copied to clipboard
public World getWorld()
Link copied to clipboard
public boolean hasAnimation(String animationName)
Checks if the specified animation exists in the animation component.
Link copied to clipboard
public boolean hasBrightnessOverride()
Whether setBrightnessOverride lights the bones at a fixed level.
Link copied to clipboard
public boolean hasViewDistanceOverride()
Whether this model has its own view distance.
Link copied to clipboard
public void hideFrom(Player player)
Hides this model from one player while everyone else keeps seeing it.
Link copied to clipboard
public void hideUnderlyingEntity(Player player)
Link copied to clipboard
public boolean isCenteredOnBody()
Link copied to clipboard
public boolean isDying()
Whether the entity is currently dying.
Link copied to clipboard
public boolean isHiddenFrom(Player player)
Whether hideFrom has hidden this model from the player.
Link copied to clipboard
public boolean isRemoved()
Link copied to clipboard
protected void onSpawnComplete()
Hook invoked once the spawn path and display initialization have completed successfully, immediately before this entity is published to the tickable registry.
Link copied to clipboard
protected void onSpawnFailed()
Subclasses undo any registry entry installed by a partial onSpawnComplete.
Link copied to clipboard
public boolean playAnimation(String animationName, boolean blendAnimation, boolean loop)
Plays an animation as set by the string name.
Link copied to clipboard
protected void removeKeepingBody()
Takes the model off its entity and leaves the entity in the world, for another model to take its place.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected boolean ridesUnderlyingEntity()
Whether Java clients track the underlying entity, which its bones need in order to ride it.
Link copied to clipboard
protected double seatScale()
The part of the underlying entity's scale that only moves its rider's seat, which the model leaves out.
Link copied to clipboard
public void setBodyTilt(@Nullable() @Nullable() Quaterniondc tilt)
Leans the whole model: a world-space rotation about the middle of its height, applied after it faces its heading and after its animations.
Link copied to clipboard
public ModeledEntity setBrightnessOverride(int blockLight, int skyLight)
Lights every display bone at a fixed level instead of the light where it stands, as a glowing creature or a lantern needs.
Link copied to clipboard
public void setCachedBoneTransformLocation(Location location)
Sets the cached bone transform location.
Link copied to clipboard
public void setCenteredOnBody(boolean centered)
Draws the model with the middle of its cubes on the middle of its entity instead of standing on the entity's feet.
Link copied to clipboard
public void setDisplayName(String displayName)
Link copied to clipboard
public void setDisplayNameLineGap(double gap)
Clear gap in blocks at scale 1; scaled Java text scales both glyphs and spacing.
Link copied to clipboard
public void setDisplayNameLines(List<String> lines)
Lines are top-to-bottom; the last line remains at the model's name anchor.
Link copied to clipboard
public void setDisplayNameScale(float scale)
Link copied to clipboard
public void setDisplayNameVisible(boolean visible)
Link copied to clipboard
Sets the callback to be triggered when a player contacts the hitbox of this entity.
Link copied to clipboard
Sets a callback to be invoked when the entity is left-clicked by a player.
Link copied to clipboard
Sets a callback that is triggered when the entity is right-clicked by a player.
Link copied to clipboard
public void setScaleModifier(double scaleModifier)
Link copied to clipboard
public ModeledEntity setTintColor(Color color)
Persistent tint applied via the leather-armor dye channel.
Link copied to clipboard
public void setUnderlyingEntity(Entity underlyingEntity)
Link copied to clipboard
Overrides the plugin-wide default view distance for this single modeled entity.
Link copied to clipboard
public void showTo(Player player)
Undoes hideFrom.
Link copied to clipboard
public void showUnderlyingEntity(Player player)
Link copied to clipboard
public static void shutdown()
Link copied to clipboard
protected void shutdownRemove()
Link copied to clipboard
public void spawn()
public void spawn(Location location)
public void spawn(Entity entity)
Link copied to clipboard
public void stopCurrentAnimations()
Stops all currently running animations.
Link copied to clipboard
public void teleport(Location location, boolean teleportUnderlyingEntity)
Teleports the entity represented by this ModeledEntity to the specified location.
Link copied to clipboard
public void updateBedrockAnimations(String baseAnimation, String actionAnimation)
Shows Bedrock clients the base animation and the action layered over it; either may be null.