all entities serialize templates
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
f60d83172d
commit
baea1e1906
@ -1784,6 +1784,7 @@ Grid alignment visualization work
|
||||
Move around entity debug tab classes
|
||||
Grid alignment data editing in debug menus
|
||||
Grid alignment offsets work
|
||||
Inventory state in non-creatures actually saves/loads to/from disk
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1002,7 +1002,7 @@ public class CommonEntityUtils {
|
||||
public static ObjectTemplate getObjectTemplate(Entity e){
|
||||
ObjectTemplate template = (ObjectTemplate)e.getData(EntityDataStrings.OBJECT_TEMPLATE);
|
||||
if(template == null){
|
||||
return null;
|
||||
template = ObjectTemplate.create(CommonEntityUtils.getEntityType(e), CommonEntityUtils.getEntitySubtype(e));
|
||||
}
|
||||
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||
inventoryData.clear();
|
||||
@ -1038,7 +1038,9 @@ public class CommonEntityUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
template.setStateCollection(StateCollection.getStateCollection(e));
|
||||
if(StateCollection.hasStateCollection(e)){
|
||||
template.setStateCollection(StateCollection.getStateCollection(e));
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,15 @@ public class StateCollection {
|
||||
this.values.add(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity has a state collection
|
||||
* @param entity The entity
|
||||
* @return true if it has a state collection, false otherwise
|
||||
*/
|
||||
public static boolean hasStateCollection(Entity entity){
|
||||
return Globals.entityValueTrackingService.getEntityTrees(entity) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Automatically generated </p>
|
||||
* <p>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user