Class DamageIndicatedItemFluidContainer

java.lang.Object
net.minecraft.world.item.Item
org.cyclops.cyclopscore.item.DamageIndicatedItemFluidContainer
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.neoforged.neoforge.common.extensions.IItemExtension, IInformationProvider

public abstract class DamageIndicatedItemFluidContainer extends net.minecraft.world.item.Item implements IInformationProvider
This extension on Item with a fluid capability will show a damage indicator depending on how full the container is. This can be used to hold certain amounts of Fluids in an Item. When this item is available in a CreativeTab, it will add itself as a full and an empty container. This container ONLY allows the fluid from the given type.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.item.Item

    net.minecraft.world.item.Item.Properties
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
     
     
    protected final Supplier<net.minecraft.world.level.material.Fluid>
     

    Fields inherited from class net.minecraft.world.item.Item

    BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES

    Fields inherited from interface org.cyclops.cyclopscore.item.IInformationProvider

    BLOCK_PREFIX, INFO_PREFIX, INFO_PREFIX_STYLES, ITEM_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    DamageIndicatedItemFluidContainer(net.minecraft.world.item.Item.Properties builder, int capacity, Supplier<net.minecraft.world.level.material.Fluid> fluid)
    Create a new DamageIndicatedItemFluidContainer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendHoverText(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag)
     
    boolean
    canDrain(int amount, net.minecraft.world.item.ItemStack itemStack)
    If the given amount can be drained.
    int
    getBarColor(net.minecraft.world.item.ItemStack stack)
     
    int
    getBarWidth(net.minecraft.world.item.ItemStack itemStack)
     
    Collection<net.minecraft.world.item.ItemStack>
     
    net.minecraft.world.level.material.Fluid
    Get the fluid.
    net.minecraft.network.chat.MutableComponent
    getInfo(net.minecraft.world.item.ItemStack itemStack)
    Get info for a given itemStack.
    boolean
    isBarVisible(net.minecraft.world.item.ItemStack stack)
     
    void
    provideInformation(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag)
    An extended way to provide additional information.

    Methods inherited from class net.minecraft.world.item.Item

    asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, use, useOn, useOnRelease, verifyTagAfterLoad

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension

    canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
  • Field Details

    • capacity

      protected final int capacity
    • component

      protected DamageIndicatedItemComponent component
    • fluid

      protected final Supplier<net.minecraft.world.level.material.Fluid> fluid
  • Constructor Details

    • DamageIndicatedItemFluidContainer

      public DamageIndicatedItemFluidContainer(net.minecraft.world.item.Item.Properties builder, int capacity, Supplier<net.minecraft.world.level.material.Fluid> fluid)
      Create a new DamageIndicatedItemFluidContainer.
      Parameters:
      builder - Item properties builder.
      capacity - The capacity this container will have.
      fluid - The Fluid instance this container must hold.
  • Method Details

    • getDefaultCreativeTabEntries

      public Collection<net.minecraft.world.item.ItemStack> getDefaultCreativeTabEntries()
    • getInfo

      public net.minecraft.network.chat.MutableComponent getInfo(net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IInformationProvider
      Get info for a given itemStack.
      Specified by:
      getInfo in interface IInformationProvider
      Parameters:
      itemStack - The itemStack that must be given information.
      Returns:
      Information for that itemStack.
    • provideInformation

      public void provideInformation(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag)
      Description copied from interface: IInformationProvider
      An extended way to provide additional information.
      Specified by:
      provideInformation in interface IInformationProvider
      Parameters:
      itemStack - The itemStack that must be given information.
      world - The player that asks for information.
      list - The list of information.
      flag - The tooltip flag type.
    • appendHoverText

      public void appendHoverText(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag)
      Overrides:
      appendHoverText in class net.minecraft.world.item.Item
    • isBarVisible

      public boolean isBarVisible(net.minecraft.world.item.ItemStack stack)
      Overrides:
      isBarVisible in class net.minecraft.world.item.Item
    • getBarWidth

      public int getBarWidth(net.minecraft.world.item.ItemStack itemStack)
      Overrides:
      getBarWidth in class net.minecraft.world.item.Item
    • getBarColor

      public int getBarColor(net.minecraft.world.item.ItemStack stack)
      Overrides:
      getBarColor in class net.minecraft.world.item.Item
    • getFluid

      public net.minecraft.world.level.material.Fluid getFluid()
      Get the fluid.
      Returns:
      The fluid.
    • canDrain

      public boolean canDrain(int amount, net.minecraft.world.item.ItemStack itemStack)
      If the given amount can be drained. (Will drain in simulation mode)
      Parameters:
      amount - The amount to try to drain.
      itemStack - The item stack to drain from.
      Returns:
      If it could be drained.