This commit is contained in:
Raoul Van den Berge
2016-06-05 21:16:34 +02:00
parent 78948a42ab
commit e9d1bf0385
2 changed files with 16 additions and 42 deletions

View File

@@ -32,9 +32,9 @@ public interface IStorage {
* For example: this function is called for dirt (64x) while there is only dirt (32x), return the dirt (32x) anyway. * For example: this function is called for dirt (64x) while there is only dirt (32x), return the dirt (32x) anyway.
* *
* @param stack A prototype of the stack to push, do NOT modify this stack * @param stack A prototype of the stack to push, do NOT modify this stack
* @param size The amount of that prototype we're pushing * @param size The amount of that prototype we're taking
* @param flags On what we are comparing to take the item, see {@link CompareFlags} * @param flags On what we are comparing to take the item, see {@link CompareFlags}
* @return The ItemStack we took from the system, or null if we didn't take anything * @return null if we didn't take anything, or an ItemStack with the take result
*/ */
ItemStack take(ItemStack stack, int size, int flags); ItemStack take(ItemStack stack, int size, int flags);

View File

@@ -17,10 +17,7 @@ import refinedstorage.api.storage.IStorageProvider;
import refinedstorage.container.ContainerStorage; import refinedstorage.container.ContainerStorage;
import refinedstorage.inventory.BasicItemHandler; import refinedstorage.inventory.BasicItemHandler;
import refinedstorage.network.MessagePriorityUpdate; import refinedstorage.network.MessagePriorityUpdate;
import refinedstorage.tile.config.ICompareConfig; import refinedstorage.tile.config.*;
import refinedstorage.tile.config.IModeConfig;
import refinedstorage.tile.config.IRedstoneModeConfig;
import refinedstorage.tile.config.ModeConstants;
import java.util.List; import java.util.List;
@@ -69,6 +66,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
@Override @Override
public ItemStack push(ItemStack stack, boolean simulate) { public ItemStack push(ItemStack stack, boolean simulate) {
if (ModeFilter.respectsMode(filters, this, compare, stack)) {
IDeepStorageUnit storageUnit = getStorageUnit(); IDeepStorageUnit storageUnit = getStorageUnit();
// @todo: fix push for deep storage units // @todo: fix push for deep storage units
@@ -82,7 +80,8 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
IItemHandler handler = getItemHandler(); IItemHandler handler = getItemHandler();
if (handler != null) { if (handler != null) {
return ItemHandlerHelper.insertItem(handler, stack.copy(), simulate); return ItemHandlerHelper.insertItem(handler, stack, simulate);
}
} }
} }
@@ -126,31 +125,6 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
return null; return null;
} }
/*
@Override
public boolean mayPush(ItemStack stack) {
if (ModeFilter.respectsMode(filters, this, compare, stack)) {
IDeepStorageUnit storageUnit = getStorageUnit();
if (storageUnit != null) {
if (storageUnit.getStoredItemType() == null) {
return stack.stackSize < storageUnit.getMaxStoredCount();
}
return RefinedStorageUtils.compareStackNoQuantity(storageUnit.getStoredItemType(), stack) && (storageUnit.getStoredItemType().stackSize + stack.stackSize) < storageUnit.getMaxStoredCount();
} else {
IItemHandler handler = getItemHandler();
if (handler != null) {
return ItemHandlerHelper.insertItem(handler, stack, true) == null;
}
}
}
return false;
}
*/
public IDeepStorageUnit getStorageUnit() { public IDeepStorageUnit getStorageUnit() {
return getFacingTile() instanceof IDeepStorageUnit ? (IDeepStorageUnit) getFacingTile() : null; return getFacingTile() instanceof IDeepStorageUnit ? (IDeepStorageUnit) getFacingTile() : null;
} }