private int getBoosters() { final ItemStack boosters = this.inv.getStackInSlot( 0 ); return boosters == null ? 0 : boosters.getCount(); }
/** * Bridge for requestItem() using an ItemStack. */ public static List<ItemStack> requestItem(ItemStack stack, ICorporeaSpark spark, boolean checkNBT, boolean doit) { return requestItem(stack, stack.getCount(), spark, checkNBT, doit); }
private void addItem(ItemStack stack) { int size = stack.getCount(); stack.setCount(1); for(int i = 0; i < size; i++) stacksIn.add(stack.copy()); }
@Nullable public static AEItemStack fromItemStack( @Nonnull final ItemStack stack ) { if( stack.isEmpty() ) { return null; } return new AEItemStack( AEItemStackRegistry.getRegisteredStack( stack ), stack.getCount() ); }
@Override public int getIcon() { if( this.getHasStack() ) { return this.getStack().getCount() > 0 ? 16 + 14 : 14; } return -1; } }
@Override public void maceratorRecipe( ItemStack in, ItemStack out ) { ic2.api.recipe.Recipes.macerator.addRecipe( new IC2RecipeInput( in, in.getCount() ), null, false, out ); } }
@Override public ItemStack insertItem( int slot, ItemStack stack, boolean simulate ) { if( slot != 0 ) { return stack; } if( !simulate && !stack.isEmpty() ) { TileCondenser.this.addPower( stack.getCount() ); } return ItemStack.EMPTY; }
public void doRequest() { ICorporeaSpark spark = getSpark(); if(spark != null && spark.getMaster() != null) { List<ItemStack> filter = getFilter(); if(!filter.isEmpty()) { ItemStack stack = filter.get(world.rand.nextInt(filter.size())); if(!stack.isEmpty()) doCorporeaRequest(stack, stack.getCount(), spark); } } }
/** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new * stack. */ @Override public ItemStack decrStackSize( final int par1 ) { if( this.getHasStack() ) { this.amountCrafted += Math.min( par1, this.getStack().getCount() ); } return super.decrStackSize( par1 ); }
private void addStack(ItemStack stack) { if(stack.isEmpty()) return; for(ItemStack oStack : materials) if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) { oStack.grow(stack.getCount()); return; } materials.add(stack); }
public int getTotalTime() { ItemStack stack = itemHandler.getStackInSlot(0); if(stack.isEmpty()) return 0; return getStackItemTime(stack) * stack.getCount(); }
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) { int count = 0; for(int i = 0; i < player.inventory.getSizeInventory(); i++) { ItemStack stack = player.inventory.getStackInSlot(i); if(!stack.isEmpty() && pattern.matcher(stack.getTranslationKey()).find()) count += stack.getCount(); } set(displayStack, count); }
public Bounds( final ItemStack stack, final FuzzyMode fuzzy, final boolean ignoreMeta ) { Preconditions.checkState( !stack.isEmpty(), "ItemStack#isEmpty() has to be false" ); Preconditions.checkState( stack.getCount() == 1, "ItemStack#getCount() has to be 1" ); final NBTTagCompound tag = stack.hasTagCompound() ? stack.getTagCompound() : null; this.lower = this.makeLowerBound( stack, tag, fuzzy, ignoreMeta ); this.upper = this.makeUpperBound( stack, tag, fuzzy, ignoreMeta ); }
private boolean canEatFuel() { final ItemStack is = this.inv.getStackInSlot( 0 ); if( !is.isEmpty() ) { final int newBurnTime = TileEntityFurnace.getItemBurnTime( is ); if( newBurnTime > 0 && is.getCount() > 0 ) { return true; } } return false; }
@Override public void securityBreak() { if( this.getItemStack().getCount() > 0 && this.getGridNode() != null ) { final List<ItemStack> items = new ArrayList<>(); items.add( this.is.copy() ); this.host.removePart( this.side, false ); Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items ); this.is.setCount( 0 ); } }
@Override public boolean isSameType( final ItemStack otherStack ) { if( otherStack.isEmpty() ) { return false; } int oldSize = otherStack.getCount(); otherStack.setCount( 1 ); boolean ret = ItemStack.areItemStacksEqual( this.getDefinition(), otherStack ); otherStack.setCount( oldSize ); return ret; }
private boolean isValidWaterContainer(ItemStack stack) { if(stack.isEmpty() || stack.getCount() != 1) return false; if(stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) { IFluidHandler handler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); FluidStack simulate = handler.drain(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), false); if(simulate != null && simulate.getFluid() == FluidRegistry.WATER && simulate.amount == Fluid.BUCKET_VOLUME) return true; } return false; }
public void updateOutput( ItemStack added, ItemStack removed ) { this.hasChanged = true; if( !added.isEmpty() ) { this.changeSet.add( AEItemStack.fromItemStack( added ) ); } if( !removed.isEmpty() ) { this.changeSet.add( AEItemStack.fromItemStack( removed ).setStackSize( -removed.getCount() ) ); } }
@SubscribeEvent public static void onDrops(LivingDropsEvent event) { if(event.getEntityLiving() instanceof EntityBlaze && event.getEntityLiving().getEntityData().getBoolean(TAG_FEL_SPAWNED)) if(event.getDrops().isEmpty()) event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(Items.BLAZE_POWDER, 6))); else for(EntityItem item : event.getDrops()) { ItemStack stack = item.getItem(); if(stack.getItem() == Items.BLAZE_ROD) item.setItem(new ItemStack(Items.BLAZE_POWDER, stack.getCount() * 10)); } }
@Override public void detectAndSendChanges() { final int boosters = this.boosterSlot.getStack().isEmpty() ? 0 : this.boosterSlot.getStack().getCount(); this.setRange( (long) ( 10 * AEConfig.instance().wireless_getMaxRange( boosters ) ) ); this.setDrain( (long) ( 100 * AEConfig.instance().wireless_getPowerDrain( boosters ) ) ); super.detectAndSendChanges(); }