-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when search yields no results
Signed-off-by: Lilly Rose Berner <lilly@lostluma.net>
- Loading branch information
1 parent
766730c
commit 15f6d17
Showing
4 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/terraformersmc/modmenu/mixin/ListWidgetMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters