Skip to content

Commit

Permalink
fix: stupid dumb no-good crash patches
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Jan 22, 2024
1 parent 8ba0aae commit aafb4f5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.pyke.vitri.finorza.inference.mixin.ducttape;

import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(RecipeBookComponent.class)
public class RecipeBookComponentMixin {
@Shadow
private EditBox searchBox;

@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", at = @At("HEAD"), cancellable = true)
private void render(CallbackInfo ci) {
if (searchBox == null) {
ci.cancel();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.pyke.vitri.finorza.inference.mixin.ducttape;

import java.util.List;

import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import net.minecraft.client.gui.screens.recipebook.RecipeButton;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(RecipeButton.class)
public abstract class RecipeButtonMixin {
@Shadow
protected abstract List<Recipe<?>> getOrderedRecipes();

@Inject(method = "Lnet/minecraft/client/gui/screens/recipebook/RecipeButton;renderButton(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", at = @At(value = "HEAD"), cancellable = true)
private void render(CallbackInfo ci) {
if (this.getOrderedRecipes().isEmpty()) {
ci.cancel();
}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/finorza.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"client": [
"ClientRecipeBookMixin",
"MinecraftMixin",
"ducttape.RecipeBookComponentMixin",
"ducttape.RecipeButtonMixin",
"input.KeyboardHandlerMixin",
"input.MouseHandlerMixin",
"input.ScreenMixin",
Expand Down

0 comments on commit aafb4f5

Please sign in to comment.