Skip to content

Commit

Permalink
Add support for datapack version 1.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Seeloewen committed May 9, 2024
1 parent 2c9678e commit 779b3ff
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions Tools/RIG 24w09a Updater/wndMain.xaml.cs
Expand Up @@ -23,6 +23,9 @@ public partial class MainWindow : Window
BackgroundWorker bgwUpdater = new BackgroundWorker();
wndAbout wndAbout;
string datapack = "";
string datapackVersion = "unknown";
string mcVersion = "unknown";
string versionBranch = "unknown";

//-- Constructor --//

Expand Down Expand Up @@ -189,10 +192,24 @@ private string GetSpecificComponent(string fileName, string item)
string splashpotion = item.Replace("\"tag\": \"{Potion:\\\"minecraft:", "").Replace("\\\"}\"", "").Replace(" ", "");
return "\"minecraft:potion_contents\": {\n \"potion\": \"minecraft:" + splashpotion + "\"\n }";
case "suspicious_stews.json":
string[] susnbt = item.Replace("\"tag\": \"{Effects:[{EffectId:", "").Replace("EffectDuration:", "").Replace("}]}\"", "").Replace(" ", "").Split(',');
string effect = susnbt[0];
string duration = susnbt[1];
return "\"minecraft:suspicious_stew_effects\": [\n {\n \"id\": \"minecraft:" + ConvertEffect(effect) + "\",\n \"duration\": " + duration + "\n }\n ]";
string effect;
string duration;

if (datapackVersion == "1.4.5")
{
string[] susnbt = item.Replace("\"tag\": \"{effects:[{id:\\\"minecraft:", "").Replace("duration:", "").Replace("}]}\"", "").Replace(" ", "").Replace("\\\"", "").Split(',');
effect = susnbt[0];
duration = susnbt[1];
return "\"minecraft:suspicious_stew_effects\": [\n {\n \"id\": \"minecraft:" + effect + "\",\n \"duration\": " + duration + "\n }\n ]";
}
else
{
string[] susnbt = item.Replace("\"tag\": \"{Effects:[{EffectId:", "").Replace("EffectDuration:", "").Replace("}]}\"", "").Replace(" ", "").Split(',');
effect = susnbt[0];
duration = susnbt[1];
return "\"minecraft:suspicious_stew_effects\": [\n {\n \"id\": \"minecraft:" + ConvertEffect(effect) + "\",\n \"duration\": " + duration + "\n }\n ]";
}

case "tipped_arrows.json":
string tippedarrow = item.Replace("\"tag\": \"{Potion:\\\"minecraft:", "").Replace("\\\"}\"", "").Replace(" ", "");
return "\"minecraft:potion_contents\": {\n \"potion\": \"minecraft:" + tippedarrow + "\"\n }";
Expand Down Expand Up @@ -234,10 +251,6 @@ private string ConvertEffect(string effect)
private bool CheckDatapackVersion()
{
//Checks the datapack version to make sure the software is compatible with it
string datapackVersion = "unknown";
string mcVersion = "unknown";
string versionBranch = "unknown";

if (File.Exists($"{tbDatapack.Text}\\Updater.txt"))
{
//Go through the file to get the variables
Expand Down

0 comments on commit 779b3ff

Please sign in to comment.