Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ plugins {
id 'eclipse'
id 'maven-publish'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8'
id 'com.gtnewhorizons.retrofuturagradle' version '1.4.0'
id 'com.gtnewhorizons.retrofuturagradle' version '1.4.9'
id 'net.darkhax.curseforgegradle' version '1.1.24' apply false
id 'com.modrinth.minotaur' version '2.8.7' apply false
id 'com.diffplug.spotless' version '6.13.0' apply false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ public void scrollTo(float value, boolean animated, long duration)
@Redirect(method = "drawScreen(IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/GuiScrollingList;applyScrollLimits()V"))
public void utBindScrollDistance(GuiScrollingList guiSlot)
{
if (Mouse.isButtonDown(0)) target = scrollDistance = UTSmoothScrolling.clamp(scrollDistance, getMaxScroll(), 0);
if (Mouse.isButtonDown(0)) target = scrollDistance = UTSmoothScrolling.clamp(scrollDistance, getMaxScroll());
}

@Inject(method = "drawScreen(IIF)V", at = @At("HEAD"))
public void utRender(int int_1, int int_2, float delta, CallbackInfo callbackInfo)
{
float[] target = new float[] {this.target};
this.scrollDistance = UTSmoothScrolling.handleScrollingPosition(target, this.scrollDistance, this.getMaxScroll(), 20f / Minecraft.getDebugFPS(), (double) this.start, (double) this.duration);
this.target = target[0];
if (!Mouse.isButtonDown(0)) {
float[] target = new float[] {this.target};
this.scrollDistance = UTSmoothScrolling.handleScrollingPosition(target, this.scrollDistance, this.getMaxScroll(), 20f / Minecraft.getDebugFPS(), (double) this.start, (double) this.duration);
this.target = target[0];
}
if (lastContentHeight != getContentHeight())
{
if (lastContentHeight != -1) scrollDistance = this.target = UTSmoothScrolling.clamp(this.target, getMaxScroll(), 0);
Expand Down Expand Up @@ -162,8 +164,6 @@ public void utRenderScrollbar(int int_1, int int_2, float float_1, CallbackInfo
@Unique
private int getMaxScroll()
{
int max = this.getContentHeight() - (this.bottom - this.top) + 4;
if (max < 0) max /= 2;
return max;
return Math.max(0, this.getContentHeight() - (this.bottom - this.top - 4));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void utBindAmountScrolled(GuiSlot guiSlot)
@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I", remap = false), cancellable = true)
public void utHandleMouseScroll(CallbackInfo callbackInfo)
{
if (Mouse.isButtonDown(0) && this.getEnabled()) target = amountScrolled = UTSmoothScrolling.clamp(amountScrolled, getMaxScroll(), 0);
if (Mouse.isButtonDown(0) && this.getEnabled()) target = amountScrolled = UTSmoothScrolling.clamp(amountScrolled, getMaxScroll());
else
{
int wheel = Mouse.getEventDWheel();
Expand Down Expand Up @@ -108,12 +108,15 @@ public void scrollTo(float value, boolean animated, long duration)
@Inject(method = "drawScreen", at = @At("HEAD"))
public void utRender(int int_1, int int_2, float delta, CallbackInfo callbackInfo)
{
float[] target = new float[] {this.target};
this.amountScrolled = UTSmoothScrolling.handleScrollingPosition(target, this.amountScrolled, this.getMaxScroll(), 20f / Minecraft.getDebugFPS(), (double) this.start, (double) this.duration);
this.target = target[0];
if (!Mouse.isButtonDown(0))
{
float[] target = new float[] {this.target};
this.amountScrolled = UTSmoothScrolling.handleScrollingPosition(target, this.amountScrolled, this.getMaxScroll(), 20f / Minecraft.getDebugFPS(), (double) this.start, (double) this.duration);
this.target = target[0];
}
if (lastContentHeight != getContentHeight())
{
if (lastContentHeight != -1) amountScrolled = this.target = UTSmoothScrolling.clamp(this.target, getContentHeight(), 0);
if (lastContentHeight != -1) amountScrolled = this.target = UTSmoothScrolling.clamp(this.target, getMaxScroll(), 0);
lastContentHeight = getContentHeight();
}
}
Expand Down
Loading