Class BucketItem

java.lang.Object
net.minecraft.item.Item
net.minecraft.item.BucketItem
All Implemented Interfaces:
ItemConvertible
Direct Known Subclasses:
FishBucketItem

public class BucketItem
extends Item
  • Field Details

    • fluid

      private final Fluid fluid
  • Constructor Details

  • Method Details

    • use

      public TypedActionResult<ItemStack> use​(World world, PlayerEntity user, Hand hand)
      Called when an item is used by a player. The use action, by default, is bound to the right mouse button.

      This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using world.isClient().

      Overrides:
      use in class Item
      Parameters:
      world - the world the item was used in
      user - the player who used the item
      hand - the hand used
      Returns:
      a typed action result that specifies whether using the item was successful. The action result contains the new item stack that the player's hand will be set to.
    • getEmptiedStack

      protected ItemStack getEmptiedStack​(ItemStack stack, PlayerEntity player)
    • onEmptied

      public void onEmptied​(World world, ItemStack stack, BlockPos pos)
    • placeFluid

      public boolean placeFluid​(@Nullable PlayerEntity player, World world, BlockPos pos, @Nullable BlockHitResult blockHitResult)
    • playEmptyingSound

      protected void playEmptyingSound​(@Nullable PlayerEntity player, WorldAccess world, BlockPos pos)