A stable modding interface between Techblox and mods https://mod.exmods.org/
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

54 řádky
2.2KB

  1. namespace TechbloxModdingAPI.Blocks.Engines
  2. {
  3. /*public class CustomBlockEngine : IFactoryEngine
  4. {
  5. public class CustomBlockEntityDescriptor : SerializableEntityDescriptor<CustomBlockEntityDescriptor._CustomBlockDescriptor>
  6. {
  7. [HashName("TechbloxModdingAPICustomBlockV0")]
  8. public class _CustomBlockDescriptor : IEntityDescriptor
  9. {
  10. public IComponentBuilder[] componentsToBuild { get; } =
  11. {
  12. new SerializableComponentBuilder<SerializationType, CustomBlock.DataStruct>(
  13. ((int) SerializationType.Network, new DefaultSerializer<CustomBlock.DataStruct>()),
  14. ((int) SerializationType.Storage, new DefaultSerializer<CustomBlock.DataStruct>()))
  15. };
  16. }
  17. }
  18. public void Ready()
  19. {
  20. SerializerManager.AddSerializer<CustomBlockEntityDescriptor>(
  21. new SimpleEntitySerializer<CustomBlockEntityDescriptor>(db =>
  22. {
  23. var (coll, c) = db.QueryEntities<CustomBlock.DataStruct>(ApiExclusiveGroups.customBlockGroup);
  24. var egids = new EGID[c];
  25. for (int i = 0; i < c; i++)
  26. egids[i] = new EGID(coll[i].ID, ApiExclusiveGroups.customBlockGroup);
  27. return egids;
  28. }));
  29. foreach (var (id, name) in _registeredBlocks)
  30. {
  31. Factory.BuildEntity<CustomBlockEntityDescriptor>(id, ApiExclusiveGroups.customBlockGroup)
  32. .Init(new CustomBlock.DataStruct {Name = new ECSString(name), ID = id});
  33. }
  34. }
  35. public EntitiesDB entitiesDB { get; set; }
  36. private List<(ushort id, string name)> _registeredBlocks = new List<(ushort, string)>();
  37. public void Dispose()
  38. {
  39. }
  40. public void RegisterBlock(ushort id, string name)
  41. {
  42. _registeredBlocks.Add((id, name));
  43. }
  44. public string Name { get; } = "TechbloxModdingAPICustomBlockEngine";
  45. public bool isRemovable { get; } = false;
  46. public IEntityFactory Factory { get; set; }
  47. }*/
  48. }