public class EntityComponent extends AbstractMessageComponent
Constructor and Description |
---|
EntityComponent(java.lang.String name)
Construct an EntityComponent with no content.
|
EntityComponent(java.lang.String name,
Entity entity)
Construct an EntityComponent with a specific entity value.
|
Modifier and Type | Method and Description |
---|---|
Entity |
getEntity()
Get the entity.
|
void |
read(java.io.InputStream in)
Read this component from a stream.
|
void |
setEntity(Entity e)
Set the entity.
|
java.lang.String |
toString() |
void |
write(java.io.OutputStream out)
Write this component to a stream.
|
getName
public EntityComponent(java.lang.String name)
name
- The name of the component.public EntityComponent(java.lang.String name, Entity entity)
name
- The name of the component.entity
- The value of this component.public Entity getEntity()
public void setEntity(Entity e)
e
- The new entity.public void write(java.io.OutputStream out) throws java.io.IOException
MessageComponent
out
- The stream to write to.java.io.IOException
- If the write fails.public void read(java.io.InputStream in) throws java.io.IOException
MessageComponent
in
- The stream to read from.java.io.IOException
- If the read fails.public java.lang.String toString()
toString
in class java.lang.Object