M
- The message entity element enum.public abstract class NetworkMessageEntity<M extends java.lang.Enum<M>> extends NetworkMessage
CHARSET
Constructor and Description |
---|
NetworkMessageEntity()
Constructor (used in decoding case).
|
NetworkMessageEntity(java.lang.Enum<?> type,
byte clientId)
Constructor (used for the client case).
|
NetworkMessageEntity(java.lang.Enum<?> type,
short entityId)
Constructor (used to identify an entity from the server).
|
NetworkMessageEntity(java.lang.Enum<?> type,
short entityId,
byte destId)
Constructor (used to identify an entity from the server).
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(M element,
boolean value)
Add an action.
|
void |
addAction(M element,
byte value)
Add an action.
|
void |
addAction(M element,
char value)
Add an action.
|
void |
addAction(M element,
double value)
Add an action.
|
void |
addAction(M element,
int value)
Add an action.
|
void |
addAction(M element,
short value)
Add an action.
|
boolean |
getActionBoolean(M element)
Get the action value.
|
byte |
getActionByte(M element)
Get the action value.
|
char |
getActionChar(M element)
Get the action value.
|
double |
getActionDouble(M element)
Get the action value.
|
int |
getActionInteger(M element)
Get the action value.
|
short |
getActionShort(M element)
Get the action value.
|
short |
getEntityId()
Get the entity id (-1 if none).
|
boolean |
hasAction(M element)
Check if the action is contained.
|
decode, encode, getClientDestId, getClientId, getType
public NetworkMessageEntity()
public NetworkMessageEntity(java.lang.Enum<?> type, byte clientId)
type
- The message type.clientId
- The client id.public NetworkMessageEntity(java.lang.Enum<?> type, short entityId)
type
- The message type.entityId
- The entity id.public NetworkMessageEntity(java.lang.Enum<?> type, short entityId, byte destId)
type
- The message type.entityId
- The entity id.destId
- The client destination.public void addAction(M element, boolean value)
element
- The action type.value
- The action value.public void addAction(M element, char value)
element
- The action type.value
- The action value.public void addAction(M element, byte value)
element
- The action type.value
- The action value.public void addAction(M element, short value)
element
- The action type.value
- The action value.public void addAction(M element, int value)
element
- The action type.value
- The action value.public void addAction(M element, double value)
element
- The action type.value
- The action value.public boolean getActionBoolean(M element)
element
- The action element.public byte getActionByte(M element)
element
- The action element.public char getActionChar(M element)
element
- The action element.public short getActionShort(M element)
element
- The action element.public int getActionInteger(M element)
element
- The action element.public double getActionDouble(M element)
element
- The action element.public boolean hasAction(M element)
element
- The action to check.true
if action is contained, false
else.public short getEntityId()