Prevent accidental Grid scrollbar click after clicking JEI recipe transfer button. Fixes #1821
This commit is contained in:
@@ -5,6 +5,8 @@ import com.raoulvdberge.refinedstorage.api.render.IElementDrawer;
|
||||
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
|
||||
import com.raoulvdberge.refinedstorage.gui.control.Scrollbar;
|
||||
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.util.RenderUtils;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
@@ -154,7 +156,8 @@ public abstract class GuiBase extends GuiContainer {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
|
||||
public static final long TRANSFER_SCROLL_DELAY_MS = 200;
|
||||
public static long LAST_TRANSFER;
|
||||
|
||||
@Override
|
||||
public Class<? extends Container> getContainerClass() {
|
||||
return ContainerGrid.class;
|
||||
@@ -28,6 +31,8 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
|
||||
|
||||
@Override
|
||||
public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||
LAST_TRANSFER = System.currentTimeMillis();
|
||||
|
||||
if (doTransfer) {
|
||||
IGrid grid = ((ContainerGrid) container).getGrid();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user