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