/// <summary> /// Called with the root json node to load the data from /// </summary> public virtual void LoadJSON(JSONNode node) { JSONNode array = node.GetAs <JSONNode>("array"); for (int i = 0; i < array.ChildCount; i++) { GrowableBlockManager.RegisterGrowableBlock(MakeGrowableBlock(array[i])); } }
static void Load() { if (queuedDefinitions != null) { for (int i = 0; i < queuedDefinitions.Count; i++) { try { GrowableBlockManager.RegisterGrowableBlockType((IGrowableBlockDefinition)Activator.CreateInstance(queuedDefinitions[i])); } catch (Exception e) { Log.WriteException(e); } } queuedDefinitions = null; } }
public override void FinishLoading() { base.FinishLoading(); if (updatableBlocks != null) { JSONNode array; if (updatableBlocks.TryGetChild("wheat", out array)) { Log.Write("Loading {0} legacy blocks to type wheat", array.ChildCount); for (int i = 0; i < array.ChildCount; i++) { GrowableBlockManager.RegisterGrowableBlock(MakeGrowableBlockLegacy(array[i])); } } } }
public override void FinishLoading() { base.FinishLoading(); if (updatableBlocks != null) { JSONNode array; if (updatableBlocks.TryGetChild("sappling", out array)) { Log.Write("Loading {0} legacy blocks to type temperate sapling", array.ChildCount); for (int i = 0; i < array.ChildCount; i++) { GrowableBlockManager.RegisterGrowableBlock(MakeGrowableBlockLegacy(array[i])); } } General.Application.StartAsyncQuitToComplete(delegate() { Log.Write("Queueing delete of legacy updatableblocks.json"); Thread.Sleep(15000); Log.Write("Deleting legacy updatableblocks.json"); File.Delete(string.Format("gamedata/savegames/{0}/updatableblocks.json", ServerManager.WorldName)); }); } }