Added Entity, Item and Block palletes for 1.17/1 and 1.18/1. Added pallete generators as a command line option. Fixed a minor warning with AttackBot

This commit is contained in:
Dusan Milutinovic 2022-02-13 01:10:10 +01:00
parent 6986902938
commit 61a682a69b
16 changed files with 4488 additions and 72 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -7,6 +8,9 @@ using System.Reflection;
using System.Threading;
using MinecraftClient.Protocol.Handlers.Forge;
using MinecraftClient.Protocol.Session;
using MinecraftClient.Mapping.EntityPalettes;
using MinecraftClient.Mapping.BlockPalettes;
using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.WinAPI;
namespace MinecraftClient
@ -109,6 +113,80 @@ namespace MinecraftClient
return;
}
if (args.Contains("--generate"))
{
string dataGenerator = "";
string dataPath = "";
foreach (string argument in args)
{
if (argument.StartsWith("--") && !argument.Contains("--generate"))
{
if (!argument.Contains("="))
throw new ArgumentException(Translations.Get("error.setting.argument_syntax", argument));
string[] argParts = argument.Substring(2).Split('=');
string argName = argParts[0].Trim();
string argValue = argParts[1].Replace("\"", "").Trim();
if(argName == "data-path") {
Console.WriteLine(dataPath);
dataPath = argValue;
}
if(argName == "data-generator") {
dataGenerator = argValue;
}
}
}
if (string.IsNullOrEmpty(dataGenerator) || !(dataGenerator.ToLower().Equals("entity") || dataGenerator.ToLower().Equals("item") || dataGenerator.ToLower().Equals("block")))
{
Console.WriteLine(Translations.Get("error.generator.invalid"));
Console.WriteLine(Translations.Get("error.usage") + " MinecraftClient.exe --data-generator=<entity|item|block>");
return;
}
if (string.IsNullOrEmpty(dataPath))
{
Console.WriteLine(Translations.Get("error.missing.argument", "--data-path"));
Console.WriteLine(Translations.Get("error.usage") + " MinecraftClient.exe --generate-entity-pallete --data-path=\"<path to resources.json>\"");
return;
}
if(!File.Exists(dataPath))
{
Console.WriteLine(Translations.Get("error.generator.path", dataPath));
return;
}
if(!dataPath.EndsWith(".json"))
{
Console.WriteLine(Translations.Get("error.generator.json", dataPath));
return;
}
Console.WriteLine(Translations.Get("mcc.generator.generating", dataGenerator, dataPath));
switch (dataGenerator)
{
case "entity":
EntityPaletteGenerator.GenerateEntityTypes(dataPath);
break;
case "item":
ItemPaletteGenerator.GenerateItemType(dataPath);
break;
case "block":
BlockPaletteGenerator.GenerateBlockPallete(dataPath);
break;
}
Console.WriteLine(Translations.Get("mcc.generator.done", dataGenerator, dataPath));
return;
}
try
{
Settings.LoadArguments(args);