Skip to main content

Overview

The RenderSource interface represents a source for rendering models, providing the necessary context such as location and entity data. It serves as the entry point for creating tracker instances and supports both entity-based and location-based (dummy) rendering.

Interface Hierarchy

Factory Methods

These static methods create appropriate RenderSource instances:

Location-Based Sources

Creates a dummy render source at the specified location. Parameters:
  • location - The world location where the model will be rendered
Returns: A new BaseDummy instance
Creates a dummy render source with a specific model profile. Parameters:
  • location - The world location
  • profile - The uncompleted model profile (skin/texture)
Returns: A new ProfiledDummy instance

Entity-Based Sources

Creates an entity render source for the given entity. Parameters:
  • entity - The entity to attach the model to
Returns: BasePlayer if entity is a player, otherwise BaseEntity
Creates an entity render source with a specific model profile. Parameters:
  • entity - The entity to attach to
  • profile - The model profile
Returns: ProfiledPlayer if entity is a player, otherwise ProfiledEntity

Core Methods

location

Returns the location of this render source.

create

Creates a new tracker for this render source. Parameters:
  • pipeline - The render pipeline to use
  • modifier - The tracker modifier for behavior configuration
  • preUpdateConsumer - Consumer to run before each update
Returns: The created tracker (type depends on source type)

completeContext

Asynchronously completes the bone render context for this source. This may involve fetching skin data or other resources. Returns: Future completing with the bone render context

fallbackContext

Returns a fallback bone render context used when the complete context cannot be resolved or is not yet available. Returns: Default BoneRenderContext for this source

Dummy Sources

Location-based rendering without entity attachment.

BaseDummy

Basic dummy source with just a location. Usage:

ProfiledDummy

Dummy source with a model profile for custom textures. Usage:

Entity Sources

Rendering attached to entity with automatic position tracking.

Entity Interface

Base interface for entity-attached sources.

entity

Returns the entity associated with this source.

getOrCreate

Gets or creates an entity tracker for this source. Parameters:
  • name - The name/identifier of the tracker
  • supplier - Supplier for creating the render pipeline
  • modifier - Tracker modifier
  • preUpdateConsumer - Pre-update callback
Returns: Existing or newly created entity tracker

BaseEntity

Basic entity source without profile customization. Usage:

ProfiledEntity

Entity source with custom model profile. Usage:

BasePlayer

Player-specific source implementing Profiled interface. Additional Methods:
  • ModelProfile profile() - Returns player’s model profile
  • PlayerArmor armors() - Returns player’s armor
  • PlayerSkinParts skinParts() - Returns visible skin parts
Usage:

ProfiledPlayer

Player source with external profile override. Usage:

Profiled Interface

Player sources implement this interface for additional data:

Usage Patterns

Creating Trackers from Source

Working with Profiles

Async Context Loading

Entity Tracker Management

Type Selection Logic

The factory methods automatically select the appropriate implementation:

Complete Example

See Also