Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when search yields no results #22

Merged
merged 2 commits into from
Feb 21, 2025
Merged
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 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.15.0
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.15.0",
"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
Loading