Shift clicking for disk drive
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package refinedstorage.container;
|
package refinedstorage.container;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.RefinedStorageItems;
|
import refinedstorage.RefinedStorageItems;
|
||||||
import refinedstorage.container.slot.BasicItemValidator;
|
import refinedstorage.container.slot.BasicItemValidator;
|
||||||
import refinedstorage.container.slot.SlotFiltered;
|
import refinedstorage.container.slot.SlotFiltered;
|
||||||
@@ -8,7 +10,7 @@ import refinedstorage.tile.TileDiskDrive;
|
|||||||
|
|
||||||
public class ContainerDiskDrive extends ContainerStorage {
|
public class ContainerDiskDrive extends ContainerStorage {
|
||||||
public ContainerDiskDrive(EntityPlayer player, TileDiskDrive drive) {
|
public ContainerDiskDrive(EntityPlayer player, TileDiskDrive drive) {
|
||||||
super(player, drive.getInventory());
|
super(player);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
addSlotToContainer(new SlotFiltered(drive, i, 98 + (i * 18), 78, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
addSlotToContainer(new SlotFiltered(drive, i, 98 + (i * 18), 78, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
||||||
@@ -17,5 +19,34 @@ public class ContainerDiskDrive extends ContainerStorage {
|
|||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
addSlotToContainer(new SlotFiltered(drive, 4 + i, 98 + (i * 18), 96, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
addSlotToContainer(new SlotFiltered(drive, 4 + i, 98 + (i * 18), 96, new BasicItemValidator(RefinedStorageItems.STORAGE_DISK)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSpecimenAndPlayerInventorySlots(drive.getInventory());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
|
ItemStack stack = null;
|
||||||
|
|
||||||
|
Slot slot = getSlot(index);
|
||||||
|
|
||||||
|
if (slot != null && slot.getHasStack()) {
|
||||||
|
stack = slot.getStack().copy();
|
||||||
|
|
||||||
|
if (index < 8) {
|
||||||
|
if (!mergeItemStack(stack, 8, inventorySlots.size(), true)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (!mergeItemStack(stack, 0, 8, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.stackSize == 0) {
|
||||||
|
slot.putStack(null);
|
||||||
|
} else {
|
||||||
|
slot.onSlotChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,9 +5,17 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
|
|
||||||
public class ContainerStorage extends ContainerBase {
|
public class ContainerStorage extends ContainerBase {
|
||||||
public ContainerStorage(EntityPlayer player, IInventory inventory) {
|
public ContainerStorage(EntityPlayer player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContainerStorage(EntityPlayer player, IInventory inventory) {
|
||||||
|
this(player);
|
||||||
|
|
||||||
|
addSpecimenAndPlayerInventorySlots(inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addSpecimenAndPlayerInventorySlots(IInventory inventory) {
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
addSlotToContainer(new SlotSpecimen(inventory, i, 8 + (18 * i), 20, false));
|
addSlotToContainer(new SlotSpecimen(inventory, i, 8 + (18 * i), 20, false));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user