aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/ledger/mixin/MouseClickEventPatch.java
blob: 4e6e3608d775a0332aa1c76c82105071870689ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package moe.nea.ledger.mixin;

import moe.nea.ledger.events.GuiClickEvent;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraftforge.common.MinecraftForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiContainer.class)
public class MouseClickEventPatch {
    @Inject(method = "handleMouseClick", at = @At("HEAD"))
    private void onHandleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) {
        MinecraftForge.EVENT_BUS.post(new GuiClickEvent(slotIn, slotId, clickedButton, clickType));
    }
}