fix streaming character templates

This commit is contained in:
austin 2022-05-10 17:29:27 -04:00
parent 611ea8c0de
commit c69e4e9c9e
3 changed files with 8 additions and 2 deletions

Binary file not shown.

View File

@ -353,6 +353,8 @@ public class CreatureUtils {
} }
} }
} }
//set race
storedTemplate.creatureType = rawType.getCreatureId();
//store template on creature //store template on creature
CreatureUtils.setCreatureTemplate(rVal, storedTemplate); CreatureUtils.setCreatureTemplate(rVal, storedTemplate);
} }
@ -392,9 +394,10 @@ public class CreatureUtils {
int id = creature.getId(); int id = creature.getId();
String type = CreatureUtils.getType(creature); String type = CreatureUtils.getType(creature);
Vector3d position = EntityUtils.getPosition(creature); Vector3d position = EntityUtils.getPosition(creature);
String template = Utilities.stringify(CreatureUtils.getCreatureTemplate(creature));
NetworkMessage message = EntityMessage.constructSpawnCreatureMessage( NetworkMessage message = EntityMessage.constructSpawnCreatureMessage(
id, id,
Utilities.stringify(CreatureUtils.getCreatureTemplate(creature)), template,
position.x, position.x,
position.y, position.y,
position.z); position.z);

View File

@ -47,8 +47,11 @@ public class CharacterProtocol {
static void spawnPlayerCharacter(ServerConnectionHandler connectionHandler){ static void spawnPlayerCharacter(ServerConnectionHandler connectionHandler){
Player playerObject = Globals.playerManager.getPlayerFromId(connectionHandler.getPlayerId()); Player playerObject = Globals.playerManager.getPlayerFromId(connectionHandler.getPlayerId());
//get template
CreatureTemplate template = connectionHandler.getCurrentCreatureTemplate();
String raceName = template.getCreatureType();
//spawn player in world //spawn player in world
Entity newPlayerEntity = CreatureUtils.spawnBasicCreature("human",connectionHandler.getCurrentCreatureTemplate()); Entity newPlayerEntity = CreatureUtils.spawnBasicCreature(raceName,template);
int playerCharacterId = newPlayerEntity.getId(); int playerCharacterId = newPlayerEntity.getId();
connectionHandler.setPlayerCharacterId(playerCharacterId); connectionHandler.setPlayerCharacterId(playerCharacterId);
CreatureUtils.initiallyPositionCreature(newPlayerEntity, new Vector3d(Globals.spawnPoint.x,Globals.spawnPoint.y,Globals.spawnPoint.z)); CreatureUtils.initiallyPositionCreature(newPlayerEntity, new Vector3d(Globals.spawnPoint.x,Globals.spawnPoint.y,Globals.spawnPoint.z));