diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b903cc..bc2c322 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: - name: setup jdk uses: actions/setup-java@v5 with: - java-version: '21' + java-version: '25' distribution: 'microsoft' - name: make gradle wrapper executable diff --git a/build.gradle b/build.gradle index 0e1089b..9214826 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id 'dev.architectury.loom' version '1.13.467' apply false - id 'architectury-plugin' version '3.4-SNAPSHOT' + id "dev.architectury.loom-no-remap" version "1.14-SNAPSHOT" apply false + id "architectury-plugin" version "3.5-SNAPSHOT" id 'com.gradleup.shadow' version '8.3.6' apply false } @@ -30,7 +30,7 @@ allprojects { } subprojects { - apply plugin: 'dev.architectury.loom' + apply plugin: "dev.architectury.loom-no-remap" apply plugin: 'architectury-plugin' apply plugin: 'maven-publish' @@ -48,10 +48,6 @@ subprojects { } } - tasks.named('remapJar') { - archiveVersion.set("") - } - loom { silentMojangMappingsLicense() @@ -69,20 +65,16 @@ subprojects { dependencies { minecraft "net.minecraft:minecraft:$rootProject.minecraft_version" - mappings loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip") - } } java { withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } tasks.withType(JavaCompile).configureEach { - it.options.release = 21 + it.options.release = 25 } processResources { diff --git a/common/build.gradle b/common/build.gradle index c516667..3e9e96a 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,7 +3,7 @@ architectury { } dependencies { - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.junit_version}" testRuntimeOnly "org.junit.platform:junit-platform-launcher" diff --git a/common/src/main/java/net/weyne1/easegui/api/EaseGUIScreenRegistry.java b/common/src/main/java/net/weyne1/easegui/api/EaseGUIScreenRegistry.java index 86d07f5..4e44b69 100644 --- a/common/src/main/java/net/weyne1/easegui/api/EaseGUIScreenRegistry.java +++ b/common/src/main/java/net/weyne1/easegui/api/EaseGUIScreenRegistry.java @@ -52,7 +52,7 @@ public final class EaseGUIScreenRegistry { register("statistics", StatsScreen.class, 1000, EaseGUIScreenGroup.BASIC); register("warning", WarningScreen.class, 1000, EaseGUIScreenGroup.BASIC); register("pause", PauseScreen.class, 1000, EaseGUIScreenGroup.BASIC); - register("share_to_lan", ShareToLanScreen.class, 1000, EaseGUIScreenGroup.BASIC); + register("multiplayer_options", MultiplayerOptionsScreen.class, 1000, EaseGUIScreenGroup.BASIC); register("death", DeathScreen.class, 1000, EaseGUIScreenGroup.BASIC); register("social_interactions", SocialInteractionsScreen.class, 1000, EaseGUIScreenGroup.BASIC); @@ -73,7 +73,7 @@ public final class EaseGUIScreenRegistry { register("direct_join_server", DirectJoinServerScreen.class, 1000, EaseGUIScreenGroup.WORLDS); register("edit_world", EditWorldScreen.class, 1000, EaseGUIScreenGroup.WORLDS); register("edit_server", ManageServerScreen.class, 1000, EaseGUIScreenGroup.WORLDS); - register("edit_game_rules", EditGameRulesScreen.class, 1000, EaseGUIScreenGroup.WORLDS); + register("edit_game_rules", AbstractGameRulesScreen.class, 1000, EaseGUIScreenGroup.WORLDS); register("experiments", ExperimentsScreen.class, 1000, EaseGUIScreenGroup.WORLDS); register("connecting", ConnectScreen.class, 1000, EaseGUIScreenGroup.WORLDS); register("disconnected", DisconnectedScreen.class, 1000, EaseGUIScreenGroup.WORLDS); diff --git a/common/src/main/java/net/weyne1/easegui/client/animation/AnimationScope.java b/common/src/main/java/net/weyne1/easegui/client/animation/AnimationScope.java index a0d5c29..4be42ff 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animation/AnimationScope.java +++ b/common/src/main/java/net/weyne1/easegui/client/animation/AnimationScope.java @@ -1,13 +1,13 @@ package net.weyne1.easegui.client.animation; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.weyne1.easegui.client.EaseGUIDebug; import org.joml.Matrix3x2fStack; public final class AnimationScope implements AutoCloseable { private static final float MIN_SCALE = 0.001f; - private final GuiGraphics guiGraphics; + private final GuiGraphicsExtractor graphics; private final float alpha; private boolean isClosed = false; @@ -37,12 +37,12 @@ public boolean isSuspended() { return isSuspended; } - public AnimationScope(GuiGraphics guiGraphics, float alpha) { - this.guiGraphics = guiGraphics; + public AnimationScope(GuiGraphicsExtractor graphics, float alpha) { + this.graphics = graphics; this.alpha = alpha; AnimationContext.pushScope(this); - this.guiGraphics.pose().pushMatrix(); + this.graphics.pose().pushMatrix(); } public void setTransformParams(float offsetX, float offsetY, float scaleX, float scaleY, float pivotX, float pivotY) { @@ -53,7 +53,7 @@ public void setTransformParams(float offsetX, float offsetY, float scaleX, float this.pivotX = pivotX; this.pivotY = pivotY; - Matrix3x2fStack poseStack = guiGraphics.pose(); + Matrix3x2fStack poseStack = graphics.pose(); if (this.scaleX != 1.0f || this.scaleY != 1.0f) { poseStack.translate(offsetX + pivotX, offsetY + pivotY); @@ -67,7 +67,7 @@ public void setTransformParams(float offsetX, float offsetY, float scaleX, float public void suspend() { if (isClosed || isSuspended) return; - Matrix3x2fStack poseStack = guiGraphics.pose(); + Matrix3x2fStack poseStack = graphics.pose(); poseStack.pushMatrix(); if (scaleX != 1.0f || scaleY != 1.0f) { @@ -84,7 +84,7 @@ public void suspend() { public void resume() { if (isClosed || !isSuspended) return; - guiGraphics.pose().popMatrix(); + graphics.pose().popMatrix(); isSuspended = false; } @@ -95,12 +95,12 @@ public void close() { isClosed = true; if (isSuspended) { - guiGraphics.pose().popMatrix(); + graphics.pose().popMatrix(); isSuspended = false; } try { - guiGraphics.pose().popMatrix(); + graphics.pose().popMatrix(); } catch (IllegalStateException e) { EaseGUIDebug.reportError("pose_stack_underflow", () -> "PoseStack underflow inside AnimationScope close!"); } diff --git a/common/src/main/java/net/weyne1/easegui/client/animation/AnimationSystem.java b/common/src/main/java/net/weyne1/easegui/client/animation/AnimationSystem.java index 317da5b..a5cf626 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animation/AnimationSystem.java +++ b/common/src/main/java/net/weyne1/easegui/client/animation/AnimationSystem.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.animation; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.util.Util; import net.weyne1.easegui.api.animation.AnimationProfile; @@ -10,7 +10,7 @@ public final class AnimationSystem { * An entry point for animations with automatic timing and progress calculation. */ public static AnimationScope begin( - GuiGraphics gg, + GuiGraphicsExtractor graphics, int x, int y, int width, int height, AnimationProfile profile, long startTime, @@ -25,11 +25,11 @@ public static AnimationScope begin( float progress = elapsed <= 0 ? 0.0f : AnimationMath.calculateProgress(elapsed, profile.getDuration(), profile.getEasing()); - return begin(gg, x, y, width, height, profile, progress, baseAlpha); + return begin(graphics, x, y, width, height, profile, progress, baseAlpha); } public static AnimationScope begin( - GuiGraphics gg, + GuiGraphicsExtractor graphics, int x, int y, int width, int height, AnimationProfile profile, float progress, @@ -39,7 +39,7 @@ public static AnimationScope begin( float lerpedAlpha = AnimationMath.lerp(profile.getStartAlpha(), 1.0f, alphaProgress); float finalAlpha = AnimationMath.clamp(baseAlpha * lerpedAlpha, 0.0f, 1.0f); - AnimationScope scope = new AnimationScope(gg, finalAlpha); + AnimationScope scope = new AnimationScope(graphics, finalAlpha); scope.setTransformParams( AnimationMath.calculateCurrentOffset(profile.getOffsetX(), progress), AnimationMath.calculateCurrentOffset(profile.getOffsetY(), progress), @@ -51,7 +51,7 @@ public static AnimationScope begin( return scope; } - public static AnimationScope beginAlphaOnly(GuiGraphics gg, float alpha) { + public static AnimationScope beginAlphaOnly(GuiGraphicsExtractor gg, float alpha) { return new AnimationScope(gg, alpha); } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/animator/AdvancementsAnimator.java b/common/src/main/java/net/weyne1/easegui/client/animator/AdvancementsAnimator.java index e745b49..daf2be4 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animator/AdvancementsAnimator.java +++ b/common/src/main/java/net/weyne1/easegui/client/animator/AdvancementsAnimator.java @@ -1,7 +1,7 @@ package net.weyne1.easegui.client.animator; import net.minecraft.util.Util; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.advancements.AdvancementsScreen; import net.weyne1.easegui.client.animation.AnimationContext; @@ -15,7 +15,7 @@ public class AdvancementsAnimator { - public static AnimationScope beginRenderWindow(AdvancementsScreen screen, GuiGraphics gg) { + public static AnimationScope beginRenderWindow(AdvancementsScreen screen, GuiGraphicsExtractor graphics) { EaseGUIScreenType type = EaseGUIScreenRegistry.from(screen); var titleSettings = ConfigManager.getConfig().screens.get(type.getId()); @@ -31,10 +31,10 @@ public static AnimationScope beginRenderWindow(AdvancementsScreen screen, GuiGra float progress = elapsed <= 0 ? 0.0f : AnimationMath.calculateProgress(elapsed, profile.getDuration(), profile.getEasing()); - return AnimationSystem.begin(gg, 0, 0, screen.width, screen.height, profile, progress, 1.0f); + return AnimationSystem.begin(graphics, 0, 0, screen.width, screen.height, profile, progress, 1.0f); } - public static AnimationScope beginRenderTab(Screen screen, GuiGraphics gg, int tabIndex) { + public static AnimationScope beginRenderTab(Screen screen, GuiGraphicsExtractor graphics, int tabIndex) { EaseGUIScreenType type = EaseGUIScreenRegistry.from(screen); var titleSettings = ConfigManager.getConfig().screens.get(type.getId()); @@ -45,7 +45,7 @@ public static AnimationScope beginRenderTab(Screen screen, GuiGraphics gg, int t float parentAlpha = AnimationContext.getCurrentAlpha(); if (tabIndex == 0) { - return AnimationSystem.beginAlphaOnly(gg, parentAlpha); + return AnimationSystem.beginAlphaOnly(graphics, parentAlpha); } var profile = titleSettings.advancements.tabsProfile; @@ -61,6 +61,6 @@ public static AnimationScope beginRenderTab(Screen screen, GuiGraphics gg, int t progress = AnimationMath.calculateProgress(elapsed, profile.getDuration(), profile.getEasing()); } - return AnimationSystem.begin(gg, 0, 0, 28, 32, profile, progress, parentAlpha); + return AnimationSystem.begin(graphics, 0, 0, 28, 32, profile, progress, parentAlpha); } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/animator/BackgroundAnimator.java b/common/src/main/java/net/weyne1/easegui/client/animator/BackgroundAnimator.java index 3db1d5e..2bb02b9 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animator/BackgroundAnimator.java +++ b/common/src/main/java/net/weyne1/easegui/client/animator/BackgroundAnimator.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.animator; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.*; import net.weyne1.easegui.client.animation.AnimationScope; import net.weyne1.easegui.client.animation.AnimationSystem; @@ -70,7 +70,7 @@ public static int getAnimatedColor(Screen screen, int originalColor) { return (originalColor & 0x00FFFFFF) | (finalAlpha << 24); } - public static AnimationScope beginRenderMenu(Screen screen, GuiGraphics gg) { + public static AnimationScope beginRenderMenu(Screen screen, GuiGraphicsExtractor graphics) { if (!shouldAnimateBackground(screen) || skipBackgroundFade) { return null; } @@ -82,7 +82,7 @@ public static AnimationScope beginRenderMenu(Screen screen, GuiGraphics gg) { } float progress = Math.max(0.0f, Math.min(1.0f, ScreenAnimationTracker.getProgress())); - return AnimationSystem.beginAlphaOnly(gg, progress); + return AnimationSystem.beginAlphaOnly(graphics, progress); } private static boolean isIgnoredScreen(Screen screen) { diff --git a/common/src/main/java/net/weyne1/easegui/client/animator/ContainerAnimator.java b/common/src/main/java/net/weyne1/easegui/client/animator/ContainerAnimator.java index 7ce80a1..93603b4 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animator/ContainerAnimator.java +++ b/common/src/main/java/net/weyne1/easegui/client/animator/ContainerAnimator.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.animator; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; import net.weyne1.easegui.client.extension.ContainerScreenExtension; @@ -14,7 +14,7 @@ public class ContainerAnimator { - public static AnimationScope beginAnimation(Screen screen, GuiGraphics gg) { + public static AnimationScope beginAnimation(Screen screen, GuiGraphicsExtractor graphics) { if (!(screen instanceof ContainerScreenExtension container)) { return null; } @@ -39,6 +39,6 @@ public static AnimationScope beginAnimation(Screen screen, GuiGraphics gg) { if (profile == null || !profile.isEnabled()) return null; long startTime = ScreenStateTracker.getScreenOpenTime(); - return AnimationSystem.begin(gg, minX, minY, maxX - minX, maxY - minY, profile, startTime, 0L, 1.0f); + return AnimationSystem.begin(graphics, minX, minY, maxX - minX, maxY - minY, profile, startTime, 0L, 1.0f); } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/animator/ListItemAnimator.java b/common/src/main/java/net/weyne1/easegui/client/animator/ListItemAnimator.java index c4c10be..02d5aa6 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animator/ListItemAnimator.java +++ b/common/src/main/java/net/weyne1/easegui/client/animator/ListItemAnimator.java @@ -1,7 +1,7 @@ package net.weyne1.easegui.client.animator; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.weyne1.easegui.api.animation.AnimationProfile; import net.weyne1.easegui.client.animation.AnimationScope; import net.weyne1.easegui.client.animation.AnimationSystem; @@ -11,14 +11,14 @@ public class ListItemAnimator { - public static AnimationScope beginRender(GuiGraphics gg, int top, int left, int width, int height) { + public static AnimationScope beginRender(GuiGraphicsExtractor graphics, int top, int left, int width, int height) { var profile = ConfigManager.getProfileForCurrentContext(WidgetCategory.LIST_ENTRY); if (profile == null || !profile.isEnabled()) return null; long delay = getDelay(top, left, profile); long startTime = ScreenStateTracker.getScreenOpenTime(); - return AnimationSystem.begin(gg, left, top, width, height, profile, startTime, delay, 1.0f); + return AnimationSystem.begin(graphics, left, top, width, height, profile, startTime, delay, 1.0f); } private static long getDelay(int top, int left, AnimationProfile profile) { diff --git a/common/src/main/java/net/weyne1/easegui/client/animator/LogoAnimator.java b/common/src/main/java/net/weyne1/easegui/client/animator/LogoAnimator.java index 8125fa5..7b42e48 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animator/LogoAnimator.java +++ b/common/src/main/java/net/weyne1/easegui/client/animator/LogoAnimator.java @@ -2,7 +2,7 @@ import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.util.Util; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.LogoRenderer; import net.minecraft.resources.Identifier; import net.weyne1.easegui.client.animation.AnimationMath; @@ -37,7 +37,7 @@ public class LogoAnimator { */ private static final int[] LOGICAL_INDICES = new int[] { 0, 1, 2, 3, 8, 7, 6, 5, 4 }; - public static boolean render(GuiGraphics gg, int screenWidth, float transparency, int height, boolean showEasterEgg, boolean keepLogoThroughFade) { + public static boolean render(GuiGraphicsExtractor graphics, int screenWidth, float transparency, int height, boolean showEasterEgg, boolean keepLogoThroughFade) { var titleSettings = ConfigManager.getConfig().screens.get("title"); if (titleSettings == null || !titleSettings.enabled || titleSettings.logo == null) { return false; @@ -49,36 +49,36 @@ public static boolean render(GuiGraphics gg, int screenWidth, float transparency Identifier logoTexture = showEasterEgg ? LogoRenderer.EASTER_EGG_LOGO : LogoRenderer.MINECRAFT_LOGO; if (logoConfig.animateWholeText) { - renderWholeLogo(gg, logoTexture, logoConfig.logoProfile, startX, height, finalAlpha); + renderWholeLogo(graphics, logoTexture, logoConfig.logoProfile, startX, height, finalAlpha); } else { - renderCascadedLetters(gg, logoConfig.logoProfile, startX, height, finalAlpha); + renderCascadedLetters(graphics, logoConfig.logoProfile, startX, height, finalAlpha); } - renderEditionText(gg, logoConfig, screenWidth, height, finalAlpha); + renderEditionText(graphics, logoConfig, screenWidth, height, finalAlpha); return true; } - private static void renderWholeLogo(GuiGraphics gg, Identifier texture, AnimationProfile profile, int startX, int height, float finalAlpha) { + private static void renderWholeLogo(GuiGraphicsExtractor graphics, Identifier texture, AnimationProfile profile, int startX, int height, float finalAlpha) { long actualStartTime = ScreenStateTracker.getTitleActualStartTime(); long elapsed = Util.getMillis() - actualStartTime; int logoWidth = LogoRendererAccessor.easeGUI$getLogoWidth(); int logoHeight = LogoRendererAccessor.easeGUI$getLogoHeight(); if (elapsed >= profile.getDuration()) { - try (AnimationScope ignored = AnimationSystem.beginAlphaOnly(gg, finalAlpha)) { - drawLogoTexture(gg, texture, startX, height); + try (AnimationScope ignored = AnimationSystem.beginAlphaOnly(graphics, finalAlpha)) { + drawLogoTexture(graphics, texture, startX, height); } return; } float progress = elapsed <= 0 ? 0.0f : AnimationMath.calculateProgress(elapsed, profile.getDuration(), profile.getEasing()); - try (AnimationScope ignored = AnimationSystem.begin(gg, startX, height, logoWidth, logoHeight, profile, progress, finalAlpha)) { - drawLogoTexture(gg, texture, startX, height); + try (AnimationScope ignored = AnimationSystem.begin(graphics, startX, height, logoWidth, logoHeight, profile, progress, finalAlpha)) { + drawLogoTexture(graphics, texture, startX, height); } } - private static void renderCascadedLetters(GuiGraphics gg, AnimationProfile profile, int startX, int height, float finalAlpha) { + private static void renderCascadedLetters(GuiGraphicsExtractor graphics, AnimationProfile profile, int startX, int height, float finalAlpha) { long now = Util.getMillis(); long actualStartTime = ScreenStateTracker.getTitleActualStartTime(); long maxLogoDelay = (LETTER_TEXTURES.length - 1) * profile.getCascadeDelay(); @@ -86,9 +86,9 @@ private static void renderCascadedLetters(GuiGraphics gg, AnimationProfile profi int logoHeight = LogoRendererAccessor.easeGUI$getLogoHeight(); if (now - actualStartTime >= maxLogoDelay + profile.getDuration()) { - try (AnimationScope ignored = AnimationSystem.beginAlphaOnly(gg, finalAlpha)) { + try (AnimationScope ignored = AnimationSystem.beginAlphaOnly(graphics, finalAlpha)) { for (Identifier texture : LETTER_TEXTURES) { - drawLogoTexture(gg, texture, startX, height); + drawLogoTexture(graphics, texture, startX, height); } } return; @@ -102,13 +102,13 @@ private static void renderCascadedLetters(GuiGraphics gg, AnimationProfile profi long elapsed = now - actualStartTime - cascadeDelay; float progress = elapsed <= 0 ? 0.0f : AnimationMath.calculateProgress(elapsed, profile.getDuration(), profile.getEasing()); - try (AnimationScope ignored = AnimationSystem.begin(gg, startX, height, logoWidth, logoHeight, profile, progress, finalAlpha)) { - drawLogoTexture(gg, texture, startX, height); + try (AnimationScope ignored = AnimationSystem.begin(graphics, startX, height, logoWidth, logoHeight, profile, progress, finalAlpha)) { + drawLogoTexture(graphics, texture, startX, height); } } } - private static void renderEditionText(GuiGraphics gg, EaseGUIConfig.LogoSettings config, int screenWidth, int height, float finalAlpha) { + private static void renderEditionText(GuiGraphicsExtractor graphics, EaseGUIConfig.LogoSettings config, int screenWidth, int height, float finalAlpha) { int editionWidth = LogoRendererAccessor.easeGUI$getEditionWidth(); int editionHeight = LogoRendererAccessor.easeGUI$getEditionHeight(); int logoHeight = LogoRendererAccessor.easeGUI$getLogoHeight(); @@ -117,26 +117,26 @@ private static void renderEditionText(GuiGraphics gg, EaseGUIConfig.LogoSettings var profile = config.editionProfile; if (profile == null || !profile.isEnabled()) { - drawStaticEdition(gg, x, y, finalAlpha); + drawStaticEdition(graphics, x, y, finalAlpha); return; } long elapsed = getEditionElapsed(config); if (elapsed >= profile.getDuration()) { - drawStaticEdition(gg, x, y, finalAlpha); + drawStaticEdition(graphics, x, y, finalAlpha); return; } float progress = elapsed <= 0 ? 0.0f : AnimationMath.calculateProgress(elapsed, profile.getDuration(), profile.getEasing()); - try (AnimationScope ignored = AnimationSystem.begin(gg, x, y, editionWidth, editionHeight, profile, progress, finalAlpha)) { - drawEditionTexture(gg, x, y); + try (AnimationScope ignored = AnimationSystem.begin(graphics, x, y, editionWidth, editionHeight, profile, progress, finalAlpha)) { + drawEditionTexture(graphics, x, y); } } - private static void drawStaticEdition(GuiGraphics gg, int x, int y, float finalAlpha) { - try (AnimationScope ignored = AnimationSystem.beginAlphaOnly(gg, finalAlpha)) { - drawEditionTexture(gg, x, y); + private static void drawStaticEdition(GuiGraphicsExtractor graphics, int x, int y, float finalAlpha) { + try (AnimationScope ignored = AnimationSystem.beginAlphaOnly(graphics, finalAlpha)) { + drawEditionTexture(graphics, x, y); } } @@ -157,16 +157,16 @@ private static long getEditionElapsed(EaseGUIConfig.LogoSettings config) { return Util.getMillis() - actualStartTime - maxLogoDelay; } - private static void drawLogoTexture(GuiGraphics gg, Identifier texture, int x, int y) { - gg.blit(RenderPipelines.GUI_TEXTURED, texture, x, y, 0.0f, 0.0f, + private static void drawLogoTexture(GuiGraphicsExtractor graphics, Identifier texture, int x, int y) { + graphics.blit(RenderPipelines.GUI_TEXTURED, texture, x, y, 0.0f, 0.0f, LogoRendererAccessor.easeGUI$getLogoWidth(), LogoRendererAccessor.easeGUI$getLogoHeight(), LogoRendererAccessor.easeGUI$getLogoWidth(), LogoRendererAccessor.easeGUI$getLogoTextureHeight()); } - private static void drawEditionTexture(GuiGraphics gg, int x, int y) { - gg.blit(RenderPipelines.GUI_TEXTURED, LogoRenderer.MINECRAFT_EDITION, x, y, 0.0f, 0.0f, + private static void drawEditionTexture(GuiGraphicsExtractor graphics, int x, int y) { + graphics.blit(RenderPipelines.GUI_TEXTURED, LogoRenderer.MINECRAFT_EDITION, x, y, 0.0f, 0.0f, LogoRendererAccessor.easeGUI$getEditionWidth(), LogoRendererAccessor.easeGUI$getEditionHeight(), LogoRendererAccessor.easeGUI$getEditionWidth(), diff --git a/common/src/main/java/net/weyne1/easegui/client/animator/WidgetAnimator.java b/common/src/main/java/net/weyne1/easegui/client/animator/WidgetAnimator.java index e2054dc..152ae5b 100644 --- a/common/src/main/java/net/weyne1/easegui/client/animator/WidgetAnimator.java +++ b/common/src/main/java/net/weyne1/easegui/client/animator/WidgetAnimator.java @@ -2,7 +2,7 @@ import net.minecraft.util.Util; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.weyne1.easegui.api.animation.AnimationProfile; @@ -17,8 +17,8 @@ */ public class WidgetAnimator { - public static AnimationScope beginRender(AbstractWidget widget, GuiGraphics gg, WidgetCategory category, AnimationState state) { - if (Minecraft.getInstance().screen instanceof AbstractContainerScreen) { + public static AnimationScope beginRender(AbstractWidget widget, GuiGraphicsExtractor graphics, WidgetCategory category, AnimationState state) { + if (Minecraft.getInstance().gui.screen() instanceof AbstractContainerScreen) { return null; } @@ -34,7 +34,7 @@ public static AnimationScope beginRender(AbstractWidget widget, GuiGraphics gg, return null; } - return AnimationSystem.begin(gg, widget.getX(), widget.getY(), widget.getWidth(), widget.getHeight(), profile, + return AnimationSystem.begin(graphics, widget.getX(), widget.getY(), widget.getWidth(), widget.getHeight(), profile, state.startTime, state.delay, ((WidgetExtension) widget).easeGUI$getAlpha()); } diff --git a/common/src/main/java/net/weyne1/easegui/client/config/ConfigManager.java b/common/src/main/java/net/weyne1/easegui/client/config/ConfigManager.java index c35fdd6..dd95836 100644 --- a/common/src/main/java/net/weyne1/easegui/client/config/ConfigManager.java +++ b/common/src/main/java/net/weyne1/easegui/client/config/ConfigManager.java @@ -98,7 +98,7 @@ public static AnimationProfile getProfileForCurrentContext(WidgetCategory catego if (category == null || category == WidgetCategory.UNKNOWN) return null; if (!isLoaded) load(); - Screen currentScreen = Minecraft.getInstance().screen; + Screen currentScreen = Minecraft.getInstance().gui.screen(); if (currentScreen != cachedScreenInstance) { cachedScreenInstance = currentScreen; diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/components/FieldValidator.java b/common/src/main/java/net/weyne1/easegui/client/gui/components/FieldValidator.java index d5b0449..6c6d790 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/components/FieldValidator.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/components/FieldValidator.java @@ -6,14 +6,10 @@ public class FieldValidator { - public static final String REGEX_INT = "\\d*"; - public static final String REGEX_FLOAT = "-?\\d*\\.?\\d*"; - private static final int COLOR_VALID = 0xFFE0E0E0; private static final int COLOR_INVALID = 0xFFFF5555; public static void registerLongValidator(EditBox editBox, long min, long max, Consumer onSuccess) { - editBox.setFilter(s -> s.matches(REGEX_INT)); editBox.setResponder(text -> { if (text.isEmpty()) { editBox.setTextColor(COLOR_INVALID); @@ -34,7 +30,6 @@ public static void registerLongValidator(EditBox editBox, long min, long max, Co } public static void registerFloatValidator(EditBox editBox, float min, float max, Consumer onSuccess) { - editBox.setFilter(s -> s.matches(REGEX_FLOAT)); editBox.setResponder(text -> { String clean = text.replace(',', '.'); if (clean.isEmpty() || clean.equals("-") || clean.equals(".") || clean.equals("-.")) { diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/components/SettingsScrollList.java b/common/src/main/java/net/weyne1/easegui/client/gui/components/SettingsScrollList.java index 7d336a5..e79f0dc 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/components/SettingsScrollList.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/components/SettingsScrollList.java @@ -2,7 +2,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ContainerObjectSelectionList; import net.minecraft.client.gui.components.EditBox; @@ -49,9 +49,9 @@ public HeaderEntry(String text) { } @Override - public void renderContent(GuiGraphics gg, int mouseX, int mouseY, boolean isHovered, float partialTick) { + public void extractContent(GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean isHovered, float partialTick) { Font font = Minecraft.getInstance().font; - gg.drawCenteredString(font, this.text, this.getContentXMiddle(), this.getContentYMiddle() - 4, COLOR_HEADER); + graphics.centeredText(font, this.text, this.getContentXMiddle(), this.getContentYMiddle() - 4, COLOR_HEADER); } @Override @@ -70,10 +70,10 @@ public ButtonEntry(int listWidth, Button button) { } @Override - public void renderContent(@NonNull GuiGraphics gg, int mouseX, int mouseY, boolean isHovered, float partialTick) { + public void extractContent(@NonNull GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean isHovered, float partialTick) { button.setX(this.getContentX() + SCROLLBAR_WIDTH_GAP / 2); button.setY(this.getContentY()); - button.render(gg, mouseX, mouseY, partialTick); + button.extractRenderState(graphics, mouseX, mouseY, partialTick); } @Override @@ -103,15 +103,15 @@ public TwoButtonsEntry(int listWidth, Button button1, Button button2, float rati } @Override - public void renderContent(@NonNull GuiGraphics gg, int mouseX, int mouseY, boolean isHovered, float partialTick) { + public void extractContent(@NonNull GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean isHovered, float partialTick) { button1.setX(this.getContentX() + SCROLLBAR_WIDTH_GAP / 2); button1.setY(this.getContentY()); button2.setX(button1.getX() + button1.getWidth() + ELEMENT_SPACING); button2.setY(this.getContentY()); - button1.render(gg, mouseX, mouseY, partialTick); - button2.render(gg, mouseX, mouseY, partialTick); + button1.extractRenderState(graphics, mouseX, mouseY, partialTick); + button2.extractRenderState(graphics, mouseX, mouseY, partialTick); } @Override @@ -129,7 +129,7 @@ public FieldEntry(int listWidth, String labelText, EditBox field) { int lblW = (int) (availWidth * LABEL_WIDTH_RATIO); int fldW = availWidth - lblW - ELEMENT_SPACING; - this.label = Button.builder(Component.literal(labelText), b -> {}) + this.label = Button.builder(Component.literal(labelText), _ -> {}) .bounds(0, 0, lblW, WIDGET_HEIGHT) .build(); this.label.active = false; @@ -141,14 +141,14 @@ public FieldEntry(int listWidth, String labelText, EditBox field) { } @Override - public void renderContent(@NonNull GuiGraphics gg, int mouseX, int mouseY, boolean isHovered, float partialTick) { + public void extractContent(@NonNull GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean isHovered, float partialTick) { label.setX(this.getContentX() + SCROLLBAR_WIDTH_GAP / 2); label.setY(this.getContentY()); field.setX(label.getX() + label.getWidth() + ELEMENT_SPACING); field.setY(this.getContentY()); - label.render(gg, mouseX, mouseY, partialTick); - field.render(gg, mouseX, mouseY, partialTick); + label.extractRenderState(graphics, mouseX, mouseY, partialTick); + field.extractRenderState(graphics, mouseX, mouseY, partialTick); } @Override @@ -168,7 +168,7 @@ public TwoFieldsEntry(int listWidth, String labelText, EditBox field1, EditBox f int fieldsArea = availWidth - lblW - ELEMENT_SPACING; int subFldW = (fieldsArea - ELEMENT_SPACING) / 2; - this.label = Button.builder(Component.literal(labelText), b -> {}) + this.label = Button.builder(Component.literal(labelText), _ -> {}) .bounds(0, 0, lblW, WIDGET_HEIGHT) .build(); this.label.active = false; @@ -185,7 +185,7 @@ public TwoFieldsEntry(int listWidth, String labelText, EditBox field1, EditBox f } @Override - public void renderContent(@NonNull GuiGraphics gg, int mouseX, int mouseY, boolean isHovered, float partialTick) { + public void extractContent(@NonNull GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean isHovered, float partialTick) { label.setX(this.getContentX() + SCROLLBAR_WIDTH_GAP / 2); label.setY(this.getContentY()); @@ -195,9 +195,9 @@ public void renderContent(@NonNull GuiGraphics gg, int mouseX, int mouseY, boole field2.setX(field1.getX() + field1.getWidth() + ELEMENT_SPACING); field2.setY(this.getContentY()); - label.render(gg, mouseX, mouseY, partialTick); - field1.render(gg, mouseX, mouseY, partialTick); - field2.render(gg, mouseX, mouseY, partialTick); + label.extractRenderState(graphics, mouseX, mouseY, partialTick); + field1.extractRenderState(graphics, mouseX, mouseY, partialTick); + field2.extractRenderState(graphics, mouseX, mouseY, partialTick); } @Override diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/configurator/AdvancementsScreenConfigurator.java b/common/src/main/java/net/weyne1/easegui/client/gui/configurator/AdvancementsScreenConfigurator.java index 1f12547..039c75c 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/configurator/AdvancementsScreenConfigurator.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/configurator/AdvancementsScreenConfigurator.java @@ -28,16 +28,16 @@ public void populate(SettingsScrollList list, EaseGUIConfig.ScreenSettings setti AnimationProfile defaultWindow = defaultSettings.windowProfile; AnimationProfile defaultTabs = defaultSettings.tabsProfile; - list.addButton(Button.builder(Component.translatable("easegui.config.advancements.window.edit_anim"), btn -> - mc.setScreen(new ProfileEditorScreen(parentScreen, adv.windowProfile, defaultWindow, EnumSet.of(ProfileFeature.OFFSET, ProfileFeature.SCALE, ProfileFeature.ALPHA, ProfileFeature.PIVOT), updated -> { + list.addButton(Button.builder(Component.translatable("easegui.config.advancements.window.edit_anim"), _ -> + mc.gui.setScreen(new ProfileEditorScreen(parentScreen, adv.windowProfile, defaultWindow, EnumSet.of(ProfileFeature.OFFSET, ProfileFeature.SCALE, ProfileFeature.ALPHA, ProfileFeature.PIVOT), updated -> { adv.windowProfile = updated; ConfigManager.save(); })) ).build()); list.addHeader(Component.translatable("easegui.config.advancements.tabs.header").getString()); - list.addButton(Button.builder(Component.translatable("easegui.config.advancements.tabs.edit_anim"), btn -> - mc.setScreen(new ProfileEditorScreen(parentScreen, adv.tabsProfile, defaultTabs, EnumSet.of(ProfileFeature.ALPHA, ProfileFeature.CASCADE_DELAY), updated -> { + list.addButton(Button.builder(Component.translatable("easegui.config.advancements.tabs.edit_anim"), _ -> + mc.gui.setScreen(new ProfileEditorScreen(parentScreen, adv.tabsProfile, defaultTabs, EnumSet.of(ProfileFeature.ALPHA, ProfileFeature.CASCADE_DELAY), updated -> { adv.tabsProfile = updated; ConfigManager.save(); })) ).build()); diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/configurator/TitleScreenConfigurator.java b/common/src/main/java/net/weyne1/easegui/client/gui/configurator/TitleScreenConfigurator.java index f2ff4ba..b125c00 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/configurator/TitleScreenConfigurator.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/configurator/TitleScreenConfigurator.java @@ -32,8 +32,8 @@ public void populate(SettingsScrollList list, EaseGUIConfig.ScreenSettings setti AnimationProfile defaultEdition = defaultSettings.editionProfile; // Настройка анимации букв - list.addButton(Button.builder(Component.translatable("easegui.config.title.logo.edit_anim"), btn -> - mc.setScreen(new ProfileEditorScreen(parentScreen, logo.logoProfile, defaultLogo, EnumSet.allOf(ProfileFeature.class), updated -> { + list.addButton(Button.builder(Component.translatable("easegui.config.title.logo.edit_anim"), _ -> + mc.gui.setScreen(new ProfileEditorScreen(parentScreen, logo.logoProfile, defaultLogo, EnumSet.allOf(ProfileFeature.class), updated -> { logo.logoProfile = updated; ConfigManager.save(); })) ).build()); @@ -48,8 +48,8 @@ public void populate(SettingsScrollList list, EaseGUIConfig.ScreenSettings setti }).build()); // Настройка профиля Edition - list.addButton(Button.builder(Component.translatable("easegui.config.title.edition.edit_anim"), btn -> - mc.setScreen(new ProfileEditorScreen(parentScreen, logo.editionProfile, defaultEdition, EnumSet.of(ProfileFeature.OFFSET, ProfileFeature.SCALE, ProfileFeature.ALPHA, ProfileFeature.PIVOT), updated -> { + list.addButton(Button.builder(Component.translatable("easegui.config.title.edition.edit_anim"), _ -> + mc.gui.setScreen(new ProfileEditorScreen(parentScreen, logo.editionProfile, defaultEdition, EnumSet.of(ProfileFeature.OFFSET, ProfileFeature.SCALE, ProfileFeature.ALPHA, ProfileFeature.PIVOT), updated -> { logo.editionProfile = updated; ConfigManager.save(); })) ).build()); diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/preview/ProfilePreviewRenderer.java b/common/src/main/java/net/weyne1/easegui/client/gui/preview/ProfilePreviewRenderer.java index fb34573..6be0885 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/preview/ProfilePreviewRenderer.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/preview/ProfilePreviewRenderer.java @@ -1,7 +1,7 @@ package net.weyne1.easegui.client.gui.preview; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.network.chat.Component; import net.weyne1.easegui.api.animation.AnimationProfile; import net.weyne1.easegui.api.animation.CascadeDirection; @@ -32,7 +32,7 @@ public class ProfilePreviewRenderer { private static final Component DISABLED_BADGE = Component.translatable("easegui.editor.preview.disabled"); - public static void render(GuiGraphics gg, Font font, int screenWidth, int screenHeight, AnimationProfile profile, EnumSet activeFeatures) { + public static void render(GuiGraphicsExtractor graphics, Font font, int screenWidth, int screenHeight, AnimationProfile profile, EnumSet activeFeatures) { int rightCenterX = (screenWidth / 2) + (screenWidth / 4); int rightCenterY = screenHeight / 2; @@ -45,24 +45,24 @@ public static void render(GuiGraphics gg, Font font, int screenWidth, int screen int boxWidth = (isHorizontal && isCascadeActive) ? 40 : 120; - renderStaticBounds(gg, rightCenterX, rightCenterY, isCascadeActive, itemCount, isEnabled, isHorizontal, boxWidth); - renderAnimatedElements(gg, font, rightCenterX, rightCenterY, profile, isCascadeActive, itemCount, isHorizontal, boxWidth); + renderStaticBounds(graphics, rightCenterX, rightCenterY, isCascadeActive, itemCount, isEnabled, isHorizontal, boxWidth); + renderAnimatedElements(graphics, font, rightCenterX, rightCenterY, profile, isCascadeActive, itemCount, isHorizontal, boxWidth); if (!isEnabled) { - renderDisabledStatus(gg, font, rightCenterX, rightCenterY, isCascadeActive, itemCount, isHorizontal); + renderDisabledStatus(graphics, font, rightCenterX, rightCenterY, isCascadeActive, itemCount, isHorizontal); } } - private static void renderStaticBounds(GuiGraphics gg, int centerX, int centerY, boolean isCascade, int count, boolean isEnabled, boolean isHorizontal, int boxWidth) { + private static void renderStaticBounds(GuiGraphicsExtractor graphics, int centerX, int centerY, boolean isCascade, int count, boolean isEnabled, boolean isHorizontal, int boxWidth) { int color = isEnabled ? 0xFF555555 : 0xCCAA3333; for (int i = 0; i < count; i++) { int targetX = getTargetX(centerX, isCascade, isHorizontal, i); int targetY = getTargetY(centerY, isCascade, isHorizontal, i); - drawBoxOutline(gg, targetX, targetY, boxWidth, color); + drawBoxOutline(graphics, targetX, targetY, boxWidth, color); } } - private static void renderAnimatedElements(GuiGraphics gg, Font font, int centerX, int centerY, AnimationProfile profile, boolean isCascade, int count, boolean isHorizontal, int boxWidth) { + private static void renderAnimatedElements(GuiGraphicsExtractor graphics, Font font, int centerX, int centerY, AnimationProfile profile, boolean isCascade, int count, boolean isHorizontal, int boxWidth) { boolean isEnabled = profile.isEnabled(); long duration = Math.max(profile.getDuration(), 50L); long totalLoopTime = duration + (isCascade ? (2 * profile.getCascadeDelay()) : 0L) + LOOP_PADDING_MS; @@ -89,10 +89,10 @@ private static void renderAnimatedElements(GuiGraphics gg, Font font, int center int x = targetX - halfW; int y = targetY - halfH; - try (AnimationScope ignored = AnimationSystem.begin(gg, x, y, boxWidth, BOX_HEIGHT, profile, easedProgress, 1.0f)) { + try (AnimationScope ignored = AnimationSystem.begin(graphics, x, y, boxWidth, BOX_HEIGHT, profile, easedProgress, 1.0f)) { int bgAlpha = calcAlphaColor(profile.getStartAlpha(), easedProgress); int boxColor = isEnabled ? 0x353535 : 0x222222; - gg.fill(x, y, x + boxWidth, y + BOX_HEIGHT, (bgAlpha << 24) | boxColor); + graphics.fill(x, y, x + boxWidth, y + BOX_HEIGHT, (bgAlpha << 24) | boxColor); Component label = isCascade ? (isHorizontal ? CASCADE_SHORT_LABELS[i] : CASCADE_LABELS[i]) @@ -101,12 +101,12 @@ private static void renderAnimatedElements(GuiGraphics gg, Font font, int center int fontAlpha = calcAlphaColor(profile.getStartAlpha(), easedProgress); int textColor = isEnabled ? 0xE0E0E0 : 0x888888; - gg.drawCenteredString(font, label, targetX, targetY - 4, (fontAlpha << 24) | textColor); + graphics.centeredText(font, label, targetX, targetY - 4, (fontAlpha << 24) | textColor); } } } - private static void renderDisabledStatus(GuiGraphics gg, Font font, int centerX, int centerY, boolean isCascade, int count, boolean isHorizontal) { + private static void renderDisabledStatus(GuiGraphicsExtractor graphics, Font font, int centerX, int centerY, boolean isCascade, int count, boolean isHorizontal) { int lastElementY = getTargetY(centerY, isCascade, isHorizontal, count - 1); int badgeY = lastElementY + (BOX_HEIGHT / 2) + 12; @@ -114,9 +114,9 @@ private static void renderDisabledStatus(GuiGraphics gg, Font font, int centerX, int paddingX = 6; int paddingY = 3; - gg.fill(centerX - (textWidth / 2) - paddingX, badgeY - paddingY, + graphics.fill(centerX - (textWidth / 2) - paddingX, badgeY - paddingY, centerX + (textWidth / 2) + paddingX, badgeY + 9 + paddingY, 0x55FF5555); - gg.drawCenteredString(font, DISABLED_BADGE, centerX, badgeY, 0xFFFF5555); + graphics.centeredText(font, DISABLED_BADGE, centerX, badgeY, 0xFFFF5555); } private static int getTargetX(int centerX, boolean isCascade, boolean isHorizontal, int index) { @@ -129,7 +129,7 @@ private static int getTargetY(int centerY, boolean isCascade, boolean isHorizont return centerY + (index - 1) * SPACING_Y; } - private static void drawBoxOutline(GuiGraphics gg, int centerX, int targetY, int boxWidth, int color) { + private static void drawBoxOutline(GuiGraphicsExtractor graphics, int centerX, int targetY, int boxWidth, int color) { int halfW = boxWidth / 2; int halfH = BOX_HEIGHT / 2; @@ -143,25 +143,25 @@ private static void drawBoxOutline(GuiGraphics gg, int centerX, int targetY, int // Upper face for (int x = x1; x < x2; x += step) { int endX = Math.min(x + dashLength, x2); - gg.fill(x, y1, endX, y1 + 1, color); + graphics.fill(x, y1, endX, y1 + 1, color); } // Bottom face for (int x = x1; x < x2; x += step) { int endX = Math.min(x + dashLength, x2); - gg.fill(x, y2 - 1, endX, y2, color); + graphics.fill(x, y2 - 1, endX, y2, color); } // Left face for (int y = y1 + 1; y < y2 - 1; y += step) { int endY = Math.min(y + dashLength, y2 - 1); - gg.fill(x1, y, x1 + 1, endY, color); + graphics.fill(x1, y, x1 + 1, endY, color); } // Right face for (int y = y1 + 1; y < y2 - 1; y += step) { int endY = Math.min(y + dashLength, y2 - 1); - gg.fill(x2 - 1, y, x2, endY, color); + graphics.fill(x2 - 1, y, x2, endY, color); } } diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/screens/EaseGUIAbstractSplitScreen.java b/common/src/main/java/net/weyne1/easegui/client/gui/screens/EaseGUIAbstractSplitScreen.java index 464b457..4a55522 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/screens/EaseGUIAbstractSplitScreen.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/screens/EaseGUIAbstractSplitScreen.java @@ -2,7 +2,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.StringWidget; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -72,20 +72,20 @@ protected void init() { protected abstract Component getRightSubtitle(); - protected void renderOverlay(GuiGraphics gg, int mouseX, int mouseY, float partialTick) {} + protected void renderOverlay(GuiGraphicsExtractor gg, int mouseX, int mouseY, float partialTick) {} @Override - public void render(@NonNull GuiGraphics gg, int mouseX, int mouseY, float partialTick) { - super.render(gg, mouseX, mouseY, partialTick); + public void extractRenderState(@NonNull GuiGraphicsExtractor graphics, int mouseX, int mouseY, float partialTick) { + super.extractRenderState(graphics, mouseX, mouseY, partialTick); // Вертикальный разделитель по центру экрана - gg.fill(halfWidth - 1, 50, halfWidth + 1, this.height - 45, LINE_COLOR); + graphics.fill(halfWidth - 1, 50, halfWidth + 1, this.height - 45, LINE_COLOR); - renderOverlay(gg, mouseX, mouseY, partialTick); + renderOverlay(graphics, mouseX, mouseY, partialTick); } @Override public void onClose() { - Minecraft.getInstance().setScreen(this.parent); + Minecraft.getInstance().gui.setScreen(this.parent); } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/screens/MainConfigScreen.java b/common/src/main/java/net/weyne1/easegui/client/gui/screens/MainConfigScreen.java index 6a5eb02..f183e48 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/screens/MainConfigScreen.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/screens/MainConfigScreen.java @@ -107,7 +107,7 @@ protected void initScreen() { rightList.addHeader(Component.translatable(category.getTranslationKey()).getString()); for (EaseGUIScreenType type : categoryScreens) { - rightList.addButton(Button.builder(type.getDisplayName(), b -> openScreenConfig(type, config) + rightList.addButton(Button.builder(type.getDisplayName(), _ -> openScreenConfig(type, config) ).build()); } } @@ -115,7 +115,7 @@ protected void initScreen() { rightList.addButton(Button.builder( EaseGUIScreenRegistry.OTHER.getDisplayName(), - b -> mc.setScreen(new ScreenSpecificConfigScreen(this, EaseGUIScreenRegistry.OTHER)) + _ -> mc.gui.setScreen(new ScreenSpecificConfigScreen(this, EaseGUIScreenRegistry.OTHER)) ).build()); this.addRenderableWidget(rightList); @@ -124,7 +124,7 @@ protected void initScreen() { // ================= НИЖНЯЯ ПАНЕЛЬ ================= this.addRenderableWidget(Button.builder( Component.translatable("easegui.generic.done"), - b -> onClose() + _ -> onClose() ).bounds(halfWidth - 100, this.height - 30, 200, 20).build()); } @@ -145,11 +145,11 @@ private void openScreenConfig(EaseGUIScreenType type, EaseGUIConfig config) { EnumSet allowedFeatures = WidgetCategory.CONTAINERS.getAllowedFeatures(); - this.minecraft.setScreen(new ProfileEditorScreen(this, originalProfile, defaultProfile, allowedFeatures, + this.minecraft.gui.setScreen(new ProfileEditorScreen(this, originalProfile, defaultProfile, allowedFeatures, updatedProfile -> {screenConfig.customProfiles.put(WidgetCategory.CONTAINERS, updatedProfile); ConfigManager.save(); } )); } else { - this.minecraft.setScreen(new ScreenSpecificConfigScreen(this, type)); + this.minecraft.gui.setScreen(new ScreenSpecificConfigScreen(this, type)); } } @@ -160,7 +160,7 @@ private void addGlobalProfileButton(SettingsScrollList list, EaseGUIConfig confi list.addButton(Button.builder( Component.translatable(translationKey), - button -> mc.setScreen(new ProfileEditorScreen( + _ -> mc.gui.setScreen(new ProfileEditorScreen( this, config.global.elementProfiles.getOrDefault(category, new AnimationProfile()), finalCleanDefault, diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/screens/ProfileEditorScreen.java b/common/src/main/java/net/weyne1/easegui/client/gui/screens/ProfileEditorScreen.java index 89896fb..82fbed7 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/screens/ProfileEditorScreen.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/screens/ProfileEditorScreen.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.gui.screens; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.screens.Screen; @@ -57,7 +57,7 @@ protected void initScreen() { Button resetBtn = Button.builder( Component.translatable("easegui.generic.reset"), - button -> { + _ -> { applyProfileValues(this.workingCopy, this.defaultProfile); this.init(this.width, this.height); } @@ -142,8 +142,8 @@ protected void initScreen() { this.addRenderableWidget(leftScrollList); // Кнопки управления снизу - this.addRenderableWidget(Button.builder(Component.translatable("easegui.generic.save"), b -> saveAndClose()).bounds(halfWidth - 105, this.height - 30, 100, 20).build()); - this.addRenderableWidget(Button.builder(Component.translatable("easegui.generic.cancel"), b -> onClose()).bounds(halfWidth + 5, this.height - 30, 100, 20).build()); + this.addRenderableWidget(Button.builder(Component.translatable("easegui.generic.save"), _ -> saveAndClose()).bounds(halfWidth - 105, this.height - 30, 100, 20).build()); + this.addRenderableWidget(Button.builder(Component.translatable("easegui.generic.cancel"), _ -> onClose()).bounds(halfWidth + 5, this.height - 30, 100, 20).build()); } private EditBox createTextField(String value) { @@ -167,7 +167,7 @@ private void saveAndClose() { } @Override - protected void renderOverlay(GuiGraphics gg, int mouseX, int mouseY, float partialTick) { + protected void renderOverlay(GuiGraphicsExtractor gg, int mouseX, int mouseY, float partialTick) { ProfilePreviewRenderer.render(gg, this.font, this.width, this.height, this.workingCopy, this.activeFeatures); } diff --git a/common/src/main/java/net/weyne1/easegui/client/gui/screens/ScreenSpecificConfigScreen.java b/common/src/main/java/net/weyne1/easegui/client/gui/screens/ScreenSpecificConfigScreen.java index f2ad615..8c9100f 100644 --- a/common/src/main/java/net/weyne1/easegui/client/gui/screens/ScreenSpecificConfigScreen.java +++ b/common/src/main/java/net/weyne1/easegui/client/gui/screens/ScreenSpecificConfigScreen.java @@ -36,7 +36,7 @@ protected void initScreen() { EaseGUIConfig.ScreenSettings settings = config.screens.get(screenType.getId()); if (settings == null) { - Minecraft.getInstance().setScreen(this.parent); + Minecraft.getInstance().gui.setScreen(this.parent); return; } @@ -92,7 +92,7 @@ protected void initScreen() { this.addRenderableWidget(rightScrollList); // Кнопка Назад - this.addRenderableWidget(Button.builder(Component.translatable("easegui.generic.back"), b -> onClose()) + this.addRenderableWidget(Button.builder(Component.translatable("easegui.generic.back"), _ -> onClose()) .bounds(halfWidth - 100, this.height - 30, 200, 20).build()); } @@ -121,12 +121,12 @@ private void setupCategoryButtons(SettingsScrollList rightScrollList, EaseGUICon if (cleanDefault == null) cleanDefault = new AnimationProfile(); AnimationProfile finalCleanDefault = cleanDefault; - Button editBtn = Button.builder(Component.translatable("easegui.generic.configure"), btn -> { + Button editBtn = Button.builder(Component.translatable("easegui.generic.configure"), _ -> { var profile = settings.customProfiles.getOrDefault(category, new AnimationProfile()); EnumSet allowedFeatures = category.getAllowedFeatures(); - Minecraft.getInstance().setScreen(new ProfileEditorScreen(this, profile, finalCleanDefault, allowedFeatures, updated -> { + Minecraft.getInstance().gui.setScreen(new ProfileEditorScreen(this, profile, finalCleanDefault, allowedFeatures, updated -> { settings.customProfiles.put(category, updated); ConfigManager.save(); })); diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/GameRendererMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/GameRendererMixin.java index 672f0d5..65fa904 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/GameRendererMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/GameRendererMixin.java @@ -13,7 +13,7 @@ public class GameRendererMixin { @Inject(method = "render", at = @At("HEAD")) - private void easeGUI$onFrameStart(DeltaTracker deltaTracker, boolean renderLevel, CallbackInfo ci) { + private void easeGUI$onFrameStart(DeltaTracker deltaTracker, boolean advanceGameTime, CallbackInfo ci) { ScreenStateTracker.incrementFrame(); AnimationContext.resetFrameState(); } diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractSelectionListMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractSelectionListMixin.java index 0bfac78..184845b 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractSelectionListMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractSelectionListMixin.java @@ -2,7 +2,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.AbstractSelectionList; import net.minecraft.client.gui.layouts.LayoutElement; import net.weyne1.easegui.client.animation.AnimationContext; @@ -20,14 +20,14 @@ public abstract class AbstractSelectionListMixin { @Shadow public abstract int getRowWidth(); @WrapOperation( - method = "renderListItems", + method = "extractListItems", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/gui/components/AbstractSelectionList;renderItem(Lnet/minecraft/client/gui/GuiGraphics;IIFLnet/minecraft/client/gui/components/AbstractSelectionList$Entry;)V" + target = "Lnet/minecraft/client/gui/components/AbstractSelectionList;extractItem(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IIFLnet/minecraft/client/gui/components/AbstractSelectionList$Entry;)V" ) ) - private void easeGUI$wrapRenderItem(AbstractSelectionList instance, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, @Coerce Object item, Operation original) { - LayoutElement element = (LayoutElement) item; + private void easeGUI$wrapRenderItem(AbstractSelectionList instance, GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a, @Coerce Object entry, Operation original) { + LayoutElement element = (LayoutElement) entry; int left = this.getRowLeft(); int width = this.getRowWidth(); int top = element.getY(); @@ -35,8 +35,8 @@ public abstract class AbstractSelectionListMixin { AnimationContext.pushParentAnimation(); - try (AnimationScope ignored = ListItemAnimator.beginRender(guiGraphics, top, left, width, height)) { - original.call(instance, guiGraphics, mouseX, mouseY, partialTick, item); + try (AnimationScope ignored = ListItemAnimator.beginRender(graphics, top, left, width, height)) { + original.call(instance, graphics, mouseX, mouseY, a, entry); } finally { AnimationContext.popParentAnimation(); } diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractWidgetMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractWidgetMixin.java index 32422e5..47203d4 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractWidgetMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AbstractWidgetMixin.java @@ -3,7 +3,7 @@ import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import net.minecraft.util.Util; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.*; import net.weyne1.easegui.client.extension.WidgetExtension; import net.weyne1.easegui.client.animation.AnimationScope; @@ -37,22 +37,22 @@ public abstract class AbstractWidgetMixin implements WidgetExtension { return this.easeGUI$cachedCategory; } - @WrapMethod(method = "render") - private void easeGUI$wrapWidgetRender(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, Operation original) { + @WrapMethod(method = "extractRenderState") + private void easeGUI$wrapWidgetRender(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a, Operation original) { AbstractWidget widget = (AbstractWidget) (Object) this; if (!widget.visible) { - original.call(guiGraphics, mouseX, mouseY, partialTick); + original.call(graphics, mouseX, mouseY, a); return; } var category = this.easeGUI$getCategory(); if (category == null || category == WidgetCategory.UNKNOWN) { - original.call(guiGraphics, mouseX, mouseY, partialTick); + original.call(graphics, mouseX, mouseY, a); return; } - try (AnimationScope ignored = WidgetAnimator.beginRender(widget, guiGraphics, category, this.easeGUI$animationState)) { + try (AnimationScope ignored = WidgetAnimator.beginRender(widget, graphics, category, this.easeGUI$animationState)) { var profile = ConfigManager.getProfileForCurrentContext(category); boolean shouldBypassHover = false; @@ -68,11 +68,11 @@ public abstract class AbstractWidgetMixin implements WidgetExtension { boolean savedHover = this.isHovered; this.isHovered = false; - original.call(guiGraphics, mouseX, mouseY, partialTick); + original.call(graphics, mouseX, mouseY, a); this.isHovered = savedHover; } else { - original.call(guiGraphics, mouseX, mouseY, partialTick); + original.call(graphics, mouseX, mouseY, a); } } } diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AdvancementsScreenMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AdvancementsScreenMixin.java index d37df27..ff09616 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AdvancementsScreenMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/AdvancementsScreenMixin.java @@ -2,7 +2,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.advancements.AdvancementTab; import net.minecraft.client.gui.screens.advancements.AdvancementsScreen; import net.weyne1.easegui.client.animation.AnimationContext; @@ -22,24 +22,24 @@ public class AdvancementsScreenMixin { // Main window animation @Inject( - method = "render", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/advancements/AdvancementsScreen;renderInside(Lnet/minecraft/client/gui/GuiGraphics;II)V") + method = "extractRenderState", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/advancements/AdvancementsScreen;extractInside(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V") ) - private void easeGUI$preRenderWindow(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, CallbackInfo ci) { + private void easeGUI$preRenderWindow(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a, CallbackInfo ci) { if (this.easeGUI$windowScope != null) { this.easeGUI$windowScope.close(); AnimationContext.popParentAnimation(); } - this.easeGUI$windowScope = AdvancementsAnimator.beginRenderWindow((AdvancementsScreen) (Object) this, guiGraphics); + this.easeGUI$windowScope = AdvancementsAnimator.beginRenderWindow((AdvancementsScreen) (Object) this, graphics); if (this.easeGUI$windowScope != null) { AnimationContext.pushParentAnimation(); } } - @Inject(method = "render", at = @At("RETURN")) - private void easeGUI$postRenderWindow(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, CallbackInfo ci) { + @Inject(method = "extractRenderState", at = @At("RETURN")) + private void easeGUI$postRenderWindow(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a, CallbackInfo ci) { if (this.easeGUI$windowScope != null) { this.easeGUI$windowScope.close(); this.easeGUI$windowScope = null; @@ -49,29 +49,29 @@ public class AdvancementsScreenMixin { // Tab animation (bg) @WrapOperation( - method = "renderWindow", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/advancements/AdvancementTab;drawTab(Lnet/minecraft/client/gui/GuiGraphics;IIIIZ)V") + method = "extractWindow", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/advancements/AdvancementTab;extractTab(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IIIIZ)V") ) - private void easeGUI$wrapDrawTab(AdvancementTab tab, GuiGraphics guiGraphics, int x, int y, int mouseX, int mouseY, boolean selected, Operation original) { + private void easeGUI$wrapDrawTab(AdvancementTab tab, GuiGraphicsExtractor graphics, int xo, int yo, int mouseX, int mouseY, boolean selected, Operation original) { AdvancementsScreen screen = (AdvancementsScreen) (Object) this; int index = ((AdvancementTabAccessor) tab).easeGUI$getIndex(); - try (AnimationScope ignored = AdvancementsAnimator.beginRenderTab(screen, guiGraphics, index)) { - original.call(tab, guiGraphics, x, y, mouseX, mouseY, selected); + try (AnimationScope ignored = AdvancementsAnimator.beginRenderTab(screen, graphics, index)) { + original.call(tab, graphics, xo, yo, mouseX, mouseY, selected); } } // Tab animation (fg/icons) @WrapOperation( - method = "renderWindow", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/advancements/AdvancementTab;drawIcon(Lnet/minecraft/client/gui/GuiGraphics;II)V") + method = "extractWindow", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/advancements/AdvancementTab;extractIcon(Lnet/minecraft/client/gui/GuiGraphicsExtractor;II)V") ) - private void easeGUI$wrapDrawIcon(AdvancementTab tab, GuiGraphics guiGraphics, int offsetX, int offsetY, Operation original) { + private void easeGUI$wrapDrawIcon(AdvancementTab tab, GuiGraphicsExtractor graphics, int xo, int yo, Operation original) { AdvancementsScreen screen = (AdvancementsScreen) (Object) this; int index = ((AdvancementTabAccessor) tab).easeGUI$getIndex(); - try (AnimationScope ignored = AdvancementsAnimator.beginRenderTab(screen, guiGraphics, index)) { - original.call(tab, guiGraphics, offsetX, offsetY); + try (AnimationScope ignored = AdvancementsAnimator.beginRenderTab(screen, graphics, index)) { + original.call(tab, graphics, xo, yo); } } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiGraphicsMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiGraphicsExtractorMixin.java similarity index 59% rename from common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiGraphicsMixin.java rename to common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiGraphicsExtractorMixin.java index 1780077..fc0f65b 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiGraphicsMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiGraphicsExtractorMixin.java @@ -2,63 +2,68 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.navigation.ScreenRectangle; -import net.minecraft.client.gui.render.state.pip.*; import net.minecraft.client.model.Model; import net.minecraft.client.model.object.banner.BannerFlagModel; import net.minecraft.client.model.object.book.BookModel; -import net.minecraft.client.model.player.PlayerModel; import net.minecraft.client.renderer.entity.state.EntityRenderState; +import net.minecraft.client.renderer.state.gui.pip.GuiBannerResultRenderState; +import net.minecraft.client.renderer.state.gui.pip.GuiBookModelRenderState; +import net.minecraft.client.renderer.state.gui.pip.GuiEntityRenderState; +import net.minecraft.client.renderer.state.gui.pip.GuiSkinRenderState; import net.minecraft.resources.Identifier; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.block.entity.BannerPatternLayers; -import net.minecraft.world.level.block.state.properties.WoodType; import net.weyne1.easegui.client.animation.AnimationContext; import net.weyne1.easegui.client.animation.PipTransform; import net.weyne1.easegui.client.util.ColorUtils; -import org.joml.Quaternionf; -import org.joml.Vector3f; +import org.joml.Quaternionfc; +import org.joml.Vector3fc; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -@SuppressWarnings("ModifyVariableMayUseName") -@Mixin(GuiGraphics.class) -public class GuiGraphicsMixin { +@Mixin(GuiGraphicsExtractor.class) +public class GuiGraphicsExtractorMixin { - @ModifyVariable(method = "submitColoredRectangle", at = @At("HEAD"), argsOnly = true, ordinal = 4) - private int easeGUI$modifyColorFrom(int colorFrom) { - if (!AnimationContext.isActive()) return colorFrom; - return ColorUtils.getAnimatedColor(colorFrom); + @ModifyVariable(method = "fillGradient", at = @At("HEAD"), argsOnly = true, name = "col1") + private int easeGUI$modifyColorFrom(int col1) { + if (!AnimationContext.isActive()) return col1; + return ColorUtils.getAnimatedColor(col1); } - @ModifyVariable(method = "submitColoredRectangle", at = @At("HEAD"), argsOnly = true, ordinal = 0) - private Integer easeGUI$modifyColorTo(Integer colorTo) { - if (!AnimationContext.isActive() || colorTo == null) return colorTo; - return ColorUtils.getAnimatedColor(colorTo); + @ModifyVariable(method = "fillGradient", at = @At("HEAD"), argsOnly = true, name = "col2") + private int easeGUI$modifyColorTo(int col2) { + if (!AnimationContext.isActive()) return col2; + return ColorUtils.getAnimatedColor(col2); } - @ModifyVariable(method = "submitBlit", at = @At("HEAD"), argsOnly = true, ordinal = 4) + @ModifyVariable(method = "innerFill", at = @At("HEAD"), argsOnly = true, name = "color1") + private int easeGUI$modifyFillColor(int color1) { + if (!AnimationContext.isActive()) return color1; + return ColorUtils.getAnimatedColor(color1); + } + + @ModifyVariable(method = "innerBlit*", at = @At("HEAD"), argsOnly = true, name = "color") private int easeGUI$modifyBlitColor(int color) { if (!AnimationContext.isActive()) return color; return ColorUtils.getAnimatedColor(color); } - @ModifyVariable(method = "submitTiledBlit", at = @At("HEAD"), argsOnly = true, ordinal = 6) + @ModifyVariable(method = "innerTiledBlit", at = @At("HEAD"), argsOnly = true, name = "color") private int easeGUI$modifyTiledBlitColor(int color) { if (!AnimationContext.isActive()) return color; return ColorUtils.getAnimatedColor(color); } @WrapOperation( - method = "submitEntityRenderState", - at = @At(value = "NEW", target = "Lnet/minecraft/client/gui/render/state/pip/GuiEntityRenderState;") + method = "entity", + at = @At(value = "NEW", target = "Lnet/minecraft/client/renderer/state/gui/pip/GuiEntityRenderState;") ) private GuiEntityRenderState easeGUI$transformEntity( - EntityRenderState renderState, Vector3f translation, Quaternionf rotation, Quaternionf overrideCameraAngle, - int x0, int y0, int x1, int y1, float scale, ScreenRectangle scissorArea, - Operation original) { + EntityRenderState renderState, Vector3fc translation, Quaternionfc rotation, Quaternionfc overrideCameraAngle, + int x0, int y0, int x1, int y1, float scale, ScreenRectangle scissorArea, Operation original) { int[] xs = PipTransform.transformRangeX(x0, x1); int[] ys = PipTransform.transformRangeY(y0, y1); @@ -70,8 +75,8 @@ public class GuiGraphicsMixin { } @WrapOperation( - method = "submitBookModelRenderState", - at = @At(value = "NEW", target = "Lnet/minecraft/client/gui/render/state/pip/GuiBookModelRenderState;") + method = "book", + at = @At(value = "NEW", target = "Lnet/minecraft/client/renderer/state/gui/pip/GuiBookModelRenderState;") ) private GuiBookModelRenderState easeGUI$transformBook( BookModel bookModel, Identifier texture, float _open, float flip, @@ -87,11 +92,11 @@ public class GuiGraphicsMixin { } @WrapOperation( - method = "submitSkinRenderState", - at = @At(value = "NEW", target = "Lnet/minecraft/client/gui/render/state/pip/GuiSkinRenderState;") + method = "skin", + at = @At(value = "NEW", target = "Lnet/minecraft/client/renderer/state/gui/pip/GuiSkinRenderState;") ) private GuiSkinRenderState easeGUI$transformSkin( - PlayerModel playerModel, Identifier texture, float rotationX, float rotationY, float pivotY, + Model.Simple playerModel, Identifier texture, float rotationX, float rotationY, float pivotY, int x0, int y0, int x1, int y1, float scale, ScreenRectangle scissorArea, Operation original) { int[] xs = PipTransform.transformRangeX(x0, x1); @@ -104,8 +109,8 @@ public class GuiGraphicsMixin { } @WrapOperation( - method = "submitBannerPatternRenderState", - at = @At(value = "NEW", target = "Lnet/minecraft/client/gui/render/state/pip/GuiBannerResultRenderState;") + method = "bannerPattern", + at = @At(value = "NEW", target = "Lnet/minecraft/client/renderer/state/gui/pip/GuiBannerResultRenderState;") ) private GuiBannerResultRenderState easeGUI$transformBanner( BannerFlagModel flag, DyeColor baseColor, BannerPatternLayers resultBannerPatterns, @@ -117,22 +122,4 @@ public class GuiGraphicsMixin { return original.call(flag, baseColor, resultBannerPatterns, xs[0], ys[0], xs[1], ys[1], scissorArea); } - - @WrapOperation( - method = "submitSignRenderState", - at = @At(value = "NEW", target = "Lnet/minecraft/client/gui/render/state/pip/GuiSignRenderState;") - ) - private GuiSignRenderState easeGUI$transformSign( - Model.Simple signModel, WoodType woodType, int x0, int y0, int x1, int y1, float scale, ScreenRectangle scissorArea, - Operation original) { - - int[] xs = PipTransform.transformRangeX(x0, x1); - int[] ys = PipTransform.transformRangeY(y0, y1); - - return original.call( - signModel, woodType, - xs[0], ys[0], xs[1], ys[1], - PipTransform.scale(scale), scissorArea - ); - } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiItemRenderStateMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiItemRenderStateMixin.java index 3447d8f..8234d74 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiItemRenderStateMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiItemRenderStateMixin.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.mixin.gui; -import net.minecraft.client.gui.render.state.GuiItemRenderState; +import net.minecraft.client.renderer.state.gui.GuiItemRenderState; import net.weyne1.easegui.client.animation.AnimationContext; import net.weyne1.easegui.client.extension.ItemExtension; import org.spongepowered.asm.mixin.Mixin; diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/MinecraftMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiMixin.java similarity index 69% rename from common/src/main/java/net/weyne1/easegui/client/mixin/MinecraftMixin.java rename to common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiMixin.java index d53b874..46aad57 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/MinecraftMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiMixin.java @@ -1,6 +1,6 @@ -package net.weyne1.easegui.client.mixin; +package net.weyne1.easegui.client.mixin.gui; -import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.screens.Screen; import net.weyne1.easegui.client.animator.BackgroundAnimator; import org.spongepowered.asm.mixin.Mixin; @@ -9,22 +9,21 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(Minecraft.class) -public class MinecraftMixin { - @Shadow - public Screen screen; +@Mixin(Gui.class) +public class GuiMixin { + @Shadow private Screen screen; @Inject(method = "setScreen", at = @At("HEAD")) - private void easeGUI$onScreenTransition(Screen guiScreen, CallbackInfo ci) { + private void easeGUI$onScreenTransition(Screen screen, CallbackInfo ci) { Screen oldScreen = this.screen; - if (!BackgroundAnimator.shouldAnimateBackground(guiScreen)) { + if (!BackgroundAnimator.shouldAnimateBackground(screen)) { BackgroundAnimator.skipBackgroundFade = true; return; } boolean wasBlurred = BackgroundAnimator.shouldAnimateBackground(oldScreen); - boolean willBeBlurred = BackgroundAnimator.shouldAnimateBackground(guiScreen); + boolean willBeBlurred = BackgroundAnimator.shouldAnimateBackground(screen); BackgroundAnimator.skipBackgroundFade = wasBlurred && willBeBlurred; } diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiRendererMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiRendererMixin.java index abe81df..f667042 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiRendererMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiRendererMixin.java @@ -4,37 +4,37 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.blaze3d.pipeline.RenderPipeline; import net.minecraft.client.gui.navigation.ScreenRectangle; -import net.minecraft.client.gui.render.TextureSetup; -import net.minecraft.client.gui.render.state.BlitRenderState; -import net.minecraft.client.gui.render.state.GuiItemRenderState; +import net.minecraft.client.gui.render.GuiItemAtlas; import net.minecraft.client.gui.render.GuiRenderer; +import net.minecraft.client.gui.render.TextureSetup; +import net.minecraft.client.renderer.state.gui.BlitRenderState; +import net.minecraft.client.renderer.state.gui.GuiItemRenderState; import net.weyne1.easegui.client.extension.ItemExtension; -import org.joml.Matrix3x2f; +import org.joml.Matrix3x2fc; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(GuiRenderer.class) public class GuiRendererMixin { - @SuppressWarnings("NameDoesntMatchTargetClass") @WrapOperation( method = "submitBlitFromItemAtlas", - at = @At(value = "NEW", target = "Lnet/minecraft/client/gui/render/state/BlitRenderState;") + at = @At(value = "NEW", target = "Lnet/minecraft/client/renderer/state/gui/BlitRenderState;") ) private BlitRenderState easeGUI$applyStoredAlphaToItems( - RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, + RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2fc pose, int x0, int y0, int x1, int y1, float u0, float u1, float v0, float v1, int color, ScreenRectangle scissorArea, ScreenRectangle bounds, Operation original, - GuiItemRenderState renderState, float x, float y, int itemSize, int atlasSize) { - float alpha = ((ItemExtension) (Object) renderState).easegui$getAlpha(); + GuiItemRenderState itemState, GuiItemAtlas.SlotView slotView) { + + float alpha = ((ItemExtension) (Object) itemState).easegui$getAlpha(); if (alpha >= 1.0f) { return original.call(pipeline, textureSetup, pose, x0, y0, x1, y1, u0, u1, v0, v1, color, scissorArea, bounds); } int a = (int) (alpha * 255) & 0xFF; - int premultipliedColor = (a << 24) | (a << 16) | (a << 8) | a; return original.call(pipeline, textureSetup, pose, x0, y0, x1, y1, u0, u1, v0, v1, premultipliedColor, scissorArea, bounds); diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiTextRenderStateMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiTextRenderStateMixin.java index 00a091a..14c7676 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiTextRenderStateMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/GuiTextRenderStateMixin.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.mixin.gui; -import net.minecraft.client.gui.render.state.GuiTextRenderState; +import net.minecraft.client.renderer.state.gui.GuiTextRenderState; import net.weyne1.easegui.client.animation.AnimationContext; import net.weyne1.easegui.client.util.ColorUtils; import org.spongepowered.asm.mixin.Mixin; diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/ScreenMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/ScreenMixin.java index 32fa162..d9374af 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/ScreenMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/ScreenMixin.java @@ -4,7 +4,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.Screen; import net.weyne1.easegui.client.extension.ContainerScreenExtension; import net.weyne1.easegui.client.animation.AnimationContext; @@ -24,31 +24,31 @@ public abstract class ScreenMixin { @Final @Shadow protected Minecraft minecraft; - @Shadow protected abstract void renderBlurredBackground(GuiGraphics guiGraphics); + @Shadow protected abstract void extractBlurredBackground(GuiGraphicsExtractor graphics); // Container lifecycle - @WrapMethod(method = "renderWithTooltipAndSubtitles") - private void easeGUI$wrapScreenRender(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick, Operation original) { + @WrapMethod(method = "extractRenderStateWithTooltipAndSubtitles") + private void easeGUI$wrapScreenRender(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a, Operation original) { if (RenderSystem.isOnRenderThread() && this instanceof ContainerScreenExtension) { - try (AnimationScope ignored = ContainerAnimator.beginAnimation((Screen) (Object) this, guiGraphics)) { + try (AnimationScope ignored = ContainerAnimator.beginAnimation((Screen) (Object) this, graphics)) { AnimationContext.pushParentAnimation(); - original.call(guiGraphics, mouseX, mouseY, partialTick); + original.call(graphics, mouseX, mouseY, a); AnimationContext.popParentAnimation(); } } else { - original.call(guiGraphics, mouseX, mouseY, partialTick); + original.call(graphics, mouseX, mouseY, a); } } // Transparent background (blur / dim) - @WrapMethod(method = "renderTransparentBackground") - private void easeGUI$wrapTransparentBackground(GuiGraphics guiGraphics, Operation original) { + @WrapMethod(method = "extractTransparentBackground") + private void easeGUI$wrapTransparentBackground(GuiGraphicsExtractor graphics, Operation original) { AnimationScope currentScope = AnimationContext.getCurrentScope(); if (currentScope != null) currentScope.suspend(); @@ -56,12 +56,12 @@ public abstract class ScreenMixin { Screen currentScreen = (Screen) (Object) this; boolean blurContainers = ConfigManager.getConfig().global.blurContainers; - if (this.minecraft != null && this.minecraft.level != null && this.minecraft.screen == (Object) this + if (this.minecraft != null && this.minecraft.level != null && this.minecraft.gui.screen() == (Object) this && blurContainers && BackgroundAnimator.shouldAnimateBackground(currentScreen)) { - this.renderBlurredBackground(guiGraphics); + this.extractBlurredBackground(graphics); } - original.call(guiGraphics); + original.call(graphics); } finally { if (currentScope != null) currentScope.resume(); } @@ -69,13 +69,13 @@ public abstract class ScreenMixin { // Menu background - @WrapMethod(method = "renderMenuBackground(Lnet/minecraft/client/gui/GuiGraphics;)V") - private void easeGUI$wrapMenuBackground(GuiGraphics guiGraphics, Operation original) { + @WrapMethod(method = "extractMenuBackground(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V") + private void easeGUI$wrapMenuBackground(GuiGraphicsExtractor graphics, Operation original) { AnimationScope currentScope = AnimationContext.getCurrentScope(); if (currentScope != null) currentScope.suspend(); - try (AnimationScope ignored = BackgroundAnimator.beginRenderMenu((Screen) (Object) this, guiGraphics)) { - original.call(guiGraphics); + try (AnimationScope ignored = BackgroundAnimator.beginRenderMenu((Screen) (Object) this, graphics)) { + original.call(graphics); } finally { if (currentScope != null) currentScope.resume(); } @@ -84,8 +84,8 @@ public abstract class ScreenMixin { // Gradient color @ModifyArgs( - method = "renderTransparentBackground(Lnet/minecraft/client/gui/GuiGraphics;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fillGradient(IIIIII)V") + method = "extractTransparentBackground(Lnet/minecraft/client/gui/GuiGraphicsExtractor;)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphicsExtractor;fillGradient(IIIIII)V") ) private void easeGUI$modifyTransparentBgColors(Args args) { Screen currentScreen = (Screen) (Object) this; diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/container/AbstractContainerScreenMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/container/AbstractContainerScreenMixin.java index 74ecd22..ae8452b 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/container/AbstractContainerScreenMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/container/AbstractContainerScreenMixin.java @@ -4,6 +4,7 @@ import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; import net.weyne1.easegui.client.extension.ContainerScreenExtension; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -12,8 +13,8 @@ public abstract class AbstractContainerScreenMixin extends Screen implements Con @Shadow protected int leftPos; @Shadow protected int topPos; - @Shadow protected int imageWidth; - @Shadow protected int imageHeight; + @Final @Shadow protected int imageWidth; + @Final @Shadow protected int imageHeight; protected AbstractContainerScreenMixin(Component title) { super(title); } diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/LogoRendererMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/LogoRendererMixin.java index b8dfb62..56413cf 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/LogoRendererMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/LogoRendererMixin.java @@ -1,6 +1,6 @@ package net.weyne1.easegui.client.mixin.gui.title; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.LogoRenderer; import net.weyne1.easegui.client.animator.LogoAnimator; import org.spongepowered.asm.mixin.Final; @@ -17,12 +17,12 @@ public class LogoRendererMixin { @Shadow @Final private boolean keepLogoThroughFade; @Inject( - method = "renderLogo(Lnet/minecraft/client/gui/GuiGraphics;IFI)V", + method = "extractRenderState(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IFI)V", at = @At("HEAD"), cancellable = true ) - private void easeGUI$overrideLogo(GuiGraphics guiGraphics, int screenWidth, float transparency, int height, CallbackInfo ci) { - if (LogoAnimator.render(guiGraphics, screenWidth, transparency, height, showEasterEgg, keepLogoThroughFade)) { + private void easeGUI$overrideLogo(GuiGraphicsExtractor graphics, int width, float alpha, int heightOffset, CallbackInfo ci) { + if (LogoAnimator.render(graphics, width, alpha, heightOffset, showEasterEgg, keepLogoThroughFade)) { ci.cancel(); } } diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/SplashRendererMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/SplashRendererMixin.java index 6996df5..5ed44a7 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/SplashRendererMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/SplashRendererMixin.java @@ -14,7 +14,7 @@ public class SplashRendererMixin { @WrapOperation( - method = "render", + method = "extractRenderState", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/gui/ActiveTextCollector;accept(Lnet/minecraft/client/gui/TextAlignment;IILnet/minecraft/client/gui/ActiveTextCollector$Parameters;Lnet/minecraft/network/chat/Component;)V" @@ -22,22 +22,22 @@ public class SplashRendererMixin { ) private void easeGUI$animateSplash( ActiveTextCollector collector, - TextAlignment textAlignment, - int x, + TextAlignment alignment, + int anchorX, int y, ActiveTextCollector.Parameters parameters, Component text, Operation original ) { if (text == null || text.getString().isBlank()) { - original.call(collector, textAlignment, x, y, parameters, text); + original.call(collector, alignment, anchorX, y, parameters, text); return; } ActiveTextCollector.Parameters animatedParams = SplashAnimator.getAnimatedParameters(parameters); if (animatedParams != null) { - original.call(collector, textAlignment, x, y, animatedParams, text); + original.call(collector, alignment, anchorX, y, animatedParams, text); } } } \ No newline at end of file diff --git a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/TitleScreenMixin.java b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/TitleScreenMixin.java index 0e88ea2..0c62e35 100644 --- a/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/TitleScreenMixin.java +++ b/common/src/main/java/net/weyne1/easegui/client/mixin/gui/title/TitleScreenMixin.java @@ -2,7 +2,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.LogoRenderer; import net.minecraft.client.gui.screens.TitleScreen; import net.weyne1.easegui.client.config.ConfigManager; @@ -18,7 +18,7 @@ public class TitleScreenMixin { * while preserving vanilla transitions if the screen animation is disabled. */ @WrapOperation( - method = "render", + method = "extractRenderState", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/TitleScreen;fadeWidgets(F)V" @@ -35,20 +35,20 @@ public class TitleScreenMixin { } @WrapOperation( - method = "render", + method = "extractRenderState", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/gui/components/LogoRenderer;renderLogo(Lnet/minecraft/client/gui/GuiGraphics;IF)V" + target = "Lnet/minecraft/client/gui/components/LogoRenderer;extractRenderState(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IF)V" ) ) - private void easeGUI$conditionallyFadeLogo(LogoRenderer instance, GuiGraphics guiGraphics, int screenWidth, float transparency, Operation original) { + private void easeGUI$conditionallyFadeLogo(LogoRenderer instance, GuiGraphicsExtractor graphics, int width, float alpha, Operation original) { var titleSettings = ConfigManager.getConfig().screens.get("title"); if (titleSettings != null && titleSettings.enabled) { - original.call(instance, guiGraphics, screenWidth, 1.0F); + original.call(instance, graphics, width, 1.0F); return; } - original.call(instance, guiGraphics, screenWidth, transparency); + original.call(instance, graphics, width, alpha); } } \ No newline at end of file diff --git a/common/src/main/resources/assets/easegui/lang/en_us.json b/common/src/main/resources/assets/easegui/lang/en_us.json index 59a5412..8813b0d 100644 --- a/common/src/main/resources/assets/easegui/lang/en_us.json +++ b/common/src/main/resources/assets/easegui/lang/en_us.json @@ -133,7 +133,7 @@ "easegui.screen_type.statistics": "Statistics Screen", "easegui.screen_type.warning": "Warning & Notification Screens", "easegui.screen_type.pause": "Pause Menu", - "easegui.screen_type.share_to_lan": "LAN World", + "easegui.screen_type.multiplayer_options": "Multiplayer Options", "easegui.screen_type.death": "Death Screen", "easegui.screen_type.chat": "Chat Screen", "easegui.screen_type.social_interactions": "Social Interactions Screen", diff --git a/common/src/main/resources/assets/easegui/lang/ru_ru.json b/common/src/main/resources/assets/easegui/lang/ru_ru.json index 40b5c75..2a2eec8 100644 --- a/common/src/main/resources/assets/easegui/lang/ru_ru.json +++ b/common/src/main/resources/assets/easegui/lang/ru_ru.json @@ -134,7 +134,7 @@ "easegui.screen_type.statistics": "Окно статистики", "easegui.screen_type.warning": "Предупреждения и уведомления", "easegui.screen_type.pause": "Меню паузы", - "easegui.screen_type.share_to_lan": "Открыть для сети", + "easegui.screen_type.multiplayer_options": "Настройки игры по сети", "easegui.screen_type.death": "Экран смерти", "easegui.screen_type.chat": "Экран чата", "easegui.screen_type.social_interactions": "Сетевые взаимодействия", diff --git a/common/src/main/resources/easegui.mixins.json b/common/src/main/resources/easegui.mixins.json index 92ed8db..2d535ee 100644 --- a/common/src/main/resources/easegui.mixins.json +++ b/common/src/main/resources/easegui.mixins.json @@ -1,18 +1,18 @@ { "required": true, "package": "net.weyne1.easegui.client.mixin", - "compatibilityLevel": "JAVA_21", + "compatibilityLevel": "JAVA_25", "minVersion": "0.8", "client": [ "GameRendererMixin", - "MinecraftMixin", + "gui.GuiMixin", "OptionsMixin", "accessor.AdvancementTabAccessor", "accessor.LogoRendererAccessor", "gui.AbstractSelectionListMixin", "gui.AbstractWidgetMixin", "gui.AdvancementsScreenMixin", - "gui.GuiGraphicsMixin", + "gui.GuiGraphicsExtractorMixin", "gui.GuiItemRenderStateMixin", "gui.GuiRendererMixin", "gui.GuiTextRenderStateMixin", diff --git a/fabric/build.gradle b/fabric/build.gradle index 2fea682..91cdbbe 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -23,13 +23,13 @@ configurations { } dependencies { - modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" - modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version" + implementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" + implementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version" - modCompileOnly "com.terraformersmc:modmenu:${rootProject.mod_menu_version}" - modLocalRuntime "com.terraformersmc:modmenu:${rootProject.mod_menu_version}" + compileOnly "com.terraformersmc:modmenu:${rootProject.mod_menu_version}" + localRuntime "com.terraformersmc:modmenu:${rootProject.mod_menu_version}" - common(project(path: ':common', configuration: 'namedElements')) { transitive = false } + common(project(path: ':common')) { transitive = false } shadowBundle project(path: ':common', configuration: 'transformProductionFabric') } @@ -47,11 +47,30 @@ processResources { } } +jar { + archiveClassifier = "raw" +} + shadowJar { + dependsOn(jar) + mainSpec.sourcePaths.clear() + from(zipTree(jar.archiveFile)) + configurations = [project.configurations.shadowBundle] - archiveClassifier = 'dev-shadow' + archiveClassifier = null +} + +configurations { + apiElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } + runtimeElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } } -remapJar { - inputFile.set shadowJar.archiveFile +tasks.assemble { + dependsOn(shadowJar) } \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 09fb815..98ab843 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -32,7 +32,7 @@ "depends": { "fabricloader": ">=${fabric_loader_version}", "minecraft": "~${minecraft_version}", - "java": ">=21", + "java": ">=25", "fabric-api": ">=${fabric_api_version}" }, "suggests": { diff --git a/gradle.properties b/gradle.properties index 8ed2d15..99468d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.parallel=true org.gradle.configuration-cache=false # Minecraft properties -minecraft_version=1.21.11 +minecraft_version=26.2 # Mod Properties mod_version=0.4.2 @@ -14,12 +14,9 @@ maven_group=net.weyne1.easegui archives_name=easegui enabled_platforms=fabric,neoforge -# Mappings version. Find versions here: https://parchmentmc.org/docs/getting-started -parchment_version=2025.12.20 - # Dependencies -neoforge_version=21.11.0-beta +neoforge_version=26.2.0.0-beta fabric_loader_version=0.18.4 -fabric_api_version=0.139.4+1.21.11 -mod_menu_version=17.0.0-alpha.1 +fabric_api_version=0.152.1+26.2 +mod_menu_version=20.0.0 junit_version=5.13.4 \ No newline at end of file diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 4f90a20..e9ceb0a 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -25,7 +25,7 @@ configurations { dependencies { neoForge "net.neoforged:neoforge:$rootProject.neoforge_version" - common(project(path: ':common', configuration: 'namedElements')) { transitive = false } + common(project(path: ':common')) { transitive = false } shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge') } @@ -42,11 +42,30 @@ processResources { } } +jar { + archiveClassifier = "raw" +} + shadowJar { + dependsOn(jar) + mainSpec.sourcePaths.clear() + from(zipTree(jar.archiveFile)) + configurations = [project.configurations.shadowBundle] - archiveClassifier = 'dev-shadow' + archiveClassifier = null +} + +configurations { + apiElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } + runtimeElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } } -remapJar { - inputFile.set(shadowJar.archiveFile) +tasks.assemble { + dependsOn(shadowJar) } \ No newline at end of file