blob: ca7439c27943eced28126eabed8e68432765b9ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package me.shedaniel.rei.mixin;
import net.minecraft.client.gui.GuiEventListener;
import net.minecraft.client.gui.ingame.AbstractPlayerInventoryScreen;
import net.minecraft.client.gui.ingame.PlayerInventoryScreen;
import net.minecraft.client.gui.ingame.RecipeBookProvider;
import net.minecraft.client.gui.recipebook.RecipeBookGui;
import net.minecraft.container.PlayerContainer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.TextComponent;
import org.spongepowered.asm.mixin.Final;
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.CallbackInfoReturnable;
@Mixin(PlayerInventoryScreen.class)
public abstract class MixinPlayerInventoryScreen extends AbstractPlayerInventoryScreen<PlayerContainer> implements RecipeBookProvider {
@Shadow
@Final
private RecipeBookGui recipeBook;
public MixinPlayerInventoryScreen(PlayerContainer container_1, PlayerInventory playerInventory_1, TextComponent textComponent_1) {
super(container_1, playerInventory_1, textComponent_1);
}
@Override
public GuiEventListener getFocused() {
return super.getFocused();
}
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
public void mouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> ci) {
if (recipeBook.mouseClicked(mouseX, mouseY, button)) {
method_1967(recipeBook);
ci.setReturnValue(true);
ci.cancel();
}
}
}
|