Fixes issue #96 "Dropping items into crafting grid with mouse won't work if your mouse is in between items"

This commit is contained in:
Raoul Van den Berge
2016-06-09 17:07:45 +02:00
parent dc61ad191a
commit 6a9a319580
2 changed files with 6 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
- Fixed not being able to place seeds - Fixed not being able to place seeds
- Fixed stacks not splitting between storages correctly - Fixed stacks not splitting between storages correctly
- Fixed storage not saving ItemStack capabilities - Fixed storage not saving ItemStack capabilities
- Fixed dropping items into crafting grid with mouse won't work if your mouse is in between items
**Features** **Features**
- Added an API - Added an API

View File

@@ -169,6 +169,10 @@ public class GuiGrid extends GuiBase {
return slotNumber >= 0; return slotNumber >= 0;
} }
private boolean isHoveringOverSlotArea(int mouseX, int mouseY) {
return inBounds(7, 19, 162, 18 * getVisibleRows(), mouseX, mouseY);
}
public boolean isHoveringOverClear(int mouseX, int mouseY) { public boolean isHoveringOverClear(int mouseX, int mouseY) {
switch (grid.getType()) { switch (grid.getType()) {
case CRAFTING: case CRAFTING:
@@ -320,7 +324,7 @@ public class GuiGrid extends GuiBase {
RefinedStorage.NETWORK.sendToServer(new MessageGridPatternCreate(gridPos.getX(), gridPos.getY(), gridPos.getZ())); RefinedStorage.NETWORK.sendToServer(new MessageGridPatternCreate(gridPos.getX(), gridPos.getY(), gridPos.getZ()));
} else if (grid.isConnected()) { } else if (grid.isConnected()) {
if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null && (clickedButton == 0 || clickedButton == 1)) { if (isHoveringOverSlotArea(mouseX - guiLeft, mouseY - guiTop) && container.getPlayer().inventory.getItemStack() != null && (clickedButton == 0 || clickedButton == 1)) {
grid.onItemPush(-1, clickedButton == 1); grid.onItemPush(-1, clickedButton == 1);
} else if (isHoveringOverItemInSlot() && container.getPlayer().inventory.getItemStack() == null) { } else if (isHoveringOverItemInSlot() && container.getPlayer().inventory.getItemStack() == null) {
if (items.get(slotNumber).getStack().stackSize == 0 || (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown())) { if (items.get(slotNumber).getStack().stackSize == 0 || (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown())) {