forked from OrnitheMC/modmenu
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
5 changed files
with
38 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
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
28 changes: 28 additions & 0 deletions
28
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,28 @@ | ||
package com.terraformersmc.modmenu.mixin; | ||
|
||
import com.llamalad7.mixinextras.expression.Definition; | ||
import com.llamalad7.mixinextras.expression.Expression; | ||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
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(); | ||
|
||
@Definition(id = "maxScroll", local = @Local(type = int.class, ordinal = 7)) | ||
@Expression("maxScroll > 0") | ||
@ModifyExpressionValue(method = "render(IIF)V", at = @At("MIXINEXTRAS:EXPRESSION")) | ||
private boolean skipBlock(boolean original) { | ||
if (this.getHeight() == 0) { | ||
return false; | ||
} else { | ||
return original; | ||
} | ||
} | ||
} |
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