mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-18 19:29:16 +00:00
fix scroll
(cherry picked from commit f3bb27cf7a6e685f3bc5b60936e75616fff99f83)
This commit is contained in:
1 parent
a7919fe707
commit
958f853c0f
1 file changed
+14
-12
@@ -47,20 +47,22 @@ public class GuiHandler implements INEIGuiHandler {
|
||||
public void onRenderTick(TickEvent.RenderTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.START) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int dWheel = Mouse.getDWheel();
|
||||
boolean isPatternTerm = mc.currentScreen instanceof GuiPatternTerm || GuiUtils.isPatternTermExGui(mc.currentScreen);
|
||||
boolean isInterface = mc.currentScreen instanceof GuiInterface;
|
||||
if (dWheel != 0 && (isPatternTerm || isInterface)) {
|
||||
int x = Mouse.getEventX() * mc.currentScreen.width / mc.displayWidth;
|
||||
int y = mc.currentScreen.height - Mouse.getEventY() * mc.currentScreen.height / mc.displayHeight - 1;
|
||||
Slot currentSlot = ((GuiContainer) mc.currentScreen).getSlotAtPosition(x, y);
|
||||
if (currentSlot instanceof SlotFake && currentSlot.getHasStack()) {
|
||||
//try to change current itemstack to next ingredient;
|
||||
if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.ingredient")) && GuiUtils.isCraftingSlot(currentSlot)) {
|
||||
handleRecipeIngredientChange((GuiContainer) mc.currentScreen, currentSlot, dWheel);
|
||||
} else if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.count"))) {
|
||||
int changeCount = dWheel / 120;
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketStackCountChange(currentSlot.slotNumber, changeCount));
|
||||
if (isPatternTerm || isInterface) {
|
||||
int dWheel = Mouse.getDWheel();
|
||||
if (dWheel != 0) {
|
||||
int x = Mouse.getEventX() * mc.currentScreen.width / mc.displayWidth;
|
||||
int y = mc.currentScreen.height - Mouse.getEventY() * mc.currentScreen.height / mc.displayHeight - 1;
|
||||
Slot currentSlot = ((GuiContainer) mc.currentScreen).getSlotAtPosition(x, y);
|
||||
if (currentSlot instanceof SlotFake && currentSlot.getHasStack()) {
|
||||
//try to change current itemstack to next ingredient;
|
||||
if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.ingredient")) && GuiUtils.isCraftingSlot(currentSlot)) {
|
||||
handleRecipeIngredientChange((GuiContainer) mc.currentScreen, currentSlot, dWheel);
|
||||
} else if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.count"))) {
|
||||
int changeCount = dWheel / 120;
|
||||
NEENetworkHandler.getInstance().sendToServer(new PacketStackCountChange(currentSlot.slotNumber, changeCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user