Class BucketItem

java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.BucketItem
All Implemented Interfaces:
DispensibleContainerItem, ItemLike, IForgeDispensibleContainerItem, IForgeItem
Direct Known Subclasses:
MobBucketItem

public class BucketItem extends Item implements DispensibleContainerItem
  • Field Details

    • content

      private final Fluid content
    • fluidSupplier

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

  • Method Details

    • use

      public InteractionResultHolder<ItemStack> use(Level p_40703_, Player p_40704_, InteractionHand p_40705_)
      Overrides:
      use in class Item
    • getEmptySuccessItem

      public static ItemStack getEmptySuccessItem(ItemStack p_40700_, Player p_40701_)
    • checkExtraContent

      public void checkExtraContent(@Nullable Player p_150711_, Level p_150712_, ItemStack p_150713_, BlockPos p_150714_)
      Specified by:
      checkExtraContent in interface DispensibleContainerItem
    • emptyContents

      @Deprecated public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_)
      Deprecated.
      Specified by:
      emptyContents in interface DispensibleContainerItem
    • emptyContents

      public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_, @Nullable ItemStack container)
      Description copied from interface: IForgeDispensibleContainerItem
      Empties the contents of the container and returns whether it was successful.
      Specified by:
      emptyContents in interface IForgeDispensibleContainerItem
      Parameters:
      p_150716_ - Player who empties the container. May be null for blocks like dispensers.
      p_150717_ - Level to place the content in
      p_150718_ - The position in the level to empty the content
      p_150719_ - Hit result of the interaction. May be null for blocks like dispensers.
      container - ItemStack of the container. May be null for backwards compatibility.
      Returns:
      true if emptying the contents of the container was successful, false otherwise
    • playEmptySound

      protected void playEmptySound(@Nullable Player p_40696_, LevelAccessor p_40697_, BlockPos p_40698_)
    • initCapabilities

      public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag 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.
      Specified by:
      initCapabilities in interface IForgeItem
      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

      protected boolean canBlockContainFluid(Level worldIn, BlockPos posIn, BlockState blockstate)