Skip to content
“Perrier” edited this page May 10, 2026 · 1 revision

Media

Components that render game-world content into a UI box.

PlayerRender

Wraps InventoryScreen.drawEntity to draw any LivingEntity (player, mob, ...) inside a UI rect. By default the entity follows the cursor with the same atan-smoothed rotation as the vanilla inventory paperdoll; pass mouseTracksRotation = false to lock the view to the front so the entity's own bodyYaw / headYaw / pitch fields drive the pose.

PlayerRender(LivingEntity entity)
PlayerRender(LivingEntity entity, Style style)
PlayerRender(Supplier<LivingEntity> entitySupplier)
PlayerRender(Supplier<LivingEntity> entitySupplier, Style style)
PlayerRender(Supplier<LivingEntity> entitySupplier, Style style,
             int entitySize, boolean mouseTracksRotation)
PlayerRender(Supplier<LivingEntity> entitySupplier, Style style,
             int entitySize, boolean mouseTracksRotation, float bottomOffset)
PlayerRender(MinecraftClient.getInstance().player,
             Style.width(120).height(180)
                  .backgroundColor(0xFF_22_22_22)
                  .borderRadius(8)
                  .build());

// Hot-swap which entity is drawn — supplier is read every frame.
State<LivingEntity> npc = State.of(initialNpc);
PlayerRender(npc::get,
             Style.width(120).height(180).build(),
             /* entitySize          */ 90,
             /* mouseTracksRotation */ true,
             /* bottomOffset        */ 0f);

Parameters:

  • entitySize — the size argument forwarded to InventoryScreen.drawEntity. Default chosen to fit the component bounds.
  • mouseTracksRotation — when true, the entity's bodyYaw and headYaw smoothly track the cursor; when false, they're left untouched and the entity faces forward.
  • bottomOffset — fractional offset for the entity's feet relative to the bottom of the bounds (0.0 = on the floor of the rect). Useful for centering entities of varying heights.

The component pushes a +100 Z translation onto the matrix stack before calling drawEntity and pops it after, so the 3D entity render stays above the surrounding 2D draws.

LocalPlayer

Convenience wrapper that auto-binds to MinecraftClient.getInstance().player. Renders nothing while the player is null (main menu, before world join).

LocalPlayer()
LocalPlayer(Style style)
LocalPlayer(Style.width(120).height(180)
                 .backgroundColor(0xFF_22_22_22)
                 .borderRadius(8)
                 .build());

This is just PlayerRender(() -> MinecraftClient.getInstance().player, style) — use the underlying factory directly if you need the entity-size or rotation controls.

Video. A full FFmpeg-backed Video / VideoPlayer lives on the feature/video-player branch but is not merged to master. It's tracked in FEATURES.md as a side branch and isn't part of the public API yet.

Clone this wiki locally