From 625023a1b7c0e0b614c765417b0e5d36382aa4e4 Mon Sep 17 00:00:00 2001 From: JustAlittleWolf Date: Wed, 23 Oct 2024 14:42:26 +0200 Subject: [PATCH] feat: port to 1.21.2 --- build.gradle | 2 +- gradle.properties | 10 +++++----- .../java/me/wolfii/mixin/EntryListWidgetMixin.java | 9 ++++++--- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 5f442a4..cc9b264 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.8-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 024fac2..25bbbe9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,11 +5,11 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21 -yarn_mappings=1.21+build.1 -loader_version=0.15.11 +minecraft_version=1.21.2 +yarn_mappings=1.21.2+build.1 +loader_version=0.16.7 # Mod Properties -mod_version=1.1.5 +mod_version=1.2.0 maven_group=me.wolfii -archives_base_name=SmoothScrollingRefurbished+1.21 +archives_base_name=SmoothScrollingRefurbished+1.21.2 diff --git a/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java b/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java index 28fd995..24f950c 100644 --- a/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java +++ b/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java @@ -4,6 +4,7 @@ import me.wolfii.ScrollMath; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.widget.EntryListWidget; +import net.minecraft.client.render.RenderLayer; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -13,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.function.Function; + @Mixin(EntryListWidget.class) public abstract class EntryListWidgetMixin { @Shadow @@ -68,8 +71,8 @@ private void setVelocity(EntryListWidget instance, double amount) { animationTimer = 0; } - @Redirect(method = "renderWidget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V", ordinal = 1)) - private void modifyScrollbar(DrawContext instance, Identifier texture, int x, int y, int width, int height) { + @Redirect(method = "renderWidget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V", ordinal = 1)) + private void modifyScrollbar(DrawContext instance, Function renderLayers, Identifier sprite, int x, int y, int width, int height) { if (scrollAmount < 0) { height -= ScrollMath.dampenSquish(Math.abs(scrollAmount), height); } @@ -82,6 +85,6 @@ private void modifyScrollbar(DrawContext instance, Identifier texture, int x, in y += squish; height -= squish; } - instance.drawGuiTexture(texture, x, y, width, height); + instance.drawGuiTexture(renderLayers, sprite, x, y, width, height); } } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9726c78..2be781e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -20,7 +20,7 @@ ], "depends": { "fabricloader": ">=0.15.0", - "minecraft": "~1.21", + "minecraft": "~1.21.2", "java": ">=21" } } \ No newline at end of file