saving items to disk
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-05-05 17:06:04 -04:00
parent 72bacc826a
commit 696f1175bb
2 changed files with 11 additions and 1 deletions

View File

@ -7,7 +7,9 @@ import org.joml.Vector3i;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.ServerEntityUtils;
import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.types.item.ItemUtils;
import electrosphere.server.content.serialization.ContentSerialization;
import electrosphere.server.content.serialization.EntitySerialization;
import electrosphere.server.datacell.Realm;
@ -97,6 +99,9 @@ public class ServerContentManager {
Entity creature = CreatureUtils.serverSpawnBasicCreature(realm, serializedEntity.getPosition(), serializedEntity.getSubtype(), null);
EntityUtils.getRotation(creature).set(serializedEntity.getRotation());
} break;
case ItemUtils.ENTITY_TYPE_ITEM: {
Entity item = ItemUtils.serverSpawnBasicItem(realm, serializedEntity.getPosition(), serializedEntity.getSubtype());
} break;
}
}
}

View File

@ -38,7 +38,12 @@ public class ContentSerialization {
rVal.serializedEntities.add(serializedEntity);
}
if(ItemUtils.isItem(entity)){
throw new UnsupportedOperationException();
EntitySerialization serializedEntity = new EntitySerialization();
serializedEntity.setPosition(EntityUtils.getPosition(entity));
serializedEntity.setRotation(EntityUtils.getRotation(entity));
serializedEntity.setType(ItemUtils.ENTITY_TYPE_ITEM);
serializedEntity.setSubtype(ItemUtils.getType(entity));
rVal.serializedEntities.add(serializedEntity);
}
if(ObjectUtils.isObject(entity)){
throw new UnsupportedOperationException();