Shift clicking patterns in the Pattern Grid now puts the patterns in the pattern slot, fixes #1142
This commit is contained in:
@@ -43,13 +43,18 @@ public class ContainerGrid extends ContainerBase {
|
||||
this.inventorySlots.clear();
|
||||
this.inventoryItemStacks.clear();
|
||||
|
||||
int headerAndSlots = getTabDelta() + display.getHeader() + (display.getVisibleRows() * 18);
|
||||
|
||||
if (grid.getType() != GridType.FLUID) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotItemHandler(grid.getFilter(), i, 204, 6 + (18 * i) + getTabDelta()));
|
||||
}
|
||||
}
|
||||
|
||||
int headerAndSlots = getTabDelta() + display.getHeader() + (display.getVisibleRows() * 18);
|
||||
if (grid.getType() == GridType.PATTERN) {
|
||||
addSlotToContainer(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 0, 152, headerAndSlots + 4));
|
||||
addSlotToContainer(new SlotOutput(((NetworkNodeGrid) grid).getPatterns(), 1, 152, headerAndSlots + 40));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, display.getYPlayerInventory());
|
||||
|
||||
@@ -85,9 +90,6 @@ public class ContainerGrid extends ContainerBase {
|
||||
}
|
||||
|
||||
addSlotToContainer(patternResultSlot = new SlotDisabled(grid.getCraftingResult(), 0, 112 + 4, headerAndSlots + 22));
|
||||
|
||||
addSlotToContainer(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 0, 152, headerAndSlots + 4));
|
||||
addSlotToContainer(new SlotOutput(((NetworkNodeGrid) grid).getPatterns(), 1, 152, headerAndSlots + 40));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +138,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
|
||||
sendCraftingSlots();
|
||||
detectAndSendChanges();
|
||||
} else if (slot != patternResultSlot && !(slot instanceof SlotFilterLegacy) && grid.getNetwork() != null) {
|
||||
} else if (slot != patternResultSlot && !(slot instanceof SlotFilterLegacy)) {
|
||||
ItemStack stack = slot.getStack();
|
||||
|
||||
if (grid.getType() != GridType.FLUID && stack.getItem() == RSItems.FILTER) {
|
||||
@@ -146,7 +148,29 @@ public class ContainerGrid extends ContainerBase {
|
||||
// Move to player inventory instead
|
||||
if (slotIndex < 4) {
|
||||
startIndex = 4;
|
||||
endIndex = 4 + (9 * 4);
|
||||
|
||||
if (grid.getType() == GridType.PATTERN) {
|
||||
startIndex += 2; // Skip the pattern slots
|
||||
}
|
||||
|
||||
endIndex = startIndex + (9 * 4);
|
||||
}
|
||||
|
||||
if (mergeItemStack(stack, startIndex, endIndex, false)) {
|
||||
slot.onSlotChanged();
|
||||
|
||||
detectAndSendChanges();
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (grid.getType() == GridType.PATTERN && stack.getItem() == RSItems.PATTERN) {
|
||||
int startIndex = 4;
|
||||
int endIndex = startIndex + 1;
|
||||
|
||||
// Move to player inventory instead
|
||||
if (slotIndex == 4) {
|
||||
startIndex = endIndex;
|
||||
endIndex = startIndex + (9 * 4);
|
||||
}
|
||||
|
||||
if (mergeItemStack(stack, startIndex, endIndex, false)) {
|
||||
@@ -158,16 +182,18 @@ public class ContainerGrid extends ContainerBase {
|
||||
}
|
||||
}
|
||||
|
||||
IItemGridHandler itemHandler = grid.getNetwork().getItemGridHandler();
|
||||
IFluidGridHandler fluidHandler = grid.getNetwork().getFluidGridHandler();
|
||||
if (grid.getNetwork() != null) {
|
||||
IItemGridHandler itemHandler = grid.getNetwork().getItemGridHandler();
|
||||
IFluidGridHandler fluidHandler = grid.getNetwork().getFluidGridHandler();
|
||||
|
||||
if (grid.getType() != GridType.FLUID && itemHandler != null) {
|
||||
slot.putStack(RSUtils.transformNullToEmpty(itemHandler.onInsert((EntityPlayerMP) player, stack)));
|
||||
} else if (grid.getType() == GridType.FLUID && fluidHandler != null) {
|
||||
slot.putStack(RSUtils.transformNullToEmpty(fluidHandler.onInsert((EntityPlayerMP) player, stack)));
|
||||
if (grid.getType() != GridType.FLUID && itemHandler != null) {
|
||||
slot.putStack(RSUtils.transformNullToEmpty(itemHandler.onInsert((EntityPlayerMP) player, stack)));
|
||||
} else if (grid.getType() == GridType.FLUID && fluidHandler != null) {
|
||||
slot.putStack(RSUtils.transformNullToEmpty(fluidHandler.onInsert((EntityPlayerMP) player, stack)));
|
||||
}
|
||||
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user