Class BucketItem

All Implemented Interfaces:
IItemProvider, IForgeItem, IForgeRegistryEntry<Item>
Direct Known Subclasses:
FishBucketItem

public class BucketItem extends Item
  • Field Details

    • content

      private final Fluid content
    • fluidSupplier

      private final Supplier<? extends Fluid> fluidSupplier
  • Constructor Details

  • Method Details

    • use

      public ActionResult<ItemStack> use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_)
      Overrides:
      use in class Item
    • getEmptySuccessItem

      protected ItemStack getEmptySuccessItem(ItemStack p_203790_1_, PlayerEntity p_203790_2_)
    • checkExtraContent

      public void checkExtraContent(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_)
    • emptyBucket

      public boolean emptyBucket(@Nullable PlayerEntity p_180616_1_, World p_180616_2_, BlockPos p_180616_3_, @Nullable BlockRayTraceResult p_180616_4_)
    • playEmptySound

      protected void playEmptySound(@Nullable PlayerEntity p_203791_1_, IWorld p_203791_2_, BlockPos p_203791_3_)
    • initCapabilities

      public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt)
      Description copied from interface: IForgeItem
      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.
      Parameters:
      stack - The ItemStack
      nbt - NBT of this item serialized, or null.
      Returns:
      A holder instance associated with this ItemStack where you can hold capabilities for the life of this item.
    • getFluid

      public Fluid getFluid()
    • canBlockContainFluid

      private boolean canBlockContainFluid(World worldIn, BlockPos posIn, BlockState blockstate)