Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b63e038a40 |
+125
-58
@@ -1,29 +1,131 @@
|
|||||||
Console.Write("Block Name(diamon_ore): ");
|
using SixLabors.ImageSharp;
|
||||||
string blockname = Console.ReadLine();
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
|
using SixLabors.ImageSharp.Processing;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(blockname))
|
|
||||||
|
namespace txtgen;
|
||||||
|
|
||||||
|
public class Program
|
||||||
{
|
{
|
||||||
blockname = "diamond_ore";
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.Write("top texture url: ");
|
// string blockname;
|
||||||
string top_texture = Console.ReadLine().Trim('\"');
|
static string ctm_dir;
|
||||||
|
static void Main()
|
||||||
Console.Write("bottom texture url: ");
|
{
|
||||||
string bottom_texture = Console.ReadLine().Trim('\"');
|
|
||||||
|
|
||||||
Console.Write("both texture url: ");
|
|
||||||
string both_texture = Console.ReadLine().Trim('\"');
|
|
||||||
|
|
||||||
Console.Write("none texture url: ");
|
|
||||||
string none_texture = Console.ReadLine().Trim('\"');
|
|
||||||
|
|
||||||
|
|
||||||
string working_dir = Directory.GetCurrentDirectory();
|
Console.Write("Block Name(diamon_ore): ");
|
||||||
// string blockname = "blockname";
|
string blockname = Console.ReadLine();
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets");
|
|
||||||
|
|
||||||
string mcmeta = @"{
|
if (string.IsNullOrEmpty(blockname))
|
||||||
|
{
|
||||||
|
blockname = "diamond_ore";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Directory.Exists("output/assets/minecraft/optifine/ctm/" + blockname))
|
||||||
|
{
|
||||||
|
Console.WriteLine("that block already exists, delete it and try again");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Create_pack(blockname);
|
||||||
|
|
||||||
|
// Console.Write("top texture url: ");
|
||||||
|
// string top_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
|
// Console.Write("bottom texture url: ");
|
||||||
|
// string bottom_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
|
Console.Write("full texture path: ");
|
||||||
|
string full_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
|
Console.Write("none texture path: ");
|
||||||
|
string none_texture = Console.ReadLine().Trim('\"');
|
||||||
|
|
||||||
|
|
||||||
|
Image full_img = Image.Load(full_texture);
|
||||||
|
Image none_img = Image.Load(none_texture);
|
||||||
|
|
||||||
|
Image bottom_img = Image.Load(full_texture);
|
||||||
|
Image top_img = Image.Load(none_texture);
|
||||||
|
int size = full_img.Height;
|
||||||
|
|
||||||
|
|
||||||
|
bottom_img.Mutate(x => x.DrawImage(none_img, new Rectangle(0, 0, size, size / 2), 1f));
|
||||||
|
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");
|
||||||
|
|
||||||
|
bottom_img.Save("tmp/bottom.png");
|
||||||
|
top_img.Save("tmp/top.png");
|
||||||
|
|
||||||
|
string top_texture = "tmp/top.png";
|
||||||
|
string bottom_texture = "tmp/bottom.png";
|
||||||
|
|
||||||
|
Add_block(blockname, top_texture, bottom_texture, full_texture, none_texture);
|
||||||
|
|
||||||
|
Directory.Delete("tmp", true);
|
||||||
|
// string blockname = "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 + @"
|
||||||
|
method=ctm
|
||||||
|
tiles=0-47";
|
||||||
|
|
||||||
|
File.WriteAllText(ctm_dir + "/" + blockname + ".properties", ctmproperties);
|
||||||
|
|
||||||
|
int[] top = { 4, 5, 7, 12, 13, 14, 15, 29, 31 };
|
||||||
|
int[] bottom = { 16, 17, 18, 36, 37, 38, 39, 40, 42 };
|
||||||
|
int[] both = { 0, 1, 2, 3 };
|
||||||
|
int[] none = { 6, 8, 9, 10, 11, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 33, 34, 35, 41, 43, 44, 45, 46 };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (int i in top)
|
||||||
|
{
|
||||||
|
File.Copy(top_texture, ctm_dir + "/" + i + ".png");
|
||||||
|
}
|
||||||
|
foreach (int i in bottom)
|
||||||
|
{
|
||||||
|
File.Copy(bottom_texture, ctm_dir + "/" + i + ".png");
|
||||||
|
}
|
||||||
|
foreach (int i in both)
|
||||||
|
{
|
||||||
|
File.Copy(full_texture, ctm_dir + "/" + i + ".png");
|
||||||
|
}
|
||||||
|
foreach (int i in none)
|
||||||
|
{
|
||||||
|
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"": {
|
""pack"": {
|
||||||
""description"": """",
|
""description"": """",
|
||||||
""pack_format"": 15,
|
""pack_format"": 15,
|
||||||
@@ -33,42 +135,7 @@ string mcmeta = @"{
|
|||||||
}
|
}
|
||||||
}";
|
}";
|
||||||
|
|
||||||
File.WriteAllText(working_dir + "/output/pack.mcmeta", mcmeta);
|
File.WriteAllText(Path.Combine(working_dir, pack_Name, "pack.mcmeta"), mcmeta);
|
||||||
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft");
|
}
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine");
|
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine/ctm");
|
|
||||||
Directory.CreateDirectory(working_dir + "/output/assets/minecraft/optifine/ctm/" + blockname);
|
|
||||||
|
|
||||||
|
|
||||||
string ctm_dir = working_dir + "/output/assets/minecraft/optifine/ctm/" + blockname;
|
|
||||||
string ctmproperties = @"matchTiles=" + blockname + @"
|
|
||||||
method=ctm
|
|
||||||
tiles=0-47";
|
|
||||||
|
|
||||||
File.WriteAllText(ctm_dir + "/" + blockname + ".properties", ctmproperties);
|
|
||||||
|
|
||||||
int[] top = {4,5,7,12,13,14,15,29,31};
|
|
||||||
int[] bottom = {16,17,18,36,37,38,39,40,42};
|
|
||||||
int[] both = {0,1,2,3};
|
|
||||||
int[] none = {6,8,9,10,11,19,20,21,22,23,24,25,26,27,28,30,32,33,34,35,41,43,44,45,46};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach (int i in top)
|
|
||||||
{
|
|
||||||
File.Copy(top_texture, ctm_dir + "/" + i + ".png");
|
|
||||||
}
|
|
||||||
foreach (int i in bottom)
|
|
||||||
{
|
|
||||||
File.Copy(bottom_texture, ctm_dir + "/" + i + ".png");
|
|
||||||
}
|
|
||||||
foreach (int i in both)
|
|
||||||
{
|
|
||||||
File.Copy(both_texture, ctm_dir + "/" + i + ".png");
|
|
||||||
}
|
|
||||||
foreach (int i in none)
|
|
||||||
{
|
|
||||||
File.Copy(none_texture, ctm_dir + "/" + i + ".png");
|
|
||||||
}
|
|
||||||
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