Entities, as you might expect, are quite different from blocks. For one thing,
there are many more kinds of entities, and they have different kinds of abilities
(and functions for us). With blocks, all you have to do is change the block
type and perhaps add some additional information (like on a sign), but entities
are more complicated.
To start off, all entities have the capabilities described in net.canarymod.api.enti-
ty.Entity . Each Entity object includes the following useful functions:
Return the Location of the entity
Set time to keep an entity on fire
Set the entity's rider
Spawn this kind of Entity into the world
Teleport the entity to a new location
Then, depending further on the type of the entity, you might have other cool
functions to play with. Living entities ( net.canarymod.api.entity.living.EntityLiving ), for
example, have the following extra functions that other nonliving entities don't
Return the item this entity is holding.
Set this entity's attack target.
Return a double of this entity's health. It can
be zero (dead) up to the amount returned by
Set the health. Zero is dead, without causing
Kill this entity, causing damage (and loot
You may have noticed that not all these functions are declared in EntityLiving
itself. This is where Java gets a little messy. The familiar entity objects
incorporate a lot of different parent recipes. For instance, a Cow is an Ageable ,
an EntityAnimal , an EntityLiving object, and, of course, an Entity .
That means it uses functions from all these different parents. For example,
because Cow inherits from Ageable , you get functions where you can alter a Cow
property to change its growing age.