本文整理汇总了Java中appeng.api.storage.data.IAEItemStack类的典型用法代码示例。如果您正苦于以下问题:Java IAEItemStack类的具体用法?Java IAEItemStack怎么用?Java IAEItemStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAEItemStack类属于appeng.api.storage.data包,在下文中一共展示了IAEItemStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRequestChange
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.AE2)
public void onRequestChange(ICraftingGrid grid, IAEItemStack aeStack){
craftingGrid = grid;
int freeSlot = -1;
for(int i = 0; i < getFilters().getSlots(); i++) {
ItemStack s = getFilters().getStackInSlot(i);
if(!s.isEmpty()) {
if(aeStack.isSameType(s)) {
s.setCount( (int) aeStack.getStackSize() );
return;
}
} else if(freeSlot == -1) {
freeSlot = i;
}
}
if(freeSlot >= 0) {
getFilters().setStackInSlot(freeSlot, aeStack.createItemStack());
}
}
示例2: getAvailableItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@ScriptCallable(description = "Get a list of the stored and craftable items in the network.", returnTypes = ReturnType.TABLE)
public List<?> getAvailableItems(IGridHost host,
@Env(Constants.ARG_CONVERTER) IConverter converter,
@Optionals @Arg(name = "details", description = "Format of stored items details (defalt: none)") ItemDetails format) {
IStorageGrid storageGrid = getStorageGrid(host);
final IItemList<IAEItemStack> storageList = storageGrid.getItemInventory().getStorageList();
List<Object> result = Lists.newArrayList();
for (IAEItemStack stack : storageList) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>)converter.fromJava(stack);
if (format != null && format != ItemDetails.NONE) {
final ItemStack itemStack = stack.getItemStack();
if (format == ItemDetails.PROXY) map.put("item", OpcAccess.itemStackMetaBuilder.createProxy(itemStack));
else if (format == ItemDetails.ALL) map.put("item", itemStack);
}
result.add(map);
}
return result;
}
示例3: extractStack
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Extracts items from the network.
*
* @param target
* @return Extracted stack.
*/
public ItemStack extractStack( final ItemStack target )
{
// Get the item monitor
IMEMonitor<IAEItemStack> monitor = this.getItemInventory();
if( monitor == null )
{
return null;
}
// Create the AE stack
IAEItemStack aeRequest = AEApi.instance().storage().createItemStack( target );
// Set size
aeRequest.setStackSize( Math.min( target.stackSize, this.maxItemRate ) );
// Extract
IAEItemStack extracted = AEApi.instance().storage().poweredExtraction( this.getEnergyGrid(), monitor, aeRequest, this.actionSource );
if( extracted == null )
{
return null;
}
return extracted.getItemStack();
}
示例4: sendExtract
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Creates a packet letting the server know the user would like to
* extract the specified itemstack from the ME network.
*
* @param player
* @param itemStack
* @param mouseButton
* @return
*/
public static void sendExtract( final EntityPlayer player, final IAEItemStack itemStack, final int mouseButton,
final boolean isShiftHeld )
{
Packet_S_ArcaneCraftingTerminal packet = newPacket( player, MODE_REQUEST_EXTRACTION );
// Set stack
packet.itemStack = itemStack;
// Set mouse button
packet.mouseButton = mouseButton;
// Set shift
packet.isShiftHeld = isShiftHeld;
// Send it
NetworkHandler.sendPacketToServer( packet );
}
示例5: getObjectFromStack
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
private Object getObjectFromStack(IAEItemStack stack, int flag) {
HashMap<String, Object> map = new HashMap<String, Object>();
String itemName = Item.itemRegistry.getNameForObject(stack.getItem());
int meta = stack.getItemDamage();
long amount = stack.getStackSize();
String displayName = stack.getItemStack().getDisplayName();
map.put("name", itemName);
map.put("meta", meta);
map.put("amount", amount);
map.put("displayName", displayName);
if (flag == 0) {
return map;
} else if (flag == 1) {
if (stack.getStackSize() > 0)
return map;
} else if (flag == 2) {
if (stack.isCraftable())
return map;
}
return null;
}
示例6: getCondensedInputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getCondensedInputs()
{
// Create a temp array
ArrayList<IAEItemStack> cond = new ArrayList<IAEItemStack>();
if( this.ingredientsAE == null )
{
this.setupAEIngredientList();
}
// Add non-null ingredients
for( int index = 0; index < this.ingredientsAE.length; index++ )
{
if( this.ingredientsAE[index] != null )
{
cond.add( this.ingredientsAE[index] );
}
}
// Return the ingredients
return cond.toArray( new IAEItemStack[cond.size()] );
}
示例7: writeAEItemStack
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
/**
* Writes an AE itemstack to the stream.
*
* @param itemStack
* @param stream
*/
protected static void writeAEItemStack( final IAEItemStack itemStack, final ByteBuf stream )
{
// Do we have a valid stack?
if( itemStack != null )
{
// Write into the stream
try
{
itemStack.writeToPacket( stream );
}
catch( IOException e )
{
}
}
}
示例8: getItemInventory
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IMEMonitor<IAEItemStack> getItemInventory()
{
// Check connectivity
if( ( this.accessPoint == null ) || !this.isConnected() )
{
return null;
}
try
{
// Get the storage grid
IStorageGrid storageGrid = this.accessPoint.getActionableNode().getGrid().getCache( IStorageGrid.class );
// Return the monitor
return storageGrid.getItemInventory();
}
catch( Exception e )
{
// Ignored
}
return null;
}
示例9: getStacksInItem
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public void getStacksInItem(ItemStack stack, List<ItemStack> curStacks){
IMEInventoryHandler<IAEItemStack> cellInventoryHandler = cellRegistry.getCellInventory(stack, null, itemChannel);
if (cellInventoryHandler != null) {
IItemList<IAEItemStack> cellItemList = itemChannel.createList();
cellInventoryHandler.getAvailableItems(cellItemList);
for (IAEItemStack aeStack : cellItemList) {
ItemStack st = aeStack.createItemStack();
st.setCount((int) aeStack.getStackSize());
curStacks.add(st);
}
}
}
示例10: updateProvidingItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Optional.Method(modid = ModIds.AE2)
private void updateProvidingItems(ICraftingProviderHelper cHelper){
IStackWatcher sWatcher = (IStackWatcher)stackWatcher;
ICraftingWatcher cWatcher = (ICraftingWatcher)craftingWatcher;
if(sWatcher != null) sWatcher.reset();
if(cWatcher != null) cWatcher.reset();
for(IAEItemStack stack : getProvidingItems()) {
if(sWatcher != null) sWatcher.add(stack);
if(cWatcher != null) cWatcher.add(stack);
if(cHelper != null) cHelper.setEmitable(stack);
}
}
示例11: getProvidingItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Optional.Method(modid = ModIds.AE2)
public List<IAEItemStack> getProvidingItems(){
List<IAEItemStack> stacks = new ArrayList<IAEItemStack>();
for(TileEntity te : providingInventories.keySet()) {
IItemHandler inv = IOHelper.getInventoryForTE(te);
if(inv != null) {
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(!stack.isEmpty()) stacks.add(AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack(stack));
}
}
}
return stacks;
}
示例12: getAvailableItems
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
@Optional.Method(modid = ModIds.AE2)
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> arg0){
for(IAEItemStack stack : getProvidingItems()) {
stack.setCountRequestable(stack.getStackSize());
arg0.addRequestable(stack);
}
return arg0;
}
示例13: isAltarRecipe
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
public static boolean isAltarRecipe(IAEItemStack[] AEStacks, ItemStack output, TileEntity te){
List<ItemStack> stacks = new ArrayList<ItemStack>();
for (IAEItemStack stack : AEStacks){
if (stack != null) {
stacks.add(stack.getItemStack());
}
}
return isAltarRecipe(stacks.toArray(), output, te);
}
示例14: getInputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getInputs() {
//return new IAEItemStack[9];
IAEItemStack[] AEStack = new IAEItemStack[9];
if (input == null) return AEStack;
for (int i = 0, inputLength = input.length; i < inputLength; i++) {
ItemStack stack = input[i];
AEStack[i] = AEApi.instance().storage().createItemStack(stack);
}
return AEStack;
}
示例15: getCondensedInputs
import appeng.api.storage.data.IAEItemStack; //导入依赖的package包/类
@Override
public IAEItemStack[] getCondensedInputs() {
List<IAEItemStack> AEStack = new ArrayList<IAEItemStack>();
if (input == null) return (IAEItemStack[]) AEStack.toArray();
for (int i = 0, inputLength = input.length; i < inputLength; i++) {
ItemStack stack = input[i];
AEStack.add(AEApi.instance().storage().createItemStack(stack));
}
//return (IAEItemStack[]) AEStack.toArray();
return AEStack.toArray(new IAEItemStack[AEStack.size()]);
}