mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-24 05:44:30 +00:00
add mouse wheel plugin
This commit is contained in:
1 parent
dfc5185030
commit
288a8531af
7 files changed
+147
-6
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package com.github.vfyjxf.nee.utils;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class GuiUtils {
|
||||
public static Slot getSlotUnderMouse(GuiContainer guiContainer, int mouseX, int mouseY) {
|
||||
Method getSlotMethod = ReflectionHelper.findMethod(AEBaseGui.class, (AEBaseGui) guiContainer, new String[]{"getSlot"}, int.class, int.class);
|
||||
try {
|
||||
return (Slot) getSlotMethod.invoke(guiContainer,mouseX,mouseY);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user