Fixes
This commit is contained in:
@@ -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);
|
||||||
|
|
||||||
|
@@ -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,20 +66,22 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack push(ItemStack stack, boolean simulate) {
|
public ItemStack push(ItemStack stack, boolean simulate) {
|
||||||
IDeepStorageUnit storageUnit = getStorageUnit();
|
if (ModeFilter.respectsMode(filters, this, compare, stack)) {
|
||||||
|
IDeepStorageUnit storageUnit = getStorageUnit();
|
||||||
|
|
||||||
// @todo: fix push for deep storage units
|
// @todo: fix push for deep storage units
|
||||||
if (storageUnit != null) {
|
if (storageUnit != null) {
|
||||||
if (storageUnit.getStoredItemType() == null) {
|
if (storageUnit.getStoredItemType() == null) {
|
||||||
storageUnit.setStoredItemType(stack.copy(), stack.stackSize);
|
storageUnit.setStoredItemType(stack.copy(), stack.stackSize);
|
||||||
|
} else {
|
||||||
|
storageUnit.setStoredItemCount(storageUnit.getStoredItemType().stackSize + stack.stackSize);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
storageUnit.setStoredItemCount(storageUnit.getStoredItemType().stackSize + stack.stackSize);
|
IItemHandler handler = getItemHandler();
|
||||||
}
|
|
||||||
} else {
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user