111 lines
5.2 KiB
Java
111 lines
5.2 KiB
Java
package dev.pfaff.recipe_nope.mixin;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import dev.pfaff.recipe_nope.injector.UnconstrainedRedirect;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
|
|
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
|
|
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
|
|
import net.minecraft.world.inventory.RecipeBookMenu;
|
|
import net.minecraft.world.inventory.Slot;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Overwrite;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
@Mixin(InventoryScreen.class)
|
|
public abstract class InventoryScreenMixin extends EffectRenderingInventoryScreen {
|
|
public InventoryScreenMixin() {
|
|
super(null, null, null);
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@UnconstrainedRedirect(method = "<init>", at = @At(value = "NEW", target = "()Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;"))
|
|
private RecipeBookComponent constructor$skipNewRecipeBook() {
|
|
return null;
|
|
}
|
|
|
|
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;init(IILnet/minecraft/client/Minecraft;ZLnet/minecraft/world/inventory/RecipeBookMenu;)V"))
|
|
private void init$skipRecipeBookInit(RecipeBookComponent instance,
|
|
int p_100310_,
|
|
int p_100311_,
|
|
Minecraft p_100312_,
|
|
boolean p_100313_,
|
|
RecipeBookMenu<?> p_100314_) {}
|
|
|
|
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;updateScreenPosition(II)I"))
|
|
private int init$findLeftEdgeWithoutRecipeBook(RecipeBookComponent instance, int width, int backgroundWidth) {
|
|
return (width - backgroundWidth) / 2;
|
|
}
|
|
|
|
@Inject(method = "init", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;updateScreenPosition(II)I"), cancellable = true)
|
|
private void init$cancelRest(CallbackInfo ci) {
|
|
ci.cancel();
|
|
}
|
|
|
|
@Redirect(method = "containerTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;tick()V"))
|
|
private void init$skipRecipeBookUpdate(RecipeBookComponent instance) {}
|
|
|
|
@Overwrite
|
|
public void recipesUpdated() {
|
|
}
|
|
|
|
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;isVisible()Z"))
|
|
private boolean render$recipeBookNeverOpen(RecipeBookComponent instance) {
|
|
return false;
|
|
}
|
|
|
|
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V"))
|
|
private void render$skipRecipeBookRender(RecipeBookComponent instance,
|
|
PoseStack p_98875_,
|
|
int p_98876_,
|
|
int p_98877_,
|
|
float p_98878_) {
|
|
}
|
|
|
|
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;renderGhostRecipe(Lcom/mojang/blaze3d/vertex/PoseStack;IIZF)V"))
|
|
private void render$skipRecipeBookDrawGhostSlots(RecipeBookComponent instance,
|
|
PoseStack p_100323_,
|
|
int p_100324_,
|
|
int p_100325_,
|
|
boolean p_100326_,
|
|
float p_100327_) {
|
|
}
|
|
|
|
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;renderTooltip(Lcom/mojang/blaze3d/vertex/PoseStack;IIII)V"))
|
|
private void render$skipRecipeBookDrawTooltip(RecipeBookComponent instance,
|
|
PoseStack p_100362_,
|
|
int p_100363_,
|
|
int p_100364_,
|
|
int p_100365_,
|
|
int p_100366_) {
|
|
}
|
|
|
|
@Redirect(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;mouseClicked(DDI)Z"))
|
|
private boolean mouseClicked$skipRecipeBook(RecipeBookComponent instance, double mouseX, double mouseY, int button) {
|
|
return false;
|
|
}
|
|
|
|
@Redirect(method = "hasClickedOutside", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;hasClickedOutside(DDIIIII)Z"))
|
|
private boolean isClickOutsideBounds$skipRecipeBook(RecipeBookComponent instance,
|
|
double mouseX,
|
|
double mouseY,
|
|
int x,
|
|
int y,
|
|
int backgroundWidth,
|
|
int backgroundHeight,
|
|
int button) {
|
|
return true;
|
|
}
|
|
|
|
@Redirect(method = "slotClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;slotClicked(Lnet/minecraft/world/inventory/Slot;)V"))
|
|
private void onMouseClick$skipRecipeBook(RecipeBookComponent instance, Slot p_100315_) {
|
|
}
|
|
|
|
@Redirect(method = "removed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;removed()V"))
|
|
private void removed$skipRecipeBook(RecipeBookComponent instance) {
|
|
}
|
|
}
|