IAEItemStack getStack( final long size ) { final IAEItemStack is = this.what.copy(); is.setStackSize( size ); return is; }
void ignore( final IAEItemStack what ) { final IAEItemStack list = this.localCache.findPrecise( what ); if( list != null ) { list.setStackSize( 0 ); } } }
public CraftingCalculationFailure( final IAEItemStack what, final long howMany ) { super( "this should have been caught!" ); this.missing = what.copy(); this.missing.setStackSize( howMany ); } }
private void updateReportingValue( final IMEMonitor<IAEItemStack> itemInventory ) { if( this.configuredItem != null ) { final IAEItemStack result = itemInventory.getStorageList().findPrecise( this.configuredItem ); if( result == null ) { this.configuredItem.setStackSize( 0 ); } else { this.configuredItem.setStackSize( result.getStackSize() ); } } }
private void handleItemChanged( int slot, IAEItemStack oldAeIS, ItemStack newIS, List<IAEItemStack> changes ) { // Completely different item this.cachedAeStacks[slot] = AEItemStack.fromItemStack( newIS ); // If we had a stack previously in this slot, notify the network about its disappearance if( oldAeIS != null ) { oldAeIS.setStackSize( -oldAeIS.getStackSize() ); changes.add( oldAeIS ); } // Notify the network about the new stack. Note that this is null if newIS was null if( this.cachedAeStacks[slot] != null ) { changes.add( this.cachedAeStacks[slot] ); } } }
@Override public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource actionSource ) { for( IAEItemStack is : change ) { is = is.copy(); is.setStackSize( 1 ); this.list.add( is ); } }
private void handleStackSizeChanged( int slot, IAEItemStack oldAeIS, ItemStack newIS, List<IAEItemStack> changes ) { // Still the same item, but amount might have changed final long diff = newIS.getCount() - oldAeIS.getStackSize(); if( diff != 0 ) { final IAEItemStack stack = oldAeIS.copy(); stack.setStackSize( newIS.getCount() ); this.cachedAeStacks[slot] = stack; final IAEItemStack a = stack.copy(); a.setStackSize( diff ); changes.add( a ); } }
public CraftBranchFailure( final IAEItemStack what, final long howMany ) { super( "Failed: " + what.getItem().getUnlocalizedName() + " x " + howMany ); this.missing = what.copy(); this.missing.setStackSize( howMany ); } }
void addTask( IAEItemStack what, final long crafts, final ICraftingPatternDetails details, final int depth ) { if( crafts > 0 ) { what = what.copy(); what.setStackSize( what.getStackSize() * crafts ); this.crafting.add( what ); } }
@Override public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final IStorageChannel chan ) { if( this.configuredItem != null ) { if( fullStack == null ) { this.configuredItem.setStackSize( 0 ); } else { this.configuredItem.setStackSize( fullStack.getStackSize() ); } final long stackSize = this.configuredItem.getStackSize(); final String humanReadableText = NUMBER_CONVERTER.toWideReadableForm( stackSize ); if( !humanReadableText.equals( this.lastHumanReadableText ) ) { this.lastHumanReadableText = humanReadableText; this.getHost().markForUpdate(); } } }
protected CreativeCellInventory( final ItemStack o ) { final CellConfig cc = new CellConfig( o ); for( final ItemStack is : cc ) { if( !is.isEmpty() ) { final IAEItemStack i = AEItemStack.fromItemStack( is ); i.setStackSize( Integer.MAX_VALUE ); this.itemListCache.add( i ); } } }
@Override public void addCrafting( final IAEItemStack option ) { if( option == null ) { return; } final IAEItemStack st = this.records.get( ( (AEItemStack) option ).getSharedStack() ); if( st != null ) { st.setCraftable( true ); return; } final IAEItemStack opt = option.copy(); opt.setStackSize( 0 ); opt.setCraftable( true ); this.putItemRecord( opt ); }
private void completeJob() { if( this.myLastLink != null ) { ( (CraftingLink) this.myLastLink ).markDone(); } if( AELog.isCraftingLogEnabled() ) { final IAEItemStack logStack = this.finalOutput.copy(); logStack.setStackSize( this.startItemCount ); AELog.crafting( LOG_MARK_AS_COMPLETE, logStack ); } this.remainingItemCount = 0; this.startItemCount = 0; this.lastTime = 0; this.elapsedTime = 0; this.isComplete = true; }
private ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode ) { final IAEItemStack reqFilter = AEItemStack.fromItemStack( filter ); if( reqFilter == null ) { return ItemStack.EMPTY; } IAEItemStack out = null; for( final IAEItemStack req : ImmutableList.copyOf( this.getList().findFuzzy( reqFilter, fuzzyMode ) ) ) { if( req != null ) { req.setStackSize( amount ); out = this.target.extractItems( req, type, this.src ); if( out != null ) { return out.createItemStack(); } } } return ItemStack.EMPTY; }
IAEItemStack getAmountCrafted( IAEItemStack what2 ) { for( final IAEItemStack is : this.details.getCondensedOutputs() ) { if( is.equals( what2 ) ) { what2 = what2.copy(); what2.setStackSize( is.getStackSize() ); return what2; } } // more fuzzy! for( final IAEItemStack is : this.details.getCondensedOutputs() ) { if( is.getItem() == what2.getItem() && ( is.getItem().isDamageable() || is.getItemDamage() == what2.getItemDamage() ) ) { what2 = is.copy(); what2.setStackSize( is.getStackSize() ); return what2; } } throw new IllegalStateException( "Crafting Tree construction failed." ); }
@Override public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src ) { if( this.hasPermission( src ) ) { final IAEItemStack target = this.getStoredItems().findPrecise( request ); if( target != null ) { final IAEItemStack output = target.copy(); if( mode == Actionable.SIMULATE ) { return output; } target.setStackSize( 0 ); this.securityTile.inventoryChanged(); return output; } } return null; }
@Override public void addRequestable( final IAEItemStack option ) { if( option == null ) { return; } final IAEItemStack st = this.records.get( ( (AEItemStack) option ).getSharedStack() ); if( st != null ) { st.setCountRequestable( st.getCountRequestable() + option.getCountRequestable() ); return; } final IAEItemStack opt = option.copy(); opt.setStackSize( 0 ); opt.setCraftable( false ); opt.setCountRequestable( option.getCountRequestable() ); this.putItemRecord( opt ); }
private void handleInput( final IItemList<IAEItemStack> s, final IAEItemStack l ) { IAEItemStack a = s.findPrecise( l ); if( l.getStackSize() <= 0 ) { if( a != null ) { a.reset(); } } else { if( a == null ) { s.add( l.copy() ); a = s.findPrecise( l ); } if( a != null ) { a.setStackSize( l.getStackSize() ); } } }
private void handleInput( final IItemList<IAEItemStack> s, final IAEItemStack l ) { IAEItemStack a = s.findPrecise( l ); if( l.getStackSize() <= 0 ) { if( a != null ) { a.reset(); } } else { if( a == null ) { s.add( l.copy() ); a = s.findPrecise( l ); } if( a != null ) { a.setStackSize( l.getStackSize() ); } } }
public void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final IActionSource src ) throws CraftBranchFailure { for( final IAEItemStack i : this.used ) { final IAEItemStack ex = storage.extractItems( i, Actionable.MODULATE, src ); if( ex == null || ex.getStackSize() != i.getStackSize() ) { throw new CraftBranchFailure( i, i.getStackSize() ); } craftingCPUCluster.addStorage( ex ); } if( this.howManyEmitted > 0 ) { final IAEItemStack i = this.what.copy().reset(); i.setStackSize( this.howManyEmitted ); craftingCPUCluster.addEmitable( i ); } for( final CraftingTreeProcess pro : this.nodes ) { pro.setJob( storage, craftingCPUCluster, src ); } }