From 4eb37e00fba26f00945733c52432859d0a65e19e Mon Sep 17 00:00:00 2001 From: JustAlittleWolf Date: Thu, 21 Dec 2023 14:16:35 +0100 Subject: [PATCH] Update to 1.20.4 --- gradle.properties | 8 ++++---- src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java | 9 +++------ src/main/resources/fabric.mod.json | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gradle.properties b/gradle.properties index 80355ec..b5f1142 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,11 +4,11 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.4 -loader_version=0.14.24 +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.3 +loader_version=0.15.3 # Mod Properties mod_version=1.1.2 maven_group=me.wolfii -archives_base_name=SmoothScrollingRefurbished+1.20.2 +archives_base_name=SmoothScrollingRefurbished+1.20.4 diff --git a/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java b/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java index 96eae6b..e4b1b8e 100644 --- a/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java +++ b/src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java @@ -17,12 +17,8 @@ public abstract class EntryListWidgetMixin { @Shadow private double scrollAmount; - @Shadow - protected int bottom; - @Shadow public abstract int getMaxScroll(); - @Unique private double animationTimer = 0; @Unique @@ -30,7 +26,7 @@ public abstract class EntryListWidgetMixin { @Unique private boolean renderSmooth = false; - @Inject(method = "render", at = @At("HEAD")) + @Inject(method = "renderWidget", at = @At("HEAD")) private void manipulateScrollAmount(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { renderSmooth = true; checkOutOfBounds(delta); @@ -72,11 +68,12 @@ private void setVelocity(EntryListWidget instance, double amount) { animationTimer = 0; } - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V")) + @Redirect(method = "renderWidget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V")) private void modifyScrollbar(DrawContext instance, Identifier texture, int x, int y, int width, int height) { if (scrollAmount < 0) { height -= ScrollMath.dampenSquish(Math.abs(scrollAmount), height); } + int bottom = ((EntryListWidget) (Object) this).getBottom(); if (y + height > bottom) { y = bottom - height; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index fbc6d4d..f268f4c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -19,7 +19,7 @@ ], "depends": { "fabricloader": ">=0.14.0", - "minecraft": "1.20.2", + "minecraft": ">1.20.2 <=1.20.4", "java": ">=17" } } \ No newline at end of file