server can apply state collections now
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
822424af3f
commit
155c51722d
@ -225,7 +225,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
CreatureUtils.clientApplyTemplate(newlySpawnedEntity, template);
|
CreatureUtils.clientApplyTemplate(newlySpawnedEntity, template);
|
||||||
//apply state synchronization if present
|
//apply state synchronization if present
|
||||||
if(template != null && template.getStateCollection() != null && template.getStateCollection().getValues() != null){
|
if(template != null && template.getStateCollection() != null && template.getStateCollection().getValues() != null){
|
||||||
StateCollection.applyStateCollection(newlySpawnedEntity, template.getStateCollection());
|
StateCollection.clientApplyStateCollection(newlySpawnedEntity, template.getStateCollection());
|
||||||
}
|
}
|
||||||
return newlySpawnedEntity;
|
return newlySpawnedEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ public class StateCollection {
|
|||||||
* @param entity The entity
|
* @param entity The entity
|
||||||
* @param collection The state collection
|
* @param collection The state collection
|
||||||
*/
|
*/
|
||||||
public static void applyStateCollection(Entity entity, StateCollection collection){
|
public static void clientApplyStateCollection(Entity entity, StateCollection collection){
|
||||||
for(SynchronizedFieldValue syncedValue : collection.getValues()){
|
for(SynchronizedFieldValue syncedValue : collection.getValues()){
|
||||||
switch(syncedValue.getBehaviorTreeId()){
|
switch(syncedValue.getBehaviorTreeId()){
|
||||||
case BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID: {
|
case BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID: {
|
||||||
@ -286,7 +286,148 @@ public class StateCollection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> Automatically generated </p>
|
||||||
|
* <p>
|
||||||
|
* Applies the state collection to the given entity
|
||||||
|
* </p>
|
||||||
|
* @param entity The entity
|
||||||
|
* @param collection The state collection
|
||||||
|
*/
|
||||||
|
public static void serverApplyStateCollection(Entity entity, StateCollection collection){
|
||||||
|
for(SynchronizedFieldValue syncedValue : collection.getValues()){
|
||||||
|
switch(syncedValue.getBehaviorTreeId()){
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERATTACKTREE_ID: {
|
||||||
|
ServerAttackTree tree = ServerAttackTree.getServerAttackTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERATTACKTREE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientAttackTree.getAttackTreeStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
case(FieldIdEnums.TREE_SERVERATTACKTREE_SYNCEDFIELD_DRIFTSTATE_ID): {
|
||||||
|
tree.setDriftState(ClientAttackTree.getAttackTreeDriftStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
case(FieldIdEnums.TREE_SERVERATTACKTREE_SYNCEDFIELD_CURRENTMOVEID_ID): {
|
||||||
|
tree.setCurrentMoveId((String)syncedValue.getValue());
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERBLOCKTREE_ID: {
|
||||||
|
ServerBlockTree tree = ServerBlockTree.getServerBlockTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientBlockTree.getBlockStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
case(FieldIdEnums.TREE_SERVERBLOCKTREE_SYNCEDFIELD_CURRENTBLOCKVARIANT_ID): {
|
||||||
|
tree.setCurrentBlockVariant((String)syncedValue.getValue());
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERTOOLBARSTATE_ID: {
|
||||||
|
ServerToolbarState tree = ServerToolbarState.getServerToolbarState(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERTOOLBARSTATE_SYNCEDFIELD_SELECTEDSLOT_ID): {
|
||||||
|
tree.setSelectedSlot(((Double)syncedValue.getValue()).intValue());
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERDOOR_ID: {
|
||||||
|
ServerDoorState tree = ServerDoorState.getServerDoorState(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERDOOR_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientDoorState.getDoorStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERGRAVITY_ID: {
|
||||||
|
ServerGravityTree tree = ServerGravityTree.getServerGravityTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERGRAVITY_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientGravityTree.getGravityTreeStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERIDLE_ID: {
|
||||||
|
ServerIdleTree tree = ServerIdleTree.getServerIdleTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERIDLE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientIdleTree.getIdleTreeStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERCHARGESTATE_ID: {
|
||||||
|
ServerChargeState tree = ServerChargeState.getServerChargeState(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERCHARGESTATE_SYNCEDFIELD_CHARGES_ID): {
|
||||||
|
tree.setCharges(((Double)syncedValue.getValue()).intValue());
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERLIFETREE_ID: {
|
||||||
|
ServerLifeTree tree = ServerLifeTree.getServerLifeTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERLIFETREE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientLifeTree.getLifeStateEnumShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERSTANCECOMPONENT_ID: {
|
||||||
|
ServerStanceComponent tree = ServerStanceComponent.getServerStanceComponent(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERSTANCECOMPONENT_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientStanceComponent.getCombatStanceShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVEREDITORMOVEMENTTREE_ID: {
|
||||||
|
ServerEditorMovementTree tree = ServerEditorMovementTree.getServerEditorMovementTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVEREDITORMOVEMENTTREE_SYNCEDFIELD_FACING_ID): {
|
||||||
|
tree.setFacing(ClientEditorMovementTree.getEditorMovementRelativeFacingShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERGROUNDMOVEMENTTREE_ID: {
|
||||||
|
ServerGroundMovementTree tree = ServerGroundMovementTree.getServerGroundMovementTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERGROUNDMOVEMENTTREE_SYNCEDFIELD_FACING_ID): {
|
||||||
|
tree.setFacing(ClientGroundMovementTree.getMovementRelativeFacingShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERJUMPTREE_ID: {
|
||||||
|
ServerJumpTree tree = ServerJumpTree.getServerJumpTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERJUMPTREE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientJumpTree.getJumpStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
case(FieldIdEnums.TREE_SERVERJUMPTREE_SYNCEDFIELD_CURRENTFRAME_ID): {
|
||||||
|
tree.setCurrentFrame(((Double)syncedValue.getValue()).intValue());
|
||||||
|
} break;
|
||||||
|
case(FieldIdEnums.TREE_SERVERJUMPTREE_SYNCEDFIELD_CURRENTJUMPFORCE_ID): {
|
||||||
|
tree.setCurrentJumpForce(((Double)syncedValue.getValue()).floatValue());
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERSPRINTTREE_ID: {
|
||||||
|
ServerSprintTree tree = ServerSprintTree.getServerSprintTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERSPRINTTREE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientSprintTree.getSprintTreeStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case BehaviorTreeIdEnums.BTREE_SERVERWALKTREE_ID: {
|
||||||
|
ServerWalkTree tree = ServerWalkTree.getServerWalkTree(entity);
|
||||||
|
switch(syncedValue.getFieldId()){
|
||||||
|
case(FieldIdEnums.TREE_SERVERWALKTREE_SYNCEDFIELD_STATE_ID): {
|
||||||
|
tree.setState(ClientWalkTree.getWalkStateShortAsEnum(((Double)syncedValue.getValue()).shortValue()));
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of a single synchronized field
|
* The value of a single synchronized field
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user