Generic ICellInventoryHandler (#3624)
Allows addons who register a custom IStorageChannel to use the IStorageCell interface without registering a cell handler. Also adds some helpers (poweredInsert/poweredExtract). This breaks API!
This commit is contained in:
@@ -32,6 +32,7 @@ import java.util.WeakHashMap;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -1165,13 +1166,6 @@ public class Platform
|
||||
return pos;
|
||||
}
|
||||
|
||||
public static long nanoTime()
|
||||
{
|
||||
// if ( Configuration.INSTANCE.enableNetworkProfiler )
|
||||
// return System.nanoTime();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static <T extends IAEStack<T>> T poweredExtraction( final IEnergySource energy, final IMEInventory<T> cell, final T request, final IActionSource src )
|
||||
{
|
||||
return poweredExtraction( energy, cell, request, src, Actionable.MODULATE );
|
||||
@@ -1179,6 +1173,12 @@ public class Platform
|
||||
|
||||
public static <T extends IAEStack<T>> T poweredExtraction( final IEnergySource energy, final IMEInventory<T> cell, final T request, final IActionSource src, final Actionable mode )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( request );
|
||||
Preconditions.checkNotNull( src );
|
||||
Preconditions.checkNotNull( mode );
|
||||
|
||||
final T possible = cell.extractItems( request.copy(), Actionable.SIMULATE, src );
|
||||
|
||||
long retrieved = 0;
|
||||
@@ -1221,6 +1221,12 @@ public class Platform
|
||||
|
||||
public static <T extends IAEStack<T>> T poweredInsert( final IEnergySource energy, final IMEInventory<T> cell, final T input, final IActionSource src, final Actionable mode )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkNotNull( src );
|
||||
Preconditions.checkNotNull( mode );
|
||||
|
||||
final T possible = cell.injectItems( input.copy(), Actionable.SIMULATE, src );
|
||||
|
||||
long stored = input.getStackSize();
|
||||
@@ -1562,6 +1568,7 @@ public class Platform
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
// TODO wtf is this?
|
||||
public static ItemStack getContainerItem( final ItemStack stackInSlot )
|
||||
{
|
||||
if( stackInSlot == null )
|
||||
|
||||
Reference in New Issue
Block a user