EdEntity
EdEntity is the core interface for managing fake entities in EdLib. These entities exist only on the client side for specific players, allowing for customized experiences without affecting the server
Basic Entity Information
Core Properties
Integer getId()
Description: Returns the unique numeric ID of this entity
Returns: Entity ID used internally for packet operations
Usage: Entity identification, packet handling
UUID getUUID()
Description: Returns the UUID of this entity
Returns: Unique identifier for the entity
Usage: Entity tracking, collision detection
EntityType getType()
Description: Returns the Minecraft entity type
Returns: EntityType enum value (ZOMBIE, CHICKEN, etc.)
Usage: Type checking, behavior branching
Object getEntity()
Description: Returns the underlying NMS entity object
Returns: Raw NMS entity (advanced usage only)
Usage: Direct NMS manipulation, advanced features
Player Visibility Management
Watcher System
void addWatcher(Player player)
Description: Makes this entity visible to a specific player
Parameters:
player- Player who will see the entityUsage: Selective visibility, instance-based entities
void removeWatcher(Player player)
Description: Hides this entity from a specific player
Parameters:
player- Player who will no longer see the entityUsage: Dynamic visibility, phase mechanics
Collection<Player> getWatchers()
Description: Returns all players currently watching this entity
Returns: Collection of players who can see the entity
Usage: Iteration over viewers, cleanup operations
Entity Lifecycle
Spawning and Removal
void spawn()
Description: Spawns the entity for all current watchers
Usage: Initial entity creation, respawning
void spawnForPlayer(Player p)
Description: Spawns the entity for a specific player only
Parameters:
p- Target playerUsage: Selective spawning, delayed visibility
void remove()
Description: Removes the entity for all watchers
Usage: Entity cleanup, despawning
void removeForPlayer(Player p)
Description: Removes the entity for a specific player only
Parameters:
p- Target playerUsage: Selective removal, temporary hiding
Entity Properties
Physics and Behavior
void setGravity(boolean gravity)
Description: Controls whether the entity is affected by gravity
Parameters:
gravity- True to enable gravity, false to disableUsage: Floating entities, custom physics
Warning: Almost every entity won't have gravity or physics since the entity doesn't exist server side. Just the entities that move client side will be affected by gravity.
void setInFire(boolean inFire)
Description: Sets the entity's fire status
Parameters:
inFire- True to set on fire, false to extinguishUsage: Visual effects, damage indicators
Equipment and Appearance
void setEquipment(EntityEquipmentSlot slot, ItemStack item)
Description: Sets equipment for the entity
Parameters:
slot- Equipment slot (HAND, HELMET, CHESTPLATE, etc.)item- ItemStack to equip
Usage: NPC gear, visual customization
void playAnimation(EntityAnimation animation)
Description: Plays an animation on the entity
Parameters:
animation- Animation type to playUsage: Combat effects, interaction feedback
void setSlimeSize(int size)
Description: Sets the size for slime-type entities
Parameters:
size- Size value (1-4 typically)Usage: Slime customization, scaling effects
Visual Modifications
void setSmall()
Description: Makes the entity small (armor stand property)
Usage: Compact displays, decorative elements
void setInvisible()
Description: Makes the entity invisible while maintaining collision
Usage: Hidden interactions, invisible NPCs
void setDisplayName(String name)
Description: Sets the name displayed above the entity
Parameters:
name- Display name (supports color codes)Usage: NPC names, labels, identification
void setGlowing(EdColor color)
Description: Makes the entity glow with a specific color
Parameters:
color- EdColor enum valueUsage: Highlighting, status indicators, special effects
float getNameHeight()
Description: Returns the height at which the name tag appears
Returns: Height offset for name positioning
Usage: Name tag positioning, visual adjustments
Movement and Positioning
Basic Movement
Vector getPosition()
Description: Returns the current position of the entity
Returns: Vector containing X, Y, Z coordinates
Usage: Position tracking, distance calculations
void tp(double x, double y, double z)
Description: Teleports the entity to the specified coordinates
Parameters:
x,y,z- Target coordinatesUsage: Instant positioning, teleportation effects
void shortTp(double x, double y, double z)
Description: Performs a short-range teleport (optimized for frequent updates)
Parameters:
x,y,z- Target coordinatesUsage: Smooth movement, animation frames
void rotateBodyAndMove(double x, double y, double z, float yaw, float pitch)
Description: Moves and rotates the entity simultaneously
Parameters:
x,y,z- Target coordinatesyaw- Horizontal rotation (0-360°)pitch- Vertical rotation (-90° to 90°)
Usage: Smooth movement with rotation, natural motion
void setNMSLocation(double x, double y, double z, float yaw, float pitch)
Description: Sets the entity's location at the NMS level
Parameters: Coordinates and rotation values
Usage: Low-level positioning, precise control
Rotation Controls
void setYawHead(float yaw)
Description: Sets only the head yaw rotation
Parameters:
yaw- Head rotation angleUsage: Head tracking, looking at targets
void setYaw(float yaw)
Description: Sets the body yaw rotation
Parameters:
yaw- Body rotation angleUsage: Body direction, movement orientation
void setPitch(float pitch)
Description: Sets the pitch (vertical) rotation
Parameters:
pitch- Vertical angleUsage: Looking up/down, aiming
void rotateBody(float yaw, float pitch)
Description: Rotates the entire body
Parameters:
yaw,pitch- Rotation anglesUsage: Full body rotation, direction changes
void rotateHead(float yaw)
Description: Rotates only the head
Parameters:
yaw- Head rotation angleUsage: Head movements, attention direction
Vector getLocVector()
Description: Returns the location as a Vector
Returns: Current position vector
Usage: Position calculations, vector math
Transformation System
Matrix Transformations
void setTransformation(Matrix4f matrix)
Description: Applies a transformation matrix instantly
Parameters:
matrix- 4x4 transformation matrixUsage: Scaling, rotation, complex transformations
void setTransformationWithInterpolation(Matrix4f matrix, int interpolationDuration)
Description: Applies transformation with smooth interpolation
Parameters:
matrix- Target transformationinterpolationDuration- Animation duration in ticks
Usage: Smooth scaling, animated transformations
void setTransformationWithInterpolation(Matrix4f matrix, int interpolationDuration, int startInterpolation)
Description: Applies transformation with delayed interpolation
Parameters:
matrix- Target transformationinterpolationDuration- Animation durationstartInterpolation- Delay before starting
Usage: Timed animations, sequence control
void setInterpolationDuration(int interpolationDuration)
Description: Sets the default interpolation duration
Parameters:
interpolationDuration- Duration in ticksUsage: Animation speed control
void startInterpolation()
Description: Manually starts the interpolation process
Usage: Triggered animations, manual control
Passenger System
void setPassengers(List<EdEntity> passengers)
Description: Sets multiple entities as passengers
Parameters:
passengers- List of entities to ride this entityUsage: Complex entity structures, vehicles
void addPassenger(EdEntity entity)
Description: Adds a single passenger entity
Parameters:
entity- Entity to add as passengerUsage: Stacking entities, rider systems
Goal System (AI Behavior)
Goal Management
void addGoal(EdGoal goal)
Description: Adds a goal to the entity's behavior queue
Parameters:
goal- Goal implementation to executeUsage: AI behavior, automated actions
void startNextGoal()
Description: Starts the next goal in the queue
Usage: Goal progression, behavior chains
void onGoalComplete()
Description: Called when a goal finishes execution
Usage: Goal completion handling, automatic progression
Queue<EdGoal> getGoalQueue()
Description: Returns the queue of pending goals
Returns: Queue of goals waiting to execute
Usage: Goal inspection, queue management
EdGoal getCurrentGoal()
Description: Returns the currently executing goal
Returns: Active goal or null if none
Usage: Current behavior checking, goal status
void setCurrentGoal(EdGoal goal)
Description: Sets the current active goal
Parameters:
goal- Goal to set as currentUsage: Manual goal control, goal switching
void clearGoals()
Description: Clears all goals and stops current execution
Usage: Behavior reset, emergency stops
void skipCurrentGoal()
Description: Skips the current goal and moves to the next
Usage: Goal interruption, behavior changes
Usage Examples
Basic Entity Setup
EdEntity entity = api.createEntity(EntityType.ZOMBIE, location);
entity.setDisplayName("§cGuard Zombie");
entity.setGlowing(EdColor.RED);
entity.addWatcher(player);
entity.spawn();Moving Entity with Goals
// Add movement goals
entity.addGoal(new EdGoalMove(new Vector(10, 64, 10), 0.2));
entity.addGoal(new EdGoalDelay(60)); // Wait 3 seconds
entity.addGoal(new EdGoalMove(new Vector(0, 64, 0), 0.2));Equipment and Appearance
entity.setEquipment(EntityEquipmentSlot.HAND, new ItemStack(Material.DIAMOND_SWORD));
entity.setEquipment(EntityEquipmentSlot.HELMET, new ItemStack(Material.DIAMOND_HELMET));
entity.playAnimation(EntityAnimation.SWING_MAIN_HAND);Passenger System
EdEntity mount = api.createEntity(EntityType.HORSE, location);
EdEntity rider = api.createEntity(EntityType.BAT, location);
mount.addPassenger(rider);Last updated
Was this helpful?