From 3f607dbea3c4c7a0ef30dd4709f6d5469d869c19 Mon Sep 17 00:00:00 2001 From: Superkat32 <89557012+Superkat32@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:34:45 -0400 Subject: Color Picker For Color Controllers (#140) * Initial work on color picker - gradient rendering FEAT: Color picker rendering progress. The selected color, HSL, and RGB gradients all render FEAT: Added new method for rendering a rainbow in the AbstractWidget class FEAT: Added a new method for rendering a sideways gradient in the AbstractWidget class TEST: Added mouse-only detection for enabling/disabling the color picker. It needs some work to allow for controller support(e.g. a button instead of the current mouseX/mouseY detection) TEST: Started work on the RGB slider detection. Needs a lot of work, and probably needs to be moved as well TEST: Added an extra color option in the "aaaaaaaaaaaa..." category BUG: The color picker has some "z-fighting" issues with options behind it BUG: The color picker needs to be in its own widget, not the way it is right now Everything is still heavy WIP, I just needed a checkpoint/backup for my work thus far * Official color picker element REFACTOR: Moved almost all of the color picker code/rendering outside of the ColorControllerElement and into a new ColorPickerElement REFACTOR: Renamed a few variables * Slider x calculation FEAT: Added a method which determines the slider's x pos based upon the pending value's hue BUG: If the color is completely black or white, the slider automatically goes to the beginning, as if the color was completely red BUG: The color picker "z-fighting" with the option behind it is still an issue * Some "z-fighting" fixing FIX: Fixed majority of the z-fighting with the color picker BUG: The option behind the color picker still gets selected. For example, the string controller behind the color picker can be typed in after clicking the color picker * Sound effect changes FEAT: Made the down button sound only play when clicking the color preview, which enables the color picker FIX: Fixed a bug where the down button sound would play upon clicking the color option(doesn't occur with other string related controllers) * Back to work! - Some refactors I don't remember the point of REFACTOR: I seemed to have refactored a few things. I did this a month ago, and don't remember anything. It probably doesn't matter, because I have plans for a huge refactor anyways in the near futre * Beginning of the end (Huge improvements, technical challenge overcome) FEAT: Began work on the hue slider's hue choosing mechanisms. It took slightly longer than I feel like it should've to figure this out, but I'm happy with its current implementation, and the ideas I have to improve it. REFACTOR: Huge refactor on the color picker and how it is rendered. Firstly, the values are now almost not-hardcoded at all, being dynamic to the screen's gui size. REFACTOR: Moved the whole color picker to its own class REFACTOR: Removed the test color variable in the "aaaaaaaaa..." category BUG: Color picker's x/xLimit seems to be flipped incorrectly BUG: HUGE lag spike while choosing the value's hue(I'm unsure how I'm going to fix this) TODO: Possible better implementation of the color picker as a whole to be clicked on not using the temporary workaround This is more of a checkpoint for me than anything. I've spent multiple hours each night working on this, and losing this progress would be terrible. * Bug fixes, some gradient refactoring, small commented out code cleanup FIX: Apparently fixed the huge lag spike when changing the hue... sometimes. It seems to have something to do with hotswapping, which shouldn't affect anybody outside of dev. env.(will do more testing later) FIX: Fixed the hue slider gradient being incorrectly displayed REFACTOR: Updated the param. usage in gradient related methods. For some reason, I had them sorta pretty janky when being used. While the code for the actual methods seem more confusing, using said methods is now less confusing. Will probably come back to this later REFACTOR: Deleted small bits of commented out code * Mouse click checkpoint WIP: Some code for the color picker clicking stuff. Hopefully to be improved soon, but this prototype actually fully works(just implemented in a way I'm not currently happy with) * Mouse click checkpoint 2 REFACTOR: Cleaned up some of the prototype mouse click code BUG: Dragging the color picker doesn't work I'm saving this incase I want to revert later. I'm very confident there is a better way than this, however. Which is why I'm going to continue testing new ideas until I find something better. * Color picker widget correct mouse clicking FEAT: Made it so that the color picker element from a color controller gets added to the YACL Screen's children, which handles rendering and mouse click events FIX: Finally, at last, fixed the color picker mouse clicking z-fighting BUG: Changing the color from the color picker, then typing in the color controller crashes the game This took many hours. I spent a long time trying to fix the color picker being removed crashing the game. I thought there were 5 different reasons for as to why it was crashing before finally finding out the true reason. A huge cleanup and possibly making the ColorPickerElement extend the AbstractWidget class instead of the StringElement class might be better. * Mouse clicking cleanup REFACTOR: Removed commented out code which previously handled the mouse clicking for the color picker BUG: Attempting to scroll through the YACL screen while hovering over the color picker ceases all scrolling * Even more cleanup REFACTOR: Cleaned up the ColorPickerElement class, making it only have methods and variables it needs/will need REFACTOR: Optmizied imports for ColorController class and updated some FIXMEs REFACTOR: Removed old, unused test method in YACLScreen class * Color picker - clicking does cool things now FEAT: Made it so that clicking on the hue slider of the color picker will now result with the controller's hue changing REFACTOR: Made it so that the hue slider thumb now properly moves only when it should REFACTOR: Clicking on the saturation/light gradient no longer changes the hue(will have proper support for sat/light gradient soon) * Initial work on color picker redesign REFACTOR: Updated the background for the color picker, now looking like an inventory container background TODO: I'm most likely going to touch up on most of the main rendering code, as it is a mess * Color picker visual redesign REFACTOR: Completely redesigned the color picker's looks, having an inventory container like background now. REFACTOR: I think I increased the hue slider thumb's height by 2 pixels to adjust for the new redesign to stay satisfying FIX: Fixed the colorPickerDim.y and colorPickerDim.yLimit being flipped(that was easier and harder than I thought it would be both at the same time) FIX: Cleaned up a bunch of messy rendering code. Turns out, it worked, but wasn't as easy to change as I thought. Should be somewhat better now, I might come back and clean it up some more though * Saturation/Light Picking + Bug fixes + Better mini preview outline FEAT: Made it so that you can now choose the saturation and light values of a color! Holding down the mouse button allows you to leave the dedicated box for easier color picking. Doing the same with the hue slider doesn't affect the saturation/light picking either REFACTOR: If a color is very bright, the mini color preview outline will change to a light grey upon hovering instead of plain white. This is to indicate to new users who may have a very bright color as an option that it can still be clicked on. FIX: Fixed a bug where choosing a color that was too dark would result in the saturation being reset FIX: Fixed a bug where having too dark of a color would mess up the hue slider TEST: Tried making the background of the color picker a texture. I was unsuccessful this time, but I'm going to try again soon. * Typing bug fix and temporary float color picker fix FIX: Fixed a bug where typing in the color controller while the color picker is visible would result in the color picker desyncing TEMPFIX: Added a temporary workaround to the color picker floating when the color controller wasn't visible anymore. A better fix will be added in the future. The current workaround probably isn't great for performance. * Color picker texture background FEAT: Color picker background texture FEAT: Transparent square texture REFACTOR: Made the background of the color picker use a texture instead of manual rendering REFACTOR: Removed code for manual rendering of the color picker background, as it has been replaced REFACTOR: Removed unused code from the YACLScreen which I didn't mean to commit in the first place CHORE: Optimized imports for ColorController * Some comments I guess? FEAT: Added some comments a couple weeks ago. I'm going to look into the popupscreen now. * Popup Color Picker Screen FEAT: Started work on testing the Color Picker as a popup screen Oh, oh my! I've managed to solve more problems in 3 hours than I was able to in 3 weeks with the popup screen-like function! * General improvements to the Popup Color Picker Screen FIX: Fixed the color picker not always appearing on first click after closing FIX: Fixed the color picker scrolling when it shouldn't be FIX: Fixed the color picker's color controller's color preview's outline(goodness) not highlighting while the color picker was visible * Color Picker Test category, beginning of alpha in color picker, move color picker if there isn't room above the controller, and another scrolling bug fix TEST: Added a new Color Picker test category FEAT: Made it so that if there isn't enough room for a color picker to be easily usable above a color controller, the color picker will appear beneath the color controller FEAT: Started work on alpha-related stuff for the color picker FIX: Fixed a bug where there were about 2 pixels worth of area where scrolling would result in the color picker "desyncing" from the color controller * Finished Alpha slider FEAT: Finished the alpha slider if the color picker's color controller has it enabled FEAT: Added some extra color options to the test config to showcase other features of the color picker * Cleanup and bug fixes FIX: Fixed a bug where the "fillSidewaysGradient" method was just completely broken and made zero sense. REFACTOR: Improved(hopefully) the "drawRainbowGradient" method's code REFACTOR: Cleaned up some unused methods in the ColorPickerElement REFACTOR: Changed the transparent texture's sizing to 7x7, so that is doesn't clip vertically (still clips a little bit horizontally) REFACTOR: Removed some commented out code in some other classes from previous testing * More cleanup REFACTOR: Did some additional cleanup in the ColorController.java class to remove really old code that was added before hte ColorPickerElement class was moved outside the ColorController class * Optimize imports REFACTOR: Optimize imports Forgot I told IntelliJ not to do that automatically, oops * Color Picker Changes 1 FIX: Fixed a bug where you could type while the color picker was active without first clicking anywhere REFACTOR: Removed unused accessWideners REFACTOR: Changed the Color Picker Popup title to a translatable string REFACTOR: Cleanup in ColorController.java, including using the protected screen variable and using the Dimension#isPointInside method REFACTOR: Cleanup in ColorPickerElement.java including: - Remove full paths for ResourceLocations - Not capturing the YACLScreen - Using "control.allowAlpha" instead of storing the boolean - No longer saving the ColorController - All variables related to the color picker's dimensions are now private final - Changed the order of the rendered items to more closely respect their z-level - Names of some methods * Extracted PopupColorPickerScreen.java to PopupControllerScreen REFACTOR: Generalized all popup related stuff from color picker to controller FIX: Actually fixed keyboard/typed character actions on the color picker without first clicking anywhere * Color preview outline fading FEAT: Added color preview outline fading to the color controller. The color preview outline will slowly flash from white to black indicating to a user to press it to enable the color picker. It has a boolean ready to be changed to a config option for when that gets added. * Popup Controller Future Proofing 1 FIX: Made changes based on feedback to ensure that all popup controller widget related items can easily be used for the dropdown controller, and any future controllers that may need it. * Color picker y is now controlled by the color controller REFACTOR: Made it so that the color picker y is now set by the color controller REFACTOR: The color picker now gets removed if the color controller is partially offscreen REFACTOR: Removed all code related to the manual scrolling of the color picker/popup widget * Fix option widget list being given FIX: Removed the option widget list parameter for the PopupControllerScreen, because it isn't used anymore * ColorPickerWidget REFACTOR: Renamed ColorPickerElement to ColorPickerWidget FIX: Small changes when YaclScreen#clearPopupControllerWidget is called. * Attempt 2 at fixing weird clearing popup controller loop FIX: (Hopefully) fixed a bug where the YaclScreen#clearPopupController method would get called twice, instead of just once. * Color picker indicator automatically disables upon discovery FEAT: Added a boolean to the YACLConfig which determines if a color controller's color preview's outline(color picker indicator) should flash or not. This boolean is on by default, and automatically disables itself upon the color picker's first opening. * Moving color picker beneath controller better detection implementation + config fix REFACTOR: Improved the color picker's implementation detecting if it should be beneath the controller or not(moved order of operations) FIX: Fixed the config option for flashing the color picker indicator not being a serial entry * Add multi-version support --------- Co-authored-by: isXander --- .../dev/isxander/yacl3/platform/YACLConfig.java | 18 + .../gui/sprites/controller/colorpicker.png | Bin 0 -> 260 bytes .../gui/sprites/controller/colorpicker.png.mcmeta | 10 + .../gui/sprites/controller/transparent.png | Bin 0 -> 115 bytes .../gui/sprites/controller/transparent.png.mcmeta | 10 + .../dev/isxander/yacl3/gui/AbstractWidget.java | 38 +- .../java/dev/isxander/yacl3/gui/YACLScreen.java | 37 +- .../yacl3/gui/controllers/ColorController.java | 133 +++++- .../yacl3/gui/controllers/ColorPickerWidget.java | 459 +++++++++++++++++++++ .../gui/controllers/ControllerPopupWidget.java | 39 ++ .../gui/controllers/PopupControllerScreen.java | 70 ++++ .../yacl3/gui/image/YACLImageReloadListener.java | 3 +- .../yacl3/gui/tab/ScrollableNavigationBar.java | 22 +- .../yacl3/gui/utils/ButtonTextureRenderer.java | 34 -- .../isxander/yacl3/gui/utils/YACLRenderHelper.java | 43 ++ .../yacl3/mixin/TabNavigationBarAccessor.java | 25 +- .../dev/isxander/yacl3/platform/YACLConfig.java | 18 + .../dev/isxander/yacl3/platform/YACLPlatform.java | 5 + .../assets/yet_another_config_lib/lang/be_by.json | 29 -- .../assets/yet_another_config_lib/lang/el_gr.json | 23 -- .../assets/yet_another_config_lib/lang/en_us.json | 31 -- .../assets/yet_another_config_lib/lang/et_ee.json | 18 - .../assets/yet_another_config_lib/lang/fr_fr.json | 29 -- .../assets/yet_another_config_lib/lang/it_it.json | 31 -- .../assets/yet_another_config_lib/lang/nl_nl.json | 31 -- .../assets/yet_another_config_lib/lang/pl_pl.json | 23 -- .../assets/yet_another_config_lib/lang/pt_br.json | 18 - .../assets/yet_another_config_lib/lang/ru_ru.json | 24 -- .../assets/yet_another_config_lib/lang/sl_si.json | 22 - .../assets/yet_another_config_lib/lang/tt_ru.json | 34 -- .../assets/yet_another_config_lib/lang/zh_cn.json | 29 -- .../assets/yet_another_config_lib/lang/zh_tw.json | 29 -- .../yet_another_config_lib_v3/lang/be_by.json | 29 ++ .../yet_another_config_lib_v3/lang/el_gr.json | 23 ++ .../yet_another_config_lib_v3/lang/en_us.json | 34 ++ .../yet_another_config_lib_v3/lang/et_ee.json | 18 + .../yet_another_config_lib_v3/lang/fr_fr.json | 29 ++ .../yet_another_config_lib_v3/lang/it_it.json | 31 ++ .../yet_another_config_lib_v3/lang/nl_nl.json | 31 ++ .../yet_another_config_lib_v3/lang/pl_pl.json | 23 ++ .../yet_another_config_lib_v3/lang/pt_br.json | 18 + .../yet_another_config_lib_v3/lang/ru_ru.json | 24 ++ .../yet_another_config_lib_v3/lang/sl_si.json | 22 + .../yet_another_config_lib_v3/lang/tt_ru.json | 34 ++ .../yet_another_config_lib_v3/lang/zh_cn.json | 29 ++ .../yet_another_config_lib_v3/lang/zh_tw.json | 29 ++ .../textures/gui/colorpicker-atlas.png | Bin 0 -> 2271 bytes .../gui/sprites/controller/colorpicker.png | Bin 0 -> 260 bytes .../gui/sprites/controller/colorpicker.png.mcmeta | 10 + .../gui/sprites/controller/transparent.png | Bin 0 -> 115 bytes .../gui/sprites/controller/transparent.png.mcmeta | 10 + .../dev/isxander/yacl3/test/AutogenConfigTest.java | 2 +- .../java/dev/isxander/yacl3/test/ConfigTest.java | 10 + .../java/dev/isxander/yacl3/test/GuiTest.java | 67 ++- .../yacl3/textures/reach-around-placement.webp | Bin 14840 -> 0 bytes .../resources/assets/yacl3/textures/sample-1.webp | Bin 10474 -> 0 bytes .../resources/assets/yacl3/textures/sample-2.webp | Bin 22308 -> 0 bytes .../resources/assets/yacl3/textures/sample-3.webp | Bin 17078 -> 0 bytes .../resources/assets/yacl3/textures/sample-4.webp | Bin 20772 -> 0 bytes .../resources/assets/yacl3/textures/sample-5.webp | Bin 11166 -> 0 bytes 60 files changed, 1368 insertions(+), 440 deletions(-) create mode 100644 common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java create mode 100644 common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png create mode 100644 common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png.mcmeta create mode 100644 common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png create mode 100644 common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png.mcmeta create mode 100644 src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java create mode 100644 src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java create mode 100644 src/main/java/dev/isxander/yacl3/gui/controllers/PopupControllerScreen.java delete mode 100644 src/main/java/dev/isxander/yacl3/gui/utils/ButtonTextureRenderer.java create mode 100644 src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java create mode 100644 src/main/java/dev/isxander/yacl3/platform/YACLConfig.java delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/be_by.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/el_gr.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/en_us.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/et_ee.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/it_it.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/nl_nl.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/pt_br.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/sl_si.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/tt_ru.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json delete mode 100644 src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/be_by.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/el_gr.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/en_us.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/et_ee.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/fr_fr.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/it_it.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/nl_nl.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/pl_pl.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/pt_br.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/ru_ru.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/sl_si.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/tt_ru.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/zh_cn.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/lang/zh_tw.json create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/textures/gui/colorpicker-atlas.png create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png.mcmeta create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png create mode 100644 src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png.mcmeta delete mode 100644 src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp delete mode 100644 src/testmod/resources/assets/yacl3/textures/sample-1.webp delete mode 100644 src/testmod/resources/assets/yacl3/textures/sample-2.webp delete mode 100644 src/testmod/resources/assets/yacl3/textures/sample-3.webp delete mode 100644 src/testmod/resources/assets/yacl3/textures/sample-4.webp delete mode 100644 src/testmod/resources/assets/yacl3/textures/sample-5.webp diff --git a/common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java b/common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java new file mode 100644 index 0000000..0d14b41 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java @@ -0,0 +1,18 @@ +package dev.isxander.yacl3.platform; + +import dev.isxander.yacl3.config.v2.api.ConfigClassHandler; +import dev.isxander.yacl3.config.v2.api.SerialEntry; +import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; + +public class YACLConfig { + public static final ConfigClassHandler HANDLER = ConfigClassHandler.createBuilder(YACLConfig.class) + .id(YACLPlatform.rl("config")) + .serializer(config -> GsonConfigSerializerBuilder.create(config) + .setPath(YACLPlatform.getConfigDir().resolve("yacl.json5")) + .setJson5(true) + .build()) + .build(); + + @SerialEntry + public boolean showColorPickerIndicator = true; +} diff --git a/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png new file mode 100644 index 0000000..1d11f72 Binary files /dev/null and b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png differ diff --git a/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png.mcmeta b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png.mcmeta new file mode 100644 index 0000000..20d1be9 --- /dev/null +++ b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/colorpicker.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 236, + "height": 34, + "border": 3 + } + } +} diff --git a/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png new file mode 100644 index 0000000..0a803ef Binary files /dev/null and b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png differ diff --git a/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png.mcmeta b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png.mcmeta new file mode 100644 index 0000000..9d21305 --- /dev/null +++ b/common/src/main/resources/assets/yet_another_config_lib/textures/gui/sprites/controller/transparent.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "tile", + "width": 7, + "height": 7, + "border": 3 + } + } +} diff --git a/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java b/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java index 6f92749..1f7c29b 100644 --- a/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java +++ b/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java @@ -1,7 +1,8 @@ package dev.isxander.yacl3.gui; +import com.mojang.blaze3d.vertex.VertexConsumer; import dev.isxander.yacl3.api.utils.Dimension; -import dev.isxander.yacl3.gui.utils.ButtonTextureRenderer; +import dev.isxander.yacl3.gui.utils.YACLRenderHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; @@ -9,8 +10,10 @@ import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.sounds.SoundEvents; +import org.joml.Matrix4f; import java.awt.Color; @@ -75,7 +78,7 @@ public abstract class AbstractWidget implements GuiEventListener, Renderable, Na int width = x2 - x1; int height = y2 - y1; - ButtonTextureRenderer.render(graphics, x1, y1, width, height, enabled, hovered); + YACLRenderHelper.renderButtonTexture(graphics, x1, y1, width, height, enabled, hovered); } protected void drawOutline(GuiGraphics graphics, int x1, int y1, int x2, int y2, int width, int color) { @@ -85,6 +88,37 @@ public abstract class AbstractWidget implements GuiEventListener, Renderable, Na graphics.fill(x1, y1, x1 + width, y2, color); } + protected void fillSidewaysGradient(GuiGraphics graphics, int x1, int y1, int x2, int y2, int startColor, int endColor) { + //Fills a gradient, left to right + //Uses practically the same method as the GuiGraphics class, but with the x/y moved + //Has a custom "z" value in case needed for later + VertexConsumer vertex = graphics.bufferSource().getBuffer(RenderType.gui()); + Matrix4f matrix4f = graphics.pose().last().pose(); + vertex.vertex(matrix4f, x1, y1, 0).color(startColor).endVertex(); + vertex.vertex(matrix4f, x1, y2, 0).color(startColor).endVertex(); + vertex.vertex(matrix4f, x2, y2, 0).color(endColor).endVertex(); + vertex.vertex(matrix4f, x2, y1, 0).color(endColor).endVertex(); + } + + + protected void drawRainbowGradient(GuiGraphics graphics, int x1, int y1, int x2, int y2) { + //Draws a rainbow gradient, left to right + int[] colors = new int[] {Color.red.getRGB(), Color.yellow.getRGB(), Color.green.getRGB(), + Color.cyan.getRGB(), Color.blue.getRGB(), Color.magenta.getRGB(), Color.red.getRGB()}; //all the colors in the gradient + int width = x2 - x1; + int maxColors = colors.length - 1; + for (int color = 0; color < maxColors; color++) { + //First checks if the final color is being rendered, if true -> uses x2 int instead of x1 + //if false -> it adds the width divided by the max colors multiplied by the current color plus one to the x1 int + //the x2 int for the fillSidewaysGradient is the same formula, excluding the additional plus one. + //The gradient colors is determined by the color int and the color int plus one, which is why red is in the colors array twice + fillSidewaysGradient(graphics, + x1 + (width / maxColors * color), y1, + color == maxColors - 1 ? x2 : x1 + (width / maxColors * (color + 1)), y2, + colors[color], colors[color + 1]); + } + } + protected int multiplyColor(int hex, float amount) { Color color = new Color(hex, true); diff --git a/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java index ec70d60..1d3be9f 100644 --- a/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java +++ b/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java @@ -7,19 +7,21 @@ import dev.isxander.yacl3.api.*; import dev.isxander.yacl3.api.utils.Dimension; import dev.isxander.yacl3.api.utils.MutableDimension; import dev.isxander.yacl3.api.utils.OptionUtils; -import dev.isxander.yacl3.gui.tab.ScrollableNavigationBar; +import dev.isxander.yacl3.gui.controllers.PopupControllerScreen; +import dev.isxander.yacl3.gui.controllers.ControllerPopupWidget; import dev.isxander.yacl3.gui.tab.ListHolderWidget; +import dev.isxander.yacl3.gui.tab.ScrollableNavigationBar; import dev.isxander.yacl3.gui.tab.TabExt; import dev.isxander.yacl3.gui.utils.GuiUtils; import dev.isxander.yacl3.impl.utils.YACLConstants; import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.MultiLineLabel; import net.minecraft.client.gui.components.Tooltip; -import net.minecraft.client.gui.components.tabs.Tab; import net.minecraft.client.gui.components.tabs.TabManager; import net.minecraft.client.gui.components.tabs.TabNavigationBar; import net.minecraft.client.gui.navigation.ScreenRectangle; @@ -34,7 +36,6 @@ import org.jetbrains.annotations.Nullable; import java.util.HashSet; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; public class YACLScreen extends Screen { @@ -52,6 +53,9 @@ public class YACLScreen extends Screen { private boolean pendingChanges; + public ControllerPopupWidget currentPopupController = null; + public boolean popupControllerVisible = false; + public YACLScreen(YetAnotherConfigLib config, Screen parent) { super(config.title()); this.config = config; @@ -87,6 +91,33 @@ public class YACLScreen extends Screen { config.initConsumer().accept(this); } + public void addPopupControllerWidget(ControllerPopupWidget controllerPopupWidget) { + + //Safety check for the color picker + if (currentPopupController != null) { + clearPopupControllerWidget(); + } + + currentPopupController = controllerPopupWidget; + popupControllerVisible = true; + + OptionListWidget optionListWidget = null; + if(this.tabNavigationBar.getTabManager().getCurrentTab() instanceof CategoryTab categoryTab) { + optionListWidget = categoryTab.optionList.getList(); + } + if(optionListWidget != null) { + this.minecraft.setScreen(new PopupControllerScreen(this, controllerPopupWidget)); + } + } + + public void clearPopupControllerWidget() { + if(Minecraft.getInstance().screen instanceof PopupControllerScreen popupControllerScreen) { + popupControllerScreen.onClose(); + } + popupControllerVisible = false; + currentPopupController = null; + } + /*? if <=1.20.4 {*/ @Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/ColorController.java b/src/main/java/dev/isxander/yacl3/gui/controllers/ColorController.java index 56e6d30..3c0a5fc 100644 --- a/src/main/java/dev/isxander/yacl3/gui/controllers/ColorController.java +++ b/src/main/java/dev/isxander/yacl3/gui/controllers/ColorController.java @@ -8,6 +8,7 @@ import dev.isxander.yacl3.gui.AbstractWidget; import dev.isxander.yacl3.gui.YACLScreen; import dev.isxander.yacl3.gui.controllers.string.IStringController; import dev.isxander.yacl3.gui.controllers.string.StringControllerElement; +import dev.isxander.yacl3.platform.YACLConfig; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; @@ -101,10 +102,13 @@ public class ColorController implements IStringController { public static class ColorControllerElement extends StringControllerElement { private final ColorController colorController; + private ColorPickerWidget colorPickerWidget; protected MutableDimension colorPreviewDim; - private final List allowedChars; + public boolean hoveredOverColorPreview = false; + private boolean colorPickerVisible = false; + private int previewOutlineFadeTicks = 0; public ColorControllerElement(ColorController control, YACLScreen screen, Dimension dim) { super(control, screen, dim, true); @@ -114,13 +118,18 @@ public class ColorController implements IStringController { @Override protected void drawValueText(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + hovered = isMouseOver(mouseX, mouseY); + if (isHovered()) { - colorPreviewDim.move(-inputFieldBounds.width() - 5, 0); + colorPreviewDim.move(-inputFieldBounds.width() - 8, -2); + colorPreviewDim.expand(4, 4); + previewOutlineFadeTicks++; super.drawValueText(graphics, mouseX, mouseY, delta); } graphics.fill(colorPreviewDim.x(), colorPreviewDim.y(), colorPreviewDim.xLimit(), colorPreviewDim.yLimit(), colorController.option().pendingValue().getRGB()); - drawOutline(graphics, colorPreviewDim.x(), colorPreviewDim.y(), colorPreviewDim.xLimit(), colorPreviewDim.yLimit(), 1, 0xFF000000); + Color outlineColor = getPreviewOutlineColor(hoveredOverColorPreview || isMouseOverColorPreview(mouseX, mouseY)); + drawOutline(graphics, colorPreviewDim.x(), colorPreviewDim.y(), colorPreviewDim.xLimit(), colorPreviewDim.yLimit(), 1, outlineColor.getRGB()); } @Override @@ -193,6 +202,14 @@ public class ColorController implements IStringController { int previewSize = (dim.height() - getYPadding() * 2) / 2; colorPreviewDim = Dimension.ofInt(dim.xLimit() - getXPadding() - previewSize, dim.centerY() - previewSize / 2, previewSize, previewSize); + + if(colorPickerWidget != null) { + colorPickerWidget.setDimension(colorPickerWidget.getDimension().withY(this.getDimension().y())); + //checks if the color controller is being partially rendered offscreen + if(this.getDimension().y() < screen.tabArea.top() || this.getDimension().yLimit() > screen.tabArea.bottom()) { + removeColorPicker(); + } + } } @Override @@ -210,11 +227,121 @@ public class ColorController implements IStringController { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { if (super.mouseClicked(mouseX, mouseY, button)) { + //Detects if the user has clicked the color preview + if(isMouseOverColorPreview(mouseX, mouseY)) { + playDownSound(); + createOrRemoveColorPicker(); + if(YACLConfig.HANDLER.instance().showColorPickerIndicator) { + YACLConfig.HANDLER.instance().showColorPickerIndicator = false; + YACLConfig.HANDLER.save(); + } + } caretPos = Math.max(1, caretPos); setSelectionLength(); return true; } + return false; } + + public boolean isMouseOverColorPreview(double mouseX, double mouseY) { + return colorPreviewDim.isPointInside((int) mouseX, (int) mouseY); + } + + public void createOrRemoveColorPicker() { + colorPickerVisible = !colorPickerVisible; + if(colorPickerVisible) { + colorPickerWidget = createColorPicker(); + screen.addPopupControllerWidget(colorPickerWidget); + } else { + removeColorPicker(); + } + } + + @Override + public void unfocus() { + if(colorPickerVisible) { + removeColorPicker(); + } + previewOutlineFadeTicks = 0; + super.unfocus(); + } + + public Color getPreviewOutlineColor(boolean colorPreviewHovered) { + Color outlineColor = new Color(0xFF000000); + Color highlightedColor = getHighlightedOutlineColor(); + + if(!hovered && !colorPreviewHovered) { + previewOutlineFadeTicks = 0; + return outlineColor; + } + + int fadeInTicks = 80; + int fadeOutTicks = fadeInTicks + 120; + + if(colorPreviewHovered) { + //white/light grey if the color preview is being hovered + previewOutlineFadeTicks = 0; + return highlightedColor; + } else if(YACLConfig.HANDLER.instance().showColorPickerIndicator) { + if(previewOutlineFadeTicks <= fadeInTicks) { + //fade to white + return getFadedColor(outlineColor, highlightedColor, previewOutlineFadeTicks, fadeInTicks); + } else if (previewOutlineFadeTicks <= fadeOutTicks) { + //fade to black + return getFadedColor(highlightedColor, outlineColor, previewOutlineFadeTicks - fadeInTicks, fadeOutTicks - fadeInTicks); + } + + if(previewOutlineFadeTicks >= fadeInTicks + fadeOutTicks + 10) { + //reset fade + previewOutlineFadeTicks = 0; + } + } + + return outlineColor; + } + + private Color getFadedColor(Color original, Color fadeToColor, int fadeTick, int maxFadeTicks) { + int red = fadeToColor.getRed() - original.getRed(); + int green = fadeToColor.getGreen() - original.getGreen(); + int blue = fadeToColor.getBlue() - original.getBlue(); + return new Color( + original.getRed() + ((red * fadeTick) / maxFadeTicks), + original.getGreen() + ((green * fadeTick) / maxFadeTicks), + original.getBlue() + ((blue * fadeTick) / maxFadeTicks) + ); + } + + private Color getHighlightedOutlineColor() { + //Brightness detector in case a developer has their starting color bright + //Makes the outline indicating to a user that the mini color preview can be clicked a light grey rather than white + //For reference, there is about a 10 digit moving room in saturation and light + Color pendingValue = colorController.option().pendingValue(); + float[] HSL = Color.RGBtoHSB(pendingValue.getRed(), pendingValue.getGreen(), pendingValue.getBlue(), null); + Color highlightedColor = new Color(0xFFFFFFFF); + if(HSL[1] < 0.1f && HSL[2] > 0.9f) { + highlightedColor = new Color(0xFFC6C6C6); + } + return highlightedColor; + } + + public ColorPickerWidget colorPickerWidget() { + return colorPickerWidget; + } + + public boolean colorPickerVisible() { + return colorPickerVisible; + } + + public ColorPickerWidget createColorPicker() { + return new ColorPickerWidget(colorController, screen, getDimension(), this); + } + + public void removeColorPicker() { + screen.clearPopupControllerWidget(); + this.colorPickerVisible = false; + this.colorPickerWidget = null; + this.hoveredOverColorPreview = false; //set to false in favor of the manual checking here to be done + } } } diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java b/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java new file mode 100644 index 0000000..c7664dc --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java @@ -0,0 +1,459 @@ +package dev.isxander.yacl3.gui.controllers; + +import dev.isxander.yacl3.api.utils.Dimension; +import dev.isxander.yacl3.api.utils.MutableDimension; +import dev.isxander.yacl3.gui.YACLScreen; +import dev.isxander.yacl3.gui.utils.YACLRenderHelper; +import dev.isxander.yacl3.platform.YACLPlatform; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; + +import java.awt.*; + +public class ColorPickerWidget extends ControllerPopupWidget { + /*? if >1.20.1 {*/ + private static final ResourceLocation COLOR_PICKER_LOCATION = YACLPlatform.rl("controller/colorpicker"); + private static final ResourceLocation TRANSPARENT_TEXTURE_LOCATION = YACLPlatform.rl("controller/transparent"); + /*? } else {*//* + // nineslice and repeating only work on a 256x atlas + private static final ResourceLocation COLOR_PICKER_ATLAS = YACLPlatform.rl("textures/gui/colorpicker-atlas.png"); + *//*?}*/ + + private final ColorController controller; + private final ColorController.ColorControllerElement entryWidget; + protected MutableDimension colorPickerDim; + protected MutableDimension previewColorDim; + protected MutableDimension saturationLightDim; + protected MutableDimension hueGradientDim; + protected MutableDimension alphaGradientDim; + private boolean mouseDown; + private boolean hueSliderDown; + private boolean satLightGradientDown; + private boolean alphaSliderDown; + private int hueThumbX; + private int satLightThumbX; + private int alphaThumbX; + private boolean charTyped; + + //The width of the outline between each color picker element(color preview, saturation/light gradient, hue gradient) + //Note: Additional space may need to be manually made upon increasing the outline + private final int outline = 1; + + //The main color preview's portion of the color picker as a whole + //example: if previewPortion is set to 7, then the color preview will take up + //a 7th of the color picker's width + private final int previewPortion = 7; + + //The height in pixels of the hue slider + //example: if the sliderHeight is set to 7, then the hue slider will be 7 pixels, with some extra padding between + //the color preview and the HSL gradient to allow for an outline(determined by the "outline" int) + private final int sliderHeight = 7; + + //The x padding between the color preview and saturation/light gradient. + //Does NOT account for the outline on its own + private final int paddingX = 1; + + //The y padding between the hue gradient and color preview & saturation/light gradient. + //Does NOT account for the outline on its own + private final int paddingY = 3; + + + private float[] HSL; + private float hue; + private float saturation; + private float light; + private int alpha; + + public ColorPickerWidget(ColorController control, YACLScreen screen, Dimension dim, ColorController.ColorControllerElement entryWidget) { + super(control, screen, dim, entryWidget); + this.controller = control; + this.entryWidget = entryWidget; + + setDimension(dim); + + updateHSL(); + setThumbX(); + } + + @Override + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + updateHSL(); + + int thumbWidth = 4; + int thumbHeight = 4; + + graphics.pose().pushPose(); + graphics.pose().translate(0, 0, 10); // render over text + + //Background + /*? if >1.20.3 { */ + graphics.blitSprite(COLOR_PICKER_LOCATION, colorPickerDim.x() - 5, colorPickerDim.y() - 5, 1, colorPickerDim.width() + 10, colorPickerDim.height() + 10); + /*? } else {*//* + graphics.blitNineSliced(COLOR_PICKER_ATLAS, colorPickerDim.x() - 5, colorPickerDim.y() - 5, colorPickerDim.width() + 10, colorPickerDim.height() + 10, 3, 236, 34, 0, 0); + *//*?}*/ + + //Main color preview + //outline + graphics.fill(previewColorDim.x() - outline, previewColorDim.y() - outline, previewColorDim.xLimit() + outline, previewColorDim.yLimit() + outline, Color.black.getRGB()); + //transparent texture - must be rendered BEFORE the main color preview + if(controller.allowAlpha()) { + /*? if >1.20.3 { */ + graphics.blitSprite(TRANSPARENT_TEXTURE_LOCATION, previewColorDim.x(), previewColorDim.y(), 3, previewColorDim.width(), previewColorDim.height()); + /*? } else {*//* + graphics.blitRepeating(COLOR_PICKER_ATLAS, previewColorDim.x(), previewColorDim.y(), previewColorDim.width(), previewColorDim.height(), 236, 0, 8, 8); + *//*?}*/ + } + //main color preview + graphics.fill(previewColorDim.x(), previewColorDim.y(), previewColorDim.xLimit(), previewColorDim.yLimit(), controller.option().pendingValue().getRGB()); + + //Saturation/light gradient + //outline + graphics.fill(saturationLightDim.x() - outline, saturationLightDim.y() - outline, saturationLightDim.xLimit() + outline, saturationLightDim.yLimit() + outline, Color.black.getRGB()); + //White to pending color's RGB from hue, left to right + fillSidewaysGradient(graphics, saturationLightDim.x(), saturationLightDim.y(), saturationLightDim.xLimit(), saturationLightDim.yLimit(), 0xFFFFFFFF, (int) getRgbFromHueX()); + //Transparent to black, top to bottom + graphics.fillGradient(saturationLightDim.x(), saturationLightDim.y(), saturationLightDim.xLimit(), saturationLightDim.yLimit(), 0x00000000, 0xFF000000); + //Sat/light thumb shadow + graphics.fill(satLightThumbX - thumbWidth / 2 - 2, getSatLightThumbY() + thumbHeight / 2 + 2, satLightThumbX + thumbWidth / 2 + 1, getSatLightThumbY() - thumbHeight / 2 - 1, 0xFF404040); + //Sat/light thumb - extra 1 pixel on left and top to make it centered + graphics.fill(satLightThumbX - thumbWidth / 2 - 1, getSatLightThumbY() + thumbHeight / 2 + 1, satLightThumbX + thumbWidth / 2, getSatLightThumbY() - thumbHeight / 2, -1); + + //Hue gradient + //outline + graphics.fill(hueGradientDim.x() - outline, hueGradientDim.y() - outline, hueGradientDim.xLimit() + outline, hueGradientDim.yLimit() + outline, Color.black.getRGB()); + //Hue rainbow gradient + drawRainbowGradient(graphics, hueGradientDim.x(), hueGradientDim.y(), hueGradientDim.xLimit(), hueGradientDim.yLimit()); + //Hue slider thumb shadow + graphics.fill(hueThumbX - thumbWidth / 2 - 1, hueGradientDim.y() - outline - 1, hueThumbX + thumbWidth / 2 + 1, hueGradientDim.yLimit() + outline + 1, 0xFF404040); + //Hue slider thumb + graphics.fill(hueThumbX - thumbWidth / 2, hueGradientDim.y() - outline, hueThumbX + thumbWidth / 2, hueGradientDim.yLimit() + outline, -1); + + if(controller.allowAlpha()) { + //outline + graphics.fill(alphaGradientDim.x() - outline, alphaGradientDim.y() - outline, alphaGradientDim.xLimit() + outline, alphaGradientDim.yLimit() + outline, Color.black.getRGB()); + //Transparent texture + /*? if >1.20.3 { */ + graphics.blitSprite(TRANSPARENT_TEXTURE_LOCATION, alphaGradientDim.x(), alphaGradientDim.y(), 3, alphaGradientDim.width(), sliderHeight); + /*? } else {*//* + graphics.blitRepeating(COLOR_PICKER_ATLAS, alphaGradientDim.x(), alphaGradientDim.y(), alphaGradientDim.width(), sliderHeight, 236, 0, 8, 8); + *//*?}*/ + //Pending color to transparent + fillSidewaysGradient(graphics, alphaGradientDim.x(), alphaGradientDim.y(), alphaGradientDim.xLimit(), alphaGradientDim.yLimit(), getRgbWithoutAlpha(), 0x00000000); + //Alpha slider thumb shadow + graphics.fill(alphaThumbX - thumbWidth / 2 - 1, alphaGradientDim.y() - outline - 1, alphaThumbX + thumbWidth / 2 + 1, alphaGradientDim.yLimit() + outline + 1, 0xFF404040); + //Alpha slider thumb + graphics.fill(alphaThumbX - thumbWidth / 2, alphaGradientDim.y() - outline, alphaThumbX + thumbWidth / 2, alphaGradientDim.yLimit() + outline, -1); + } + + //graphics.blitRepeating(COLOR_PICKER_ATLAS, colorPickerDim.x(), colorPickerDim.y(), colorPickerDim.width(), colorPickerDim.height(), 237, 0, 4, 4); + + graphics.pose().popPose(); + } + + public boolean clickedHueSlider(double mouseX, double mouseY) { + if (satLightGradientDown || alphaSliderDown) return false; + + if (mouseY >= hueGradientDim.y() && mouseY <= hueGradientDim.yLimit()) { + if (mouseX >= hueGradientDim.x() && mouseX <= hueGradientDim.xLimit()) { + hueSliderDown = true; + } + } + + if (hueSliderDown) { + hueThumbX = (int) Mth.clamp(mouseX, hueGradientDim.x(), hueGradientDim.xLimit()); + } + + return hueSliderDown; + } + + public boolean clickedSatLightGradient(double mouseX, double mouseY) { + if (hueSliderDown || alphaSliderDown) return false; + + if (mouseX >= saturationLightDim.x() && mouseX <= saturationLightDim.xLimit()) { + if (mouseY >= saturationLightDim.y() && mouseY <= saturationLightDim.yLimit()) { + satLightGradientDown = true; + } + } + + if(satLightGradientDown) { + satLightThumbX = (int) Mth.clamp(mouseX, saturationLightDim.x(), saturationLightDim.xLimit()); + } + + return satLightGradientDown; + } + + public boolean clickedAlphaSlider(double mouseX, double mouseY) { + if (satLightGradientDown || hueSliderDown) return false; + + if (mouseX >= alphaGradientDim.x() && mouseX <= alphaGradientDim.xLimit()) { + if (mouseY >= alphaGradientDim.y() && mouseY <= alphaGradientDim.yLimit()) { + alphaSliderDown = true; + } + } + + if (alphaSliderDown) { + alphaThumbX = (int) Mth.clamp(mouseX, alphaGradientDim.x(), alphaGradientDim.xLimit()); + } + + return alphaSliderDown; + } + + public void setColorFromMouseClick(double mouseX, double mouseY) { + if (clickedSatLightGradient(mouseX, mouseY)) { + setSatLightFromMouse(mouseX, mouseY); + } else if (clickedHueSlider(mouseX, mouseY)) { + setHueFromMouse(mouseX); + } else if (controller.allowAlpha() && clickedAlphaSlider(mouseX, mouseY)) { + setAlphaFromMouse(mouseX); + } + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (isMouseOver(mouseX, mouseY)) { + mouseDown = true; + hueSliderDown = false; + satLightGradientDown = false; + alphaSliderDown = false; + setColorFromMouseClick(mouseX, mouseY); + return true; + } else if (entryWidget.isMouseOver(mouseX, mouseY)) { + return entryWidget.mouseClicked(mouseX, mouseY, button); + } else { + close(); //removes color picker + return false; + } + } + @Override + public boolean mouseReleased(double mouseX, double mouseY, int button) { + mouseDown = false; + return false; + } + @Override + public boolean isMouseOver(double mouseX, double mouseY) { + //Checks if the mouse is either over the color picker or the color controller + //The addition/subtraction of the outline and extra 3 pixels is to account for both the outline and the background + if (mouseX >= colorPickerDim.x() - outline - 3 && mouseX <= colorPickerDim.xLimit() + outline + 3 + && mouseY >= colorPickerDim.y() - outline - 3 && mouseY <= colorPickerDim.yLimit() + outline + 3) { + return true; + } + return false; + } + + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) { + if (mouseDown || isMouseOver(mouseX, mouseY)) { + setColorFromMouseClick(mouseX, mouseY); + return true; + } + return entryWidget.mouseDragged(mouseX, mouseY, button, deltaX, deltaY); + } + + @Override + public boolean charTyped(char chr, int modifiers) { + //Done to allow for typing whilst the color picker is visible + charTyped = true; + return entryWidget.charTyped(chr, modifiers); + } + + @Override + public void setDimension(Dimension dim) { + super.setDimension(dim); + + int colorPickerHeight = (dim.height() * 2) + 7; + int colorPickerX = dim.centerX() - getXPadding() * 2; + int colorPickerY = dim.y() - colorPickerHeight - sliderHeight; + int alphaSliderHeight = 0; + if (controller.allowAlpha()) { + alphaSliderHeight = sliderHeight + outline + paddingY; + colorPickerHeight += alphaSliderHeight; + colorPickerY -= alphaSliderHeight; + } + + //Check if the color picker should be moved to beneath the controller + //Add additional numbers after colorPickerY to reduce the "strictness" of this detection + if (colorPickerY < screen.tabArea.top()) { + colorPickerY = dim.yLimit() + sliderHeight; + } + + //A single dimension for the entire color picker as a whole + //Division is used for the main color preview, saturation/light picker, and hue slider to determine their dimensions + colorPickerDim = Dimension.ofInt(colorPickerX, colorPickerY, dim.xLimit() - colorPickerX, colorPickerHeight); + + previewColorDim = Dimension.ofInt(colorPickerDim.x(), colorPickerDim.y(), (colorPickerDim.x() + (colorPickerDim.xLimit() / previewPortion) - paddingX) - colorPickerDim.x(), (colorPickerDim.yLimit() - sliderHeight - paddingY) - colorPickerDim.y() - alphaSliderHeight); + saturationLightDim = Dimension.ofInt(colorPickerDim.x() + (colorPickerDim.xLimit() / previewPortion) + paddingX + 1, colorPickerDim.y(), colorPickerDim.xLimit() - (colorPickerDim.x() + (colorPickerDim.xLimit() / previewPortion) + paddingX + 1), (colorPickerDim.yLimit() - sliderHeight - paddingY) - colorPickerDim.y() - alphaSliderHeight); + hueGradientDim = Dimension.ofInt(colorPickerDim.x(), colorPickerDim.yLimit() - sliderHeight - alphaSliderHeight, colorPickerDim.width(), sliderHeight); + if (controller.allowAlpha()) { + alphaGradientDim = Dimension.ofInt(hueGradientDim.x(), hueGradientDim.y() + alphaSliderHeight, hueGradientDim.width(), sliderHeight); + } + } + + @Override + public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + entryWidget.hoveredOverColorPreview = entryWidget.isMouseOverColorPreview(mouseX, mouseY); + } + + @Override + public void close() { + entryWidget.removeColorPicker(); + } + + @Override + public Component popupTitle() { + return Component.translatable("yacl.control.color.color_picker_title"); + } + + public void setThumbX() { + //Sets the thumb x for both hue and sat/light + hueThumbX = getHueThumbX(); + satLightThumbX = getSatLightThumbX(); + if (controller.allowAlpha()) { + alphaThumbX = getAlphaThumbX(); + } + } + + protected int getHueThumbX() { + int min = hueGradientDim.x(); + int max = hueGradientDim.xLimit(); + int value = (int) (min + hueGradientDim.width() * this.hue); + + return Mth.clamp(value, min, max); + } + + protected int getSatLightThumbX() { + int min = saturationLightDim.x(); + int max = saturationLightDim.xLimit(); + int value = (int) (min + (saturationLightDim.width() * this.saturation)); + + return Mth.clamp(value, min, max); + } + + protected int getSatLightThumbY() { + int min = saturationLightDim.y(); + int max = saturationLightDim.yLimit(); + int value = (int) (min + (saturationLightDim.height() * (1.0f - this.light))); + + return Mth.clamp(value, min, max); + } + + protected int getAlphaThumbX() { + int min = alphaGradientDim.x(); + int max = alphaGradientDim.xLimit(); + int value = max - (alphaGradientDim.width() * this.alpha / 255); + + return Mth.clamp(value, min, max); + } + + public void setHueFromMouse(double mouseX) { + //Changes the hue of the pending color based on the mouseX's pos. + //relative to the colorPickerDim's x/xLimit + if(mouseX < hueGradientDim.x()) { + this.hue = 0f; + } else if (mouseX > hueGradientDim.xLimit()) { + this.hue = 1f; + } else { + float newHue = (float) (mouseX - hueGradientDim.x()) / hueGradientDim.width(); + + this.hue = Mth.clamp(newHue, 0f, 1f); + } + + setColorControllerFromHSL(); + } + + public void setSatLightFromMouse(double mouseX, double mouseY) { + if(mouseX < saturationLightDim.x()) { + this.saturation = 0f; + } else if (mouseX > saturationLightDim.xLimit()) { + this.saturation = 1f; + } else { + float newSat = (float) (mouseX - saturationLightDim.x()) / saturationLightDim.width(); + + this.saturation = Mth.clamp(newSat, 0f, 1.0f); + } + + if(mouseY < saturationLightDim.y()) { + this.light = 1f; + } else if (mouseY > saturationLightDim.yLimit()) { + this.light = 0f; + } else { + float newLight = (float) (mouseY - saturationLightDim.y()) / saturationLightDim.height(); + + this.light = Mth.clamp(1f - newLight, 0f, 1.0f); + } + + setColorControllerFromHSL(); + } + + public void setAlphaFromMouse(double mouseX) { + //Changes the alpha of the pending color based on the mouseX's pos. + if(mouseX < alphaGradientDim.x()) { + this.alpha = 255; + } else if (mouseX > alphaGradientDim.xLimit()) { + this.alpha = 0; + } else { + int newAlpha = (int) ((mouseX - alphaGradientDim.xLimit()) / alphaGradientDim.width() * -255); + + this.alpha = Mth.clamp(newAlpha, 0, 255); + } + + setColorControllerFromHSL(); + } + + public void setColorControllerFromHSL() { + //Updates the current color controller's pending value based from HSL to RGB + float trueHue = (float) (hueThumbX - colorPickerDim.x()) / colorPickerDim.width(); + Color color = Color.getHSBColor(trueHue, saturation, light); + Color returnColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); + controller.option().requestSet(returnColor); + } + + protected void updateHSL() { + this.HSL = getHSL(); + this.hue = hue(); + this.saturation = saturation(); + this.light = light(); + this.alpha = getAlpha(); + if(charTyped) { + setThumbX(); + charTyped = false; + } + } + + protected float[] getHSL() { + Color pendingValue = controller.option().pendingValue(); + return Color.RGBtoHSB(pendingValue.getRed(), pendingValue.getGreen(), pendingValue.getBlue(), null); + } + + protected float hue() { + //Gets the hue of the pending value + return HSL[0]; + } + + protected float saturation() { + //Gets the saturation of the pending value + return HSL[1]; + } + + protected float light() { + //Gets the light/brightness/value(has a few different names, all refer to the same thing) of the pending value + return HSL[2]; + } + + protected int getAlpha() { + return controller.option().pendingValue().getAlpha(); + } + + protected float getRgbFromHueX() { + float trueHue = (float) (hueThumbX - colorPickerDim.x()) / colorPickerDim.width(); + + return Color.HSBtoRGB(trueHue, 1, 1); + } + + protected int getRgbWithoutAlpha() { + Color pendingColor = controller.option().pendingValue(); + Color returnColor = new Color(pendingColor.getRed(), pendingColor.getGreen(), pendingColor.getBlue(), 255); + return returnColor.getRGB(); + } +} diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java b/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java new file mode 100644 index 0000000..e2f19bc --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java @@ -0,0 +1,39 @@ +package dev.isxander.yacl3.gui.controllers; + +import dev.isxander.yacl3.api.Controller; +import dev.isxander.yacl3.api.utils.Dimension; +import dev.isxander.yacl3.gui.YACLScreen; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.network.chat.Component; + +public abstract class ControllerPopupWidget> extends ControllerWidget> implements GuiEventListener { + public final ControllerWidget entryWidget; + public ControllerPopupWidget(T control, YACLScreen screen, Dimension dim, ControllerWidget entryWidget) { + super(control, screen, dim); + this.entryWidget = entryWidget; + } + + public ControllerWidget entryWidget() { + return entryWidget; + } + + public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {} + + @Override + public boolean keyPressed(int keyCode, int scanCode, int modifiers) { + return entryWidget.keyPressed(keyCode, scanCode, modifiers); + } + + public void close() {} + + public Component popupTitle() { + return Component.translatable("yacl.control.text.blank"); + } + + @Override + protected int getHoveredControlWidth() { + return 0; + } + +} diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/PopupControllerScreen.java b/src/main/java/dev/isxander/yacl3/gui/controllers/PopupControllerScreen.java new file mode 100644 index 0000000..f6a5db3 --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/gui/controllers/PopupControllerScreen.java @@ -0,0 +1,70 @@ +package dev.isxander.yacl3.gui.controllers; + +import dev.isxander.yacl3.gui.YACLScreen; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.Screen; + +public class PopupControllerScreen extends Screen { + private final YACLScreen backgroundYaclScreen; + private final ControllerPopupWidget controllerPopup; + public PopupControllerScreen(YACLScreen backgroundYaclScreen, ControllerPopupWidget controllerPopup) { + super(controllerPopup.popupTitle()); //Gets narrated by the narrator + this.backgroundYaclScreen = backgroundYaclScreen; + this.controllerPopup = controllerPopup; + } + + + @Override + protected void init() { + this.addRenderableWidget(this.controllerPopup); + } + + @Override + public void resize(Minecraft minecraft, int width, int height) { + minecraft.setScreen(backgroundYaclScreen); + } + + @Override + public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { + controllerPopup.renderBackground(graphics, mouseX, mouseY, delta); + this.backgroundYaclScreen.render(graphics, -1, -1, delta); //mouseX/Y set to -1 to prevent hovering outlines + + super.render(graphics, mouseX, mouseY, delta); + } + + @Override + public void renderBackground( + GuiGraphics guiGraphics + /*? if >1.20.1 {*/, + int mouseX, + int mouseY, + float partialTick + /*?}*/ + ) { + + } + + @Override + public boolean mouseScrolled(double mouseX, double mouseY, /*? if >1.20.1 {*/ double scrollX, /*?}*/ double scrollY) { + backgroundYaclScreen.mouseScrolled(mouseX, mouseY, /*? if >1.20.1 {*/ scrollX, /*?}*/ scrollY); //mouseX & mouseY are needed here + return super.mouseScrolled(mouseX, mouseY, /*? if >1.20.1 {*/ scrollX, /*?}*/ scrollY); + } + + @Override + public boolean charTyped(char codePoint, int modifiers) { + return controllerPopup.charTyped(codePoint, modifiers); + } + + + @Override + public boolean keyPressed(int keyCode, int scanCode, int modifiers) { + return controllerPopup.keyPressed(keyCode, scanCode, modifiers); + } + + @Override + public void onClose() { + this.minecraft.screen = backgroundYaclScreen; + } + +} diff --git a/src/main/java/dev/isxander/yacl3/gui/image/YACLImageReloadListener.java b/src/main/java/dev/isxander/yacl3/gui/image/YACLImageReloadListener.java index b6524a7..1852d98 100644 --- a/src/main/java/dev/isxander/yacl3/gui/image/YACLImageReloadListener.java +++ b/src/main/java/dev/isxander/yacl3/gui/image/YACLImageReloadListener.java @@ -1,6 +1,7 @@ package dev.isxander.yacl3.gui.image; import dev.isxander.yacl3.impl.utils.YACLConstants; +import dev.isxander.yacl3.platform.YACLPlatform; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; import net.minecraft.ReportedException; @@ -104,7 +105,7 @@ public class YACLImageReloadListener /*? if fabric {*/ @Override public ResourceLocation getFabricId() { - return new ResourceLocation("yet_another_config_lib_v3", "image_reload_listener"); + return YACLPlatform.rl("image_reload_listener"); } /*?}*/ } diff --git a/src/main/java/dev/isxander/yacl3/gui/tab/ScrollableNavigationBar.java b/src/main/java/dev/isxander/yacl3/gui/tab/ScrollableNavigationBar.java index f458557..61c07c7 100644 --- a/src/main/java/dev/isxander/yacl3/gui/tab/ScrollableNavigationBar.java +++ b/src/main/java/dev/isxander/yacl3/gui/tab/ScrollableNavigationBar.java @@ -30,7 +30,7 @@ public class ScrollableNavigationBar extends TabNavigationBar { this.accessor = (TabNavigationBarAccessor) this; // add tab tooltips to the tab buttons - for (TabButton tabButton : accessor.getTabButtons()) { + for (TabButton tabButton : accessor.yacl$getTabButtons()) { if (tabButton.tab() instanceof TabExt tab) { tabButton.setTooltip(tab.getTooltip()); } @@ -39,8 +39,8 @@ public class ScrollableNavigationBar extends TabNavigationBar { @Override public void arrangeElements() { - ImmutableList tabButtons = accessor.getTabButtons(); - int noScrollWidth = accessor.getWidth() - NAVBAR_MARGIN*2; + ImmutableList tabButtons = accessor.yacl$getTabButtons(); + int noScrollWidth = accessor.yacl$getWidth() - NAVBAR_MARGIN*2; int allTabsWidth = 0; // first pass: set the width of each tab button @@ -63,12 +63,12 @@ public class ScrollableNavigationBar extends TabNavigationBar { allTabsWidth = noScrollWidth; } - Layout layout = ((TabNavigationBarAccessor) this).getLayout(); + Layout layout = ((TabNavigationBarAccessor) this).yacl$getLayout(); layout.arrangeElements(); layout.setY(0); scrollOffset = 0; - layout.setX(Math.max((accessor.getWidth() - allTabsWidth) / 2, NAVBAR_MARGIN)); + layout.setX(Math.max((accessor.yacl$getWidth() - allTabsWidth) / 2, NAVBAR_MARGIN)); this.maxScrollOffset = Math.max(0, allTabsWidth - noScrollWidth); } @@ -95,7 +95,7 @@ public class ScrollableNavigationBar extends TabNavigationBar { } public void setScrollOffset(int scrollOffset) { - Layout layout = ((TabNavigationBarAccessor) this).getLayout(); + Layout layout = ((TabNavigationBarAccessor) this).yacl$getLayout(); layout.setX(layout.getX() + this.scrollOffset); this.scrollOffset = Mth.clamp(scrollOffset, 0, maxScrollOffset); @@ -117,12 +117,16 @@ public class ScrollableNavigationBar extends TabNavigationBar { protected void ensureVisible(TabButton tabButton) { if (tabButton.getX() < NAVBAR_MARGIN) { this.setScrollOffset(this.scrollOffset - (NAVBAR_MARGIN - tabButton.getX())); - } else if (tabButton.getX() + tabButton.getWidth() > accessor.getWidth() - NAVBAR_MARGIN) { - this.setScrollOffset(this.scrollOffset + (tabButton.getX() + tabButton.getWidth() - (accessor.getWidth() - NAVBAR_MARGIN))); + } else if (tabButton.getX() + tabButton.getWidth() > accessor.yacl$getWidth() - NAVBAR_MARGIN) { + this.setScrollOffset(this.scrollOffset + (tabButton.getX() + tabButton.getWidth() - (accessor.yacl$getWidth() - NAVBAR_MARGIN))); } } public ImmutableList getTabs() { - return accessor.getTabs(); + return accessor.yacl$getTabs(); + } + + public TabManager getTabManager() { + return accessor.yacl$getTabManager(); } } diff --git a/src/main/java/dev/isxander/yacl3/gui/utils/ButtonTextureRenderer.java b/src/main/java/dev/isxander/yacl3/gui/utils/ButtonTextureRenderer.java deleted file mode 100644 index aa52a3f..0000000 --- a/src/main/java/dev/isxander/yacl3/gui/utils/ButtonTextureRenderer.java +++ /dev/null @@ -1,34 +0,0 @@ -package dev.isxander.yacl3.gui.utils; - -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.resources.ResourceLocation; - -public class ButtonTextureRenderer { - /*? if >1.20.1 {*/ - private static final net.minecraft.client.gui.components.WidgetSprites SPRITES = new net.minecraft.client.gui.components.WidgetSprites( - new ResourceLocation("widget/button"), // normal - new ResourceLocation("widget/button_disabled"), // disabled & !focused - new ResourceLocation("widget/button_highlighted"), // !disabled & focused - new ResourceLocation("widget/slider_highlighted") // disabled & focused - ); - /*?} else {*//* - private static final ResourceLocation SLIDER_LOCATION = new ResourceLocation("textures/gui/slider.png"); - *//*?}*/ - - public static void render(GuiGraphics graphics, int x, int y, int width, int height, boolean enabled, boolean focused) { - /*? if >1.20.1 {*/ - graphics.blitSprite(SPRITES.get(enabled, focused), x, y, width, height); - /*?} else {*//* - int textureV; - if (enabled) { - textureV = focused ? 60 : 40; - } else { - textureV = focused ? 20 : 0; - } - - RenderSystem.setShaderColor(1f, 1f, 1f, 1f); - graphics.blitNineSliced(SLIDER_LOCATION, x, y, width, height, 20, 4, 200, 20, 0, textureV); - *//*?}*/ - } -} diff --git a/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java b/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java new file mode 100644 index 0000000..b49557b --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java @@ -0,0 +1,43 @@ +package dev.isxander.yacl3.gui.utils; + +import com.mojang.blaze3d.systems.RenderSystem; +import dev.isxander.yacl3.platform.YACLPlatform; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.resources.ResourceLocation; + +public class YACLRenderHelper { + /*? if >1.20.1 {*/ + private static final net.minecraft.client.gui.components.WidgetSprites SPRITES = new net.minecraft.client.gui.components.WidgetSprites( + new ResourceLocation("widget/button"), // normal + new ResourceLocation("widget/button_disabled"), // disabled & !focused + new ResourceLocation("widget/button_highlighted"), // !disabled & focused + new ResourceLocation("widget/slider_highlighted") // disabled & focused + ); + /*?} else {*//* + private static final ResourceLocation SLIDER_LOCATION = new ResourceLocation("textures/gui/slider.png"); + *//*?}*/ + + public static void renderButtonTexture(GuiGraphics graphics, int x, int y, int width, int height, boolean enabled, boolean focused) { + /*? if >1.20.1 {*/ + graphics.blitSprite(SPRITES.get(enabled, focused), x, y, width, height); + /*?} else {*//* + int textureV; + if (enabled) { + textureV = focused ? 60 : 40; + } else { + textureV = focused ? 20 : 0; + } + + RenderSystem.setShaderColor(1f, 1f, 1f, 1f); + graphics.blitNineSliced(SLIDER_LOCATION, x, y, width, height, 20, 4, 200, 20, 0, textureV); + *//*?}*/ + } + + public static ResourceLocation getSpriteLocation(String path) { + /*? if >1.20.3 {*/ + return YACLPlatform.rl(path); + /*? } else {*//* + return YACLPlatform.rl("textures/gui/sprites/" + path + ".png"); + *//*?}*/ + } +} diff --git a/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java b/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java index f0da81d..8850390 100644 --- a/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java +++ b/src/main/java/dev/isxander/yacl3/mixin/TabNavigationBarAccessor.java @@ -7,28 +7,27 @@ import net.minecraft.client.gui.components.tabs.TabManager; import net.minecraft.client.gui.components.tabs.TabNavigationBar; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(TabNavigationBar.class) public interface TabNavigationBarAccessor { /*? if >1.20.4 {*//* - @Accessor - net.minecraft.client.gui.layouts.LinearLayout getLayout(); + @Accessor("layout") + net.minecraft.client.gui.layouts.LinearLayout yacl$getLayout(); *//*? } else {*/ - @Accessor - net.minecraft.client.gui.layouts.GridLayout getLayout(); + @Accessor("layout") + net.minecraft.client.gui.layouts.GridLayout yacl$getLayout(); /*?}*/ - @Accessor - int getWidth(); + @Accessor("width") + int yacl$getWidth(); - @Accessor - TabManager getTabManager(); + @Accessor("tabManager") + TabManager yacl$getTabManager(); - @Accessor - ImmutableList getTabs(); + @Accessor("tabs") + ImmutableList yacl$getTabs(); - @Accessor - ImmutableList getTabButtons(); + @Accessor("tabButtons") + ImmutableList yacl$getTabButtons(); } diff --git a/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java b/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java new file mode 100644 index 0000000..0d14b41 --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java @@ -0,0 +1,18 @@ +package dev.isxander.yacl3.platform; + +import dev.isxander.yacl3.config.v2.api.ConfigClassHandler; +import dev.isxander.yacl3.config.v2.api.SerialEntry; +import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; + +public class YACLConfig { + public static final ConfigClassHandler HANDLER = ConfigClassHandler.createBuilder(YACLConfig.class) + .id(YACLPlatform.rl("config")) + .serializer(config -> GsonConfigSerializerBuilder.create(config) + .setPath(YACLPlatform.getConfigDir().resolve("yacl.json5")) + .setJson5(true) + .build()) + .build(); + + @SerialEntry + public boolean showColorPickerIndicator = true; +} diff --git a/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java b/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java index d134e70..0a4fc04 100644 --- a/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java +++ b/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java @@ -2,6 +2,7 @@ package dev.isxander.yacl3.platform; /*?if fabric {*/ import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.resources.ResourceLocation; /*?} elif neoforge {*//* import net.neoforged.fml.loading.FMLEnvironment; import net.neoforged.fml.loading.FMLPaths; @@ -13,6 +14,10 @@ import net.minecraftforge.fml.loading.FMLPaths; import java.nio.file.Path; public final class YACLPlatform { + public static ResourceLocation rl(String path) { + return new ResourceLocation("yet_another_config_lib_v3", path); + } + public static Env getEnvironment() { /*?if fabric {*/ return switch (FabricLoader.getInstance().getEnvironmentType()) { diff --git a/src/main/resources/assets/yet_another_config_lib/lang/be_by.json b/src/main/resources/assets/yet_another_config_lib/lang/be_by.json deleted file mode 100644 index 16f84f0..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/be_by.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "yacl.control.boolean.true": "Праўда", - "yacl.control.boolean.false": "Няпраўда", - - "yacl.control.action.execute": "ВЫКАНАЦЬ", - - "yacl.gui.save": "Захаваць змены", - "yacl.gui.save.tooltip": "Робіць змены перманентнымі.", - "yacl.gui.finished.tooltip": "Закрыць GUI.", - "yacl.gui.cancel.tooltip": "Забыць усе змены і зачыніць GUI.", - "yacl.gui.reset.tooltip": "Скінуць усе налады да вызначаных. (Гэта можна адмяніць!)", - "yacl.gui.undo": "Адмяніць", - "yacl.gui.undo.tooltip": "Вярнуць усе налады да моманту змен.", - "yacl.gui.fail_apply": "Памылка пры ўжыванні", - "yacl.gui.fail_apply.tooltip": "Узнікла памылка і змены не могуць быць ужыты.", - "yacl.gui.save_before_exit": "Захавайце перад выхадам!", - "yacl.gui.save_before_exit.tooltip": "Захавайце ці скасуйце выхад з GUI.", - - "yacl.list.move_up": "Перамясціць вышэй", - "yacl.list.move_down": "Перамясціць ніжэй", - "yacl.list.remove": "Выдаліць", - "yacl.list.add_top": "New entry", - "yacl.list.empty": "Спіс пусты", - - "yacl.restart.title": "Налады патрабуюць перазапуск!", - "yacl.restart.message": "Адна ці больш налад патрабуе перазапуск гульні, каб ужыць змены.", - "yacl.restart.yes": "Закрыць Minecraft", - "yacl.restart.no": "Ігнараваць" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/el_gr.json b/src/main/resources/assets/yet_another_config_lib/lang/el_gr.json deleted file mode 100644 index b7bc2d2..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/el_gr.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "yacl.control.boolean.true": "Ναι", - "yacl.control.boolean.false": "Όχι", - - "yacl.control.action.execute": "ΕΚΤΕΛΕΣΗ", - - "yacl.gui.save": "Αποθήκευση Αλλαγών", - "yacl.gui.save.tooltip": "Μονιμοποιήει τις αλλαγές.", - "yacl.gui.finished.tooltip": "Κλείνει το GUI.", - "yacl.gui.cancel.tooltip": "Ξεχνά τις ενεργές αλλαγές και κλείνει το μενού.", - "yacl.gui.reset.tooltip": "Επαναφέρει όλες τις επιλογές στις προεπιλογές τους. (Μπορεί να ανερεθε)", - "yacl.gui.undo": "Επαναφορά", - "yacl.gui.undo.tooltip": "Επαναφέρει όλες τις ενεργές επιλογές στις προεπιλογές τους.", - "yacl.gui.fail_apply": "Αποτυχία εφαρμογής", - "yacl.gui.fail_apply.tooltip": "Δημιουργήθηκε ένα σφάλμα και οι αλλαγές δεν μπόρεσαν να εφαρμοστούν.", - "yacl.gui.save_before_exit": "Αποθήκευση πριν το κλείσιμο!", - "yacl.gui.save_before_exit.tooltip": "Αποθήκευσε ή ακύρωσε για να βγεις απ' το μενού." - - "yacl.restart.title": "Η ρύθμιση απαιτεί επανεκκήνιση!", - "yacl.restart.message": "Μία ή παραπάνω επιλογές προϋποθέτουν επανεκκήνηση το παιχνιδιού για να εφαρμοστούν.", - "yacl.restart.yes": "Κλείσιμο του Minecraft", - "yacl.restart.no": "Αγνόησε το για τώρα" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/en_us.json b/src/main/resources/assets/yet_another_config_lib/lang/en_us.json deleted file mode 100644 index c04d29e..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/en_us.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "yacl.control.boolean.true": "True", - "yacl.control.boolean.false": "False", - - "yacl.control.action.execute": "EXECUTE", - - "yacl.control.text.blank": "", - - "yacl.gui.save": "Save Changes", - "yacl.gui.save.tooltip": "Makes the changes made permanent.", - "yacl.gui.finished.tooltip": "Closes the GUI.", - "yacl.gui.cancel.tooltip": "Forgets pending changes and closes the GUI.", - "yacl.gui.reset.tooltip": "Resets all options to default. (This is reversible!)", - "yacl.gui.undo": "Undo", - "yacl.gui.undo.tooltip": "Reverts all options back to what they were before editing.", - "yacl.gui.fail_apply": "Failed to apply", - "yacl.gui.fail_apply.tooltip": "There was an error and the changes couldn't be applied.", - "yacl.gui.save_before_exit": "Save before exiting!", - "yacl.gui.save_before_exit.tooltip": "Save or cancel to exit the GUI.", - - "yacl.list.move_up": "Move up", - "yacl.list.move_down": "Move down", - "yacl.list.remove": "Remove", - "yacl.list.add_top": "New entry", - "yacl.list.empty": "List is empty", - - "yacl.restart.title": "Config requires restart!", - "yacl.restart.message": "One or more options needs you to restart the game to apply the changes.", - "yacl.restart.yes": "Close Minecraft", - "yacl.restart.no": "Ignore" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/et_ee.json b/src/main/resources/assets/yet_another_config_lib/lang/et_ee.json deleted file mode 100644 index 5f5274a..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/et_ee.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "yacl.control.boolean.true": "Tõene", - "yacl.control.boolean.false": "Väär", - - "yacl.control.action.execute": "KÄIVITA", - - "yacl.gui.save": "Salvesta muudatused", - "yacl.gui.save.tooltip": "Teeb tehtud muudatused püsivaks.", - "yacl.gui.finished.tooltip": "Sulgeb liidese.", - "yacl.gui.cancel.tooltip": "Unustab tehtud muudatused ja sulgeb liidese.", - "yacl.gui.reset.tooltip": "Lähtestab kõik valikud vaikeväärtustele. (Seda saab tagasi võtta!)", - "yacl.gui.undo": "Võta tagasi", - "yacl.gui.undo.tooltip": "Lähtestab kõik valikud muutmise-eelsetele väärtustele.", - "yacl.gui.fail_apply": "Rakendamine ebaõnnestus", - "yacl.gui.fail_apply.tooltip": "Esines viga ja muudatusi ei saadud rakendada.", - "yacl.gui.save_before_exit": "Salvesta enne väljumist!", - "yacl.gui.save_before_exit.tooltip": "Liidesest väljumiseks salvesta või loobu." -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json b/src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json deleted file mode 100644 index bc069cf..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/fr_fr.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "yacl.control.boolean.true": "Vrai", - "yacl.control.boolean.false": "Faux", - - "yacl.control.action.execute": "EXÉCUTION", - - "yacl.gui.save": "Sauvegarder les modifications", - "yacl.gui.save.tooltip": "Rend les changements effectués permanents.", - "yacl.gui.finished.tooltip": "Ferme la superposition.", - "yacl.gui.cancel.tooltip": "Oublie les changements en cours et ferme la superposition.", - "yacl.gui.reset.tooltip": "Réinitialise toutes les options par défaut. (Réversible !)", - "yacl.gui.undo": "Annuler", - "yacl.gui.undo.tooltip": "Rétablit toutes les options telles qu'elles étaient avant l'édition.", - "yacl.gui.fail_apply": "Échec de l'application", - "yacl.gui.fail_apply.tooltip": "Il y a eu une erreur et les changements n'ont pas pu être appliqués.", - "yacl.gui.save_before_exit": "Sauvegardez avant de quitter !", - "yacl.gui.save_before_exit.tooltip": "Sauvegardez ou annulez pour quitter la superposition.", - - "yacl.list.move_up": "Monter en haut", - "yacl.list.move_down": "Monter en bas", - "yacl.list.remove": "Retirer", - "yacl.list.add_top": "Nouvelle entrée", - "yacl.list.empty": "La liste est vide", - - "yacl.restart.title": "La configuration nécessite un redémarrage !", - "yacl.restart.message": "Une ou plusieurs options nécessitent que vous redémarriez le jeu pour appliquer les changements.", - "yacl.restart.yes": "Fermer Minecraft", - "yacl.restart.no": "Ignorer" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/it_it.json b/src/main/resources/assets/yet_another_config_lib/lang/it_it.json deleted file mode 100644 index 1489071..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/it_it.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "yacl.control.boolean.true": "Vero", - "yacl.control.boolean.false": "Falso", - - "yacl.control.action.execute": "ESEGUI", - - "yacl.control.text.blank": "", - - "yacl.gui.save": "Salva Modifiche", - "yacl.gui.save.tooltip": "Rende permanenti le modifiche apportate.", - "yacl.gui.finished.tooltip": "Chiude la GUI.", - "yacl.gui.cancel.tooltip": "Scarta le modifiche in sospeso e chiude la GUI.", - "yacl.gui.reset.tooltip": "Ripristina tutte le opzioni ai valori predefiniti. (È reversibile!)", - "yacl.gui.undo": "Annulla", - "yacl.gui.undo.tooltip": "Ripristina tutte le opzioni a ciò che erano prima della modifica.", - "yacl.gui.fail_apply": "Applicazione delle opzioni non riuscita", - "yacl.gui.fail_apply.tooltip": "Si è verificato un errore e le modifiche non hanno potuto essere applicate.", - "yacl.gui.save_before_exit": "Salvare prima di uscire!", - "yacl.gui.save_before_exit.tooltip": "Salva o annulla per uscire dalla GUI.", - - "yacl.list.move_up": "Sposta su", - "yacl.list.move_down": "Sposta giù", - "yacl.list.remove": "Rimuovi", - "yacl.list.add_top": "Nuova voce", - "yacl.list.empty": "La lista è vuota", - - "yacl.restart.title": "L'opzione richiede il riavvio!", - "yacl.restart.message": "Una o più opzioni richiedono il riavvio del gioco per applicare le modifiche.", - "yacl.restart.yes": "Chiudi Minecraft", - "yacl.restart.no": "Ignora" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/nl_nl.json b/src/main/resources/assets/yet_another_config_lib/lang/nl_nl.json deleted file mode 100644 index c432cda..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/nl_nl.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "yacl.control.boolean.true": "Waar", - "yacl.control.boolean.false": "Niet Waar", - - "yacl.control.action.execute": "UITVOEREN", - - "yacl.control.text.blank": "", - - "yacl.gui.save": "Wijzigingen Opslaan", - "yacl.gui.save.tooltip": "Maak de aangebrachte wijzigingen permanent.", - "yacl.gui.finished.tooltip": "Sluit de GUI.", - "yacl.gui.cancel.tooltip": "Vergeet wijzigingen en sluit het GUI.", - "yacl.gui.reset.tooltip": "Zet alle opties terug naar de standaardwaarden. (Dit is omkeerbaar!)", - "yacl.gui.undo": "Ongedaan maken", - "yacl.gui.undo.tooltip": "Zet alle opties terug naar wat ze waren voor het bewerken.", - "yacl.gui.fail_apply": "Toepassen gefaald", - "yacl.gui.fail_apply.tooltip": "Er is een fout opgetreden en de wijzigingen konden niet worden toegepast.", - "yacl.gui.save_before_exit": "Slaag op voordat u afsluit!", - "yacl.gui.save_before_exit.tooltip": "Slaag op of annuleer om het GUI af te sluiten.", - - "yacl.list.move_up": "Ga omhoog", - "yacl.list.move_down": "Ga omlaag", - "yacl.list.remove": "Verwijder", - "yacl.list.add_top": "Nieuwe invoer", - "yacl.list.empty": "Lijst is leeg", - - "yacl.restart.title": "Configuratie vereist opnieuw opstarten!", - "yacl.restart.message": "Voor één of meer opties moet je het spel opnieuw opstarten om de wijzigingen toe te passen.", - "yacl.restart.yes": "Sluit Minecraft", - "yacl.restart.no": "Negeren" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json b/src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json deleted file mode 100644 index 49074ea..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/pl_pl.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "yacl.control.boolean.true": "Tak", - "yacl.control.boolean.false": "Nie", - - "yacl.control.action.execute": "WYKONAJ", - - "yacl.gui.save": "Zapisz zmiany", - "yacl.gui.save.tooltip": "Sprawia, że wprowadzone zmiany są trwałe.", - "yacl.gui.finished.tooltip": "Zamyka GUI.", - "yacl.gui.cancel.tooltip": "Zapomina oczekujące zmiany i zamyka GUI.", - "yacl.gui.reset.tooltip": "Resetuje wszystkie opcje do wartości domyślnych. (To jest odwracalne!)", - "yacl.gui.undo": "Cofnij", - "yacl.gui.undo.tooltip": "Przywraca wszystkie opcje do stanu sprzed edycji.", - "yacl.gui.fail_apply": "Nie udało się zastosować", - "yacl.gui.fail_apply.tooltip": "Wystąpił błąd i nie udało się zastosować zmian.", - "yacl.gui.save_before_exit": "Zapisz przed wyjściem!", - "yacl.gui.save_before_exit.tooltip": "Zapisz lub anuluj, aby wyjść z GUI.", - - "yacl.restart.title": "Konfiguracja wymaga restartu!", - "yacl.restart.message": "Jedna lub więcej opcji wymaga ponownego uruchomienia gry, aby zastosować zmiany.", - "yacl.restart.yes": "Zamknij Minecrafta", - "yacl.restart.no": "Ignoruj" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/pt_br.json b/src/main/resources/assets/yet_another_config_lib/lang/pt_br.json deleted file mode 100644 index 9d4ef8d..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/pt_br.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "yacl.control.boolean.true": "Verdadeiro", - "yacl.control.boolean.false": "Falso", - - "yacl.control.action.execute": "EXECUTAR", - - "yacl.gui.save": "Salvar Mudanças", - "yacl.gui.save.tooltip": "Faz as mudanças serem permanentes.", - "yacl.gui.finished.tooltip": "Fecha o GUI.", - "yacl.gui.cancel.tooltip": "Esquece as mudanças pendentes e fecha o GUI.", - "yacl.gui.reset.tooltip": "Reinicia todas as opções para o valor padrão. (Isso é irreversível!)", - "yacl.gui.undo": "Desfazer", - "yacl.gui.undo.tooltip": "Reverte todas as opções como elas estavam antes de serem editadas.", - "yacl.gui.fail_apply": "Falha na aplicação", - "yacl.gui.fail_apply.tooltip": "Houve um erro e as mudanças não puderam ser aplicadas.", - "yacl.gui.save_before_exit": "Salve antes de sair!", - "yacl.gui.save_before_exit.tooltip": "Salve ou calcele para sair do GUI." -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json b/src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json deleted file mode 100644 index 5725d34..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/ru_ru.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "yacl.control.boolean.true": "§atrue", - "yacl.control.boolean.false": "§cfalse", - - "yacl.control.action.execute": "Выполнить", - - "yacl.gui.save": "Сохранить", - "yacl.gui.save.tooltip": "Сохранить изменения до следующего редактирования.", - "yacl.gui.finished.tooltip": "Закрыть меню.", - "yacl.gui.cancel": "Назад", - "yacl.gui.cancel.tooltip": "Отменить изменения и закрыть настройки.", - "yacl.gui.reset.tooltip": "Сбросить все настройки до значений по умолчанию (их можно восстановить).", - "yacl.gui.undo": "Отменить", - "yacl.gui.undo.tooltip": "Вернуть все настройки к состоянию, в котором они были до изменений.", - "yacl.gui.fail_apply": "Не удалось сохранить", - "yacl.gui.fail_apply.tooltip": "Возникла ошибка; изменения невозможно применить.", - "yacl.gui.save_before_exit": "Сохраните перед закрытием", - "yacl.gui.save_before_exit.tooltip": "Сохраните или отмените изменения, чтобы закрыть настройки.", - - "yacl.restart.title": "Настройки требуют перезагрузки.", - "yacl.restart.message": "Одна или несколько настроек требует перезапуска игры для применения изменений.", - "yacl.restart.yes": "Закрыть Minecraft", - "yacl.restart.no": "Игнорировать" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/sl_si.json b/src/main/resources/assets/yet_another_config_lib/lang/sl_si.json deleted file mode 100644 index 743dd4d..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/sl_si.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "yacl.control.boolean.true": "Vklopljeno", - "yacl.control.boolean.false": "Izklopljeno", - - "yacl.control.action.execute": "POŽENI", - - "yacl.gui.save": "Shrani spremembe", - "yacl.gui.save.tooltip": "Uvede trajne spremembe.", - "yacl.gui.finished.tooltip": "Zapre meni.", - "yacl.gui.cancel.tooltip": "Zavrže neshranjene spremembe in zapre meni.", - "yacl.gui.reset.tooltip": "Ponastavi vse možnosti na privzete. (To se da razveljaviti!)", - "yacl.gui.undo": "Razveljavi", - "yacl.gui.undo.tooltip": "Ponastavi vse možnosti na take kot pred spreminjanjem.", - "yacl.gui.fail_apply": "Napaka pri uveljavljanju", - "yacl.gui.fail_apply.tooltip": "Prišlo je do napake pri uveljavljanju sprememb.", - "yacl.gui.save_before_exit": "Shrani pred izhodom!", - "yacl.gui.save_before_exit.tooltip": "Shrani ali prekliči za izhod iz menija.", - "yacl.restart.title": "Nastavitve potrebujejo ponovni zagon!", - "yacl.restart.message": "Vsaj ena izmed nastavitev potrebuje ponovni zagon igre za uveljavitev.", - "yacl.restart.yes": "Zapri Minecraft", - "yacl.restart.no": "Prezri" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/tt_ru.json b/src/main/resources/assets/yet_another_config_lib/lang/tt_ru.json deleted file mode 100644 index 06d005a..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/tt_ru.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "modmenu.summaryTranslation.yacl": "Төзүче нигезендә Minecraft өчен көйләүләр китапханәсе.", - "modmenu.descriptionTranslation.yacl": "YetAnotherConfigLib (yacl) — нәкъ менә кирәк нәрсә. Төзүче нигезендә Minecraft өчен көйләүләр китапханәсе.", - - "yacl.control.boolean.true": "Дөрес", - "yacl.control.boolean.false": "Ялган", - - "yacl.control.action.execute": "ҮТӘҮ", - - "yacl.control.text.blank": "<буш>", - - "yacl.gui.save": "Үзгәрешләрне саклау", - "yacl.gui.save.tooltip": "Кертелгән үзгәрешләрне даими итә.", - "yacl.gui.finished.tooltip": "GUI-ны яба.", - "yacl.gui.cancel.tooltip": "Үзгәрешләрне баш тарта һәм GUI-ны яба.", - "yacl.gui.reset.tooltip": "Барлык көйләүләрне беренчелгә кайтара. (Аларны төзәтергә ярый!)", - "yacl.gui.undo": "Баш тарту", - "yacl.gui.undo.tooltip": "Үзгәрешләргә кадәр булган халәткә барлык көйләүләрне төзәтә.", - "yacl.gui.fail_apply": "Кулланып булмады", - "yacl.gui.fail_apply.tooltip": "Үзгәрешләрне кулланып булмады; хата булды.", - "yacl.gui.save_before_exit": "Чыкканчы саклагыз!", - "yacl.gui.save_before_exit.tooltip": "GUI-тан чыгу өчен саклагыз яки баш тартыгыз.", - - "yacl.list.move_up": "Өскә күчү", - "yacl.list.move_down": "Аска күчү", - "yacl.list.remove": "Бетерү", - "yacl.list.add_top": "Яңа элемент", - "yacl.list.empty": "Исемлек буш", - - "yacl.restart.title": "Көйләү яңадан кушуны таләп ителә!", - "yacl.restart.message": "Үзгәрешләр куллану өчен бер яки күбрәк көйләү уенның яңадан кушуын таләп ителә.", - "yacl.restart.yes": "Minecraft-ны ябу", - "yacl.restart.no": "Әһәмият бирмәү" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json b/src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json deleted file mode 100644 index 9307c9b..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/zh_cn.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "yacl.control.boolean.true": "是", - "yacl.control.boolean.false": "否", - - "yacl.control.action.execute": "执行", - - "yacl.gui.save": "保存更改", - "yacl.gui.save.tooltip": "永久保存所做更改。", - "yacl.gui.finished.tooltip": "关闭 GUI。", - "yacl.gui.cancel.tooltip": "忽略犹豫不决的更改然后关闭 GUI。", - "yacl.gui.reset.tooltip": "将所有选项重置为默认值。(这是可逆的!)", - "yacl.gui.undo": "撤销", - "yacl.gui.undo.tooltip": "将所有选项恢复到编辑前的状态。", - "yacl.gui.fail_apply": "应用失败", - "yacl.gui.fail_apply.tooltip": "有一个错误以至于更改不能被应用。", - "yacl.gui.save_before_exit": "退出前保存!", - "yacl.gui.save_before_exit.tooltip": "保存或取消以退出 GUI。", - - "yacl.list.move_up": "上移", - "yacl.list.move_down": "下移", - "yacl.list.remove": "移除", - "yacl.list.add_top": "新条目", - "yacl.list.empty": "列表为空", - - "yacl.restart.title": "配置需要重新启动!", - "yacl.restart.message": "一个或多个选项需要你重新启动游戏来应用这些更改。", - "yacl.restart.yes": "关闭 Minecraft", - "yacl.restart.no": "忽略" -} diff --git a/src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json b/src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json deleted file mode 100644 index 0ac792f..0000000 --- a/src/main/resources/assets/yet_another_config_lib/lang/zh_tw.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "yacl.control.boolean.true": "是", - "yacl.control.boolean.false": "否", - - "yacl.control.action.execute": "執行", - - "yacl.gui.save": "儲存變更", - "yacl.gui.save.tooltip": "儲存你的變更。", - "yacl.gui.finished.tooltip": "關閉介面。", - "yacl.gui.cancel.tooltip": "取消變更並關閉介面。", - "yacl.gui.reset.tooltip": "重設所有選項到預設。(這可以復原!)", - "yacl.gui.undo": "復原", - "yacl.gui.undo.tooltip": "將所有選項恢復成編輯前的狀態。", - "yacl.gui.fail_apply": "套用失敗", - "yacl.gui.fail_apply.tooltip": "發生錯誤,無法套用變更。", - "yacl.gui.save_before_exit": "在離開時儲存!", - "yacl.gui.save_before_exit.tooltip": "儲存或是取消並離開介面。", - - "yacl.list.move_up": "上移", - "yacl.list.move_down": "下移", - "yacl.list.remove": "移除", - "yacl.list.add_top": "新增項目", - "yacl.list.empty": "列表為空", - - "yacl.restart.title": "變更設定需要重開遊戲!", - "yacl.restart.message": "一個或多個選項需要你重開遊戲才能套用變更。", - "yacl.restart.yes": "關閉 Minecraft", - "yacl.restart.no": "忽略" -} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/be_by.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/be_by.json new file mode 100644 index 0000000..16f84f0 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/be_by.json @@ -0,0 +1,29 @@ +{ + "yacl.control.boolean.true": "Праўда", + "yacl.control.boolean.false": "Няпраўда", + + "yacl.control.action.execute": "ВЫКАНАЦЬ", + + "yacl.gui.save": "Захаваць змены", + "yacl.gui.save.tooltip": "Робіць змены перманентнымі.", + "yacl.gui.finished.tooltip": "Закрыць GUI.", + "yacl.gui.cancel.tooltip": "Забыць усе змены і зачыніць GUI.", + "yacl.gui.reset.tooltip": "Скінуць усе налады да вызначаных. (Гэта можна адмяніць!)", + "yacl.gui.undo": "Адмяніць", + "yacl.gui.undo.tooltip": "Вярнуць усе налады да моманту змен.", + "yacl.gui.fail_apply": "Памылка пры ўжыванні", + "yacl.gui.fail_apply.tooltip": "Узнікла памылка і змены не могуць быць ужыты.", + "yacl.gui.save_before_exit": "Захавайце перад выхадам!", + "yacl.gui.save_before_exit.tooltip": "Захавайце ці скасуйце выхад з GUI.", + + "yacl.list.move_up": "Перамясціць вышэй", + "yacl.list.move_down": "Перамясціць ніжэй", + "yacl.list.remove": "Выдаліць", + "yacl.list.add_top": "New entry", + "yacl.list.empty": "Спіс пусты", + + "yacl.restart.title": "Налады патрабуюць перазапуск!", + "yacl.restart.message": "Адна ці больш налад патрабуе перазапуск гульні, каб ужыць змены.", + "yacl.restart.yes": "Закрыць Minecraft", + "yacl.restart.no": "Ігнараваць" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/el_gr.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/el_gr.json new file mode 100644 index 0000000..b7bc2d2 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/el_gr.json @@ -0,0 +1,23 @@ +{ + "yacl.control.boolean.true": "Ναι", + "yacl.control.boolean.false": "Όχι", + + "yacl.control.action.execute": "ΕΚΤΕΛΕΣΗ", + + "yacl.gui.save": "Αποθήκευση Αλλαγών", + "yacl.gui.save.tooltip": "Μονιμοποιήει τις αλλαγές.", + "yacl.gui.finished.tooltip": "Κλείνει το GUI.", + "yacl.gui.cancel.tooltip": "Ξεχνά τις ενεργές αλλαγές και κλείνει το μενού.", + "yacl.gui.reset.tooltip": "Επαναφέρει όλες τις επιλογές στις προεπιλογές τους. (Μπορεί να ανερεθε)", + "yacl.gui.undo": "Επαναφορά", + "yacl.gui.undo.tooltip": "Επαναφέρει όλες τις ενεργές επιλογές στις προεπιλογές τους.", + "yacl.gui.fail_apply": "Αποτυχία εφαρμογής", + "yacl.gui.fail_apply.tooltip": "Δημιουργήθηκε ένα σφάλμα και οι αλλαγές δεν μπόρεσαν να εφαρμοστούν.", + "yacl.gui.save_before_exit": "Αποθήκευση πριν το κλείσιμο!", + "yacl.gui.save_before_exit.tooltip": "Αποθήκευσε ή ακύρωσε για να βγεις απ' το μενού." + + "yacl.restart.title": "Η ρύθμιση απαιτεί επανεκκήνιση!", + "yacl.restart.message": "Μία ή παραπάνω επιλογές προϋποθέτουν επανεκκήνηση το παιχνιδιού για να εφαρμοστούν.", + "yacl.restart.yes": "Κλείσιμο του Minecraft", + "yacl.restart.no": "Αγνόησε το για τώρα" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/en_us.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/en_us.json new file mode 100644 index 0000000..6556648 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/en_us.json @@ -0,0 +1,34 @@ +{ + "yacl.control.boolean.true": "True", + "yacl.control.boolean.false": "False", + + "yacl.control.action.execute": "EXECUTE", + + "yacl.control.color.color_picker_title": "Color Picker", + + "yacl.control.text.blank": "", + + "yacl.gui.save": "Save Changes", + "yacl.gui.save.tooltip": "Makes the changes made permanent.", + "yacl.gui.finished.tooltip": "Closes the GUI.", + "yacl.gui.cancel.tooltip": "Forgets pending changes and closes the GUI.", + "yacl.gui.reset.tooltip": "Resets all options to default. (This is reversible!)", + "yacl.gui.undo": "Undo", + "yacl.gui.undo.tooltip": "Reverts all options back to what they were before editing.", + "yacl.gui.fail_apply": "Failed to apply", + "yacl.gui.fail_apply.tooltip": "There was an error and the changes couldn't be applied.", + "yacl.gui.save_before_exit": "Save before exiting!", + "yacl.gui.save_before_exit.tooltip": "Save or cancel to exit the GUI.", + + "yacl.list.move_up": "Move up", + "yacl.list.move_down": "Move down", + "yacl.list.remove": "Remove", + "yacl.list.add_top": "New entry", + "yacl.list.empty": "List is empty", + + "yacl.restart.title": "Config requires restart!", + "yacl.restart.message": "One or more options needs you to restart the game to apply the changes.", + "yacl.restart.yes": "Close Minecraft", + "yacl.restart.no": "Ignore" + +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/et_ee.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/et_ee.json new file mode 100644 index 0000000..5f5274a --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/et_ee.json @@ -0,0 +1,18 @@ +{ + "yacl.control.boolean.true": "Tõene", + "yacl.control.boolean.false": "Väär", + + "yacl.control.action.execute": "KÄIVITA", + + "yacl.gui.save": "Salvesta muudatused", + "yacl.gui.save.tooltip": "Teeb tehtud muudatused püsivaks.", + "yacl.gui.finished.tooltip": "Sulgeb liidese.", + "yacl.gui.cancel.tooltip": "Unustab tehtud muudatused ja sulgeb liidese.", + "yacl.gui.reset.tooltip": "Lähtestab kõik valikud vaikeväärtustele. (Seda saab tagasi võtta!)", + "yacl.gui.undo": "Võta tagasi", + "yacl.gui.undo.tooltip": "Lähtestab kõik valikud muutmise-eelsetele väärtustele.", + "yacl.gui.fail_apply": "Rakendamine ebaõnnestus", + "yacl.gui.fail_apply.tooltip": "Esines viga ja muudatusi ei saadud rakendada.", + "yacl.gui.save_before_exit": "Salvesta enne väljumist!", + "yacl.gui.save_before_exit.tooltip": "Liidesest väljumiseks salvesta või loobu." +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/fr_fr.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/fr_fr.json new file mode 100644 index 0000000..bc069cf --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/fr_fr.json @@ -0,0 +1,29 @@ +{ + "yacl.control.boolean.true": "Vrai", + "yacl.control.boolean.false": "Faux", + + "yacl.control.action.execute": "EXÉCUTION", + + "yacl.gui.save": "Sauvegarder les modifications", + "yacl.gui.save.tooltip": "Rend les changements effectués permanents.", + "yacl.gui.finished.tooltip": "Ferme la superposition.", + "yacl.gui.cancel.tooltip": "Oublie les changements en cours et ferme la superposition.", + "yacl.gui.reset.tooltip": "Réinitialise toutes les options par défaut. (Réversible !)", + "yacl.gui.undo": "Annuler", + "yacl.gui.undo.tooltip": "Rétablit toutes les options telles qu'elles étaient avant l'édition.", + "yacl.gui.fail_apply": "Échec de l'application", + "yacl.gui.fail_apply.tooltip": "Il y a eu une erreur et les changements n'ont pas pu être appliqués.", + "yacl.gui.save_before_exit": "Sauvegardez avant de quitter !", + "yacl.gui.save_before_exit.tooltip": "Sauvegardez ou annulez pour quitter la superposition.", + + "yacl.list.move_up": "Monter en haut", + "yacl.list.move_down": "Monter en bas", + "yacl.list.remove": "Retirer", + "yacl.list.add_top": "Nouvelle entrée", + "yacl.list.empty": "La liste est vide", + + "yacl.restart.title": "La configuration nécessite un redémarrage !", + "yacl.restart.message": "Une ou plusieurs options nécessitent que vous redémarriez le jeu pour appliquer les changements.", + "yacl.restart.yes": "Fermer Minecraft", + "yacl.restart.no": "Ignorer" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/it_it.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/it_it.json new file mode 100644 index 0000000..1489071 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/it_it.json @@ -0,0 +1,31 @@ +{ + "yacl.control.boolean.true": "Vero", + "yacl.control.boolean.false": "Falso", + + "yacl.control.action.execute": "ESEGUI", + + "yacl.control.text.blank": "", + + "yacl.gui.save": "Salva Modifiche", + "yacl.gui.save.tooltip": "Rende permanenti le modifiche apportate.", + "yacl.gui.finished.tooltip": "Chiude la GUI.", + "yacl.gui.cancel.tooltip": "Scarta le modifiche in sospeso e chiude la GUI.", + "yacl.gui.reset.tooltip": "Ripristina tutte le opzioni ai valori predefiniti. (È reversibile!)", + "yacl.gui.undo": "Annulla", + "yacl.gui.undo.tooltip": "Ripristina tutte le opzioni a ciò che erano prima della modifica.", + "yacl.gui.fail_apply": "Applicazione delle opzioni non riuscita", + "yacl.gui.fail_apply.tooltip": "Si è verificato un errore e le modifiche non hanno potuto essere applicate.", + "yacl.gui.save_before_exit": "Salvare prima di uscire!", + "yacl.gui.save_before_exit.tooltip": "Salva o annulla per uscire dalla GUI.", + + "yacl.list.move_up": "Sposta su", + "yacl.list.move_down": "Sposta giù", + "yacl.list.remove": "Rimuovi", + "yacl.list.add_top": "Nuova voce", + "yacl.list.empty": "La lista è vuota", + + "yacl.restart.title": "L'opzione richiede il riavvio!", + "yacl.restart.message": "Una o più opzioni richiedono il riavvio del gioco per applicare le modifiche.", + "yacl.restart.yes": "Chiudi Minecraft", + "yacl.restart.no": "Ignora" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/nl_nl.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/nl_nl.json new file mode 100644 index 0000000..c432cda --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/nl_nl.json @@ -0,0 +1,31 @@ +{ + "yacl.control.boolean.true": "Waar", + "yacl.control.boolean.false": "Niet Waar", + + "yacl.control.action.execute": "UITVOEREN", + + "yacl.control.text.blank": "", + + "yacl.gui.save": "Wijzigingen Opslaan", + "yacl.gui.save.tooltip": "Maak de aangebrachte wijzigingen permanent.", + "yacl.gui.finished.tooltip": "Sluit de GUI.", + "yacl.gui.cancel.tooltip": "Vergeet wijzigingen en sluit het GUI.", + "yacl.gui.reset.tooltip": "Zet alle opties terug naar de standaardwaarden. (Dit is omkeerbaar!)", + "yacl.gui.undo": "Ongedaan maken", + "yacl.gui.undo.tooltip": "Zet alle opties terug naar wat ze waren voor het bewerken.", + "yacl.gui.fail_apply": "Toepassen gefaald", + "yacl.gui.fail_apply.tooltip": "Er is een fout opgetreden en de wijzigingen konden niet worden toegepast.", + "yacl.gui.save_before_exit": "Slaag op voordat u afsluit!", + "yacl.gui.save_before_exit.tooltip": "Slaag op of annuleer om het GUI af te sluiten.", + + "yacl.list.move_up": "Ga omhoog", + "yacl.list.move_down": "Ga omlaag", + "yacl.list.remove": "Verwijder", + "yacl.list.add_top": "Nieuwe invoer", + "yacl.list.empty": "Lijst is leeg", + + "yacl.restart.title": "Configuratie vereist opnieuw opstarten!", + "yacl.restart.message": "Voor één of meer opties moet je het spel opnieuw opstarten om de wijzigingen toe te passen.", + "yacl.restart.yes": "Sluit Minecraft", + "yacl.restart.no": "Negeren" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/pl_pl.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/pl_pl.json new file mode 100644 index 0000000..49074ea --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/pl_pl.json @@ -0,0 +1,23 @@ +{ + "yacl.control.boolean.true": "Tak", + "yacl.control.boolean.false": "Nie", + + "yacl.control.action.execute": "WYKONAJ", + + "yacl.gui.save": "Zapisz zmiany", + "yacl.gui.save.tooltip": "Sprawia, że wprowadzone zmiany są trwałe.", + "yacl.gui.finished.tooltip": "Zamyka GUI.", + "yacl.gui.cancel.tooltip": "Zapomina oczekujące zmiany i zamyka GUI.", + "yacl.gui.reset.tooltip": "Resetuje wszystkie opcje do wartości domyślnych. (To jest odwracalne!)", + "yacl.gui.undo": "Cofnij", + "yacl.gui.undo.tooltip": "Przywraca wszystkie opcje do stanu sprzed edycji.", + "yacl.gui.fail_apply": "Nie udało się zastosować", + "yacl.gui.fail_apply.tooltip": "Wystąpił błąd i nie udało się zastosować zmian.", + "yacl.gui.save_before_exit": "Zapisz przed wyjściem!", + "yacl.gui.save_before_exit.tooltip": "Zapisz lub anuluj, aby wyjść z GUI.", + + "yacl.restart.title": "Konfiguracja wymaga restartu!", + "yacl.restart.message": "Jedna lub więcej opcji wymaga ponownego uruchomienia gry, aby zastosować zmiany.", + "yacl.restart.yes": "Zamknij Minecrafta", + "yacl.restart.no": "Ignoruj" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/pt_br.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/pt_br.json new file mode 100644 index 0000000..9d4ef8d --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/pt_br.json @@ -0,0 +1,18 @@ +{ + "yacl.control.boolean.true": "Verdadeiro", + "yacl.control.boolean.false": "Falso", + + "yacl.control.action.execute": "EXECUTAR", + + "yacl.gui.save": "Salvar Mudanças", + "yacl.gui.save.tooltip": "Faz as mudanças serem permanentes.", + "yacl.gui.finished.tooltip": "Fecha o GUI.", + "yacl.gui.cancel.tooltip": "Esquece as mudanças pendentes e fecha o GUI.", + "yacl.gui.reset.tooltip": "Reinicia todas as opções para o valor padrão. (Isso é irreversível!)", + "yacl.gui.undo": "Desfazer", + "yacl.gui.undo.tooltip": "Reverte todas as opções como elas estavam antes de serem editadas.", + "yacl.gui.fail_apply": "Falha na aplicação", + "yacl.gui.fail_apply.tooltip": "Houve um erro e as mudanças não puderam ser aplicadas.", + "yacl.gui.save_before_exit": "Salve antes de sair!", + "yacl.gui.save_before_exit.tooltip": "Salve ou calcele para sair do GUI." +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/ru_ru.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/ru_ru.json new file mode 100644 index 0000000..5725d34 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/ru_ru.json @@ -0,0 +1,24 @@ +{ + "yacl.control.boolean.true": "§atrue", + "yacl.control.boolean.false": "§cfalse", + + "yacl.control.action.execute": "Выполнить", + + "yacl.gui.save": "Сохранить", + "yacl.gui.save.tooltip": "Сохранить изменения до следующего редактирования.", + "yacl.gui.finished.tooltip": "Закрыть меню.", + "yacl.gui.cancel": "Назад", + "yacl.gui.cancel.tooltip": "Отменить изменения и закрыть настройки.", + "yacl.gui.reset.tooltip": "Сбросить все настройки до значений по умолчанию (их можно восстановить).", + "yacl.gui.undo": "Отменить", + "yacl.gui.undo.tooltip": "Вернуть все настройки к состоянию, в котором они были до изменений.", + "yacl.gui.fail_apply": "Не удалось сохранить", + "yacl.gui.fail_apply.tooltip": "Возникла ошибка; изменения невозможно применить.", + "yacl.gui.save_before_exit": "Сохраните перед закрытием", + "yacl.gui.save_before_exit.tooltip": "Сохраните или отмените изменения, чтобы закрыть настройки.", + + "yacl.restart.title": "Настройки требуют перезагрузки.", + "yacl.restart.message": "Одна или несколько настроек требует перезапуска игры для применения изменений.", + "yacl.restart.yes": "Закрыть Minecraft", + "yacl.restart.no": "Игнорировать" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/sl_si.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/sl_si.json new file mode 100644 index 0000000..743dd4d --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/sl_si.json @@ -0,0 +1,22 @@ +{ + "yacl.control.boolean.true": "Vklopljeno", + "yacl.control.boolean.false": "Izklopljeno", + + "yacl.control.action.execute": "POŽENI", + + "yacl.gui.save": "Shrani spremembe", + "yacl.gui.save.tooltip": "Uvede trajne spremembe.", + "yacl.gui.finished.tooltip": "Zapre meni.", + "yacl.gui.cancel.tooltip": "Zavrže neshranjene spremembe in zapre meni.", + "yacl.gui.reset.tooltip": "Ponastavi vse možnosti na privzete. (To se da razveljaviti!)", + "yacl.gui.undo": "Razveljavi", + "yacl.gui.undo.tooltip": "Ponastavi vse možnosti na take kot pred spreminjanjem.", + "yacl.gui.fail_apply": "Napaka pri uveljavljanju", + "yacl.gui.fail_apply.tooltip": "Prišlo je do napake pri uveljavljanju sprememb.", + "yacl.gui.save_before_exit": "Shrani pred izhodom!", + "yacl.gui.save_before_exit.tooltip": "Shrani ali prekliči za izhod iz menija.", + "yacl.restart.title": "Nastavitve potrebujejo ponovni zagon!", + "yacl.restart.message": "Vsaj ena izmed nastavitev potrebuje ponovni zagon igre za uveljavitev.", + "yacl.restart.yes": "Zapri Minecraft", + "yacl.restart.no": "Prezri" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/tt_ru.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/tt_ru.json new file mode 100644 index 0000000..06d005a --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/tt_ru.json @@ -0,0 +1,34 @@ +{ + "modmenu.summaryTranslation.yacl": "Төзүче нигезендә Minecraft өчен көйләүләр китапханәсе.", + "modmenu.descriptionTranslation.yacl": "YetAnotherConfigLib (yacl) — нәкъ менә кирәк нәрсә. Төзүче нигезендә Minecraft өчен көйләүләр китапханәсе.", + + "yacl.control.boolean.true": "Дөрес", + "yacl.control.boolean.false": "Ялган", + + "yacl.control.action.execute": "ҮТӘҮ", + + "yacl.control.text.blank": "<буш>", + + "yacl.gui.save": "Үзгәрешләрне саклау", + "yacl.gui.save.tooltip": "Кертелгән үзгәрешләрне даими итә.", + "yacl.gui.finished.tooltip": "GUI-ны яба.", + "yacl.gui.cancel.tooltip": "Үзгәрешләрне баш тарта һәм GUI-ны яба.", + "yacl.gui.reset.tooltip": "Барлык көйләүләрне беренчелгә кайтара. (Аларны төзәтергә ярый!)", + "yacl.gui.undo": "Баш тарту", + "yacl.gui.undo.tooltip": "Үзгәрешләргә кадәр булган халәткә барлык көйләүләрне төзәтә.", + "yacl.gui.fail_apply": "Кулланып булмады", + "yacl.gui.fail_apply.tooltip": "Үзгәрешләрне кулланып булмады; хата булды.", + "yacl.gui.save_before_exit": "Чыкканчы саклагыз!", + "yacl.gui.save_before_exit.tooltip": "GUI-тан чыгу өчен саклагыз яки баш тартыгыз.", + + "yacl.list.move_up": "Өскә күчү", + "yacl.list.move_down": "Аска күчү", + "yacl.list.remove": "Бетерү", + "yacl.list.add_top": "Яңа элемент", + "yacl.list.empty": "Исемлек буш", + + "yacl.restart.title": "Көйләү яңадан кушуны таләп ителә!", + "yacl.restart.message": "Үзгәрешләр куллану өчен бер яки күбрәк көйләү уенның яңадан кушуын таләп ителә.", + "yacl.restart.yes": "Minecraft-ны ябу", + "yacl.restart.no": "Әһәмият бирмәү" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/zh_cn.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/zh_cn.json new file mode 100644 index 0000000..9307c9b --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/zh_cn.json @@ -0,0 +1,29 @@ +{ + "yacl.control.boolean.true": "是", + "yacl.control.boolean.false": "否", + + "yacl.control.action.execute": "执行", + + "yacl.gui.save": "保存更改", + "yacl.gui.save.tooltip": "永久保存所做更改。", + "yacl.gui.finished.tooltip": "关闭 GUI。", + "yacl.gui.cancel.tooltip": "忽略犹豫不决的更改然后关闭 GUI。", + "yacl.gui.reset.tooltip": "将所有选项重置为默认值。(这是可逆的!)", + "yacl.gui.undo": "撤销", + "yacl.gui.undo.tooltip": "将所有选项恢复到编辑前的状态。", + "yacl.gui.fail_apply": "应用失败", + "yacl.gui.fail_apply.tooltip": "有一个错误以至于更改不能被应用。", + "yacl.gui.save_before_exit": "退出前保存!", + "yacl.gui.save_before_exit.tooltip": "保存或取消以退出 GUI。", + + "yacl.list.move_up": "上移", + "yacl.list.move_down": "下移", + "yacl.list.remove": "移除", + "yacl.list.add_top": "新条目", + "yacl.list.empty": "列表为空", + + "yacl.restart.title": "配置需要重新启动!", + "yacl.restart.message": "一个或多个选项需要你重新启动游戏来应用这些更改。", + "yacl.restart.yes": "关闭 Minecraft", + "yacl.restart.no": "忽略" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/lang/zh_tw.json b/src/main/resources/assets/yet_another_config_lib_v3/lang/zh_tw.json new file mode 100644 index 0000000..0ac792f --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/lang/zh_tw.json @@ -0,0 +1,29 @@ +{ + "yacl.control.boolean.true": "是", + "yacl.control.boolean.false": "否", + + "yacl.control.action.execute": "執行", + + "yacl.gui.save": "儲存變更", + "yacl.gui.save.tooltip": "儲存你的變更。", + "yacl.gui.finished.tooltip": "關閉介面。", + "yacl.gui.cancel.tooltip": "取消變更並關閉介面。", + "yacl.gui.reset.tooltip": "重設所有選項到預設。(這可以復原!)", + "yacl.gui.undo": "復原", + "yacl.gui.undo.tooltip": "將所有選項恢復成編輯前的狀態。", + "yacl.gui.fail_apply": "套用失敗", + "yacl.gui.fail_apply.tooltip": "發生錯誤,無法套用變更。", + "yacl.gui.save_before_exit": "在離開時儲存!", + "yacl.gui.save_before_exit.tooltip": "儲存或是取消並離開介面。", + + "yacl.list.move_up": "上移", + "yacl.list.move_down": "下移", + "yacl.list.remove": "移除", + "yacl.list.add_top": "新增項目", + "yacl.list.empty": "列表為空", + + "yacl.restart.title": "變更設定需要重開遊戲!", + "yacl.restart.message": "一個或多個選項需要你重開遊戲才能套用變更。", + "yacl.restart.yes": "關閉 Minecraft", + "yacl.restart.no": "忽略" +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/colorpicker-atlas.png b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/colorpicker-atlas.png new file mode 100644 index 0000000..2a47705 Binary files /dev/null and b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/colorpicker-atlas.png differ diff --git a/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png new file mode 100644 index 0000000..1d11f72 Binary files /dev/null and b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png differ diff --git a/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png.mcmeta b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png.mcmeta new file mode 100644 index 0000000..20d1be9 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/colorpicker.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "nine_slice", + "width": 236, + "height": 34, + "border": 3 + } + } +} diff --git a/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png new file mode 100644 index 0000000..0a803ef Binary files /dev/null and b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png differ diff --git a/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png.mcmeta b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png.mcmeta new file mode 100644 index 0000000..9d21305 --- /dev/null +++ b/src/main/resources/assets/yet_another_config_lib_v3/textures/gui/sprites/controller/transparent.png.mcmeta @@ -0,0 +1,10 @@ +{ + "gui": { + "scaling": { + "type": "tile", + "width": 7, + "height": 7, + "border": 3 + } + } +} diff --git a/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java b/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java index b3b49b6..9bb361e 100644 --- a/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java +++ b/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java @@ -24,7 +24,7 @@ import java.util.List; public class AutogenConfigTest { public static final ConfigClassHandler INSTANCE = ConfigClassHandler.createBuilder(AutogenConfigTest.class) - .id(new ResourceLocation("yacl3", "config")) + .id(new ResourceLocation("yacl3-test", "config")) .serializer(config -> GsonConfigSerializerBuilder.create(config) .setPath(YACLPlatform.getConfigDir().resolve("yacl-test-v2.json5")) .setJson5(true) diff --git a/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java b/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java index a8f49b0..72c4454 100644 --- a/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java +++ b/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java @@ -37,6 +37,16 @@ public class ConfigTest { @SerialEntry public Color colorOption = Color.red; @SerialEntry + public Color topColorOption = Color.blue; + @SerialEntry + public Color alphaColorOption = Color.green; + @SerialEntry + public Color buttonColorOption = new Color(0, 255, 255); + @SerialEntry + public Color alternativePreviewOutline = Color.white; + @SerialEntry + public Color anotherAlphaColorOption = new Color(3, 24, 255, 158); + @SerialEntry public double doubleField = 0.5; @SerialEntry public float floatField = 0.5f; diff --git a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java index 473b04a..34ae06a 100644 --- a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java +++ b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java @@ -83,7 +83,7 @@ public class GuiTest { .append(Component.literal("e").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("e"))))) .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://isxander.dev"))) ) - .webpImage(new ResourceLocation("yacl3", "reach-around-placement.webp")) + .webpImage(new ResourceLocation("yacl3-test", "reach-around-placement.webp")) .build()) .binding( defaults.booleanToggle, @@ -100,7 +100,6 @@ public class GuiTest { .name(Component.literal("Custom Boolean Toggle")) .description(val -> OptionDescription.createBuilder() .text(Component.literal("You can customize controllers like so! YACL is truly infinitely customizable! This tooltip is long in order to demonstrate the cool, smooth scrolling of these descriptions. Did you know, they are also super clickable?! I know, cool right, YACL 3.x really is amazing.")) - .image(Path.of("D:\\Xander\\Downloads\\_MG_0860-Enhanced-NR.png"), new ResourceLocation("yacl", "f.webp")) // TODO: Add img file to git? .build()) .binding( defaults.customBooleanToggle, @@ -180,7 +179,8 @@ public class GuiTest { () -> config.colorOption, value -> config.colorOption = value ) - .customController(ColorController::new) + .controller(opt -> ColorControllerBuilder.create(opt) + .allowAlpha(true)) .build()) .build()) .group(OptionGroup.createBuilder() @@ -388,6 +388,67 @@ public class GuiTest { .build()) .build()) .build()) + .category(ConfigCategory.createBuilder() + .name(Component.literal("Color Picker Test")) + .option(Option.createBuilder() + .name(Component.literal("Top Color Option")) + .binding( + defaults.topColorOption, + () -> config.topColorOption, + value -> config.topColorOption = value + ) + .customController(ColorController::new) + .description(OptionDescription.of(Component.literal("A Color Controller's Color Picker will appear beneath the color if there is not enough room above it."))) + .build()) + .option(LabelOption.create(Component.literal("Enabling a Color Controller's Color Picker at the top of the screen will appear beneath it if there isn't enough room above. This also applies to color controllers with alpha enabled."))) + .option(Option.createBuilder() + .name(Component.literal("Alpha Color Option")) + .binding( + defaults.alphaColorOption, + () -> config.alphaColorOption, + value -> config.alphaColorOption = value + ) + .customController(opt -> new ColorController(opt, true)) + .description(OptionDescription.of(Component.literal("A Color Picker will also allow you to choose a Color Controller's alpha if it is enabled."))) + .build()) + .option(ButtonOption.createBuilder() + .name(Component.literal("Button \"Option\"")) + .action((screen, opt) -> opt.setAvailable(false)) + .build()) + .option(LabelOption.create(Component.literal("You can try and hit the button above while the color picker below is visible, but you shouldn't be able to."))) + .option(Option.createBuilder() + .name(Component.literal("Button Color Option")) + .binding( + defaults.buttonColorOption, + () -> config.buttonColorOption, + value -> config.buttonColorOption = value + ) + .customController(ColorController::new) + .description(OptionDescription.of(Component.literal("Other controller's buttons are disabled while a color picker is visible!"))) + .build()) + .option(LabelOption.create(Component.literal("The color picker button will be outlined with a light grey color instead of white if the controller's color is very light. This is all determined using the hue and value(brightness) of the color."))) + .option(Option.createBuilder() + .name(Component.literal("Alternative Color Outline")) + .binding( + defaults.alternativePreviewOutline, + () -> config.alternativePreviewOutline, + value -> config.alternativePreviewOutline = value + ) + .customController(opt -> new ColorController(opt, true)) + .description(OptionDescription.of(Component.literal("This helps users who don't know about the color picker discover it, even if a developer chooses a lighter color"))) + .build()) + .option(LabelOption.create(Component.literal("An extra color controller with alpha enabled to show that it too has the alternative color outline"))) + .option(Option.createBuilder() + .name(Component.literal("Alpha Color Option 2")) + .binding( + defaults.anotherAlphaColorOption, + () -> config.anotherAlphaColorOption, + value -> config.anotherAlphaColorOption = value + ) + .customController(opt -> new ColorController(opt, true)) + .description(OptionDescription.of(Component.literal("Yay!!!!!!"))) + .build()) + .build()) .category(ConfigCategory.createBuilder() .name(Component.literal("Category Test")) .option(LabelOption.create(Component.literal("This is a test category!"))) diff --git a/src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp b/src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp deleted file mode 100644 index 1937809..0000000 Binary files a/src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp and /dev/null differ diff --git a/src/testmod/resources/assets/yacl3/textures/sample-1.webp b/src/testmod/resources/assets/yacl3/textures/sample-1.webp deleted file mode 100644 index 0da983e..0000000 Binary files a/src/testmod/resources/assets/yacl3/textures/sample-1.webp and /dev/null differ diff --git a/src/testmod/resources/assets/yacl3/textures/sample-2.webp b/src/testmod/resources/assets/yacl3/textures/sample-2.webp deleted file mode 100644 index e887f8c..0000000 Binary files a/src/testmod/resources/assets/yacl3/textures/sample-2.webp and /dev/null differ diff --git a/src/testmod/resources/assets/yacl3/textures/sample-3.webp b/src/testmod/resources/assets/yacl3/textures/sample-3.webp deleted file mode 100644 index eda78a9..0000000 Binary files a/src/testmod/resources/assets/yacl3/textures/sample-3.webp and /dev/null differ diff --git a/src/testmod/resources/assets/yacl3/textures/sample-4.webp b/src/testmod/resources/assets/yacl3/textures/sample-4.webp deleted file mode 100644 index 8bbe329..0000000 Binary files a/src/testmod/resources/assets/yacl3/textures/sample-4.webp and /dev/null differ diff --git a/src/testmod/resources/assets/yacl3/textures/sample-5.webp b/src/testmod/resources/assets/yacl3/textures/sample-5.webp deleted file mode 100644 index ed91379..0000000 Binary files a/src/testmod/resources/assets/yacl3/textures/sample-5.webp and /dev/null differ -- cgit