diff --git a/.github/workflows/format-java.yml b/.github/workflows/format-java.yml
new file mode 100644
index 00000000..3b15c202
--- /dev/null
+++ b/.github/workflows/format-java.yml
@@ -0,0 +1,47 @@
+# Runs formatting requirements
+name: Java Formatting
+
+on:
+ push:
+ branches: ['1.20.1', '1.21.1']
+ paths: ['src/main/java/**', 'src/test/**']
+ pull_request:
+ paths: ['**']
+
+concurrency:
+ group: formatting-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ formatting:
+ name: Formatting
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: read
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0 # do a full checkout instead of a shallow clone of HEAD so spotless's ratchetFrom works
+ - name: Check Path Filter
+ uses: dorny/paths-filter@v3
+ id: filter
+ with:
+ filters: |
+ code:
+ - 'src/main/java/**'
+ - 'src/test/**'
+ - name: Setup Java
+ if: steps.filter.outputs.code == 'true'
+ uses: actions/setup-java@v5
+ with:
+ distribution: 'temurin'
+ java-version: '21'
+ - name: Setup Gradle
+ if: steps.filter.outputs.code == 'true'
+ uses: gradle/actions/setup-gradle@v4
+ with:
+ cache-read-only: true
+ - name: Run Spotless Formatting Check with Gradle
+ if: steps.filter.outputs.code == 'true'
+ run: chmod +x ./gradlew && ./gradlew spotlessCheck --warning-mode all
diff --git a/build.gradle b/build.gradle
index a7075c0f..c1106045 100755
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ plugins {
id 'maven-publish'
alias libs.plugins.modDevGradle
//alias libs.plugins.shadow
- alias libs.plugins.editorconfig
+ alias libs.plugins.spotless
alias libs.plugins.lombok
}
@@ -73,7 +73,7 @@ apply from: "$rootDir/gradle/scripts/repositories.gradle"
apply from: "$rootDir/dependencies.gradle"
apply from: "$rootDir/gradle/scripts/resources.gradle"
apply from: "$rootDir/gradle/scripts/publishing.gradle"
-apply from: "$rootDir/gradle/scripts/formatting.gradle"
+apply from: "$rootDir/gradle/scripts/spotless.gradle"
apply from: "$rootDir/gradle/scripts/docs.gradle"
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 3063e6a7..ba184193 100755
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -4,7 +4,7 @@ minecraft = "1.20.1"
forge = "47.4.28"
parchment = "2023.09.03" # https://parchmentmc.org/docs/getting-started
shadow = "8.3.5"
-editorconfig = "0.1.0"
+spotless = "8.1.0"
modDevGradle = "2.0.86"
lombok = "8.14"
@@ -25,5 +25,5 @@ mcdevAnnotations = { module = "com.demonwav.mcdev:annotations", version.ref = "m
[plugins]
modDevGradle = { id = "net.neoforged.moddev.legacyforge", version.ref = "modDevGradle" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
-editorconfig = { id = "org.ec4j.editorconfig", version.ref = "editorconfig" }
+spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
diff --git a/gradle/scripts/formatting.gradle b/gradle/scripts/formatting.gradle
deleted file mode 100644
index 677adf1c..00000000
--- a/gradle/scripts/formatting.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-// EditorConfig auto-formatter
-// See https://github.com/ec4j/editorconfig-gradle-plugin
-// Can be locally toggled via @formatter:off/@formatter:on comments
-editorconfig {
- includes = ['*']
-}
diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle
new file mode 100644
index 00000000..b082a949
--- /dev/null
+++ b/gradle/scripts/spotless.gradle
@@ -0,0 +1,27 @@
+// Spotless auto-formatter
+// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
+// Can be locally toggled via spotless:off/spotless:on comments
+spotless {
+ encoding 'UTF-8'
+ ratchetFrom 'origin/1.20.1'
+
+ format 'misc', {
+ target '.gitignore'
+
+ trimTrailingWhitespace()
+ leadingTabsToSpaces()
+ endWithNewline()
+ }
+ java {
+ target 'src/main/java/**/*.java', 'src/test/java/**/*.java'
+
+ def orderFile = file("$rootDir/spotless/spotless.importorder")
+ def formatFile = file("$rootDir/spotless/spotless.eclipseformat.xml")
+
+ toggleOffOn()
+ importOrderFile(orderFile)
+ removeUnusedImports('cleanthat-javaparser-unnecessaryimport')
+ endWithNewline()
+ eclipse('4.36').configFile(formatFile)
+ }
+}
diff --git a/spotless/spotless.eclipseformat.xml b/spotless/spotless.eclipseformat.xml
new file mode 100644
index 00000000..8db01de4
--- /dev/null
+++ b/spotless/spotless.eclipseformat.xml
@@ -0,0 +1,400 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spotless/spotless.importorder b/spotless/spotless.importorder
new file mode 100644
index 00000000..5c05beb3
--- /dev/null
+++ b/spotless/spotless.importorder
@@ -0,0 +1,7 @@
+#Organize Import Order
+0=brachy
+1=net
+2=
+3=java
+4=javax
+5=\#
diff --git a/src/main/java/brachy/modularui/ClientProxy.java b/src/main/java/brachy/modularui/ClientProxy.java
index 6d436a98..6198a558 100644
--- a/src/main/java/brachy/modularui/ClientProxy.java
+++ b/src/main/java/brachy/modularui/ClientProxy.java
@@ -22,7 +22,6 @@
import net.minecraft.client.Timer;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
-import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
import net.minecraftforge.client.event.RegisterClientTooltipComponentFactoriesEvent;
import net.minecraftforge.common.MinecraftForge;
@@ -33,6 +32,7 @@
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
+import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import java.util.function.Function;
@@ -73,7 +73,7 @@ protected void onInit(FMLCommonSetupEvent event) {
}
private void onClientStartup(FMLClientSetupEvent event) {
- //noinspection deprecation,RedundantCast
+ // noinspection deprecation,RedundantCast
event.enqueueWork(() -> MenuScreens.register(ModularUIMenuTypes.MODULAR_CONTAINER.get(),
(MenuScreens.ScreenConstructor) ContainerScreenWrapper::new));
}
diff --git a/src/main/java/brachy/modularui/CommonProxy.java b/src/main/java/brachy/modularui/CommonProxy.java
index 5161e2bc..8f73a4b7 100644
--- a/src/main/java/brachy/modularui/CommonProxy.java
+++ b/src/main/java/brachy/modularui/CommonProxy.java
@@ -11,7 +11,6 @@
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
-import com.mojang.brigadier.Command;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
@@ -23,6 +22,8 @@
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
+import com.mojang.brigadier.Command;
+
public class CommonProxy {
CommonProxy(FMLJavaModLoadingContext ctx) {
@@ -74,7 +75,8 @@ private void onRegisterCommand(RegisterCommandsEvent event) {
.executes(ctx -> {
ThemeManager.reload();
// TODO translations for this
- ctx.getSource().sendSuccess(() -> Component.literal("ModularUI Themes reloaded").withStyle(Text.GREEN), true);
+ ctx.getSource().sendSuccess(
+ () -> Component.literal("ModularUI Themes reloaded").withStyle(Text.GREEN), true);
return Command.SINGLE_SUCCESS;
}));
event.getDispatcher().register(command);
diff --git a/src/main/java/brachy/modularui/ModularUI.java b/src/main/java/brachy/modularui/ModularUI.java
index 1a0caaf1..e961bb04 100644
--- a/src/main/java/brachy/modularui/ModularUI.java
+++ b/src/main/java/brachy/modularui/ModularUI.java
@@ -112,7 +112,7 @@ public static boolean isClientThread() {
/**
* @return if the game is the PHYSICAL client, e.g. not a dedicated server.
* @apiNote Do not use this to check if you're currently on the server thread for side-specific actions!
- * It does NOT work for that. Use {@link #isClientThread()} instead.
+ * It does NOT work for that. Use {@link #isClientThread()} instead.
* @see #isClientThread()
*/
public static boolean isClientSide() {
@@ -123,7 +123,7 @@ public static boolean isClientSide() {
* This check isn't the same for client and server!
*
* @return if it's safe to access the current instance {@link net.minecraft.world.level.Level Level} on client or if
- * it's safe to access any level on server.
+ * it's safe to access any level on server.
*/
public static boolean canGetServerLevel() {
if (isClientSide()) {
@@ -174,15 +174,15 @@ private static RegistryAccess getClientRegistries() {
public enum Mods {
- //BLUR(ModIds.BLUR),
- //BOGOSORTER(ModIds.BOGOSORTER),
+ // BLUR(ModIds.BLUR),
+ // BOGOSORTER(ModIds.BOGOSORTER),
CURIOS(ModIds.CURIOS),
EMI(ModIds.EMI),
JEI(ModIds.JEI),
REI(ModIds.REI),
KUBEJS(ModIds.KUBEJS),
- //MODNAMETOOLTIP(ModIds.MODNAMETOOLTIP)
- //NEA(ModIds.NEA),
+ // MODNAMETOOLTIP(ModIds.MODNAMETOOLTIP)
+ // NEA(ModIds.NEA),
EMBEDDIUM(ModIds.EMBEDDIUM),
SODIUM(ModIds.SODIUM),
IRIS(ModIds.IRIS),
diff --git a/src/main/java/brachy/modularui/ModularUIConfig.java b/src/main/java/brachy/modularui/ModularUIConfig.java
index 8a8926f4..29e75365 100644
--- a/src/main/java/brachy/modularui/ModularUIConfig.java
+++ b/src/main/java/brachy/modularui/ModularUIConfig.java
@@ -26,7 +26,8 @@ public class ModularUIConfig {
.translation("config.modularui.defaultScrollSpeed")
.defineInRange("defaultScrollSpeed", 30, 1, 100);
public static final BooleanValue SMOOTH_PROGRESS_BARS = BUILDER
- .comment("If progress bars should step in texture pixels or screen pixels. (Screen pixels are way smaller and therefore smoother)")
+ .comment(
+ "If progress bars should step in texture pixels or screen pixels. (Screen pixels are way smaller and therefore smoother)")
.translation("config.modularui.smoothProgressBars")
.define("smoothProgressBars", false);
public static final IntValue ANIMATION_TIME = BUILDER
@@ -39,7 +40,8 @@ public class ModularUIConfig {
.translation("config.modularui.tooltipPos")
.defineEnum("tooltipPos", RichTooltip.Pos.NEXT_TO_MOUSE);
public static final BooleanValue ESC_RESTORES_LAST_TEXT = BUILDER
- .comment("If true, pressing ESC key in the text field will restore the last text instead of confirming current one.")
+ .comment(
+ "If true, pressing ESC key in the text field will restore the last text instead of confirming current one.")
.translation("config.modularui.escRestoresLastText")
.define("escRestoresLastText", false);
public static final BooleanValue USE_DARK_THEME_BY_DEFAULT = BUILDER
@@ -49,12 +51,12 @@ public class ModularUIConfig {
public static final BooleanValue ENABLE_TEST_GUIS = BUILDER
.comment("Enables a test block, test item with a test gui and opening a gui by right clicking a diamond.")
.translation("config.modularui.enableTestGuis")
- .worldRestart() //.gameRestart()
+ .worldRestart() // .gameRestart()
.define("enableTestGuis", ModularUI.isDev());
public static final BooleanValue ENABLE_TEST_OVERLAYS = BUILDER
.comment("Enables a test overlay shown on title screen and watermark shown on every GuiContainer.")
.translation("config.modularui.enableTestOverlays")
- .worldRestart() //.gameRestart()
+ .worldRestart() // .gameRestart()
.define("enableTestOverlays", false);
public static final BooleanValue REPLACE_VANILLA_TOOLTIPS = BUILDER
.comment("If true, vanilla tooltip will be replaced with MUI's RichTooltip")
diff --git a/src/main/java/brachy/modularui/ModularUIMenuTypes.java b/src/main/java/brachy/modularui/ModularUIMenuTypes.java
index 7064700d..ee441676 100644
--- a/src/main/java/brachy/modularui/ModularUIMenuTypes.java
+++ b/src/main/java/brachy/modularui/ModularUIMenuTypes.java
@@ -11,9 +11,11 @@
public class ModularUIMenuTypes {
- private static final DeferredRegister> MENU_TYPES = DeferredRegister.create(Registries.MENU, ModularUI.MOD_ID);
+ private static final DeferredRegister> MENU_TYPES = DeferredRegister.create(Registries.MENU,
+ ModularUI.MOD_ID);
- public static final RegistryObject> MODULAR_CONTAINER = MENU_TYPES.register("modular",
+ public static final RegistryObject> MODULAR_CONTAINER = MENU_TYPES.register(
+ "modular",
() -> IForgeMenuType.create(ModularContainerMenu::new));
public static void register(IEventBus modBus) {
diff --git a/src/main/java/brachy/modularui/api/ITheme.java b/src/main/java/brachy/modularui/api/ITheme.java
index 60059cbf..4d38ad15 100644
--- a/src/main/java/brachy/modularui/api/ITheme.java
+++ b/src/main/java/brachy/modularui/api/ITheme.java
@@ -11,12 +11,8 @@
import com.mojang.serialization.DataResult;
import com.mojang.serialization.DynamicOps;
import com.mojang.serialization.Encoder;
-
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
-
-import net.minecraft.util.ExtraCodecs;
-
import org.jetbrains.annotations.UnmodifiableView;
import java.util.Collection;
@@ -39,6 +35,7 @@ public interface ITheme {
ITheme::getId);
Encoder ENCODER = new Encoder<>() {
+
@Override
public DataResult encode(ITheme input, DynamicOps ops, T prefix) {
var mapBuilder = ops.mapBuilder();
@@ -49,7 +46,8 @@ public DataResult encode(ITheme input, DynamicOps ops, T prefix) {
for (WidgetThemeEntry> entry : input.getWidgetThemeEntries()) {
if (entry.key() == IThemeApi.FALLBACK) continue;
var set = encodedThemes.computeIfAbsent(entry.key().getName(), k -> new ObjectOpenHashSet<>());
- if (entry.key().isSubWidgetTheme() && set.contains(entry.theme()) && set.contains(entry.hoverTheme())) continue;
+ if (entry.key().isSubWidgetTheme() && set.contains(entry.theme()) && set.contains(entry.hoverTheme()))
+ continue;
entry.encode(ops, mapBuilder, false);
set.add(entry.theme());
set.add(entry.hoverTheme());
diff --git a/src/main/java/brachy/modularui/api/IThemeApi.java b/src/main/java/brachy/modularui/api/IThemeApi.java
index 924725bc..115590c4 100644
--- a/src/main/java/brachy/modularui/api/IThemeApi.java
+++ b/src/main/java/brachy/modularui/api/IThemeApi.java
@@ -19,7 +19,6 @@
import brachy.modularui.utils.serialization.json.JsonBuilder;
import com.mojang.serialization.Codec;
-
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
@@ -105,7 +104,8 @@ public interface IThemeApi {
.register();
WidgetThemeKey TOGGLE_BUTTON = get().widgetThemeKeyBuilder("toggleButton", SelectableTheme.class)
- .defaultTheme(SelectableTheme.whiteTextShadow(18, 18, GuiTextures.MC_BUTTON, GuiTextures.MC_BUTTON_DISABLED))
+ .defaultTheme(
+ SelectableTheme.whiteTextShadow(18, 18, GuiTextures.MC_BUTTON, GuiTextures.MC_BUTTON_DISABLED))
.defaultHoverTheme(SelectableTheme.whiteTextShadow(18, 18, GuiTextures.MC_BUTTON_HOVERED, IDrawable.NONE))
.fieldsOf(FALLBACK)
.field(SELECTED_BACKGROUND, IDrawable.class, IDrawable.CODEC, SelectableTheme::getSelectedBackground)
@@ -124,7 +124,6 @@ public interface IThemeApi {
String HOVER_SUFFIX = ":hover";
-
/**
* @return the default api implementation
*/
@@ -188,7 +187,8 @@ default void registerTheme(ThemeBuilder> themeBuilder) {
* @param defaultTheme default theme if no theme was found
* @return the registered theme for the given screen or the given default theme or {@link #getDefaultTheme()}
*/
- default ITheme getThemeForScreen(String owner, String name, @Nullable String defaultTheme, @Nullable String fallbackTheme) {
+ default ITheme getThemeForScreen(String owner, String name, @Nullable String defaultTheme,
+ @Nullable String fallbackTheme) {
return getThemeForScreen(owner, name, null, defaultTheme, fallbackTheme);
}
@@ -201,7 +201,8 @@ default ITheme getThemeForScreen(String owner, String name, @Nullable String def
* @param defaultTheme default theme if no theme was found
* @return the registered theme for the given screen or the given default theme or {@link #getDefaultTheme()}
*/
- ITheme getThemeForScreen(String owner, String name, @Nullable String panel, @Nullable String defaultTheme, @Nullable String fallbackTheme);
+ ITheme getThemeForScreen(String owner, String name, @Nullable String panel, @Nullable String defaultTheme,
+ @Nullable String fallbackTheme);
/**
* Gets the appropriate theme for a specific panel.
@@ -212,7 +213,8 @@ default ITheme getThemeForScreen(String owner, String name, @Nullable String def
*/
default ITheme getThemeForScreen(ModularPanel> panel, @Nullable String defaultTheme) {
ModularScreen screen = panel.getScreen();
- return getThemeForScreen(screen.getOwner(), screen.getName(), panel.getName(), defaultTheme, screen.getThemeOverride());
+ return getThemeForScreen(screen.getOwner(), screen.getName(), panel.getName(), defaultTheme,
+ screen.getThemeOverride());
}
/**
@@ -247,7 +249,8 @@ default void registerThemeForScreen(String owner, String name, String theme) {
@Deprecated
WidgetThemeKey registerWidgetTheme(String id, T defaultTheme, T defaultHoverTheme,
- WidgetThemeMerger merger, WidgetThemeCodec codec);
+ WidgetThemeMerger merger,
+ WidgetThemeCodec codec);
default WidgetThemeKeyBuilder widgetThemeKeyBuilder(String id, Class type) {
return new WidgetThemeKeyBuilder<>(id, type);
diff --git a/src/main/java/brachy/modularui/api/drawable/IDrawable.java b/src/main/java/brachy/modularui/api/drawable/IDrawable.java
index eba02dd1..2406237b 100644
--- a/src/main/java/brachy/modularui/api/drawable/IDrawable.java
+++ b/src/main/java/brachy/modularui/api/drawable/IDrawable.java
@@ -14,14 +14,14 @@
import brachy.modularui.widget.Widget;
import brachy.modularui.widget.sizer.Area;
-import com.mojang.serialization.Codec;
-import com.mojang.serialization.DataResult;
-import com.mojang.serialization.JsonOps;
-import com.mojang.serialization.MapCodec;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import com.google.gson.JsonElement;
+import com.mojang.serialization.Codec;
+import com.mojang.serialization.DataResult;
+import com.mojang.serialization.JsonOps;
+import com.mojang.serialization.MapCodec;
import org.jetbrains.annotations.Nullable;
/**
@@ -45,6 +45,7 @@ static IDrawable of(IDrawable... drawables) {
* An empty drawable. Does nothing.
*/
IDrawable EMPTY = new IDrawable() {
+
@Override
public void draw(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme) {}
@@ -58,6 +59,7 @@ public String toString() {
* An empty drawable used to mark hover textures as "should not be used"!
*/
IDrawable NONE = new IDrawable() {
+
@Override
public void draw(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme) {}
@@ -68,7 +70,8 @@ public String toString() {
};
CodecRegistry CODECS = new CodecRegistry<>();
- MapCodec CODEC_DISPATCH = CodecUtil.dispatchNullable(Codec.STRING, IDrawable::getTypeName, CODECS::getNullableCodec);
+ MapCodec CODEC_DISPATCH = CodecUtil.dispatchNullable(Codec.STRING, IDrawable::getTypeName,
+ CODECS::getNullableCodec);
Codec CODEC_EMPTY_NONE = Codec.STRING.flatXmap(s -> {
if (s == null || s.equals("empty") || s.equals("null")) return DataResult.success(EMPTY);
if (s.equals("none")) return DataResult.success(NONE);
@@ -168,7 +171,8 @@ default void drawAtZero(GuiContext context, Area area, WidgetTheme widgetTheme)
*/
@OnlyIn(Dist.CLIENT)
default void drawAtZeroPadded(GuiContext context, Area area, WidgetTheme widgetTheme) {
- draw(context, area.getPadding().left(), area.getPadding().top(), area.paddedWidth(), area.paddedHeight(), widgetTheme);
+ draw(context, area.getPadding().left(), area.getPadding().top(), area.paddedWidth(), area.paddedHeight(),
+ widgetTheme);
}
/**
diff --git a/src/main/java/brachy/modularui/api/drawable/IRichTextBuilder.java b/src/main/java/brachy/modularui/api/drawable/IRichTextBuilder.java
index a1f39740..d8ac7303 100644
--- a/src/main/java/brachy/modularui/api/drawable/IRichTextBuilder.java
+++ b/src/main/java/brachy/modularui/api/drawable/IRichTextBuilder.java
@@ -94,12 +94,14 @@ default T addDrawableLine(IDrawable line) {
* @param lang lang key of the multilang to add.
* @return this
*/
- /*TODO default T addMultiLine(String lang) {
- for (MutableComponent text : LangHandler.getMultiLang(lang)) {
- getRichText().addLine(text);
- }
- return getThis();
- }*/
+ /*
+ * TODO default T addMultiLine(String lang) {
+ * for (MutableComponent text : LangHandler.getMultiLang(lang)) {
+ * getRichText().addLine(text);
+ * }
+ * return getThis();
+ * }
+ */
/**
* Starts a new line. This is always preferred over {@code "\n"} or {@code IKey.str("\n")}, it reduces computation a
diff --git a/src/main/java/brachy/modularui/api/drawable/ITextLine.java b/src/main/java/brachy/modularui/api/drawable/ITextLine.java
index b5621525..e0601e66 100644
--- a/src/main/java/brachy/modularui/api/drawable/ITextLine.java
+++ b/src/main/java/brachy/modularui/api/drawable/ITextLine.java
@@ -10,7 +10,8 @@ public interface ITextLine {
int getHeight(Font font);
- void draw(GuiContext context, Font font, float x, float y, int color, boolean shadow, int availableWidth, int availableHeight);
+ void draw(GuiContext context, Font font, float x, float y, int color, boolean shadow, int availableWidth,
+ int availableHeight);
Object getHoveringElement(Font font, int x, int y);
}
diff --git a/src/main/java/brachy/modularui/api/drawable/Text.java b/src/main/java/brachy/modularui/api/drawable/Text.java
index 7c532ea9..8e79e7f9 100644
--- a/src/main/java/brachy/modularui/api/drawable/Text.java
+++ b/src/main/java/brachy/modularui/api/drawable/Text.java
@@ -10,8 +10,6 @@
import brachy.modularui.utils.Alignment;
import brachy.modularui.utils.serialization.codec.MutableObjectCodec;
-import com.demonwav.mcdev.annotations.Translatable;
-
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
@@ -19,6 +17,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
+import com.demonwav.mcdev.annotations.Translatable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -157,7 +156,8 @@ default void draw(GuiContext context, int x, int y, int width, int height, Widge
}
@OnlyIn(Dist.CLIENT)
- default void drawAligned(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme, Alignment alignment) {
+ default void drawAligned(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme,
+ Alignment alignment) {
renderer.setColor(widgetTheme.getTextColor());
renderer.setShadow(widgetTheme.isTextShadow());
renderer.setAlignment(alignment, width, height);
@@ -201,9 +201,11 @@ default float getScale() {
ModularComponent withStyle();
- /*default AnimatedText withAnimation() {
- return new AnimatedText(this);
- }*/
+ /*
+ * default AnimatedText withAnimation() {
+ * return new AnimatedText(this);
+ * }
+ */
/**
* Set text formatting to this key. If {@link Text#RESET} is used, then that's applied first and then all other
diff --git a/src/main/java/brachy/modularui/api/layout/IViewportStack.java b/src/main/java/brachy/modularui/api/layout/IViewportStack.java
index cb7e6856..7662b632 100755
--- a/src/main/java/brachy/modularui/api/layout/IViewportStack.java
+++ b/src/main/java/brachy/modularui/api/layout/IViewportStack.java
@@ -4,7 +4,6 @@
import brachy.modularui.widget.sizer.Area;
import com.mojang.blaze3d.vertex.PoseStack;
-
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
diff --git a/src/main/java/brachy/modularui/api/value/IValue.java b/src/main/java/brachy/modularui/api/value/IValue.java
index 7e2d7a36..bdf9456d 100644
--- a/src/main/java/brachy/modularui/api/value/IValue.java
+++ b/src/main/java/brachy/modularui/api/value/IValue.java
@@ -1,6 +1,5 @@
package brachy.modularui.api.value;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.UnknownNullability;
/**
diff --git a/src/main/java/brachy/modularui/api/widget/IDraggable.java b/src/main/java/brachy/modularui/api/widget/IDraggable.java
index 252f36e0..2fd7500e 100644
--- a/src/main/java/brachy/modularui/api/widget/IDraggable.java
+++ b/src/main/java/brachy/modularui/api/widget/IDraggable.java
@@ -21,7 +21,8 @@ public interface IDraggable {
/**
* Gets called every frame after everything else is rendered.
* Is only called when {@link #isMoving()} is true.
- * Translate to the mouse pos and draw with {@link WidgetTree#drawTree(IWidget, ModularGuiContext, boolean, boolean)}.
+ * Translate to the mouse pos and draw with
+ * {@link WidgetTree#drawTree(IWidget, ModularGuiContext, boolean, boolean)}.
*
* @param graphics
* @param partialTicks difference from last from
diff --git a/src/main/java/brachy/modularui/api/widget/IPositioned.java b/src/main/java/brachy/modularui/api/widget/IPositioned.java
index 9f65c924..b37ea882 100644
--- a/src/main/java/brachy/modularui/api/widget/IPositioned.java
+++ b/src/main/java/brachy/modularui/api/widget/IPositioned.java
@@ -15,7 +15,7 @@
*
* @param widget type
*/
-@SuppressWarnings({"unused", "UnusedReturnValue"})
+@SuppressWarnings({ "unused", "UnusedReturnValue" })
public interface IPositioned> {
/**
@@ -62,8 +62,10 @@ default W coverChildrenHeight() {
}
/**
- * Calculate the width by covering all children of this widget. For this calculation the widget children are used NOT the resizer
- * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this widgets size
+ * Calculate the width by covering all children of this widget. For this calculation the widget children are used
+ * NOT the resizer
+ * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this
+ * widgets size
* is calculated. If all children depend on this widgets size, the min size is used.
*
* @param minWidth minimum width this widget can have, negative values disables cover children
@@ -75,8 +77,10 @@ default W coverChildrenWidth(int minWidth) {
}
/**
- * Calculate the height by covering all children of this widget. For this calculation the widget children are used NOT the resizer
- * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this widgets size
+ * Calculate the height by covering all children of this widget. For this calculation the widget children are used
+ * NOT the resizer
+ * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this
+ * widgets size
* is calculated. If all children depend on this widgets size, the min size is used.
*
* @param minHeight minimum height this widget can have, negative values disables cover children
@@ -97,8 +101,10 @@ default W coverChildren() {
}
/**
- * Calculate the width and height by covering all children of this widget. For this calculation the widget children are used NOT the resizer
- * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this widgets size
+ * Calculate the width and height by covering all children of this widget. For this calculation the widget children
+ * are used NOT the resizer
+ * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this
+ * widgets size
* is calculated. If all children depend on this widgets size, the min size is used.
*
* @param minSize minimum width and height this widget can have, negative values disables cover children
@@ -109,8 +115,10 @@ default W coverChildren(int minSize) {
}
/**
- * Calculate the width and height by covering all children of this widget. For this calculation the widget children are used NOT the resizer
- * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this widgets size
+ * Calculate the width and height by covering all children of this widget. For this calculation the widget children
+ * are used NOT the resizer
+ * children. If a child position/size depends on this widget, its position/size is ignored and calculated after this
+ * widgets size
* is calculated. If all children depend on this widgets size, the min size is used.
*
* @param minWidth minimum width this widget can have, negative values disables cover children
@@ -149,7 +157,8 @@ default W disableCoverChildren() {
}
/**
- * Sets if this resizer is decoration. Decoration will be ignored during coverChildren and margin/padding calculations.
+ * Sets if this resizer is decoration. Decoration will be ignored during coverChildren and margin/padding
+ * calculations.
*
* @param decoration true if this resizer is decoration
* @return this
@@ -167,7 +176,8 @@ default W decoration() {
}
/**
- * Sets whether this widget should expand inside a {@link brachy.modularui.widgets.layout.Flow Flow} widget. Expanded means it takes
+ * Sets whether this widget should expand inside a {@link brachy.modularui.widgets.layout.Flow Flow} widget.
+ * Expanded means it takes
* as much space as possible on the main axis without overlapping with other children in the flow.
*
* @return this
@@ -190,8 +200,10 @@ default W relative(Area area) {
}
/**
- * Sets the resizer this widget should be relative to. That means all left, top, right, bottom, width and height properties will be
- * calculated based of the new resizer. By default, this is the widgets parent. Every resize node tree configuration is allowed as long
+ * Sets the resizer this widget should be relative to. That means all left, top, right, bottom, width and height
+ * properties will be
+ * calculated based of the new resizer. By default, this is the widgets parent. Every resize node tree configuration
+ * is allowed as long
* as there are no circular dependencies.
*
* @param resizeNode resizer parent override
@@ -239,7 +251,8 @@ default W left(int val) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0).
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0).
* 0.0 means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
*
* @param val relative left edge to parent left edge distance
@@ -251,9 +264,12 @@ default W leftRel(float val) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an offset.
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative left edge to parent left edge distance
* @param offset additional distance offset in pixel
@@ -265,14 +281,18 @@ default W leftRelOffset(float val, int offset) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an anchor.
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative left edge to parent left edge distance
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W leftRelAnchor(float val, float anchor) {
@@ -281,17 +301,22 @@ default W leftRelAnchor(float val, float anchor) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative left edge to parent left edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W leftRel(float val, int offset, float anchor) {
@@ -300,18 +325,24 @@ default W leftRel(float val, int offset, float anchor) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val left edge to parent left edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
- * @param measure determines if the val param should be a relative value or in pixel, the anchor does nothing in pixel
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
+ * @param measure determines if the val param should be a relative value or in pixel, the anchor does
+ * nothing in pixel
* @return this
*/
default W left(float val, int offset, float anchor, Unit.Measure measure) {
@@ -332,9 +363,12 @@ default W left(DoubleSupplier val, Unit.Measure measure) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an offset.
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative left edge to parent left edge distance function which is called on every resize
* @param offset additional distance offset in pixel
@@ -346,14 +380,18 @@ default W leftRelOffset(DoubleSupplier val, int offset) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an anchor.
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative left edge to parent left edge distance function which is called on every resize
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W leftRelAnchor(DoubleSupplier val, float anchor) {
@@ -362,17 +400,22 @@ default W leftRelAnchor(DoubleSupplier val, float anchor) {
}
/**
- * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets left edge to the resizers widget left edge (usually between 0.0 and
+ * 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the parent right edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the right edge touches the
+ * parent right edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative left edge to parent left edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W leftRel(DoubleSupplier val, int offset, float anchor) {
@@ -392,7 +435,8 @@ default W right(int val) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0).
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0).
* 0.0 means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
*
* @param val relative right edge to parent right edge distance
@@ -404,9 +448,12 @@ default W rightRel(float val) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an offset.
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative right edge to parent right edge distance
* @param offset additional distance offset in pixel
@@ -418,14 +465,18 @@ default W rightRelOffset(float val, int offset) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an anchor.
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative right edge to parent right edge distance
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W rightRelAnchor(float val, float anchor) {
@@ -434,17 +485,22 @@ default W rightRelAnchor(float val, float anchor) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative right edge to parent right edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W rightRel(float val, int offset, float anchor) {
@@ -453,18 +509,24 @@ default W rightRel(float val, int offset, float anchor) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val right edge to parent right edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
- * @param measure determines if the val param should be a relative value or in pixel, the anchor does nothing in pixel
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
+ * @param measure determines if the val param should be a relative value or in pixel, the anchor does
+ * nothing in pixel
* @return this
*/
default W right(float val, int offset, float anchor, Unit.Measure measure) {
@@ -485,9 +547,12 @@ default W right(DoubleSupplier val, Unit.Measure measure) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an offset.
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative right edge to parent right edge distance function which is called on every resize
* @param offset additional distance offset in pixel
@@ -499,14 +564,18 @@ default W rightRelOffset(DoubleSupplier val, int offset) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an anchor.
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative right edge to parent right edge distance function which is called on every resize
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W rightRelAnchor(DoubleSupplier val, float anchor) {
@@ -515,17 +584,22 @@ default W rightRelAnchor(DoubleSupplier val, float anchor) {
}
/**
- * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets right edge to the resizers widget right edge (usually between 0.0
+ * and 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches the parent left edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the right edge touches the parent right edge. 1.0 means the left edge touches
+ * the parent left edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative right edge to parent right edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W rightRel(DoubleSupplier val, int offset, float anchor) {
@@ -545,7 +619,8 @@ default W top(int val) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0).
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0).
* 0.0 means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
*
* @param val relative top edge to parent top edge distance
@@ -557,9 +632,12 @@ default W topRel(float val) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an offset.
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative top edge to parent top edge distance
* @param offset additional distance offset in pixel
@@ -571,14 +649,18 @@ default W topRelOffset(float val, int offset) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an anchor.
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative top edge to parent top edge distance
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W topRelAnchor(float val, float anchor) {
@@ -587,17 +669,22 @@ default W topRelAnchor(float val, float anchor) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative top edge to parent top edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W topRel(float val, int offset, float anchor) {
@@ -606,18 +693,24 @@ default W topRel(float val, int offset, float anchor) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val top edge to parent top edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
- * @param measure determines if the val param should be a relative value or in pixel, the anchor does nothing in pixel
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
+ * @param measure determines if the val param should be a relative value or in pixel, the anchor does
+ * nothing in pixel
* @return this
*/
default W top(float val, int offset, float anchor, Unit.Measure measure) {
@@ -638,9 +731,12 @@ default W top(DoubleSupplier val, Unit.Measure measure) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an offset.
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative top edge to parent top edge distance function which is called on every resize
* @param offset additional distance offset in pixel
@@ -652,14 +748,18 @@ default W topRelOffset(DoubleSupplier val, int offset) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an anchor.
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative top edge to parent top edge distance function which is called on every resize
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W topRelAnchor(DoubleSupplier val, float anchor) {
@@ -668,17 +768,22 @@ default W topRelAnchor(DoubleSupplier val, float anchor) {
}
/**
- * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets top edge to the resizers widget top edge (usually between 0.0 and
+ * 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the parent bottom edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the top edge touches the parent top edge. 1.0 means the bottom edge touches the
+ * parent bottom edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative top edge to parent top edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W topRel(DoubleSupplier val, int offset, float anchor) {
@@ -698,7 +803,8 @@ default W bottom(int val) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0).
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0).
* 0.0 means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches the parent top edge.
*
* @param val relative bottom edge to parent bottom edge distance
@@ -710,9 +816,12 @@ default W bottomRel(float val) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches the parent top edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an offset.
+ * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches
+ * the parent top edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative bottom edge to parent bottom edge distance
* @param offset additional distance offset in pixel
@@ -724,14 +833,18 @@ default W bottomRelOffset(float val, int offset) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches the parent top edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an anchor.
+ * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches
+ * the parent top edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative bottom edge to parent bottom edge distance
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W bottomRelAnchor(float val, float anchor) {
@@ -740,17 +853,22 @@ default W bottomRelAnchor(float val, float anchor) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches the parent top edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches
+ * the parent top edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative bottom edge to parent bottom edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W bottomRel(float val, int offset, float anchor) {
@@ -759,18 +877,24 @@ default W bottomRel(float val, int offset, float anchor) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches the parent top edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches
+ * the parent top edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val bottom edge to parent bottom edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
- * @param measure determines if the val param should be a relative value or in pixel, the anchor does nothing in pixel
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
+ * @param measure determines if the val param should be a relative value or in pixel, the anchor does
+ * nothing in pixel
* @return this
*/
default W bottom(float val, int offset, float anchor, Unit.Measure measure) {
@@ -779,7 +903,8 @@ default W bottom(float val, int offset, float anchor, Unit.Measure measure) {
}
/**
- * Sets the distance from this widgets bottom edge to the resizers widget bottom edge in pixel or as a relative value.
+ * Sets the distance from this widgets bottom edge to the resizers widget bottom edge in pixel or as a relative
+ * value.
*
* @param val bottom edge to parent bottom edge distance function which is called on every resize
* @param measure determines if the val param should be a relative value or in pixel
@@ -791,9 +916,12 @@ default W bottom(DoubleSupplier val, Unit.Measure measure) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an offset.
- * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the top edge touches the parent top edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an offset.
+ * 0.0 for the relative value means the left edge touches the parent left edge. 1.0 means the top edge touches the
+ * parent top edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative bottom edge to parent bottom edge distance function which is called on every resize
* @param offset additional distance offset in pixel
@@ -805,14 +933,18 @@ default W bottomRelOffset(DoubleSupplier val, int offset) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an anchor.
- * 0.0 for the relative value means the bottom edge touches the parent left bottom. 1.0 means the top edge touches the parent top edge.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an anchor.
+ * 0.0 for the relative value means the bottom edge touches the parent left bottom. 1.0 means the top edge touches
+ * the parent top edge.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative bottom edge to parent bottom edge distance function which is called on every resize
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W bottomRelAnchor(DoubleSupplier val, float anchor) {
@@ -821,17 +953,22 @@ default W bottomRelAnchor(DoubleSupplier val, float anchor) {
}
/**
- * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0 and 1.0) with an offset
+ * Sets the relative distance from this widgets bottom edge to the resizers widget bottom edge (usually between 0.0
+ * and 1.0) with an offset
* and an anchor.
- * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches the parent top edge.
- * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be negative.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget. By default,
+ * 0.0 for the relative value means the bottom edge touches the parent bottom edge. 1.0 means the top edge touches
+ * the parent top edge.
+ * The offset is in pixel and is added after the position with the relative value is calculated. The offset can be
+ * negative.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget. By default,
* the anchor is equal to the relative value. The formular for calculating the position is
* parentSize * relativeValue - selfSize * anchor.
*
* @param val relative bottom edge to parent bottom edge distance
* @param offset additional distance offset in pixel
- * @param anchor determines the relative position which is used to calculate the actual position with the relative value
+ * @param anchor determines the relative position which is used to calculate the actual position with the relative
+ * value
* @return this
*/
default W bottomRel(DoubleSupplier val, int offset, float anchor) {
@@ -863,7 +1000,8 @@ default W widthRel(float val) {
/**
* Sets the relative width of this widget with an offset. 1.0 is the same size as the resizer parent.
- * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be negative.
+ * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative width
* @param offset additional size offset in pixel
@@ -888,7 +1026,8 @@ default W width(float val, Unit.Measure measure) {
/**
* Sets the width of this widget in pixel or as a relative value with an offset.
- * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be negative.
+ * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative width function which is called on every resize
* @param offset additional size offset in pixel
@@ -947,7 +1086,8 @@ default W height(float val, Unit.Measure measure) {
/**
* Sets the relative height of this widget with an offset. 1.0 is the same size as the resizer parent.
- * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be negative.
+ * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative height
* @param offset additional size offset in pixel
@@ -960,7 +1100,8 @@ default W heightRelOffset(float val, int offset) {
/**
* Sets the width of this widget in pixel or as a relative value with an offset.
- * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be negative.
+ * The offset is in pixel and is added after the size with the relative value is calculated. The offset can be
+ * negative.
*
* @param val relative width function which is called on every resize
* @param offset additional size offset in pixel
@@ -1008,7 +1149,8 @@ default W posRel(float x, float y) {
}
/**
- * Sets the relative position with an {@link Alignment}. Combines {@link #leftRel(float)} and {@link #topRel(float)}.
+ * Sets the relative position with an {@link Alignment}. Combines {@link #leftRel(float)} and
+ * {@link #topRel(float)}.
*
* @param alignment relative position
* @return this
@@ -1031,7 +1173,8 @@ default W size(int w, int h) {
}
/**
- * Sets the relative width and height of this widget. Combines {@link #widthRel(float)} and {@link #heightRel(float)}.
+ * Sets the relative width and height of this widget. Combines {@link #widthRel(float)} and
+ * {@link #heightRel(float)}.
*
* @param w relative width
* @param h relative height
@@ -1053,7 +1196,8 @@ default W size(int val) {
}
/**
- * Sets the relative width and height of this widget. Combines {@link #widthRel(float)} and {@link #heightRel(float)}.
+ * Sets the relative width and height of this widget. Combines {@link #widthRel(float)} and
+ * {@link #heightRel(float)}.
*
* @param val relative width and height
* @return this
@@ -1091,7 +1235,8 @@ default W full() {
/**
* Sets the anchor on the left side of the widget.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget.
*
* @param val anchor on the left side
* @return this
@@ -1103,7 +1248,8 @@ default W anchorLeft(float val) {
/**
* Sets the anchor on the right side of the widget.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget.
*
* @param val anchor on the right side
* @return this
@@ -1115,7 +1261,8 @@ default W anchorRight(float val) {
/**
* Sets the anchor on the top side of the widget.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget.
*
* @param val anchor on the top side
* @return this
@@ -1127,7 +1274,8 @@ default W anchorTop(float val) {
/**
* Sets the anchor on the bottom side of the widget.
- * The anchor determines what relative position inside this widget is used to calculate the relative position of the widget.
+ * The anchor determines what relative position inside this widget is used to calculate the relative position of the
+ * widget.
*
* @param val anchor on the bottom side
* @return this
diff --git a/src/main/java/brachy/modularui/api/widget/IWidget.java b/src/main/java/brachy/modularui/api/widget/IWidget.java
index a5e9a204..dd0690a7 100644
--- a/src/main/java/brachy/modularui/api/widget/IWidget.java
+++ b/src/main/java/brachy/modularui/api/widget/IWidget.java
@@ -14,9 +14,8 @@
import brachy.modularui.widget.sizer.Area;
import brachy.modularui.widget.sizer.StandardResizer;
-import com.mojang.serialization.Codec;
-
import com.google.common.base.CharMatcher;
+import com.mojang.serialization.Codec;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -74,7 +73,8 @@ default boolean hasParent() {
/**
* @return the panel this widget is in
*/
- @NotNull ModularPanel> getPanel();
+ @NotNull
+ ModularPanel> getPanel();
/**
* @return the area this widget occupies
@@ -297,6 +297,7 @@ default WidgetThemeEntry> getWidgetThemeEntry(ITheme theme) {
/**
* Gets the theme that is currently in use for this widget.
+ *
* @return The gui theme.
*/
ITheme getTheme();
diff --git a/src/main/java/brachy/modularui/api/widget/Interactable.java b/src/main/java/brachy/modularui/api/widget/Interactable.java
index 5618137c..39a89df0 100755
--- a/src/main/java/brachy/modularui/api/widget/Interactable.java
+++ b/src/main/java/brachy/modularui/api/widget/Interactable.java
@@ -4,10 +4,10 @@
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
import net.minecraft.sounds.SoundEvents;
-import com.mojang.blaze3d.platform.InputConstants;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
+import com.mojang.blaze3d.platform.InputConstants;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW;
@@ -22,8 +22,8 @@ public interface Interactable {
*
* @param button mouse button that was pressed.
* @return result that determines what happens to other widgets
- * {@link #onMouseTapped(int)} is only called if this returns {@link Result#ACCEPT} or
- * {@link Result#SUCCESS}
+ * {@link #onMouseTapped(int)} is only called if this returns {@link Result#ACCEPT} or
+ * {@link Result#SUCCESS}
*/
@NotNull
default Result onMousePressed(int button) {
@@ -35,7 +35,7 @@ default Result onMousePressed(int button) {
*
* @param button mouse button that was released.
* @return whether other widgets should get called to. If this returns false,
- * {@link #onMouseTapped(int)} will NOT be called.
+ * {@link #onMouseTapped(int)} will NOT be called.
*/
default boolean onMouseReleased(int button) {
return false;
@@ -46,9 +46,9 @@ default boolean onMouseReleased(int button) {
*
* @param button mouse button that was pressed.
* @return result that determines if other widgets should get tapped to
- * {@link Result#IGNORE IGNORE} and {@link Result#ACCEPT ACCEPT} will both "ignore" the result and
- * {@link Result#STOP STOP} and {@link Result#SUCCESS SUCCESS} will both stop other widgets
- * from getting tapped.
+ * {@link Result#IGNORE IGNORE} and {@link Result#ACCEPT ACCEPT} will both "ignore" the result and
+ * {@link Result#STOP STOP} and {@link Result#SUCCESS SUCCESS} will both stop other widgets
+ * from getting tapped.
*/
@NotNull
default Result onMouseTapped(int button) {
@@ -62,8 +62,8 @@ default Result onMouseTapped(int button) {
* @param scanCode character that was pressed.
* @param modifiers any modifiers that were used.
* @return result that determines what happens to other widgets
- * {@link #onKeyTapped(int, int, int)} is only called if this returns {@link Result#ACCEPT} or
- * {@link Result#SUCCESS}
+ * {@link #onKeyTapped(int, int, int)} is only called if this returns {@link Result#ACCEPT} or
+ * {@link Result#SUCCESS}
*/
@NotNull
default Result onKeyPressed(int keyCode, int scanCode, int modifiers) {
@@ -77,7 +77,7 @@ default Result onKeyPressed(int keyCode, int scanCode, int modifiers) {
* @param scanCode character that was pressed.
* @param modifiers any modifiers that were used.
* @return whether other widgets should get called too. If this returns false, {@link #onKeyTapped(int, int, int)}
- * will NOT be called.
+ * will NOT be called.
*/
default boolean onKeyReleased(int keyCode, int scanCode, int modifiers) {
return false;
@@ -90,8 +90,8 @@ default boolean onKeyReleased(int keyCode, int scanCode, int modifiers) {
* @param scanCode character that was pressed.
* @param modifiers any modifiers that were used.
* @return result that determines if other widgets should get tapped to
- * {@link Result#IGNORE} and {@link Result#ACCEPT} will both "ignore" the result and {@link Result#STOP} and
- * {@link Result#SUCCESS} will both stop other widgets from getting tapped.
+ * {@link Result#IGNORE} and {@link Result#ACCEPT} will both "ignore" the result and {@link Result#STOP} and
+ * {@link Result#SUCCESS} will both stop other widgets from getting tapped.
*/
@NotNull
default Result onKeyTapped(int keyCode, int scanCode, int modifiers) {
@@ -104,8 +104,8 @@ default Result onKeyTapped(int keyCode, int scanCode, int modifiers) {
* @param codePoint character that was typed
* @param modifiers any modifiers that were used.
* @return result that determines what happens to other widgets
- * {@link #onKeyTapped(int, int, int)} is only called if this returns {@link Result#ACCEPT} or
- * {@link Result#SUCCESS}
+ * {@link #onKeyTapped(int, int, int)} is only called if this returns {@link Result#ACCEPT} or
+ * {@link Result#SUCCESS}
*/
@NotNull
default Result onCharTyped(char codePoint, int modifiers) {
diff --git a/src/main/java/brachy/modularui/core/mixins/client/MinecraftMixin.java b/src/main/java/brachy/modularui/core/mixins/client/MinecraftMixin.java
index 99eeb5f2..0eb0ea30 100755
--- a/src/main/java/brachy/modularui/core/mixins/client/MinecraftMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/client/MinecraftMixin.java
@@ -30,7 +30,8 @@ public class MinecraftMixin {
}
}
- @Inject(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;removed()V"))
+ @Inject(method = "setScreen",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;removed()V"))
public void modularui$trackRealScreenClose(Screen guiScreen, CallbackInfo ci) {
if (guiScreen == null) {
// the ScreenEvent.Closing is also closed when the screen is transitioning to another screen,
diff --git a/src/main/java/brachy/modularui/core/mixins/common/ComponentSerializerMixin.java b/src/main/java/brachy/modularui/core/mixins/common/ComponentSerializerMixin.java
index 7e7fc859..cc73421f 100644
--- a/src/main/java/brachy/modularui/core/mixins/common/ComponentSerializerMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/common/ComponentSerializerMixin.java
@@ -25,10 +25,11 @@
public class ComponentSerializerMixin {
@WrapOperation(
- method = "serialize(Lnet/minecraft/network/chat/Component;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;",
- at = @At(value = "INVOKE",
- target = "Lnet/minecraft/network/chat/Component$Serializer;serialize(Lnet/minecraft/network/chat/Component;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;"))
- public JsonElement serialize(Component.Serializer instance, Component src, Type typeOfSrc, JsonSerializationContext context, Operation original) {
+ method = "serialize(Lnet/minecraft/network/chat/Component;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;",
+ at = @At(value = "INVOKE",
+ target = "Lnet/minecraft/network/chat/Component$Serializer;serialize(Lnet/minecraft/network/chat/Component;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;"))
+ public JsonElement serialize(Component.Serializer instance, Component src, Type typeOfSrc,
+ JsonSerializationContext context, Operation original) {
if (src instanceof ModularComponent mc) {
var d = ModularComponent.CODEC.mutableCodec().encodeJson(mc);
var res = d.result();
@@ -38,10 +39,14 @@ public JsonElement serialize(Component.Serializer instance, Component src, Type
return original.call(instance, src, typeOfSrc, context);
}
- @WrapOperation(method = "deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/network/chat/MutableComponent;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/chat/Component$Serializer;deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/network/chat/MutableComponent;"))
- public MutableComponent deserialize(Component.Serializer instance, JsonElement json, Type typeOfT, JsonDeserializationContext context, Operation original) {
+ @WrapOperation(method = "deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/network/chat/MutableComponent;",
+ at = @At(value = "INVOKE",
+ target = "Lnet/minecraft/network/chat/Component$Serializer;deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/network/chat/MutableComponent;"))
+ public MutableComponent deserialize(Component.Serializer instance, JsonElement json, Type typeOfT,
+ JsonDeserializationContext context, Operation original) {
MutableComponent comp = original.call(instance, json, typeOfT, context);
- if (comp.getClass() == MutableComponent.class && json instanceof JsonObject jsonObj && ModularComponent.CODEC.hasAnyField(jsonObj)) {
+ if (comp.getClass() == MutableComponent.class && json instanceof JsonObject jsonObj &&
+ ModularComponent.CODEC.hasAnyField(jsonObj)) {
ModularComponent mc = comp.asModular();
var d = ModularComponent.CODEC.mutableCodec().parseJson(jsonObj, mc);
var res = d.result();
diff --git a/src/main/java/brachy/modularui/core/mixins/common/TextColorMixin.java b/src/main/java/brachy/modularui/core/mixins/common/TextColorMixin.java
index bf5109b5..be8c2a5d 100644
--- a/src/main/java/brachy/modularui/core/mixins/common/TextColorMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/common/TextColorMixin.java
@@ -12,7 +12,8 @@ public class TextColorMixin {
/**
* @reason Minecraft uses Integer.parseInt which fails when alpha is specified because of signed vs. unsigned
*/
- @Redirect(method = "parseColor", at = @At(value = "INVOKE", target = "Ljava/lang/Integer;parseInt(Ljava/lang/String;I)I"))
+ @Redirect(method = "parseColor",
+ at = @At(value = "INVOKE", target = "Ljava/lang/Integer;parseInt(Ljava/lang/String;I)I"))
private static int fixDecode(String s, int radix) {
return (int) Long.parseLong(s, radix);
}
diff --git a/src/main/java/brachy/modularui/core/mixins/emi/EmiRenderHelperMixin.java b/src/main/java/brachy/modularui/core/mixins/emi/EmiRenderHelperMixin.java
index d0cf4827..9b440e04 100644
--- a/src/main/java/brachy/modularui/core/mixins/emi/EmiRenderHelperMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/emi/EmiRenderHelperMixin.java
@@ -14,7 +14,8 @@
public class EmiRenderHelperMixin {
@Inject(method = "renderRecipe",
- at = @At(value = "INVOKE", target = "Ldev/emi/emi/api/recipe/EmiRecipe;addWidgets(Ldev/emi/emi/api/widget/WidgetHolder;)V"))
+ at = @At(value = "INVOKE",
+ target = "Ldev/emi/emi/api/recipe/EmiRecipe;addWidgets(Ldev/emi/emi/api/widget/WidgetHolder;)V"))
private static void modularui$tellTheRecipeItsInATooltip(EmiRecipe recipe, EmiDrawContext context, int x, int y,
boolean showMissing, int overlayColor,
CallbackInfo ci) {
diff --git a/src/main/java/brachy/modularui/core/mixins/emi/RecipeScreenMixin.java b/src/main/java/brachy/modularui/core/mixins/emi/RecipeScreenMixin.java
index 6380a572..c232eb4a 100644
--- a/src/main/java/brachy/modularui/core/mixins/emi/RecipeScreenMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/emi/RecipeScreenMixin.java
@@ -16,7 +16,8 @@
@Mixin(value = RecipeScreen.class, remap = false)
public class RecipeScreenMixin {
- @Shadow private List currentPage;
+ @Shadow
+ private List currentPage;
@Inject(method = "mouseScrolled", at = @At("HEAD"), remap = true, cancellable = true)
private void mui$mouseScrolled(double mouseX, double mouseY, double amount, CallbackInfoReturnable cir) {
@@ -45,7 +46,8 @@ public class RecipeScreenMixin {
}
@Inject(method = "mouseDragged", at = @At("HEAD"), remap = true, cancellable = true)
- private void mui$mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY, CallbackInfoReturnable cir) {
+ private void mui$mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY,
+ CallbackInfoReturnable cir) {
for (WidgetGroup group : currentPage) {
for (Widget widget : group.widgets) {
if (widget instanceof ModularUIEmiRecipe.UIWrapperWidget wrapperWidget) {
@@ -56,5 +58,4 @@ public class RecipeScreenMixin {
}
}
}
-
}
diff --git a/src/main/java/brachy/modularui/core/mixins/jei/RecipeGuiLogicMixin.java b/src/main/java/brachy/modularui/core/mixins/jei/RecipeGuiLogicMixin.java
index f1fe8357..3f72b280 100644
--- a/src/main/java/brachy/modularui/core/mixins/jei/RecipeGuiLogicMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/jei/RecipeGuiLogicMixin.java
@@ -2,13 +2,12 @@
import brachy.modularui.integration.jei.recipe.ModularUIJeiCategory;
+import net.minecraft.client.renderer.Rect2i;
+
import mezz.jei.api.gui.IRecipeLayoutDrawable;
import mezz.jei.common.util.ImmutableSize2i;
import mezz.jei.gui.recipes.IRecipeLayoutWithButtons;
import mezz.jei.gui.recipes.RecipeGuiLogic;
-
-import net.minecraft.client.renderer.Rect2i;
-
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@@ -19,7 +18,8 @@
public class RecipeGuiLogicMixin {
@ModifyArg(method = "getVisibleRecipeLayoutsWithButtons",
- at = @At(value = "INVOKE", target = "Ljava/util/Optional;map(Ljava/util/function/Function;)Ljava/util/Optional;"))
+ at = @At(value = "INVOKE",
+ target = "Ljava/util/Optional;map(Ljava/util/function/Function;)Ljava/util/Optional;"))
private Function, ImmutableSize2i> modularui$useCategoryMaxHeightForLayout(Function, ImmutableSize2i> original) {
return layoutWithButtons -> {
ImmutableSize2i size = original.apply(layoutWithButtons);
@@ -30,7 +30,8 @@ public class RecipeGuiLogicMixin {
int borderWidth = size.width() - area.getWidth();
// size.height() contains the layout's areaWithBorder.height
int borderHeight = size.height() - area.getHeight();
- return new ImmutableSize2i(muiCategory.getMaxWidth() + borderWidth, muiCategory.getMaxHeight() + borderHeight);
+ return new ImmutableSize2i(muiCategory.getMaxWidth() + borderWidth,
+ muiCategory.getMaxHeight() + borderHeight);
}
return size;
};
diff --git a/src/main/java/brachy/modularui/core/mixins/jei/RecipeLayoutBuilderMixin.java b/src/main/java/brachy/modularui/core/mixins/jei/RecipeLayoutBuilderMixin.java
index 8d33fc53..f28803c1 100644
--- a/src/main/java/brachy/modularui/core/mixins/jei/RecipeLayoutBuilderMixin.java
+++ b/src/main/java/brachy/modularui/core/mixins/jei/RecipeLayoutBuilderMixin.java
@@ -28,9 +28,9 @@ public abstract class RecipeLayoutBuilderMixin implements IRecipeLayoutBuilde
@Shadow
private @Final T recipe;
-
+
private static final @Unique ThreadLocal