Terraria.ModLoader.MapLoader.SetupModMap C# (CSharp) Method

SetupModMap() static private method

static private SetupModMap ( ) : void
return void
		internal static void SetupModMap()
		{
			if (Main.dedServ)
			{
				return;
			}
			Array.Resize(ref MapHelper.tileLookup, TileLoader.TileCount);
			Array.Resize(ref MapHelper.wallLookup, WallLoader.WallCount);
			IList<Color> colors = new List<Color>();
			IList<string> names = new List<string>();
			foreach (ushort type in tileEntries.Keys)
			{
				MapHelper.tileLookup[type] = (ushort)(MapHelper.modPosition + colors.Count);
				foreach (MapEntry entry in tileEntries[type])
				{
					ushort mapType = (ushort)(MapHelper.modPosition + colors.Count);
					entryToTile[mapType] = type;
					nameFuncs[mapType] = entry.getName;
					colors.Add(entry.color);
					names.Add(entry.name);
				}
			}
			foreach (ushort type in wallEntries.Keys)
			{
				MapHelper.wallLookup[type] = (ushort)(MapHelper.modPosition + colors.Count);
				foreach (MapEntry entry in wallEntries[type])
				{
					ushort mapType = (ushort)(MapHelper.modPosition + colors.Count);
					entryToWall[mapType] = type;
					nameFuncs[mapType] = entry.getName;
					colors.Add(entry.color);
					names.Add(entry.name);
				}
			}
			Array.Resize(ref MapHelper.colorLookup, MapHelper.modPosition + colors.Count);
			Lang.mapLegend.Resize(MapHelper.modPosition + names.Count);
			for (int k = 0; k < colors.Count; k++)
			{
				MapHelper.colorLookup[MapHelper.modPosition + k] = colors[k];
				Lang.mapLegend[MapHelper.modPosition + k] = names[k];
			}
			initialized = true;
		}

Usage Example

Ejemplo n.º 1
0
        internal static void Load()
        {
            Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
            LoadModContent(mod => {
                mod.loading = true;
                mod.File?.Read(TmodFile.LoadedState.Streaming, mod.LoadResourceFromStream);
                mod.Autoload();
                mod.Load();
                mod.loading = false;
            });

            Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
            ResizeArrays();
            RecipeGroupHelper.FixRecipeGroupLookups();

            Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
            LoadModContent(mod => {
                mod.SetupContent();
                mod.PostSetupContent();
                mod.File?.UnloadAssets();
            });

            if (Main.dedServ)
            {
                ModNet.AssignNetIDs();
            }

            Main.player[255] = new Player(false);             // setup inventory is unnecessary

            RefreshModLanguage(Language.ActiveCulture);
            MapLoader.SetupModMap();
            ItemSorting.SetupWhiteLists();
            PlayerInput.ReInitialize();
            SetupRecipes();
        }
All Usage Examples Of Terraria.ModLoader.MapLoader::SetupModMap