Skip to content

Commit

Permalink
feat: port to 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAlittleWolf committed Oct 23, 2024
1 parent 696ae46 commit 625023a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish'
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 6 additions & 3 deletions src/main/java/me/wolfii/mixin/EntryListWidgetMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, int width, int height) {
if (scrollAmount < 0) {
height -= ScrollMath.dampenSquish(Math.abs(scrollAmount), height);
}
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"depends": {
"fabricloader": ">=0.15.0",
"minecraft": "~1.21",
"minecraft": "~1.21.2",
"java": ">=21"
}
}

0 comments on commit 625023a

Please sign in to comment.