Example usage for net.minecraftforge.fluids FluidAttributes BUCKET_VOLUME

List of usage examples for net.minecraftforge.fluids FluidAttributes BUCKET_VOLUME

Introduction

In this page you can find the example usage for net.minecraftforge.fluids FluidAttributes BUCKET_VOLUME.

Prototype

int BUCKET_VOLUME

To view the source code for net.minecraftforge.fluids FluidAttributes BUCKET_VOLUME.

Click Source Link

Usage

From source file:com.teambrmodding.assistedprogression.common.item.PipetteItem.java

License:Creative Commons License

@Nullable
@Override//www  . j a  v  a2 s .  c  om
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)
 *//* w  ww  . j av a  2s  .  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);
                });
    }
}