예제 #1
0
        internal void LoadModdedStuff()
        {
            string path = Path.Combine(Main.ActiveWorldFileData.Path.Replace(".wld", ""), ActiveDimensionName.Split(':')[1]) + "\\modded.data";

            using (BinaryReader reader = new BinaryReader(File.Open(path, FileMode.Open)))
            {
                int bufferSize = reader.ReadInt32();
                Terraria.ModLoader.IO.TagCompound tag = Terraria.ModLoader.IO.TagIO.FromStream(new MemoryStream(reader.ReadBytes(bufferSize)));

                typeof(Main).Assembly.GetType("Terraria.ModLoader.IO.TileIO")
                .GetMethod("LoadTiles", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { tag.GetCompound("tiles") });
                typeof(Main).Assembly.GetType("Terraria.ModLoader.IO.TileIO")
                .GetMethod("LoadContainers", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { tag.GetCompound("containers") });
            }
        }