rename mod to cgb

This commit is contained in:
Joseph Garcia 2020-12-30 11:41:13 -06:00
parent a1f039848f
commit e6f364cddd
6 changed files with 25 additions and 27 deletions

View File

@ -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

View File

@ -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<JSONObject> 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 -> {

View File

@ -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<JSONObject> commListCopy = MacroButtons.getMasterCommList();
ArrayList<JSONObject> 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<JSONObject> commListCopy = MacroButtons.getMasterCommList();
ArrayList<JSONObject> commListCopy = CommandButtons.getMasterCommList();
commListCopy.remove(objToRemove);
// get commands.json

View File

@ -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<JSONObject> commListCopy = MacroButtons.getMasterCommList();
ArrayList<JSONObject> 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

View File

@ -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;

View File

@ -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": [