using System; using System.Collections.Generic; using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Persistence; using TechbloxModdingAPI.Utility; using RobocraftX.Common; using Svelto.ECS; using Svelto.ECS.Experimental; using Svelto.ECS.Serialization; namespace TechbloxModdingAPI.Blocks { /*public class CustomBlockEngine : IFactoryEngine { public class CustomBlockEntityDescriptor : SerializableEntityDescriptor { [HashName("TechbloxModdingAPICustomBlockV0")] public class _CustomBlockDescriptor : IEntityDescriptor { public IComponentBuilder[] componentsToBuild { get; } = { new SerializableComponentBuilder( ((int) SerializationType.Network, new DefaultSerializer()), ((int) SerializationType.Storage, new DefaultSerializer())) }; } } public void Ready() { SerializerManager.AddSerializer( new SimpleEntitySerializer(db => { var (coll, c) = db.QueryEntities(ApiExclusiveGroups.customBlockGroup); var egids = new EGID[c]; for (int i = 0; i < c; i++) egids[i] = new EGID(coll[i].ID, ApiExclusiveGroups.customBlockGroup); return egids; })); foreach (var (id, name) in _registeredBlocks) { Factory.BuildEntity(id, ApiExclusiveGroups.customBlockGroup) .Init(new CustomBlock.DataStruct {Name = new ECSString(name), ID = id}); } } public EntitiesDB entitiesDB { get; set; } private List<(ushort id, string name)> _registeredBlocks = new List<(ushort, string)>(); public void Dispose() { } public void RegisterBlock(ushort id, string name) { _registeredBlocks.Add((id, name)); } public string Name { get; } = "TechbloxModdingAPICustomBlockEngine"; public bool isRemovable { get; } = false; public IEntityFactory Factory { get; set; } }*/ }