Models
The EdModel and EdModelEntity interfaces provide advanced BDEngine 3D model support for creating custom entities with complex animations and multi-part structures.
EdModel Interface
The EdModel interface represents a registered 3D model template that can be used to create multiple model entities.
Core Properties
String getId()
Description: Returns the unique identifier for this model
Returns: Model ID as registered in the system
Usage: Model identification, configuration references
Float getMaxHeight()
Description: Returns the maximum height of the model in blocks
Returns: Height value for collision and interaction calculations
Usage: Interaction zone sizing, collision detection
Entity Creation
EdModelEntity createEntity(Location location)
Description: Creates a new model entity instance at the specified location
Parameters:
location- World location where the model should spawnReturns: EdModelEntity instance for manipulation
Usage: Spawning model instances, creating NPCs with custom models
EdModelEntity Interface
The EdModelEntity interface represents an active instance of a 3D model in the world, composed of multiple entities working together to create a complex visual structure.
Component Access
EdEntity getInteractionEntity()
Description: Returns the invisible interaction entity for click detection
Returns: EdEntity used for player interactions
Usage: Click handling, collision detection, interaction zones
EdEntity getMainEntity()
Description: Returns the primary visual entity of the model
Returns: Main EdEntity representing the model's base
Usage: Core model manipulation, primary positioning
EdEntity getDisplayName()
Description: Returns the entity responsible for name display
Returns: EdEntity handling the name tag
Usage: Name tag customization, text positioning
Map<String, EdEntity> getPassengers()
Description: Returns all passenger entities that make up the model
Returns: Map of passenger names to their EdEntity instances
Usage: Individual component access, complex animations
EdModel getModel()
Description: Returns the template model this entity is based on
Returns: EdModel template reference
Usage: Model information access, type checking
Positioning and Rotation
Basic Rotation
void setYaw(float yaw)
Description: Sets the horizontal rotation of the entire model
Parameters:
yaw- Rotation angle in degrees (0-360°)Usage: Model orientation, direction setting
void setPitch(float pitch)
Description: Sets the vertical rotation of the entire model
Parameters:
pitch- Vertical angle in degrees (-90° to 90°)Usage: Vertical orientation, looking up/down
void rotate(float yaw, float pitch)
Description: Sets both horizontal and vertical rotation simultaneously
Parameters:
yaw- Horizontal rotationpitch- Vertical rotation
Usage: Complete orientation changes, smooth rotation updates
Lifecycle Management
Visibility and Spawning
void spawn()
Description: Spawns the complete model for all current watchers
Usage: Initial model creation, respawning after removal
void addWatcher(Player player)
Description: Makes the model visible to a specific player
Parameters:
player- Player who will see the modelUsage: Selective visibility, instance-based models
void remove()
Description: Removes the entire model for all watchers
Usage: Model cleanup, despawning, memory management
Visual Effects
void setGlowing(EdColor color)
Description: Makes the entire model glow with a specific color
Parameters:
color- EdColor enum value for glow effectUsage: Highlighting, status indicators, special effects
Animation System
Animation Playback
void playAnimation(String animation)
Description: Plays a one-time animation sequence
Parameters:
animation- Animation name as defined in the modelUsage: Action animations, interaction feedback, combat effects
void playLoopAnimation(String animation)
Description: Plays an animation that loops continuously
Parameters:
animation- Animation name to loopUsage: Idle animations, walking cycles, ambient effects
void stopAnimation()
Description: Stops the currently playing animation
Usage: Animation interruption, state changes
Animation State
boolean isPlayingAnimation()
Description: Checks if any animation is currently playing
Returns: True if an animation is active, false otherwise
Usage: Animation state checking, conditional logic
String getCurrentAnimation()
Description: Returns the name of the currently playing animation
Returns: Animation name or null if none playing
Usage: Animation tracking, state management
Usage Examples
Basic Model Creation
// Get a registered model
EdModel dragonModel = EdLibAPI.getInstance().getModel("dragon");
// Create an instance at a location
EdModelEntity dragon = dragonModel.createEntity(player.getLocation());
// Make it visible to players
dragon.addWatcher(player);
dragon.spawn();Model Positioning and Rotation
// Orient the model
dragon.setYaw(90.0f); // Face east
dragon.setPitch(15.0f); // Look slightly up
// Or set both at once
dragon.rotate(180.0f, -30.0f); // Face south, look downAnimation Control
// Play a one-time animation
dragon.playAnimation("roar");
// Start a looping idle animation
dragon.playLoopAnimation("idle_breathing");
// Check animation state
if (dragon.isPlayingAnimation()) {
String current = dragon.getCurrentAnimation();
player.sendMessage("Dragon is playing: " + current);
}
// Stop current animation
dragon.stopAnimation();Advanced Component Access
// Access individual components
EdEntity mainBody = dragon.getMainEntity();
EdEntity nameTag = dragon.getDisplayName();
EdEntity clickZone = dragon.getInteractionEntity();Last updated
Was this helpful?