Beispiel #1
0
        public override void Start(ICoreAPI api)
        {
            this.api = api;


            try
            {
                IAsset asset = api.Assets.TryGet("config.json");
                if (asset != null)
                {
                    config = asset.ToObject <SurvivalConfig>();
                }
            }
            catch (Exception e)
            {
                api.World.Logger.Error("Failed loading survivalconfig.json, error {0}. Will initialize new one", e);
                config = new SurvivalConfig();
            }


            RegisterDefaultBlocks();
            RegisterDefaultBlockBehaviors();
            RegisterDefaultCropBehaviors();
            RegisterDefaultItems();
            RegisterDefaultEntities();
            RegisterDefaultEntityBehaviors();
            RegisterDefaultBlockEntities();

            api.RegisterMountable("bed", BlockBed.GetMountable);
        }
Beispiel #2
0
 private void loadConfig()
 {
     try
     {
         IAsset asset = api.Assets.TryGet("config/general.json");
         if (asset != null)
         {
             config = asset.ToObject <SurvivalConfig>();
         }
     }
     catch (Exception e)
     {
         api.World.Logger.Error("Failed loading survivalconfig.json, error {0}. Will initialize new one", e);
         config = new SurvivalConfig();
     }
 }
Beispiel #3
0
 private void onConfigFromServer(SurvivalConfig networkMessage)
 {
     this.config = networkMessage;
     applyConfig();
 }