Created
February 4, 2016 15:52
-
-
Save Corosauce/6e9cce61145139e3718a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SubscribeEvent | |
@SideOnly(Side.CLIENT) | |
public void tickClient(ClientTickEvent event) { | |
try { | |
if (Minecraft.getMinecraft().currentScreen instanceof GuiInventory) { | |
GuiInventory gui = (GuiInventory) Minecraft.getMinecraft().currentScreen; | |
Slot slot = gui.getSlotUnderMouse(); | |
if (slot != null) { | |
int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, gui, "guiLeft"); | |
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, gui, "guiTop"); | |
Mouse.setCursorPosition(guiLeft + slot.xDisplayPosition + 8, guiTop + slot.yDisplayPosition + 8); | |
} | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment