Added ability to shift click items into Importer, Exporter, Constructor, Destructor and Detector to set up whitelist / blacklist configurations easier, fixes #202
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
**Features**
|
**Features**
|
||||||
- Added X button to Processing Pattern Encoder to clear configuration of inputs and outputs
|
- Added X button to Processing Pattern Encoder to clear configuration of inputs and outputs
|
||||||
- Added Grid view toggle buttons (regular, craftable items only, no craftable items)
|
- Added Grid view toggle buttons (regular, craftable items only, no craftable items)
|
||||||
|
- Added ability to shift click items into Importer, Exporter, Constructor, Destructor and Detector to set up whitelist / blacklist configurations easier
|
||||||
- Re-added opposite facing on shift click functionality
|
- Re-added opposite facing on shift click functionality
|
||||||
- Updated to Forge 2014
|
- Updated to Forge 2014
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import net.minecraft.inventory.ClickType;
|
|||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
import refinedstorage.RefinedStorageUtils;
|
||||||
import refinedstorage.container.slot.SlotDisabled;
|
import refinedstorage.container.slot.SlotDisabled;
|
||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.container.slot.SlotSpecimenLegacy;
|
import refinedstorage.container.slot.SlotSpecimenLegacy;
|
||||||
@@ -106,6 +108,25 @@ public abstract class ContainerBase extends Container {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack mergeItemStackToSpecimen(ItemStack stack, int begin, int end) {
|
||||||
|
for (int i = begin; i < end; ++i) {
|
||||||
|
if (RefinedStorageUtils.compareStackNoQuantity(getSlot(i).getStack(), stack)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = begin; i < end; ++i) {
|
||||||
|
if (!getSlot(i).getHasStack()) {
|
||||||
|
getSlot(i).putStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||||
|
getSlot(i).onSlotChanged();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ContainerConstructor extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||||
return null;
|
return mergeItemStackToSpecimen(stack, 4, 4 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.stackSize == 0) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ContainerDestructor extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||||
return null;
|
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.stackSize == 0) {
|
||||||
|
|||||||
@@ -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.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.tile.TileDetector;
|
import refinedstorage.tile.TileDetector;
|
||||||
|
|
||||||
@@ -12,4 +14,15 @@ public class ContainerDetector extends ContainerBase {
|
|||||||
|
|
||||||
addPlayerInventory(8, 55);
|
addPlayerInventory(8, 55);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
|
Slot slot = getSlot(index);
|
||||||
|
|
||||||
|
if (slot != null && slot.getHasStack() && index > 0) {
|
||||||
|
return mergeItemStackToSpecimen(slot.getStack(), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ContainerExporter extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||||
return null;
|
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.stackSize == 0) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ContainerImporter extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||||
return null;
|
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.stackSize == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user