diff options
author | isXander <xander@isxander.dev> | 2024-06-11 23:13:49 +0100 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2024-06-11 23:13:57 +0100 |
commit | 305718e163f91802a4bc1c1ed6540febb2ce204e (patch) | |
tree | d72fe8b95dab1ef89f67b13a19f8c06fdb582c28 /src/main/java/dev/isxander/yacl3/gui | |
parent | 65b4f7ba8374bbaebc6a431f8347ffc3e8afdced (diff) | |
download | YetAnotherConfigLib-305718e163f91802a4bc1c1ed6540febb2ce204e.tar.gz YetAnotherConfigLib-305718e163f91802a4bc1c1ed6540febb2ce204e.tar.bz2 YetAnotherConfigLib-305718e163f91802a4bc1c1ed6540febb2ce204e.zip |
codec config and rewritten kotlin dsl
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/gui')
7 files changed, 39 insertions, 40 deletions
diff --git a/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java b/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java index e6ab3f1..8def3b3 100644 --- a/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java +++ b/src/main/java/dev/isxander/yacl3/gui/AbstractWidget.java @@ -100,12 +100,12 @@ public abstract class AbstractWidget implements GuiEventListener, Renderable, Na vertex.addVertex(matrix4f, x1, y2, 0).setColor(startColor); vertex.addVertex(matrix4f, x2, y2, 0).setColor(endColor); vertex.addVertex(matrix4f, x2, y1, 0).setColor(endColor); - *//*? } else { */ + *//*?} else {*/ 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(); - /*? } */ + /*?}*/ } diff --git a/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java b/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java index be95caa..8412cc8 100644 --- a/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java +++ b/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java @@ -25,8 +25,8 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten public ElementListWidgetExt(Minecraft client, int x, int y, int width, int height, boolean smoothScrolling) { /*? if >1.20.2 {*/ super(client, width, x, y, height); - /*? } else {*//* - super(client, width, height, y, y + height, 22); + /*?} else {*/ + /*super(client, width, height, y, y + height, 22); this.x0 = x; this.x1 = x + width; *//*?}*/ @@ -53,10 +53,10 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten } @Override - /*? if >1.20.2 { */ + /*? if >1.20.2 {*/ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) - /*?} else { *//* - public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) + /*?} else {*/ + /*public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) *//*?}*/ { if (usingScrollbar) { @@ -73,10 +73,10 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten graphics.enableScissor(this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getHeight()); - /*? if >1.20.2 { */ + /*? if >1.20.2 {*/ super.renderWidget(graphics, mouseX, mouseY, delta); - /*?} else { *//* - super.render(graphics, mouseX, mouseY, delta); + /*?} else {*/ + /*super.render(graphics, mouseX, mouseY, delta); *//*?}*/ graphics.disableScissor(); @@ -84,7 +84,7 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten returnSmoothAmount = false; } - /*? if >1.20.1 { */ + /*? if >1.20.1 {*/ @Override /*?}*/ protected boolean isValidMouseClick(int button) { @@ -197,8 +197,8 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten @Override /*? if >1.20.4 {*/ protected void renderListItems(GuiGraphics graphics, int mouseX, int mouseY, float delta) - /*? } else {*//* - protected void renderList(GuiGraphics graphics, int mouseX, int mouseY, float delta) + /*?} else {*/ + /*protected void renderList(GuiGraphics graphics, int mouseX, int mouseY, float delta) *//*?}*/ { int left = this.getRowLeft(); @@ -252,8 +252,8 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten } } - /*? if <1.20.3 {*//* - @Override + /*? if <1.20.3 {*/ + /*@Override public int getX() { return x0; } diff --git a/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java index 04f1b67..90bc75f 100644 --- a/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java +++ b/src/main/java/dev/isxander/yacl3/gui/YACLScreen.java @@ -123,8 +123,8 @@ public class YACLScreen extends Screen { currentPopupController = null; } - /*? if <=1.20.4 {*//* - @Override + /*? if <=1.20.4 {*/ + /*@Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { renderDirtBackground(graphics); super.render(graphics, mouseX, mouseY, delta); diff --git a/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java b/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java index 33028d7..7c1e7e1 100644 --- a/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java +++ b/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java @@ -13,11 +13,10 @@ public class YACLTooltip extends Tooltip { this.widget = widget; } - /*? if >1.20.4 {*/ // stonecutter cannot handle AND expressions - /*? } elif >1.20.1 {*//* - @Override + //? if >1.20.1 && <=1.20.4 { + /*@Override protected ClientTooltipPositioner createTooltipPositioner(boolean bl, boolean bl2, ScreenRectangle screenRectangle) { return new YACLTooltipPositioner(widget); } - *//*?}*/ + *///?} } diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java b/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java index 8830f20..efa1aec 100644 --- a/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java +++ b/src/main/java/dev/isxander/yacl3/gui/controllers/ColorPickerWidget.java @@ -16,8 +16,8 @@ public class ColorPickerWidget extends ControllerPopupWidget<ColorController> { /*? 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 + /*?} else {*/ + /*// nineslice and repeating only work on a 256x atlas private static final ResourceLocation COLOR_PICKER_ATLAS = YACLPlatform.rl("textures/gui/colorpicker-atlas.png"); *//*?}*/ @@ -88,10 +88,10 @@ public class ColorPickerWidget extends ControllerPopupWidget<ColorController> { graphics.pose().translate(0, 0, 10); // render over text //Background - /*? if >1.20.3 { */ + /*? if >1.20.3 {*/ graphics.blitSprite(COLOR_PICKER_LOCATION, colorPickerDim.x() - 5, colorPickerDim.y() - 5, 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); + /*?} 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 @@ -99,10 +99,10 @@ public class ColorPickerWidget extends ControllerPopupWidget<ColorController> { 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 { */ + /*? if >1.20.3 {*/ graphics.blitSprite(TRANSPARENT_TEXTURE_LOCATION, previewColorDim.x(), previewColorDim.y(), previewColorDim.width(), previewColorDim.height()); - /*? } else {*//* - graphics.blitRepeating(COLOR_PICKER_ATLAS, previewColorDim.x(), previewColorDim.y(), previewColorDim.width(), previewColorDim.height(), 236, 0, 8, 8); + /*?} else {*/ + /*graphics.blitRepeating(COLOR_PICKER_ATLAS, previewColorDim.x(), previewColorDim.y(), previewColorDim.width(), previewColorDim.height(), 236, 0, 8, 8); *//*?}*/ } //main color preview @@ -134,10 +134,10 @@ public class ColorPickerWidget extends ControllerPopupWidget<ColorController> { //outline graphics.fill(alphaGradientDim.x() - outline, alphaGradientDim.y() - outline, alphaGradientDim.xLimit() + outline, alphaGradientDim.yLimit() + outline, Color.black.getRGB()); //Transparent texture - /*? if >1.20.3 { */ + /*? if >1.20.3 {*/ graphics.blitSprite(TRANSPARENT_TEXTURE_LOCATION, alphaGradientDim.x(), alphaGradientDim.y(), alphaGradientDim.width(), sliderHeight); - /*? } else {*//* - graphics.blitRepeating(COLOR_PICKER_ATLAS, alphaGradientDim.x(), alphaGradientDim.y(), alphaGradientDim.width(), sliderHeight, 236, 0, 8, 8); + /*?} 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); diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java b/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java index 6252291..f799059 100644 --- a/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java +++ b/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java @@ -63,8 +63,8 @@ public class DropdownWidget<T> extends ControllerPopupWidget<AbstractDropdownCon graphics.blit( /*? if >1.20.4 {*/ Screen.MENU_BACKGROUND, - /*?} else {*//* - Screen.BACKGROUND_LOCATION, + /*?} else {*/ + /*Screen.BACKGROUND_LOCATION, *//*?}*/ dropdownDim.x(), dropdownDim.y(), 0, 0.0f, 0.0f, diff --git a/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java b/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java index b8293fb..aadc249 100644 --- a/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java +++ b/src/main/java/dev/isxander/yacl3/gui/utils/YACLRenderHelper.java @@ -13,15 +13,15 @@ public class YACLRenderHelper { YACLPlatform.mcRl("widget/button_highlighted"), // !disabled & focused YACLPlatform.mcRl("widget/slider_highlighted") // disabled & focused ); - /*?} else {*//* - private static final ResourceLocation SLIDER_LOCATION = new ResourceLocation("textures/gui/slider.png"); + /*?} 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; + /*?} else {*/ + /*int textureV; if (enabled) { textureV = focused ? 60 : 40; } else { @@ -36,8 +36,8 @@ public class YACLRenderHelper { public static ResourceLocation getSpriteLocation(String path) { /*? if >1.20.3 {*/ return YACLPlatform.rl(path); - /*? } else {*//* - return YACLPlatform.rl("textures/gui/sprites/" + path + ".png"); + /*?} else {*/ + /*return YACLPlatform.rl("textures/gui/sprites/" + path + ".png"); *//*?}*/ } } |