Package games.stendhal.client.entity
Class Entity
java.lang.Object
games.stendhal.client.entity.Entity
- All Implemented Interfaces:
IEntity,RPObjectChangeListener
- Direct Known Subclasses:
ActiveEntity,Blood,Chest,Corpse,Fire,GameBoard,GrainField,InvisibleEntity,Item,PlantGrower,Sign,Spell,StatefulEntity,Wall
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe entity class.protected booleanQuick work-around to prevent fireMovementEvent() from calling in onChangedAdded() from other initialize() hack.protected StringThe entity name.protected RPObjectThe arianne object associated with this game entity.protected StringThe entity title.protected StringThe entity type.protected doubleThe current x location of this entity.protected doubleThe current y location of this entity.Fields inherited from interface games.stendhal.client.entity.IEntity
PROP_ANIMATED, PROP_CLASS, PROP_NAME, PROP_POSITION, PROP_SIZE, PROP_STATE, PROP_TITLE, PROP_VISIBILITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(EntityChangeListener<?> listener) Add a change listener.voidAdd a listener for content changesvoidfireChange(games.stendhal.client.entity.Property property) Fire change to all registered listeners.getArea()Get the area the entity occupies.gets the name of the cursor to use for this entityGet the entity class.Get the entity sub-class.doubleGet the entity height.final RPObject.IDgetID()getName()Get the name.final intgetPath()Get identifier path for the entity.intGet the resistance this has on other entities (0-100).intgetResistance(IEntity entity) Get the amount of resistance between this and another entity (0-100).Get the RPObject this represents.Gets the slot specified by name.getTitle()Get the nicely formatted entity title.getType()Get the entity type.intGet the entity visibility.doublegetWidth()Get the entity width.doublegetX()Get the X coordinate.doublegetY()Get the Y coordinate.voidinitialize(RPObject object) Initialize this entity for an object.booleanisObstacle(IEntity entity) Determine if this is an obstacle for another entity.booleanDetermine if this entity is on the ground.booleanisUser()Check if the entity is the user.final voidAn object was added.voidonChangedAdded(RPObject object, RPObject changes) The object added/changed attribute(s).voidonChangedRemoved(RPObject object, RPObject changes) The object removed attribute(s).protected voidonPosition(double x, double y) When the entity's position changed.final voidDeprecated.Moving to different listener.voidonSlotAdded(RPObject object, String slotName, RPObject sobject) A slot object was added.voidonSlotChangedAdded(RPObject object, String slotName, RPObject sobject, RPObject schanges) A slot object added/changed attribute(s).voidonSlotChangedRemoved(RPObject object, String slotName, RPObject sobject, RPObject schanges) A slot object removed attribute(s).voidonSlotRemoved(RPObject object, String slotName, RPObject sobject) A slot object was removed.protected voidprocessPositioning(RPObject base, RPObject diff) Process attribute changes that may affect positioning.voidrelease()Release this entity.voidremoveChangeListener(EntityChangeListener<?> listener) Remove a change listener.voidRemove a content change listener.toString()voidupdate(int delta) Update cycle.
-
Field Details
-
x
protected double xThe current x location of this entity. -
y
protected double yThe current y location of this entity. -
rpObject
The arianne object associated with this game entity. -
clazz
The entity class. -
name
The entity name. -
title
The entity title. -
type
The entity type. -
inAdd
protected boolean inAddQuick work-around to prevent fireMovementEvent() from calling in onChangedAdded() from other initialize() hack. TODO: get rid off inAdd variable.
-
-
Constructor Details
-
Entity
public Entity()
-
-
Method Details
-
addChangeListener
Description copied from interface:IEntityAdd a change listener.- Specified by:
addChangeListenerin interfaceIEntity- Parameters:
listener- The listener.
-
addContentChangeListener
Description copied from interface:IEntityAdd a listener for content changes- Specified by:
addContentChangeListenerin interfaceIEntity
-
removeContentChangeListener
Description copied from interface:IEntityRemove a content change listener.- Specified by:
removeContentChangeListenerin interfaceIEntity
-
fireChange
public void fireChange(games.stendhal.client.entity.Property property) Fire change to all registered listeners.- Parameters:
property- The changed property.
-
isUser
public boolean isUser()Description copied from interface:IEntityCheck if the entity is the user. -
getArea
Description copied from interface:IEntityGet the area the entity occupies. -
getVisibility
public int getVisibility()Description copied from interface:IEntityGet the entity visibility.- Specified by:
getVisibilityin interfaceIEntity- Returns:
- The entity visibility (0 - 100).
-
getHeight
public double getHeight()Description copied from interface:IEntityGet the entity height. -
getID
-
getObjectID
public final int getObjectID() -
getEntityClass
Description copied from interface:IEntityGet the entity class.- Specified by:
getEntityClassin interfaceIEntity- Returns:
- The entity class.
-
getName
Description copied from interface:IEntityGet the name. -
getEntitySubclass
Description copied from interface:IEntityGet the entity sub-class.- Specified by:
getEntitySubclassin interfaceIEntity- Returns:
- The entity sub-class.
-
getTitle
Description copied from interface:IEntityGet the nicely formatted entity title. This searches the follow attribute order: title, name (w/o underscore), type (w/o underscore). -
getType
Description copied from interface:IEntityGet the entity type. -
getX
public double getX()Description copied from interface:IEntityGet the X coordinate. -
getY
public double getY()Description copied from interface:IEntityGet the Y coordinate. -
getRPObject
Description copied from interface:IEntityGet the RPObject this represents.- Specified by:
getRPObjectin interfaceIEntity- Returns:
- The RPObject.
-
getWidth
public double getWidth()Description copied from interface:IEntityGet the entity width. -
isOnGround
public boolean isOnGround()Description copied from interface:IEntityDetermine if this entity is on the ground.- Specified by:
isOnGroundin interfaceIEntity- Returns:
trueif the entity is on the ground.
-
processPositioning
Process attribute changes that may affect positioning. This is needed because different entities may want to process coordinate changes more gracefully.- Parameters:
base- The previous values.diff- The changes.
-
onPosition
protected void onPosition(double x, double y) When the entity's position changed.- Parameters:
x- The new X coordinate.y- The new Y coordinate.
-
getResistance
public int getResistance()Description copied from interface:IEntityGet the resistance this has on other entities (0-100).- Specified by:
getResistancein interfaceIEntity- Returns:
- The resistance.
-
getResistance
Description copied from interface:IEntityGet the amount of resistance between this and another entity (0-100).- Specified by:
getResistancein interfaceIEntity- Parameters:
entity- The entity to check against.- Returns:
- The effective resistance.
-
getSlot
Description copied from interface:IEntityGets the slot specified by name. -
initialize
Description copied from interface:IEntityInitialize this entity for an object.- Specified by:
initializein interfaceIEntity- Parameters:
object- The object.- See Also:
-
isObstacle
Description copied from interface:IEntityDetermine if this is an obstacle for another entity.- Specified by:
isObstaclein interfaceIEntity- Parameters:
entity- The entity to check against.- Returns:
truethe entity can not enter this entity's area.
-
release
public void release()Description copied from interface:IEntityRelease this entity. This should clean anything that isn't automatically released (such as unregister callbacks, cancel external operations, etc). -
removeChangeListener
Description copied from interface:IEntityRemove a change listener.- Specified by:
removeChangeListenerin interfaceIEntity- Parameters:
listener- The listener.
-
update
public void update(int delta) Description copied from interface:IEntityUpdate cycle. -
onAdded
An object was added.- Specified by:
onAddedin interfaceRPObjectChangeListener- Parameters:
object- The object.
-
onChangedAdded
The object added/changed attribute(s).- Specified by:
onChangedAddedin interfaceRPObjectChangeListener- Parameters:
object- The base object.changes- The changes.
-
onChangedRemoved
The object removed attribute(s).- Specified by:
onChangedRemovedin interfaceRPObjectChangeListener- Parameters:
object- The base object.changes- The changes.
-
onRemoved
Deprecated.Moving to different listener. Userelease().An object was removed.- Specified by:
onRemovedin interfaceRPObjectChangeListener- Parameters:
object- The object.
-
onSlotAdded
A slot object was added.- Specified by:
onSlotAddedin interfaceRPObjectChangeListener- Parameters:
object- The container object.slotName- The slot name.sobject- The slot object.
-
onSlotChangedAdded
public void onSlotChangedAdded(RPObject object, String slotName, RPObject sobject, RPObject schanges) A slot object added/changed attribute(s).- Specified by:
onSlotChangedAddedin interfaceRPObjectChangeListener- Parameters:
object- The base container object.slotName- The container's slot name.sobject- The slot object.schanges- The slot object changes.
-
onSlotChangedRemoved
public void onSlotChangedRemoved(RPObject object, String slotName, RPObject sobject, RPObject schanges) A slot object removed attribute(s).- Specified by:
onSlotChangedRemovedin interfaceRPObjectChangeListener- Parameters:
object- The base container object.slotName- The container's slot name.sobject- The slot object.schanges- The slot object changes.
-
onSlotRemoved
A slot object was removed.- Specified by:
onSlotRemovedin interfaceRPObjectChangeListener- Parameters:
object- The container object.slotName- The slot name.sobject- The slot object.
-
toString
-
getCursor
gets the name of the cursor to use for this entity -
getPath
Get identifier path for the entity.
-