new file: .gitignore
This commit is contained in:
+93
-26
@@ -1,4 +1,20 @@
|
|||||||
Console.Write("Block Name(diamon_ore): ");
|
using SixLabors.ImageSharp;
|
||||||
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
|
using SixLabors.ImageSharp.Processing;
|
||||||
|
|
||||||
|
|
||||||
|
namespace txtgen;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
// string blockname;
|
||||||
|
static string ctm_dir;
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Console.Write("Block Name(diamon_ore): ");
|
||||||
string blockname = Console.ReadLine();
|
string blockname = Console.ReadLine();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(blockname))
|
if (string.IsNullOrEmpty(blockname))
|
||||||
@@ -6,42 +22,67 @@ if (string.IsNullOrEmpty(blockname))
|
|||||||
blockname = "diamond_ore";
|
blockname = "diamond_ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.Write("top texture url: ");
|
if (Directory.Exists("output/assets/minecraft/optifine/ctm/" + blockname))
|
||||||
string top_texture = Console.ReadLine().Trim('\"');
|
{
|
||||||
|
Console.WriteLine("that block already exists, delete it and try again");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Create_pack(blockname);
|
||||||
|
|
||||||
Console.Write("bottom texture url: ");
|
// Console.Write("top texture url: ");
|
||||||
string bottom_texture = Console.ReadLine().Trim('\"');
|
// string top_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
Console.Write("both texture url: ");
|
// Console.Write("bottom texture url: ");
|
||||||
string both_texture = Console.ReadLine().Trim('\"');
|
// string bottom_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
Console.Write("none texture url: ");
|
Console.Write("full texture path: ");
|
||||||
|
string full_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
|
Console.Write("none texture path: ");
|
||||||
string none_texture = Console.ReadLine().Trim('\"');
|
string none_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
|
|
||||||
string working_dir = Directory.GetCurrentDirectory();
|
Image full_img = Image.Load(full_texture);
|
||||||
// string blockname = "blockname";
|
Image none_img = Image.Load(none_texture);
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets");
|
|
||||||
|
|
||||||
string mcmeta = @"{
|
Image bottom_img = Image.Load(full_texture);
|
||||||
""pack"": {
|
Image top_img = Image.Load(none_texture);
|
||||||
""description"": """",
|
int size = full_img.Height;
|
||||||
""pack_format"": 15,
|
|
||||||
""min_format"": [15, 0],
|
|
||||||
""max_format"": [1000, 0],
|
bottom_img.Mutate(x => x.DrawImage(none_img, new Rectangle(0, 0, size, size / 2), 1f));
|
||||||
""supported_formats"": [15, 1000]
|
top_img.Mutate(x => x.DrawImage(full_img, new Rectangle(0, 0, size, size / 2), 1f));
|
||||||
|
|
||||||
|
|
||||||
|
// g.Save();
|
||||||
|
if (Directory.Exists("tmp"))
|
||||||
|
{
|
||||||
|
Directory.Delete("tmp", true);
|
||||||
}
|
}
|
||||||
}";
|
Directory.CreateDirectory("tmp");
|
||||||
|
|
||||||
File.WriteAllText(working_dir + "/output/pack.mcmeta", mcmeta);
|
bottom_img.Save("tmp/bottom.png");
|
||||||
|
top_img.Save("tmp/top.png");
|
||||||
|
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft");
|
string top_texture = "tmp/top.png";
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine");
|
string bottom_texture = "tmp/bottom.png";
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine/ctm");
|
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine/ctm/" + blockname);
|
Add_block(blockname, top_texture, bottom_texture, full_texture, none_texture);
|
||||||
|
|
||||||
|
Directory.Delete("tmp", true);
|
||||||
|
// string blockname = "blockname";
|
||||||
|
|
||||||
|
|
||||||
string ctm_dir = working_dir + "/output/assets/minecraft/optifine/ctm/" + blockname;
|
// Directory.CreateDirectory(working_dir + "/output/assets/minecraft");
|
||||||
|
// Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine");
|
||||||
|
// Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine/ctm");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
static void Add_block(string blockname, string top_texture, string bottom_texture, string full_texture, string none_texture)
|
||||||
|
{
|
||||||
string ctmproperties = @"matchTiles=" + blockname + @"
|
string ctmproperties = @"matchTiles=" + blockname + @"
|
||||||
method=ctm
|
method=ctm
|
||||||
tiles=0-47";
|
tiles=0-47";
|
||||||
@@ -66,9 +107,35 @@ foreach (int i in bottom)
|
|||||||
}
|
}
|
||||||
foreach (int i in both)
|
foreach (int i in both)
|
||||||
{
|
{
|
||||||
File.Copy(both_texture, ctm_dir + "/" + i + ".png");
|
File.Copy(full_texture, ctm_dir + "/" + i + ".png");
|
||||||
}
|
}
|
||||||
foreach (int i in none)
|
foreach (int i in none)
|
||||||
{
|
{
|
||||||
File.Copy(none_texture, ctm_dir + "/" + i + ".png");
|
File.Copy(none_texture, ctm_dir + "/" + i + ".png");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
static void Create_pack(string blockname)
|
||||||
|
{
|
||||||
|
string working_dir = Directory.GetCurrentDirectory();
|
||||||
|
|
||||||
|
string pack_Name = "output";
|
||||||
|
|
||||||
|
ctm_dir = Path.Combine(working_dir,pack_Name, "assets/minecraft/optifine/ctm/" + blockname);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(ctm_dir);
|
||||||
|
// Directory.CreateDirectory(working_dir + "/1output/assets");
|
||||||
|
|
||||||
|
string mcmeta = @"{
|
||||||
|
""pack"": {
|
||||||
|
""description"": """",
|
||||||
|
""pack_format"": 15,
|
||||||
|
""min_format"": [15, 0],
|
||||||
|
""max_format"": [1000, 0],
|
||||||
|
""supported_formats"": [15, 1000]
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(working_dir, pack_Name, "pack.mcmeta"), mcmeta);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 701 B |
Binary file not shown.
|
Before Width: | Height: | Size: 665 B |
@@ -8,4 +8,8 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user