fix foliage seed handling
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
d56d08204c
commit
822424af3f
@ -1734,6 +1734,7 @@ Catch errors in pathfinding threads
|
|||||||
Remove old data classes
|
Remove old data classes
|
||||||
Update default block cursor size
|
Update default block cursor size
|
||||||
Creature template -> object template
|
Creature template -> object template
|
||||||
|
Fix foliage saving seed to template
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package electrosphere.client.ui.menu.ingame;
|
package electrosphere.client.ui.menu.ingame;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
@ -239,7 +237,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, data.getId(), new Random().nextLong());
|
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, data.getId());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package electrosphere.client.ui.menu.script;
|
package electrosphere.client.ui.menu.script;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.graalvm.polyglot.HostAccess.Export;
|
import org.graalvm.polyglot.HostAccess.Export;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
@ -69,7 +67,7 @@ public class ScriptLevelEditorUtils {
|
|||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
}
|
}
|
||||||
cursorPos = cursorPos.add(cursorVerticalOffset);
|
cursorPos = cursorPos.add(cursorVerticalOffset);
|
||||||
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, Globals.selectedSpawntype.getId(), new Random().nextLong());
|
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, Globals.selectedSpawntype.getId());
|
||||||
} else {
|
} else {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + Globals.selectedSpawntype.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + Globals.selectedSpawntype.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
|
|||||||
@ -273,7 +273,6 @@ public class EntityDataStrings {
|
|||||||
*/
|
*/
|
||||||
public static final String FOLIAGE_TYPE = "foliageType";
|
public static final String FOLIAGE_TYPE = "foliageType";
|
||||||
public static final String FOLIAGE_AMBIENT_TREE = "foliageAmbientTree";
|
public static final String FOLIAGE_AMBIENT_TREE = "foliageAmbientTree";
|
||||||
public static final String FOLIAGE_SEED = "foliageSeed";
|
|
||||||
public static final String FOLIAGE_IS_SEEDED = "foliageIsSeeded";
|
public static final String FOLIAGE_IS_SEEDED = "foliageIsSeeded";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -68,6 +68,7 @@ import electrosphere.entity.types.collision.CollisionObjUtils;
|
|||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.creature.ObjectInventoryData;
|
import electrosphere.entity.types.creature.ObjectInventoryData;
|
||||||
import electrosphere.entity.types.creature.ObjectTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.game.data.collidable.CollidableTemplate;
|
import electrosphere.game.data.collidable.CollidableTemplate;
|
||||||
import electrosphere.game.data.common.CommonEntityType;
|
import electrosphere.game.data.common.CommonEntityType;
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
@ -833,6 +834,33 @@ public class CommonEntityUtils {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawns a server-side object
|
||||||
|
* @param type The type of object to spawn
|
||||||
|
* @return The object
|
||||||
|
*/
|
||||||
|
public static Entity serverSpawnTemplateObject(Realm realm, Vector3d position, String type, ObjectTemplate template){
|
||||||
|
Entity rVal = CommonEntityUtils.serverSpawnBasicObject(realm, position, type);
|
||||||
|
|
||||||
|
//apply inventory data
|
||||||
|
if(template.getInventoryData() != null){
|
||||||
|
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||||
|
if(inventoryData.getNaturalItems() != null && inventoryData.getNaturalItems().size() > 0){
|
||||||
|
for(EntitySerialization serializedItem : inventoryData.getNaturalItems()){
|
||||||
|
ItemUtils.serverCreateContainerItem(rVal, Globals.gameConfigCurrent.getItemMap().getItem(serializedItem.getSubtype()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(inventoryData.getEquipItems() != null && inventoryData.getEquipItems().size() > 0){
|
||||||
|
throw new Error("Unsupported currently");
|
||||||
|
}
|
||||||
|
if(inventoryData.getToolbarItems() != null && inventoryData.getToolbarItems().size() > 0){
|
||||||
|
throw new Error("Unsupported currently");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the object to a given player
|
* Sets the object to a given player
|
||||||
* @param player The player
|
* @param player The player
|
||||||
|
|||||||
@ -27,19 +27,24 @@ import org.joml.Vector3d;
|
|||||||
*/
|
*/
|
||||||
public class FoliageUtils {
|
public class FoliageUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default seed
|
||||||
|
*/
|
||||||
|
public static final long DEFAULT_SEED = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawns a basic foliage object
|
* Spawns a basic foliage object
|
||||||
* @param type The type of foliage object
|
* @param type The type of foliage object
|
||||||
* @return The entity for the foliage
|
* @return The entity for the foliage
|
||||||
*/
|
*/
|
||||||
public static Entity clientSpawnBasicFoliage(String type, long seed){
|
public static Entity clientSpawnBasicFoliage(String type){
|
||||||
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
||||||
Entity rVal;
|
Entity rVal;
|
||||||
if(
|
if(
|
||||||
rawType.getGraphicsTemplate().getProceduralModel() != null &&
|
rawType.getGraphicsTemplate().getProceduralModel() != null &&
|
||||||
rawType.getGraphicsTemplate().getProceduralModel().getTreeModel()!=null
|
rawType.getGraphicsTemplate().getProceduralModel().getTreeModel()!=null
|
||||||
){
|
){
|
||||||
rVal = ProceduralTree.clientGenerateProceduralTree(type, 0);
|
rVal = ProceduralTree.clientGenerateProceduralTree(type, DEFAULT_SEED);
|
||||||
} else {
|
} else {
|
||||||
rVal = EntityCreationUtils.createClientSpatialEntity();
|
rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
}
|
}
|
||||||
@ -56,7 +61,6 @@ public class FoliageUtils {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
rVal.putData(EntityDataStrings.FOLIAGE_TYPE, rawType);
|
rVal.putData(EntityDataStrings.FOLIAGE_TYPE, rawType);
|
||||||
rVal.putData(EntityDataStrings.FOLIAGE_SEED, seed);
|
|
||||||
rVal.putData(EntityDataStrings.FOLIAGE_IS_SEEDED, true);
|
rVal.putData(EntityDataStrings.FOLIAGE_IS_SEEDED, true);
|
||||||
|
|
||||||
//audio
|
//audio
|
||||||
@ -77,14 +81,14 @@ public class FoliageUtils {
|
|||||||
* @param seed the seed for the tree
|
* @param seed the seed for the tree
|
||||||
* @return the tree entity
|
* @return the tree entity
|
||||||
*/
|
*/
|
||||||
public static Entity serverSpawnTreeFoliage(Realm realm, Vector3d position, String type, long seed){
|
public static Entity serverSpawnTreeFoliage(Realm realm, Vector3d position, String type){
|
||||||
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
||||||
Entity rVal;
|
Entity rVal;
|
||||||
if(
|
if(
|
||||||
rawType.getGraphicsTemplate().getProceduralModel() != null &&
|
rawType.getGraphicsTemplate().getProceduralModel() != null &&
|
||||||
rawType.getGraphicsTemplate().getProceduralModel().getTreeModel()!=null
|
rawType.getGraphicsTemplate().getProceduralModel().getTreeModel()!=null
|
||||||
){
|
){
|
||||||
rVal = ProceduralTree.serverGenerateProceduralTree(realm, position, rawType, seed);
|
rVal = ProceduralTree.serverGenerateProceduralTree(realm, position, rawType, DEFAULT_SEED);
|
||||||
} else {
|
} else {
|
||||||
rVal = EntityCreationUtils.createServerEntity(realm, position);
|
rVal = EntityCreationUtils.createServerEntity(realm, position);
|
||||||
}
|
}
|
||||||
@ -104,7 +108,6 @@ public class FoliageUtils {
|
|||||||
//
|
//
|
||||||
ServerEntityTagUtils.attachTagToEntity(rVal, EntityTags.FOLIAGE);
|
ServerEntityTagUtils.attachTagToEntity(rVal, EntityTags.FOLIAGE);
|
||||||
rVal.putData(EntityDataStrings.FOLIAGE_TYPE, rawType);
|
rVal.putData(EntityDataStrings.FOLIAGE_TYPE, rawType);
|
||||||
rVal.putData(EntityDataStrings.FOLIAGE_SEED, seed);
|
|
||||||
rVal.putData(EntityDataStrings.FOLIAGE_IS_SEEDED, true);
|
rVal.putData(EntityDataStrings.FOLIAGE_IS_SEEDED, true);
|
||||||
|
|
||||||
//position entity
|
//position entity
|
||||||
@ -117,15 +120,6 @@ public class FoliageUtils {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the seed for a given foliage item
|
|
||||||
* @param entity The entity
|
|
||||||
* @return The seed
|
|
||||||
*/
|
|
||||||
public static long getFoliageSeed(Entity entity){
|
|
||||||
return (long)entity.getData(EntityDataStrings.FOLIAGE_SEED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of foliage
|
* Gets the type of foliage
|
||||||
* @param entity the entity
|
* @param entity the entity
|
||||||
@ -165,12 +159,11 @@ public class FoliageUtils {
|
|||||||
Vector3d position = EntityUtils.getPosition(foliage);
|
Vector3d position = EntityUtils.getPosition(foliage);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(foliage);
|
Quaterniond rotation = EntityUtils.getRotation(foliage);
|
||||||
if(FoliageUtils.hasSeed(foliage)){
|
if(FoliageUtils.hasSeed(foliage)){
|
||||||
long seed = FoliageUtils.getFoliageSeed(foliage);
|
|
||||||
NetworkMessage message = EntityMessage.constructCreateMessage(
|
NetworkMessage message = EntityMessage.constructCreateMessage(
|
||||||
id,
|
id,
|
||||||
EntityType.FOLIAGE.getValue(),
|
EntityType.FOLIAGE.getValue(),
|
||||||
type.getId(),
|
type.getId(),
|
||||||
seed + "",
|
DEFAULT_SEED + "",
|
||||||
position.x,
|
position.x,
|
||||||
position.y,
|
position.y,
|
||||||
position.z,
|
position.z,
|
||||||
|
|||||||
@ -258,7 +258,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
static Entity spawnFoliage(EntityMessage message){
|
static Entity spawnFoliage(EntityMessage message){
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] Spawn foliage " + message.getentityID() + " at " + message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] Spawn foliage " + message.getentityID() + " at " + message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
||||||
String type = message.getentitySubtype();
|
String type = message.getentitySubtype();
|
||||||
Entity newlySpawnedEntity = FoliageUtils.clientSpawnBasicFoliage(type,Long.parseLong(message.getcreatureTemplate()));
|
Entity newlySpawnedEntity = FoliageUtils.clientSpawnBasicFoliage(type);
|
||||||
ClientEntityUtils.initiallyPositionEntity(
|
ClientEntityUtils.initiallyPositionEntity(
|
||||||
newlySpawnedEntity,
|
newlySpawnedEntity,
|
||||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class EnvironmentGenerator {
|
|||||||
0,
|
0,
|
||||||
ServerWorldData.convertWorldToReal(worldPos.z) + rand.nextFloat() * 16
|
ServerWorldData.convertWorldToReal(worldPos.z) + rand.nextFloat() * 16
|
||||||
);
|
);
|
||||||
FoliageUtils.serverSpawnTreeFoliage(realm, position, "oak", rand.nextLong());
|
FoliageUtils.serverSpawnTreeFoliage(realm, position, "oak");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,8 +117,7 @@ public class ServerContentGenerator {
|
|||||||
height,
|
height,
|
||||||
realZ
|
realZ
|
||||||
),
|
),
|
||||||
type,
|
type
|
||||||
random.nextLong()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,15 +65,15 @@ public class ContentSerialization {
|
|||||||
EntitySerialization serializedEntity = new EntitySerialization();
|
EntitySerialization serializedEntity = new EntitySerialization();
|
||||||
serializedEntity.setPosition(EntityUtils.getPosition(entity));
|
serializedEntity.setPosition(EntityUtils.getPosition(entity));
|
||||||
serializedEntity.setRotation(EntityUtils.getRotation(entity));
|
serializedEntity.setRotation(EntityUtils.getRotation(entity));
|
||||||
|
if(CommonEntityUtils.getObjectTemplate(entity) != null){
|
||||||
|
serializedEntity.setTemplate(Utilities.stringify(CommonEntityUtils.getObjectTemplate(entity)));
|
||||||
|
}
|
||||||
EntityType type = CommonEntityUtils.getEntityType(entity);
|
EntityType type = CommonEntityUtils.getEntityType(entity);
|
||||||
if(type != null){
|
if(type != null){
|
||||||
switch(type){
|
switch(type){
|
||||||
case CREATURE: {
|
case CREATURE: {
|
||||||
serializedEntity.setType(EntityType.CREATURE.getValue());
|
serializedEntity.setType(EntityType.CREATURE.getValue());
|
||||||
serializedEntity.setSubtype(CommonEntityUtils.getEntitySubtype(entity));
|
serializedEntity.setSubtype(CommonEntityUtils.getEntitySubtype(entity));
|
||||||
if(CommonEntityUtils.getObjectTemplate(entity) != null){
|
|
||||||
serializedEntity.setTemplate(Utilities.stringify(CommonEntityUtils.getObjectTemplate(entity)));
|
|
||||||
}
|
|
||||||
} break;
|
} break;
|
||||||
case ITEM: {
|
case ITEM: {
|
||||||
if(!AttachUtils.isAttached(entity)){
|
if(!AttachUtils.isAttached(entity)){
|
||||||
@ -84,7 +84,6 @@ public class ContentSerialization {
|
|||||||
case FOLIAGE: {
|
case FOLIAGE: {
|
||||||
serializedEntity.setType(EntityType.FOLIAGE.getValue());
|
serializedEntity.setType(EntityType.FOLIAGE.getValue());
|
||||||
serializedEntity.setSubtype(CommonEntityUtils.getEntitySubtype(entity));
|
serializedEntity.setSubtype(CommonEntityUtils.getEntitySubtype(entity));
|
||||||
serializedEntity.setTemplate(FoliageUtils.getFoliageSeed(entity) + "");
|
|
||||||
} break;
|
} break;
|
||||||
case COMMON: {
|
case COMMON: {
|
||||||
serializedEntity.setType(EntityType.COMMON.getValue());
|
serializedEntity.setType(EntityType.COMMON.getValue());
|
||||||
@ -121,15 +120,17 @@ public class ContentSerialization {
|
|||||||
if(serializedEntity.getSubtype() == null){
|
if(serializedEntity.getSubtype() == null){
|
||||||
throw new Error("Subtype undefined!");
|
throw new Error("Subtype undefined!");
|
||||||
}
|
}
|
||||||
|
ObjectTemplate template = null;
|
||||||
|
if(serializedEntity.getTemplate() != null && serializedEntity.getTemplate().length() > 0){
|
||||||
|
try{
|
||||||
|
template = Utilities.deserialize(serializedEntity.getTemplate(), ObjectTemplate.class);
|
||||||
|
} catch(Exception e){
|
||||||
|
String message = serializedEntity.getTemplate() + "\n";
|
||||||
|
throw new Error(message, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
||||||
case CREATURE: {
|
case CREATURE: {
|
||||||
ObjectTemplate template = null;
|
|
||||||
if(serializedEntity.getTemplate() != null){
|
|
||||||
template = Utilities.deserialize(serializedEntity.getTemplate(), ObjectTemplate.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//Spawn the creature itself
|
|
||||||
rVal = CreatureUtils.serverSpawnBasicCreature(realm, serializedEntity.getPosition(), serializedEntity.getSubtype(), template);
|
rVal = CreatureUtils.serverSpawnBasicCreature(realm, serializedEntity.getPosition(), serializedEntity.getSubtype(), template);
|
||||||
CreatureUtils.serverApplyTemplate(realm, rVal, template);
|
CreatureUtils.serverApplyTemplate(realm, rVal, template);
|
||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
@ -139,12 +140,15 @@ public class ContentSerialization {
|
|||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
} break;
|
} break;
|
||||||
case COMMON: {
|
case COMMON: {
|
||||||
|
if(template == null){
|
||||||
rVal = CommonEntityUtils.serverSpawnBasicObject(realm, serializedEntity.getPosition(), serializedEntity.getSubtype());
|
rVal = CommonEntityUtils.serverSpawnBasicObject(realm, serializedEntity.getPosition(), serializedEntity.getSubtype());
|
||||||
|
} else {
|
||||||
|
rVal = CommonEntityUtils.serverSpawnTemplateObject(realm, serializedEntity.getPosition(), serializedEntity.getSubtype(), template);
|
||||||
|
}
|
||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
} break;
|
} break;
|
||||||
case FOLIAGE: {
|
case FOLIAGE: {
|
||||||
long seed = Long.parseLong(serializedEntity.getTemplate());
|
rVal = FoliageUtils.serverSpawnTreeFoliage(realm, serializedEntity.getPosition(), serializedEntity.getSubtype());
|
||||||
rVal = FoliageUtils.serverSpawnTreeFoliage(realm, serializedEntity.getPosition(), serializedEntity.getSubtype(), seed);
|
|
||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
} break;
|
} break;
|
||||||
case ENGINE: {
|
case ENGINE: {
|
||||||
@ -160,15 +164,12 @@ public class ContentSerialization {
|
|||||||
*/
|
*/
|
||||||
public static Entity clientHydrateEntitySerialization(EntitySerialization serializedEntity){
|
public static Entity clientHydrateEntitySerialization(EntitySerialization serializedEntity){
|
||||||
Entity rVal = null;
|
Entity rVal = null;
|
||||||
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
|
||||||
case CREATURE: {
|
|
||||||
ObjectTemplate template = null;
|
ObjectTemplate template = null;
|
||||||
if(serializedEntity.getTemplate() != null){
|
if(serializedEntity.getTemplate() != null && serializedEntity.getTemplate().length() > 0){
|
||||||
template = Utilities.deserialize(serializedEntity.getTemplate(), ObjectTemplate.class);
|
template = Utilities.deserialize(serializedEntity.getTemplate(), ObjectTemplate.class);
|
||||||
}
|
}
|
||||||
|
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
||||||
//
|
case CREATURE: {
|
||||||
//Spawn the creature itself
|
|
||||||
rVal = CreatureUtils.clientSpawnBasicCreature(serializedEntity.getSubtype(), template);
|
rVal = CreatureUtils.clientSpawnBasicCreature(serializedEntity.getSubtype(), template);
|
||||||
CreatureUtils.clientApplyTemplate(rVal, template);
|
CreatureUtils.clientApplyTemplate(rVal, template);
|
||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
@ -182,8 +183,7 @@ public class ContentSerialization {
|
|||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
} break;
|
} break;
|
||||||
case FOLIAGE: {
|
case FOLIAGE: {
|
||||||
long seed = Long.parseLong(serializedEntity.getTemplate());
|
rVal = FoliageUtils.clientSpawnBasicFoliage(serializedEntity.getSubtype());
|
||||||
rVal = FoliageUtils.clientSpawnBasicFoliage(serializedEntity.getSubtype(), seed);
|
|
||||||
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
EntityUtils.getRotation(rVal).set(serializedEntity.getRotation());
|
||||||
} break;
|
} break;
|
||||||
case ENGINE: {
|
case ENGINE: {
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class SpawnAllEntitiesTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
FoliageTypeLoader foliageTypeMap = Globals.gameConfigCurrent.getFoliageMap();
|
FoliageTypeLoader foliageTypeMap = Globals.gameConfigCurrent.getFoliageMap();
|
||||||
for(FoliageType foliage : foliageTypeMap.getTypes()){
|
for(FoliageType foliage : foliageTypeMap.getTypes()){
|
||||||
FoliageUtils.serverSpawnTreeFoliage(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), foliage.getId(), 0);
|
FoliageUtils.serverSpawnTreeFoliage(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), foliage.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonEntityMap commonEntityMap = Globals.gameConfigCurrent.getObjectTypeMap();
|
CommonEntityMap commonEntityMap = Globals.gameConfigCurrent.getObjectTypeMap();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user