Fixed interface having weird extraction / insertion rules, fixes #224
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
- Fixed rendering crash with Disk Drive
|
- Fixed rendering crash with Disk Drive
|
||||||
- Fixed crash when quickly toggling sorting direction in Grid
|
- Fixed crash when quickly toggling sorting direction in Grid
|
||||||
- Fixed not being able to clear exporter row in interface
|
- Fixed not being able to clear exporter row in interface
|
||||||
|
- Fixed interface having weird extraction / insertion rules. It can now take items from any side, or extract items from any side depending on the block that is inserting or extracting the item (like conduits).
|
||||||
|
|
||||||
### 0.8.12
|
### 0.8.12
|
||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
|
|||||||
24
src/main/java/refinedstorage/inventory/InterfaceItemHandler.java
Executable file
24
src/main/java/refinedstorage/inventory/InterfaceItemHandler.java
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
package refinedstorage.inventory;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
|
public class InterfaceItemHandler extends ItemStackHandler {
|
||||||
|
private BasicItemHandler importItems;
|
||||||
|
private BasicItemHandler exportItems;
|
||||||
|
|
||||||
|
public InterfaceItemHandler(BasicItemHandler importItems, BasicItemHandler exportItems) {
|
||||||
|
this.importItems = importItems;
|
||||||
|
this.exportItems = exportItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||||
|
return importItems.insertItem(slot, stack, simulate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||||
|
return exportItems.extractItem(slot, amount, simulate);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
|||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.container.ContainerInterface;
|
import refinedstorage.container.ContainerInterface;
|
||||||
import refinedstorage.inventory.BasicItemHandler;
|
import refinedstorage.inventory.BasicItemHandler;
|
||||||
|
import refinedstorage.inventory.InterfaceItemHandler;
|
||||||
import refinedstorage.inventory.UpgradeItemHandler;
|
import refinedstorage.inventory.UpgradeItemHandler;
|
||||||
import refinedstorage.item.ItemUpgrade;
|
import refinedstorage.item.ItemUpgrade;
|
||||||
import refinedstorage.tile.config.ICompareConfig;
|
import refinedstorage.tile.config.ICompareConfig;
|
||||||
@@ -22,6 +23,7 @@ public class TileInterface extends TileNode implements ICompareConfig {
|
|||||||
private BasicItemHandler importItems = new BasicItemHandler(9, this);
|
private BasicItemHandler importItems = new BasicItemHandler(9, this);
|
||||||
private BasicItemHandler exportSpecimenItems = new BasicItemHandler(9, this);
|
private BasicItemHandler exportSpecimenItems = new BasicItemHandler(9, this);
|
||||||
private BasicItemHandler exportItems = new BasicItemHandler(9, this);
|
private BasicItemHandler exportItems = new BasicItemHandler(9, this);
|
||||||
|
private InterfaceItemHandler itemHandler = new InterfaceItemHandler(importItems, exportItems);
|
||||||
private UpgradeItemHandler upgrades = new UpgradeItemHandler(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK);
|
private UpgradeItemHandler upgrades = new UpgradeItemHandler(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK);
|
||||||
|
|
||||||
private int compare = 0;
|
private int compare = 0;
|
||||||
@@ -173,11 +175,7 @@ public class TileInterface extends TileNode implements ICompareConfig {
|
|||||||
@Override
|
@Override
|
||||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
if (facing == EnumFacing.DOWN) {
|
return (T) itemHandler;
|
||||||
return (T) exportItems;
|
|
||||||
} else {
|
|
||||||
return (T) importItems;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getCapability(capability, facing);
|
return super.getCapability(capability, facing);
|
||||||
|
|||||||
Reference in New Issue
Block a user