pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.util;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -33,55 +32,50 @@ import appeng.util.inv.AdaptorItemHandlerPlayerInv;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
|
||||
|
||||
/**
|
||||
* Universal Facade for other inventories. Used to conveniently interact with various types of inventories. This is not
|
||||
* used for
|
||||
* actually monitoring an inventory. It is just for insertion and extraction, and is primarily used by import/export
|
||||
* buses.
|
||||
* Universal Facade for other inventories. Used to conveniently interact with
|
||||
* various types of inventories. This is not used for actually monitoring an
|
||||
* inventory. It is just for insertion and extraction, and is primarily used by
|
||||
* import/export buses.
|
||||
*/
|
||||
public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
||||
{
|
||||
public static InventoryAdaptor getAdaptor( final TileEntity te, final Direction d )
|
||||
{
|
||||
if( te != null )
|
||||
{
|
||||
LazyOptional<IItemHandler> cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d);
|
||||
public abstract class InventoryAdaptor implements Iterable<ItemSlot> {
|
||||
public static InventoryAdaptor getAdaptor(final TileEntity te, final Direction d) {
|
||||
if (te != null) {
|
||||
LazyOptional<IItemHandler> cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d);
|
||||
|
||||
// Attempt getting an IItemHandler for the given side via caps
|
||||
if( cap.isPresent() )
|
||||
{
|
||||
return new AdaptorItemHandler( cap.orElseThrow(IllegalStateException::new) );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// Attempt getting an IItemHandler for the given side via caps
|
||||
if (cap.isPresent()) {
|
||||
return new AdaptorItemHandler(cap.orElseThrow(IllegalStateException::new));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static InventoryAdaptor getAdaptor( final PlayerEntity te )
|
||||
{
|
||||
if( te != null )
|
||||
{
|
||||
return new AdaptorItemHandlerPlayerInv( te );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static InventoryAdaptor getAdaptor(final PlayerEntity te) {
|
||||
if (te != null) {
|
||||
return new AdaptorItemHandlerPlayerInv(te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination );
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination);
|
||||
|
||||
public abstract ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination );
|
||||
public abstract ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination);
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination );
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode,
|
||||
IInventoryDestination destination);
|
||||
|
||||
public abstract ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination );
|
||||
public abstract ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode,
|
||||
IInventoryDestination destination);
|
||||
|
||||
// return what isn't used...
|
||||
public abstract ItemStack addItems( ItemStack toBeAdded );
|
||||
// return what isn't used...
|
||||
public abstract ItemStack addItems(ItemStack toBeAdded);
|
||||
|
||||
public abstract ItemStack simulateAdd( ItemStack toBeSimulated );
|
||||
public abstract ItemStack simulateAdd(ItemStack toBeSimulated);
|
||||
|
||||
public abstract boolean containsItems();
|
||||
public abstract boolean containsItems();
|
||||
|
||||
public abstract boolean hasSlots();
|
||||
public abstract boolean hasSlots();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user