Esempio n. 1
0
        bool ShouldProcessZipEntry(string filename)
        {
            string name = ResourceList.GetFile(filename);

            ResourceList.Files.Remove(name);
            return(false);
        }
Esempio n. 2
0
        void CheckTexturePack()
        {
            byte flags = ResourceList.GetFetchFlags();

            if (flags != 0)
            {
                AllResourcesExist = false;
            }

            if ((flags & ResourceList.mask_classic) != 0)
            {
                DownloadSize += 291 / 1024f; ResourcesCount++;
            }
            if ((flags & ResourceList.mask_modern) != 0)
            {
                DownloadSize += 4621 / 1024f; ResourcesCount++;
            }
            if ((flags & ResourceList.mask_terrain) != 0)
            {
                DownloadSize += 7 / 1024f; ResourcesCount++;
            }
            if ((flags & ResourceList.mask_gui) != 0)
            {
                DownloadSize += 21 / 1024f; ResourcesCount++;
            }
        }
        public void DownloadItems(AsyncDownloader downloader, Action <string> setStatus)
        {
            this.downloader = downloader;
            byte fetchFlags = ResourceList.GetFetchFlags();

            if ((fetchFlags & ResourceList.mask_classic) != 0)
            {
                QueueItem(jarClassicUri, "classic jar");
            }
            if ((fetchFlags & ResourceList.mask_modern) != 0)
            {
                QueueItem(jar162Uri, "1.6.2 jar");
            }
            if ((fetchFlags & ResourceList.mask_gui) != 0)
            {
                QueueItem(pngGuiPatchUri, "gui.png patch");
            }
            if ((fetchFlags & ResourceList.mask_terrain) != 0)
            {
                QueueItem(pngTerrainPatchUri, "terrain.png patch");
            }

            DownloadMusicFiles();
            digPatcher = new SoundPatcher(ResourceList.DigSounds, "dig_");
            digPatcher.FetchFiles(digSoundsUri, altDigSoundsUri, this, DigSoundsExist);
            stepPatcher = new SoundPatcher(ResourceList.StepSounds, "step_");
            stepPatcher.FetchFiles(stepSoundsUri, altStepSoundsUri, this, StepSoundsExist);

            setStatus(MakeNext());
        }
Esempio n. 4
0
        void ProcessZipEntry_Classic(string filename, byte[] data, ZipEntry entry)
        {
            if (!filename.EndsWith(".png", comp))
            {
                return;
            }
            entry.Filename = ResourceList.GetFile(filename);

            if (entry.Filename != "terrain.png")
            {
                if (entry.Filename == "gui.png")
                {
                    entry.Filename = "gui_classic.png";
                }

                if (!existing.Contains(entry.Filename))
                {
                    writer.WriteZipEntry(entry, data);
                }
            }
            else if (!existing.Contains("terrain.png"))
            {
                terrainBmp = Platform.ReadBmp32Bpp(drawer, data);
                using (Bitmap mask = Platform.ReadBmp32Bpp(drawer, pngTerrainPatch)) {
                    CopyTile(0, 0, 3 * 16, 3 * 16, mask, terrainBmp);
                    CopyTile(16, 0, 6 * 16, 3 * 16, mask, terrainBmp);
                    CopyTile(32, 0, 6 * 16, 2 * 16, mask, terrainBmp);

                    CopyTile(0, 16, 5 * 16, 3 * 16, mask, terrainBmp);
                    CopyTile(16, 16, 6 * 16, 5 * 16, mask, terrainBmp);
                    CopyTile(32, 16, 11 * 16, 0 * 16, mask, terrainBmp);
                    patchedTerrain = true;
                }
            }
        }
Esempio n. 5
0
        void ProcessZipEntry_Modern(string filename, byte[] data, ZipEntry entry)
        {
            entry.Filename = ResourceList.GetFile(filename);
            switch (filename)
            {
            case "assets/minecraft/textures/environment/snow.png":
                if (!existing.Contains("snow.png"))
                {
                    writer.WriteZipEntry(entry, data);
                }
                break;

            case "assets/minecraft/textures/entity/chicken.png":
                if (!existing.Contains("chicken.png"))
                {
                    writer.WriteZipEntry(entry, data);
                }
                break;

            case "assets/minecraft/textures/blocks/water_still.png":
                PatchDefault(data, 0);
                break;

            case "assets/minecraft/textures/blocks/lava_still.png":
                PatchCycle(data, 16);
                break;

            case "assets/minecraft/textures/blocks/fire_layer_1.png":
                PatchDefault(data, 32);
                break;
            }
        }
Esempio n. 6
0
        void ProcessZipEntry_Classic(string filename, byte[] data, ZipEntry entry)
        {
            if (!filename.EndsWith(".png", comp))
            {
                return;
            }
            entry.Filename = ResourceList.GetFile(filename);

            if (entry.Filename != "terrain.png")
            {
                if (entry.Filename == "gui.png")
                {
                    entry.Filename = "gui_classic.png";
                }
                if (!existing.Contains(entry.Filename))
                {
                    writer.WriteZipEntry(entry, data);
                }
                return;
            }
            else if (!existing.Contains("terrain.png"))
            {
                using (Bitmap dstBitmap = new Bitmap(new MemoryStream(data)),
                       maskBitmap = new Bitmap(new MemoryStream(pngTerrainPatch))) {
                    PatchImage(dstBitmap, maskBitmap);
                    writer.WriteNewImage(dstBitmap, "terrain.png");
                }
            }
        }
        void ProcessZipEntry_Classic(string filename, byte[] data, ZipEntry entry)
        {
            if (!filename.EndsWith(".png", comp))
            {
                return;
            }
            entry.Filename = ResourceList.GetFile(filename);

            if (entry.Filename != "terrain.png")
            {
                if (entry.Filename == "gui.png")
                {
                    entry.Filename = "gui_classic.png";
                }
                if (!existing.Contains(entry.Filename))
                {
                    writer.WriteZipEntry(entry, data);
                }
                return;
            }
            else if (!existing.Contains("terrain.png"))
            {
                using (Bitmap dst = Platform.ReadBmp32Bpp(drawer, data),
                       mask = Platform.ReadBmp32Bpp(drawer, pngTerrainPatch)) {
                    PatchImage(dst, mask);
                    writer.WriteNewImage(dst, "terrain.png");
                }
            }
        }
Esempio n. 8
0
 void ExtractExisting(string filename, byte[] data, ZipEntry entry)
 {
     filename       = ResourceList.GetFile(filename);
     entry.Filename = filename;
     existing.Add(filename);
     entries.Add(entry);
     datas.Add(data);
 }
Esempio n. 9
0
        bool SelectZipEntry(string filename)
        {
            string name = ResourceList.GetFile(filename);

            for (int i = 0; i < ResourceList.Filenames.Length; i++)
            {
                if (ResourceList.FilesExist[i])
                {
                    continue;
                }
                if (name != ResourceList.Filenames[i])
                {
                    continue;
                }

                ResourceList.FilesExist[i] = true;
                break;
            }
            return(false);
        }
Esempio n. 10
0
 void ProcessZipEntry_Modern(string filename, byte[] data, ZipEntry entry)
 {
     entry.Filename = ResourceList.GetFile(filename);
     if (filename == "assets/minecraft/textures/environment/snow.png")
     {
         if (!existing.Contains("snow.png"))
         {
             writer.WriteZipEntry(entry, data);
         }
     }
     else if (filename == "assets/minecraft/textures/entity/chicken.png")
     {
         if (!existing.Contains("chicken.png"))
         {
             writer.WriteZipEntry(entry, data);
         }
     }
     else if (filename == "assets/minecraft/textures/blocks/fire_layer_1.png")
     {
         PatchAnim(data);
     }
     else if (filename == "assets/minecraft/textures/blocks/sandstone_bottom.png")
     {
         PatchBlock(data, 9, 3);
     }
     else if (filename == "assets/minecraft/textures/blocks/sandstone_normal.png")
     {
         PatchBlock(data, 9, 2);
     }
     else if (filename == "assets/minecraft/textures/blocks/sandstone_top.png")
     {
         PatchBlock(data, 9, 1);
     }
     else if (filename == "assets/minecraft/textures/blocks/quartz_block_lines_top.png")
     {
         PatchBlock(data, 10, 3);
         PatchBlock(data, 10, 1);
     }
     else if (filename == "assets/minecraft/textures/blocks/quartz_block_lines.png")
     {
         PatchBlock(data, 10, 2);
     }
     else if (filename == "assets/minecraft/textures/blocks/stonebrick.png")
     {
         PatchBlock(data, 4, 3);
     }
     else if (filename == "assets/minecraft/textures/blocks/snow.png")
     {
         PatchBlock(data, 2, 3);
     }
     else if (filename == "assets/minecraft/textures/blocks/wool_colored_blue.png")
     {
         PatchBlock(data, 3, 5);
     }
     else if (filename == "assets/minecraft/textures/blocks/wool_colored_brown.png")
     {
         PatchBlock(data, 2, 5);
     }
     else if (filename == "assets/minecraft/textures/blocks/wool_colored_cyan.png")
     {
         PatchBlock(data, 4, 5);
     }
     else if (filename == "assets/minecraft/textures/blocks/wool_colored_green.png")
     {
         PatchBlock(data, 1, 5);
     }
     else if (filename == "assets/minecraft/textures/blocks/wool_colored_pink.png")
     {
         PatchBlock(data, 0, 5);
     }
 }