From 4c721e10717a61be3399fa3b41513eadd9cc6a76 Mon Sep 17 00:00:00 2001 From: Joel Paul Date: Thu, 31 Aug 2023 15:20:01 +1000 Subject: [PATCH 1/6] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ad0fee2..878acae 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ reobfuscated .idea/dictionaries .idea/libraries .idea/jarRepositories.xml +.idea/misc.xml +.idea/modules.xml From 7995fc2ce7a9c7f3a8987cc3f7c58194b01897a4 Mon Sep 17 00:00:00 2001 From: Joel Paul Date: Thu, 31 Aug 2023 15:20:35 +1000 Subject: [PATCH 2/6] IDEA stuff --- .idea/misc.xml | 2 +- .idea/runConfigurations.xml | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index d56db2d..f8b6ff9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,5 +7,5 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 93e4b17..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file From cad493f864848d6997d34fcebf82ded915235d9b Mon Sep 17 00:00:00 2001 From: Joel Paul Date: Thu, 31 Aug 2023 15:22:21 +1000 Subject: [PATCH 3/6] Update mod_version --- gradle.properties | 2 +- src/main/java/craftguide/CraftGuideAddon.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index e43fef7..05b6840 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ minecraft_version = 1.5.2 yarn_mappings = 1.5.2+build.202201092137 loader_version = 1.0.0 -mod_version = 3.0.0 +mod_version = 3.0.1 maven_group = craftguide archives_base_name = craft-guide diff --git a/src/main/java/craftguide/CraftGuideAddon.java b/src/main/java/craftguide/CraftGuideAddon.java index cab6f7a..6b5a311 100644 --- a/src/main/java/craftguide/CraftGuideAddon.java +++ b/src/main/java/craftguide/CraftGuideAddon.java @@ -7,7 +7,7 @@ public class CraftGuideAddon extends BTWAddon { private static CraftGuideAddon instance; private CraftGuideAddon() { - super("Craft Guide", "3.0.0", "CG"); + super("Craft Guide", "3.0.1", "CG"); } @Override From 0812876a45891ec37e16f3d795accb1d8f0df629 Mon Sep 17 00:00:00 2001 From: Joel Paul Date: Thu, 31 Aug 2023 16:25:11 +1000 Subject: [PATCH 4/6] Add support for lang files --- .../java/craftguide/CraftGuide_Vanilla.java | 2 +- .../uristqwerty/CraftGuide/CraftGuide.java | 24 ------------------- .../uristqwerty/CraftGuide/GuiCraftGuide.java | 23 +++++++++--------- .../client/ui/CraftTypeDisplay.java | 9 +++---- src/main/resources/lang/cg_en_US.lang | 18 ++++++++++++++ 5 files changed, 36 insertions(+), 40 deletions(-) create mode 100644 src/main/resources/lang/cg_en_US.lang diff --git a/src/main/java/craftguide/CraftGuide_Vanilla.java b/src/main/java/craftguide/CraftGuide_Vanilla.java index 3aa8906..4b1cef2 100644 --- a/src/main/java/craftguide/CraftGuide_Vanilla.java +++ b/src/main/java/craftguide/CraftGuide_Vanilla.java @@ -116,7 +116,7 @@ public void initClientNetworkChannels() public void initKeybind() { - keyBinding = new KeyBinding("Open CraftGuide", Keyboard.KEY_G); + keyBinding = new KeyBinding(StatCollector.translateToLocal("key.craftguide.open"), Keyboard.KEY_G); GameSettings settings = Minecraft.getMinecraft().gameSettings; KeyBinding[] keyBindings = settings.keyBindings; keyBindings = Arrays.copyOf(keyBindings, keyBindings.length + 1); diff --git a/src/main/java/uristqwerty/CraftGuide/CraftGuide.java b/src/main/java/uristqwerty/CraftGuide/CraftGuide.java index e523c24..9ba8c1a 100644 --- a/src/main/java/uristqwerty/CraftGuide/CraftGuide.java +++ b/src/main/java/uristqwerty/CraftGuide/CraftGuide.java @@ -269,28 +269,4 @@ public static File configDirectory() return dir; } - - public static String getTranslation(String string) - { - if(string.equals("filter_type.input")) - { - return "Input"; - } - else if(string.equals("filter_type.output")) - { - return "Output"; - } - else if(string.equals("filter_type.machine")) - { - return "Machine"; - } - else if(string.equals("filter")) - { - return "Filter"; - } - else - { - return null; - } - } } diff --git a/src/main/java/uristqwerty/CraftGuide/GuiCraftGuide.java b/src/main/java/uristqwerty/CraftGuide/GuiCraftGuide.java index 345080e..fc52a91 100644 --- a/src/main/java/uristqwerty/CraftGuide/GuiCraftGuide.java +++ b/src/main/java/uristqwerty/CraftGuide/GuiCraftGuide.java @@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.src.ItemStack; +import net.minecraft.src.StatCollector; import org.lwjgl.input.Keyboard; import uristqwerty.CraftGuide.api.SlotType; @@ -110,7 +111,7 @@ public GuiCraftGuide() generateRecipeTab(texture, buttonTemplate) .anchor(AnchorPoint.TOP_LEFT, AnchorPoint.BOTTOM_RIGHT), (GuiButton)new GuiButton(6, 6, 28, 28, buttonTemplate) - .setToolTip("Recipe list") + .setToolTip(StatCollector.translateToLocal("craftguide.list.recipe")) .addElement(new GuiElement(0, 0, 28,28) .setBackground(new TextureClip(texture, 1, 76, 28,28)) .setClickable(false))) @@ -118,7 +119,7 @@ public GuiCraftGuide() generateTypeTab(texture, buttonTemplate) .anchor(AnchorPoint.TOP_LEFT, AnchorPoint.BOTTOM_RIGHT), (GuiButton)new GuiButton(34, 6, 28, 28, buttonTemplate) - .setToolTip("Show/Hide recipes by crafting type") + .setToolTip(StatCollector.translateToLocal("craftguide.list.type")) .addElement(new GuiElement(0, 0, 28,28) .setBackground(new TextureClip(texture, 29, 76, 28,28)) .setClickable(false))) @@ -162,7 +163,7 @@ private GuiElement generateRecipeTab(Texture texture, ButtonTemplate buttonTempl .addButtonListener(new FilterToggle(SlotType.INPUT_SLOT)) .anchor(AnchorPoint.BOTTOM_LEFT) .addElement( - new GuiText(15, 3, CraftGuide.getTranslation("filter_type.input"), 0xff000000))); + new GuiText(15, 3, StatCollector.translateToLocal("craftguide.filter_type.input"), 0xff000000))); recipeTab.addElement( @@ -171,7 +172,7 @@ private GuiElement generateRecipeTab(Texture texture, ButtonTemplate buttonTempl .addButtonListener(new FilterToggle(SlotType.OUTPUT_SLOT)) .anchor(AnchorPoint.BOTTOM_LEFT) .addElement( - new GuiText(15, 3, CraftGuide.getTranslation("filter_type.output"), 0xff000000))); + new GuiText(15, 3, StatCollector.translateToLocal("craftguide.filter_type.output"), 0xff000000))); recipeTab.addElement( new ToggleButton(8, 130, 13, 13, toggleTemplate) @@ -179,16 +180,16 @@ private GuiElement generateRecipeTab(Texture texture, ButtonTemplate buttonTempl .addButtonListener(new FilterToggle(SlotType.MACHINE_SLOT)) .anchor(AnchorPoint.BOTTOM_LEFT) .addElement( - new GuiText(15, 3, CraftGuide.getTranslation("filter_type.machine"), 0xff000000))); + new GuiText(15, 3, StatCollector.translateToLocal("craftguide.filter_type.machine"), 0xff000000))); GuiButton clearButton = - (GuiButton) new GuiButton(8, initialWindowHeight - 18, 50, 13, buttonTemplate, "Clear") + (GuiButton) new GuiButton(8, initialWindowHeight - 18, 50, 13, buttonTemplate, StatCollector.translateToLocal("craftguide.clear")) .anchor(AnchorPoint.BOTTOM_LEFT); recipeTab.addElement(clearButton); recipeTab.addElement( - new GuiText(9, 151, CraftGuide.getTranslation("filter"), 0xff000000) + new GuiText(9, 151, StatCollector.translateToLocal("craftguide.filter"), 0xff000000) .anchor(AnchorPoint.BOTTOM_LEFT)); recipeTab.addElement( @@ -208,11 +209,11 @@ private GuiElement generateRecipeTab(Texture texture, ButtonTemplate buttonTempl .setClickable(false); GuiButton backButton = - (GuiButton) new GuiButton(8, 166, 50, 13, buttonTemplate, "Back") + (GuiButton) new GuiButton(8, 166, 50, 13, buttonTemplate, StatCollector.translateToLocal("craftguide.back")) .anchor(AnchorPoint.BOTTOM_LEFT); GuiButton itemListButton = - (GuiButton) new GuiButton(8, 166, 50, 13, buttonTemplate, "Set item") + (GuiButton) new GuiButton(8, 166, 50, 13, buttonTemplate, StatCollector.translateToLocal("craftguide.set_item")) .anchor(AnchorPoint.BOTTOM_LEFT); itemListArea.addElement(backButton); @@ -256,7 +257,7 @@ private GuiElement generateRecipeTab(Texture texture, ButtonTemplate buttonTempl itemListArea.addElement(filterGrid); itemListArea.addElement( - new GuiText(68, 183, "Search", 0xff000000) + new GuiText(68, 183, StatCollector.translateToLocal("craftguide.search"), 0xff000000) .anchor(AnchorPoint.BOTTOM_LEFT)); itemListArea.addElement( @@ -289,7 +290,7 @@ public void onButtonEvent(GuiButton button, Event eventType) } itemListArea.addElement( - new GuiButton(initialWindowWidth - 54, 180, 32, 13, buttonTemplate, "Clear") + new GuiButton(initialWindowWidth - 54, 180, 32, 13, buttonTemplate, StatCollector.translateToLocal("craftguide.clear")) .addButtonListener(new ClearButtonListener(searchInput)) .anchor(AnchorPoint.BOTTOM_RIGHT)); diff --git a/src/main/java/uristqwerty/CraftGuide/client/ui/CraftTypeDisplay.java b/src/main/java/uristqwerty/CraftGuide/client/ui/CraftTypeDisplay.java index 8ad7673..b8a5a53 100644 --- a/src/main/java/uristqwerty/CraftGuide/client/ui/CraftTypeDisplay.java +++ b/src/main/java/uristqwerty/CraftGuide/client/ui/CraftTypeDisplay.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Set; +import net.minecraft.src.StatCollector; import uristqwerty.CraftGuide.CraftType; import uristqwerty.CraftGuide.RecipeCache; import uristqwerty.CraftGuide.client.ui.Rendering.FloatingItemText; @@ -220,7 +221,7 @@ public void draw() super.draw(); if(toolTipText != "") { - toolTip.setText(toolTipText); + toolTip.setText(StatCollector.translateToLocal(toolTipText)); render(toolTipOverlay); } } @@ -241,15 +242,15 @@ public void mouseMovedRow(int row, int x, int y, boolean inBounds) switch(relX / 29) { case 0: - toolTipText = "Show recipes of this type"; + toolTipText = "craftguide.recipe.show"; break; case 1: - toolTipText = "Hide recipes of this type"; + toolTipText = "craftguide.recipe.hide"; break; case 2: - toolTipText = "Show only recipes of this type"; + toolTipText = "craftguide.recipe.show_only"; } } } diff --git a/src/main/resources/lang/cg_en_US.lang b/src/main/resources/lang/cg_en_US.lang new file mode 100644 index 0000000..b5ce8be --- /dev/null +++ b/src/main/resources/lang/cg_en_US.lang @@ -0,0 +1,18 @@ +key.craftguide.open=Open CraftGuidea + +craftguide.filter_type.input=Inputa +craftguide.filter_type.output=Outputa +craftguide.filter_type.machine=Machinea +craftguide.filter=Filtera + +craftguide.list.recipe=Recipe Lista +craftguide.list.type=Recipe Typea + +craftguide.clear=Cleara +craftguide.back=Backa +craftguide.set_item=Set Itema +craftguide.search=Searcha + +craftguide.recipe.show=Show recipes of this typea +craftguide.recipe.hide=Hide recipes of this typea +craftguide.recipe.show_only=Show only recipes of this typea From ce40a017b415a44ebf685e82e6f3f8466916ffbc Mon Sep 17 00:00:00 2001 From: Joel Paul <37064691+Joel-Paul@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:00:04 +1000 Subject: [PATCH 5/6] Update README.md --- README.md | 95 +++++++++++++++---------------------------------------- 1 file changed, 26 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 621634a..369c925 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,26 @@ -# BTW-gradle-fabric-example - -This repository is based on the [BTW-Gradle](https://github.com/BTW-Community/BTW-gradle) and the [Example Mod](https://github.com/minecraft-cursed-legacy/Example-Mod) -repositories, combining them to enable fabric development for the Better Than Wolves mod. -**This repository was only tested for client-side development yet.** - -## Quick Start - -* Clone this repository -* Acquire the full BTW sources and put them under `src/btw/java` -* (Optional) Put the BTW resources (textures, etc.) under `src/btw/resources` -* Run the gradle task *btwJar* -* Run the gradle task *build* and then *runClient* -* (Optional) Put the vanilla MC resources (sounds) under `run/resources` - -## BTW Source Code - -To get access to the Better Than Wolves source code, please refer to the [BTW-Gradle repository](https://github.com/BTW-Community/BTW-gradle) - or (alternatively) the [BTW-Public repository](https://github.com/BTW-Community/BTW-Public), which also offers a way to generate the sources. - -## Development - -Similar to the [BTW-Gradle](https://github.com/BTW-Community/BTW-gradle) project, this repository comes with a few configuration files for IntelliJ IDEA. - -In this repository, there is an example implementation of a fabric mod that is a BTW-Addon at the same time. Base class overwrites, -either for initializing your BTW-Addon or for changes to the functionality of MC are in many cases not needed -anymore. (But they are still possible, put the overwriting-sources under `main/java/net/minecraft/src`. - This requires your mod to be loaded as a coremod, which is currently not supported in a dev-environment - only in production.) The -addon initialization is taken care of by the PreLaunchInitializer. - -For functionality changes to base classes, please have a look at mixins, which enable you -to inject code at runtime, offering much better compatibility. Most fabric-mixin tutorials should apply here, but keep in -mind that no fabric-api is available yet, just bare mixins. An even more powerful alternative is fabric-asm, but this has not -been tested yet. - -If you use reflection, please keep in mind that it is now, in many cases at least, not needed anymore, in addition to the fact that fabric -remaps Minecraft at runtime into an intermediary form, which is different from the obfuscated one. To get the intermediary names -of classes, fields, and methods, have a look at the mappings under `custom_mappings`. - -## Releasing Mods/Addons - -If you want to run fabric mods with BTW in a non-dev environment, you have to either use -the [BTW-fabric MultiMC instance](https://github.com/BTW-Community/cursed-fabric-loader/releases/latest) (recommended) or -follow the [installation instructions for the Vanilla launcher](https://github.com/BTW-Community/legacy-fabric-installer/releases/latest). - - -Drop on by the discord server if you need help: [BTW Discord](https://discord.gg/fhMK5kx). - -The mod file for the release is generated by the Gradle task *remapJar* and then put into `release`. - -After successfully importing the MultiMC instance, you can put your mod file into the mods folder of your installation. -If it is a coremod, put it into coremods. - -## Issues & Troubleshooting - -* How do I obtain the BTW-sources? *Please refer to [BTW-Gradle](https://github.com/BTW-Community/BTW-gradle) or [BTW-Public](https://github.com/BTW-Community/BTW-Public).* - -More troubleshooting is still todo. Feel free to message me on Discord. - -## MultiMC Remarks -* The MultiMC instance should support most BTW versions and their addons, install them normally via `Add to Minecraft.jar`. -* Addons developed outside of the fabric environment that use -Java reflection might not work if they reference obfuscated names via Strings (as mentioned above). -Porting those addons is a simple process though, as only the new intermediary names have to be adopted. - -## License -This project incorporates: -* A modified version of [Fabric Loom](https://github.com/FabricMC/fabric-loom) (MIT) -* A precompiled version of [Tiny Remapper](https://github.com/FabricMC/tiny-remapper) (LGPL-3.0) +# CraftGuide Addon for Better Than Wolves +CraftGuide allows players to view recipes in-game by pressing a key (`G` by default) and alleviates the tedium of having to remember or lookup recipes. +This particular addon fixes previous versions of CraftGuide not displaying certain recipes in [Better Than Wolves](https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/3117153-better-than-wolves-community-edition). + +## Links +- [Download](https://github.com/BTW-Community/CraftGuide/releases/latest) +- [Better than Wolves forum](https://www.sargunster.com/btwforum/viewtopic.php?p=159719) +- [Source](https://github.com/BTW-Community/CraftGuide/tree/BTW-CE) + +## Installation +- Install [Better than Wolves with Fabric](https://www.sargunster.com/btwforum/viewtopic.php?t=10201) +- Download `craft-guide-x.x.x.jar` +- Place `craft-guide-x.x.x.jar` into the `mods/` folder of your BTW installation +- Enjoy :) + +## Permissions +Here's a [quote from Uristqwerty](https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/1277913-craftguide-v1-7-1-1) on the Minecraft Forum regarding source code editing and redistribution permissions: +> If you want to make a custom version of CraftGuide, use bits of its code, or just see how it works, you can find the source code [on Github](https://github.com/Uristqwerty/CraftGuide). +If you want to use some (or all) of it in your own project, you are free to do so, though it would be nice if you mentioned CraftGuide in a text file or somewhere else where someone can find it. + +## Credits +- Uristqwerty - original CraftGuide author ([MC Forum](https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/1277913-craftguide-v1-7-1-1)) ([GitHub](https://github.com/Uristqwerty/CraftGuide)) +- jorgebonafe - previous maintainer ([BTW Forum](https://www.sargunster.com/btwforum/viewtopic.php?f=12&t=9452)) ([GitHub](https://github.com/BTW-Community/CraftGuide/tree/jorge-bonafe)) +- IssaMe - current maintainer +- Arminias - Fabric support +- Dawnraider - providing hooks in BTW From edcb2930bcf1a9b18875c5ca34730059bcf28b74 Mon Sep 17 00:00:00 2001 From: Joel Paul Date: Thu, 31 Aug 2023 17:02:40 +1000 Subject: [PATCH 6/6] Remove a at the end of lang --- src/main/resources/lang/cg_en_US.lang | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/resources/lang/cg_en_US.lang b/src/main/resources/lang/cg_en_US.lang index b5ce8be..93afba3 100644 --- a/src/main/resources/lang/cg_en_US.lang +++ b/src/main/resources/lang/cg_en_US.lang @@ -1,18 +1,18 @@ -key.craftguide.open=Open CraftGuidea +key.craftguide.open=Open CraftGuide -craftguide.filter_type.input=Inputa -craftguide.filter_type.output=Outputa -craftguide.filter_type.machine=Machinea -craftguide.filter=Filtera +craftguide.filter_type.input=Input +craftguide.filter_type.output=Output +craftguide.filter_type.machine=Machine +craftguide.filter=Filter -craftguide.list.recipe=Recipe Lista -craftguide.list.type=Recipe Typea +craftguide.list.recipe=Recipe List +craftguide.list.type=Recipe Type -craftguide.clear=Cleara -craftguide.back=Backa -craftguide.set_item=Set Itema -craftguide.search=Searcha +craftguide.clear=Clear +craftguide.back=Back +craftguide.set_item=Set Item +craftguide.search=Search -craftguide.recipe.show=Show recipes of this typea -craftguide.recipe.hide=Hide recipes of this typea -craftguide.recipe.show_only=Show only recipes of this typea +craftguide.recipe.show=Show recipes of this type +craftguide.recipe.hide=Hide recipes of this type +craftguide.recipe.show_only=Show only recipes of this type