void LoadEntities(List <RegistryObjectType>[] variantLists) { // Step2: create all the entities from their types, and register them: this has to be on the main thread as the registry is not thread-safe LoadFromVariants(variantLists, "entitie", (variants) => { foreach (EntityType type in variants) { api.RegisterEntityClass(type.Class, type.CreateProperties()); } }); }
void LoadEntities() { foreach (var val in entityTypes) { if (!val.Value.Enabled) { continue; } foreach (EntityType type in GatherEntities(val.Key, val.Value)) { api.RegisterEntityClass(type.Class, type.CreateProperties()); } } }
public override void StartServerSide(ICoreServerAPI api) { Dictionary <AssetLocation, EntityType> configs = api.Assets.GetMany <EntityType>(api.Server.Logger, "entities/"); foreach (EntityType config in configs.Values) { if (!config.Enabled) { continue; } config.InitClass(api.Assets); api.RegisterEntityClass(config.Class, config); } }