Overview
TheBetterModel class provides static access to the platform instance, configuration, model managers, NMS handlers, and entity registries. It serves as a service provider for interacting with the BetterModel engine.
This is the primary class you’ll use to access all BetterModel functionality.
The BetterModel class cannot be instantiated. All methods are static and accessed directly.
Package
Static Methods
Configuration
config()
Returns the platform configuration manager.BetterModelConfig - The configuration manager
Since: 1.15.2
Example:
Model Management
model()
Retrieves a model renderer by its name, wrapped in an Optional.The name of the model to retrieve
Optional<ModelRenderer> - An optional containing the renderer if found
Since: 1.15.2
Example:
modelOrNull()
Retrieves a model renderer by its name, or null if not found.The name of the model to retrieve
ModelRenderer - The renderer, or null if not found
Since: 1.15.2
models()
Returns a collection of all loaded model renderers.Collection<ModelRenderer> - An unmodifiable collection of models
Since: 1.15.2
modelKeys()
Returns a set of all loaded model names.Set<String> - An unmodifiable set of model keys
Since: 1.15.2
Player Limb Management
limb()
Retrieves a player limb renderer by its name, wrapped in an Optional.The name of the limb model to retrieve
Optional<ModelRenderer> - An optional containing the renderer if found
Since: 1.15.2
Example:
limbOrNull()
Retrieves a player limb renderer by its name, or null if not found.The name of the limb model to retrieve
ModelRenderer - The renderer, or null if not found
Since: 1.15.2
limbs()
Returns a collection of all loaded player limb renderers.Collection<ModelRenderer> - An unmodifiable collection of limb models
Since: 1.15.2
limbKeys()
Returns a set of all loaded player limb model names.Set<String> - An unmodifiable set of limb keys
Since: 1.15.2
Player Management
player()
Retrieves a player channel handler by the player’s UUID.The player’s unique identifier
Optional<PlayerChannelHandler> - An optional containing the channel handler if found
Since: 1.15.2
Example:
Entity Registry Management
registry(UUID)
Retrieves an entity tracker registry by the entity’s UUID.The entity’s unique identifier
Optional<EntityTrackerRegistry> - An optional containing the registry if found
Since: 1.15.2
registry(PlatformEntity)
Retrieves an entity tracker registry for a platform entity.The platform entity (e.g., Bukkit entity)
Optional<EntityTrackerRegistry> - An optional containing the registry if found
Since: 1.15.2
registry(BaseEntity)
Retrieves an entity tracker registry for a base entity.The base entity
Optional<EntityTrackerRegistry> - An optional containing the registry if found
Since: 1.15.2
registryOrNull(UUID)
Retrieves an entity tracker registry by the entity’s UUID, or null if not found.The entity’s unique identifier
EntityTrackerRegistry - The registry, or null if not found
Since: 1.15.2
registryOrNull(PlatformEntity)
Retrieves an entity tracker registry for a platform entity, or null if not found.The platform entity (e.g., Bukkit entity)
EntityTrackerRegistry - The registry, or null if not found
Since: 1.15.2
registryOrNull(BaseEntity)
Retrieves an entity tracker registry for a base entity, or null if not found.The base entity
EntityTrackerRegistry - The registry, or null if not found
Since: 1.15.2
Example:
Platform Access
platform()
Returns the singleton instance of the BetterModel platform.BetterModelPlatform - The platform instance
Throws: NullPointerException - If the platform has not been initialized
Since: 2.0.0
Example:
nms()
Returns the NMS handler instance for version-specific operations.NMS - The NMS handler
Since: 1.15.2
eventBus()
Returns the event bus for registering and handling events.BetterModelEventBus - The event bus
Since: 2.0.0
Complete Example
See Also
- BetterModelPlatform - Platform interface
- BetterModelConfig - Configuration interface
