List of usage examples for net.minecraftforge.fluids.capability.templates FluidHandlerItemStack FluidHandlerItemStack
public FluidHandlerItemStack(@Nonnull ItemStack container, int capacity)
From source file:blusunrize.immersiveengineering.common.items.ItemJerrycan.java
@Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { if (!stack.isEmpty()) return new FluidHandlerItemStack(stack, 10000); return null;//from w w w. j a v a 2 s . c om }
From source file:com.buuz135.industrial.item.MeatFeederItem.java
License:Open Source License
@Nullable @Override/*from www.j ava 2s. c o m*/ public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { FluidHandlerItemStack handlerItemStack = new FluidHandlerItemStack(stack, 128000) { @Override public boolean canFillFluidType(FluidStack fluid) { return fluid.getFluid().equals(FluidsRegistry.MEAT); } }; handlerItemStack.fill(new FluidStack(FluidsRegistry.MEAT, 0), true); return handlerItemStack; }
From source file:com.teambrmodding.assistedprogression.common.item.PipetteItem.java
License:Creative Commons License
@Nullable @Override//from w w w .j av a2 s. co m public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { return new FluidHandlerItemStack(stack, FluidAttributes.BUCKET_VOLUME); }
From source file:com.teambrmodding.assistedprogression.common.item.PipetteItem.java
License:Creative Commons License
/** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) *//*from w w w . j a v a2s . c o m*/ @Override public void fillItemGroup(ItemGroup itemIn, NonNullList<ItemStack> tab) { if (itemIn == ItemManager.itemGroupAssistedProgressionPipettes) { tab.add(new ItemStack(this)); // Add for all fluids ForgeRegistries.FLUIDS.getValues().stream().filter(fluid -> fluid.isSource(fluid.getDefaultState())) .forEach(fluid -> { ItemStack pipetteStack = new ItemStack(this); FluidHandlerItemStack fluidStack = new FluidHandlerItemStack(pipetteStack, FluidAttributes.BUCKET_VOLUME); if (fluidStack.fill(new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE) == FluidAttributes.BUCKET_VOLUME) tab.add(pipetteStack); }); } }
From source file:com.teambrmodding.neotech.common.blocks.storage.ItemBlockFluidStorage.java
License:Creative Commons License
/** * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack. * Can be retrieved from stack.getCapabilities() * The NBT can be null if this is not called from readNBT or if the item the stack is * changing FROM is different then this item, or the previous item had no capabilities. * * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item. * Remember that getItem CAN return null. * * @param stack The ItemStack//from w w w.j ava 2 s . co m * @param nbt NBT of this item serialized, or null. * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item. */ @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { int capacity = 16000; if (fluidStorage == BlockManager.advancedTank) capacity *= 4; else if (fluidStorage == BlockManager.eliteTank) capacity *= 8; return new FluidHandlerItemStack(stack, capacity); }