Prevent accidental Grid scrollbar click after clicking JEI recipe transfer button. Fixes #1821

This commit is contained in:
raoulvdberge
2018-06-19 19:33:03 +02:00
parent 10da57fe28
commit 5572c3ae09
3 changed files with 10 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ NOTE: Worlds that used Refined Storage 1.5.x are fully compatible with Refined S
- Fixed a crash when breaking an Ender IO conduit with the Destructor (raoulvdberge) - Fixed a crash when breaking an Ender IO conduit with the Destructor (raoulvdberge)
- Fixed bug where storage disks in Portable Grids could be moved into themselves (raoulvdberge) - Fixed bug where storage disks in Portable Grids could be moved into themselves (raoulvdberge)
- Fixed the Crafter crashing when opening it while connected to a Primal Tech Grill or Kiln (raoulvdberge) - Fixed the Crafter crashing when opening it while connected to a Primal Tech Grill or Kiln (raoulvdberge)
- Prevent accidental Grid scrollbar click after clicking JEI recipe transfer button (raoulvdberge)
- Added a missing config option for Crafter Manager energy usage (raoulvdberge) - Added a missing config option for Crafter Manager energy usage (raoulvdberge)
- If an Interface is configured to expose the entire network storage (by configuring no export slots), it will no longer expose the entire RS storage, due to performance issues (raoulvdberge) - If an Interface is configured to expose the entire network storage (by configuring no export slots), it will no longer expose the entire RS storage, due to performance issues (raoulvdberge)
- The Portable Grid no longer exposes a inventory for crossmod interaction, due to performance issues (raoulvdberge) - The Portable Grid no longer exposes a inventory for crossmod interaction, due to performance issues (raoulvdberge)

View File

@@ -5,6 +5,8 @@ import com.raoulvdberge.refinedstorage.api.render.IElementDrawer;
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers; import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
import com.raoulvdberge.refinedstorage.gui.control.Scrollbar; import com.raoulvdberge.refinedstorage.gui.control.Scrollbar;
import com.raoulvdberge.refinedstorage.gui.control.SideButton; import com.raoulvdberge.refinedstorage.gui.control.SideButton;
import com.raoulvdberge.refinedstorage.integration.jei.IntegrationJEI;
import com.raoulvdberge.refinedstorage.integration.jei.RecipeTransferHandlerGrid;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
import com.raoulvdberge.refinedstorage.util.RenderUtils; import com.raoulvdberge.refinedstorage.util.RenderUtils;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
@@ -154,7 +156,8 @@ public abstract class GuiBase extends GuiContainer {
renderHoveredToolTip(mouseX, mouseY); renderHoveredToolTip(mouseX, mouseY);
if (scrollbar != null) { // Prevent accidental scrollbar click after clicking recipe transfer button
if (scrollbar != null && (!IntegrationJEI.isLoaded() || System.currentTimeMillis() - RecipeTransferHandlerGrid.LAST_TRANSFER > RecipeTransferHandlerGrid.TRANSFER_SCROLL_DELAY_MS)) {
scrollbar.update(this, mouseX - guiLeft, mouseY - guiTop); scrollbar.update(this, mouseX - guiLeft, mouseY - guiTop);
} }
} }

View File

@@ -21,6 +21,9 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class RecipeTransferHandlerGrid implements IRecipeTransferHandler { public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
public static final long TRANSFER_SCROLL_DELAY_MS = 200;
public static long LAST_TRANSFER;
@Override @Override
public Class<? extends Container> getContainerClass() { public Class<? extends Container> getContainerClass() {
return ContainerGrid.class; return ContainerGrid.class;
@@ -28,6 +31,8 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
@Override @Override
public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
LAST_TRANSFER = System.currentTimeMillis();
if (doTransfer) { if (doTransfer) {
IGrid grid = ((ContainerGrid) container).getGrid(); IGrid grid = ((ContainerGrid) container).getGrid();