Class CustomFluidContainerTest.CustomFluidContainer

java.lang.Object
net.minecraft.world.item.Item
net.minecraftforge.debug.item.CustomFluidContainerTest.CustomFluidContainer
All Implemented Interfaces:
FeatureElement, ItemLike, IForgeItem
Enclosing class:
CustomFluidContainerTest

private static class CustomFluidContainerTest.CustomFluidContainer extends Item
A custom fluid container item with a capacity of a vanilla bucket which uses the FluidUtil functionalities to pickup and place fluids.
  • Constructor Details

    • CustomFluidContainer

      public CustomFluidContainer(Item.Properties properties)
  • Method Details

    • getName

      @Nonnull public Component getName(@Nonnull ItemStack itemStack)
      Overrides:
      getName in class Item
    • use

      public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand)
      Overrides:
      use in class Item
    • initCapabilities

      public ICapabilityProvider initCapabilities(@Nonnull 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.
      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.