Skip to content

Commit

Permalink
Fix crash when search yields no results
Browse files Browse the repository at this point in the history
Signed-off-by: Lilly Rose Berner <lilly@lostluma.net>
  • Loading branch information
LostLuma committed Feb 21, 2025
1 parent 062bdf2 commit a739fef
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ archives_base_name = modmenu
# Dependencies
minecraft_version = 1.12.2
feather_build = 19
fabric_loader_version = 0.14.22
fabric_loader_version = 0.16.10
quilt_loader_version = 0.19.2
osl_version = 0.10.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.terraformersmc.modmenu.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.gui.widget.ListWidget;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ListWidget.class)
public abstract class ListWidgetMixin {
@Shadow
protected abstract int getHeight();

@WrapOperation(method = "render(IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/ListWidget;getMaxScroll()I"))
private int skipBlock(ListWidget instance, Operation<Integer> operation) {
if (this.getHeight() == 0) {
return 0;
} else {
return operation.call(instance);
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"depends": {
"minecraft": "1.12.x",
"fabricloader": ">=0.14.21",
"fabricloader": ">=0.16.10",
"osl-entrypoints": ">=0.4.0",
"osl-resource-loader": ">=0.2.3"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/mixins.modmenu.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"client": [
"AccessorButtonWidget",
"InvokerScreen",
"ListWidgetMixin",
"MixinGameMenu",
"MixinTitleScreen"
],
Expand Down

0 comments on commit a739fef

Please sign in to comment.