diff --git a/gradle.properties b/gradle.properties index dbab644..5dfff85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ org.gradle.jvmargs=-Xmx1G # Mod Properties mod_version = 1.0.0 - maven_group = com.josyf.macrobuttons - archives_base_name = macro-gui-buttons + maven_group = com.josyf.commandbuttons + archives_base_name = command-gui-buttons # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api diff --git a/src/main/java/com/josyf/macrobuttons/MacroButtons.java b/src/main/java/com/josyf/commandbuttons/CommandButtons.java similarity index 84% rename from src/main/java/com/josyf/macrobuttons/MacroButtons.java rename to src/main/java/com/josyf/commandbuttons/CommandButtons.java index e3a796c..4a45fb7 100644 --- a/src/main/java/com/josyf/macrobuttons/MacroButtons.java +++ b/src/main/java/com/josyf/commandbuttons/CommandButtons.java @@ -1,9 +1,9 @@ -package com.josyf.macrobuttons; +package com.josyf.commandbuttons; -import com.josyf.macrobuttons.gui.ButtonGUI; -import com.josyf.macrobuttons.gui.ButtonGUIScreen; +import com.josyf.commandbuttons.gui.ButtonGUI; +import com.josyf.commandbuttons.gui.ButtonGUIScreen; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; @@ -15,7 +15,7 @@ import org.lwjgl.glfw.GLFW; import java.util.ArrayList; -public class MacroButtons implements ModInitializer { +public class CommandButtons implements ModInitializer { public static final String MOD_ID = "mgbuttons"; private static ArrayList masterCommList; @@ -34,10 +34,10 @@ public class MacroButtons implements ModInitializer { private void assignGuiToKey() { // Currently assigns to the G key KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key.macrobuttons.opengui", // The translation key of the keybinding's name + "key.commandbuttons.opengui", // The translation key of the keybinding's name InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse. GLFW.GLFW_KEY_G, // The keycode of the key - "gui.macrobuttons.mgbuttons" // The translation key of the keybinding's category. + "gui.commandbuttons.mgbuttons" // The translation key of the keybinding's category. )); ClientTickEvents.END_CLIENT_TICK.register(client -> { diff --git a/src/main/java/com/josyf/macrobuttons/ConfigFile.java b/src/main/java/com/josyf/commandbuttons/ConfigFile.java similarity index 92% rename from src/main/java/com/josyf/macrobuttons/ConfigFile.java rename to src/main/java/com/josyf/commandbuttons/ConfigFile.java index d7d5694..426debf 100644 --- a/src/main/java/com/josyf/macrobuttons/ConfigFile.java +++ b/src/main/java/com/josyf/commandbuttons/ConfigFile.java @@ -1,4 +1,4 @@ -package com.josyf.macrobuttons; +package com.josyf.commandbuttons; import com.alibaba.fastjson.JSON; import com.cedarsoftware.util.io.JsonWriter; @@ -8,7 +8,6 @@ import org.json.simple.parser.ParseException; import org.json.simple.parser.*; import java.io.*; -import java.lang.reflect.Array; import java.util.ArrayList; public class ConfigFile { @@ -88,14 +87,14 @@ public class ConfigFile { } public static void addObjectToCommList(JSONObject jsonObject) { - ArrayList commListCopy = MacroButtons.getMasterCommList(); + ArrayList commListCopy = CommandButtons.getMasterCommList(); commListCopy.add(jsonObject); - MacroButtons.setMasterCommList(commListCopy); + CommandButtons.setMasterCommList(commListCopy); } public static void removeObject(JSONObject objToRemove) { // get masterCommList and remove object from list - ArrayList commListCopy = MacroButtons.getMasterCommList(); + ArrayList commListCopy = CommandButtons.getMasterCommList(); commListCopy.remove(objToRemove); // get commands.json diff --git a/src/main/java/com/josyf/macrobuttons/gui/ButtonGUI.java b/src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java similarity index 92% rename from src/main/java/com/josyf/macrobuttons/gui/ButtonGUI.java rename to src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java index 8c06c25..dcb49ff 100644 --- a/src/main/java/com/josyf/macrobuttons/gui/ButtonGUI.java +++ b/src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java @@ -1,11 +1,10 @@ -package com.josyf.macrobuttons.gui; +package com.josyf.commandbuttons.gui; -import com.josyf.macrobuttons.ConfigFile; -import com.josyf.macrobuttons.MacroButtons; +import com.josyf.commandbuttons.CommandButtons; +import com.josyf.commandbuttons.ConfigFile; import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription; import io.github.cottonmc.cotton.gui.widget.*; -import net.minecraft.text.LiteralText; import net.minecraft.text.TranslatableText; import org.json.simple.JSONObject; @@ -73,7 +72,7 @@ public class ButtonGUI extends LightweightGuiDescription { ConfigFile.removeObject(newJsonObject); root.remove(button); } else { - MacroButtons.runCommand(commandString); + CommandButtons.runCommand(commandString); } }); @@ -106,7 +105,7 @@ public class ButtonGUI extends LightweightGuiDescription { ConfigFile.removeObject(object); root.remove(button); } else { - MacroButtons.runCommand(command); + CommandButtons.runCommand(command); } }); @@ -121,7 +120,7 @@ public class ButtonGUI extends LightweightGuiDescription { // Array will contain String class types. Convert these to objects. private void addSavedButtons(WGridPanel root, WToggleButton toggle) { - ArrayList commListCopy = MacroButtons.getMasterCommList(); + ArrayList commListCopy = CommandButtons.getMasterCommList(); // Then convert the objects to buttons if (commListCopy != null) { for (int i = 0; i < commListCopy.size(); i++) { @@ -146,7 +145,7 @@ public class ButtonGUI extends LightweightGuiDescription { } private boolean isListTooLong() { - return MacroButtons.getMasterCommList().size() > 19; + return CommandButtons.getMasterCommList().size() > 19; } // Change background panel color to transparent black diff --git a/src/main/java/com/josyf/macrobuttons/gui/ButtonGUIScreen.java b/src/main/java/com/josyf/commandbuttons/gui/ButtonGUIScreen.java similarity index 87% rename from src/main/java/com/josyf/macrobuttons/gui/ButtonGUIScreen.java rename to src/main/java/com/josyf/commandbuttons/gui/ButtonGUIScreen.java index be3eb97..55120e1 100644 --- a/src/main/java/com/josyf/macrobuttons/gui/ButtonGUIScreen.java +++ b/src/main/java/com/josyf/commandbuttons/gui/ButtonGUIScreen.java @@ -1,4 +1,4 @@ -package com.josyf.macrobuttons.gui; +package com.josyf.commandbuttons.gui; import io.github.cottonmc.cotton.gui.GuiDescription; import io.github.cottonmc.cotton.gui.client.CottonClientScreen; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index fa67594..5fb360f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,16 +1,16 @@ { "schemaVersion": 1, - "id": "macro-gui-buttons", + "id": "command-gui-buttons", "version": "${version}", - "name": "Macro GUI Buttons", - "description": "Create GUI buttons in-game to execute macro commands.", + "name": "Command GUI Buttons", + "description": "Create GUI buttons in-game to execute commands.", "authors": [ "JosephG" ], "contact": { "homepage": "", - "sources": "https://github.com/joseph-garcia/macro-gui-buttons" + "sources": "https://github.com/joseph-garcia/command-gui-buttons" }, "license": "gpl-3.0", @@ -19,7 +19,7 @@ "environment": "*", "entrypoints": { "main": [ - "com.josyf.macrobuttons.MacroButtons" + "com.josyf.commandbuttons.CommandButtons" ] }, "mixins": [