Package org.cyclops.cyclopscore.item
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, net.minecraft.world.item.Item.TooltipContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected DamageIndicatedItemComponentprotected final Supplier<net.minecraft.world.level.material.Fluid> Fields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canRepair, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTHFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIESFields inherited from interface org.cyclops.cyclopscore.item.IInformationProvider
BLOCK_PREFIX, INFO_PREFIX, INFO_PREFIX_STYLES, ITEM_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionDamageIndicatedItemFluidContainer(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 TypeMethodDescriptionvoidappendHoverText(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.item.Item.TooltipContext context, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag) booleancanDrain(int amount, net.minecraft.world.item.ItemStack itemStack) If the given amount can be drained.intgetBarColor(net.minecraft.world.item.ItemStack stack) intgetBarWidth(net.minecraft.world.item.ItemStack itemStack) Collection<net.minecraft.world.item.ItemStack> net.minecraft.world.level.material.FluidgetFluid()Get the fluid.net.minecraft.network.chat.MutableComponentgetInfo(net.minecraft.world.item.ItemStack itemStack) Get info for a given itemStack.booleanisBarVisible(net.minecraft.world.item.ItemStack stack) voidprovideInformation(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, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isRepairable, isValidRepairItem, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, use, useOn, useOnRelease, verifyComponentsAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
-
Field Details
-
capacity
protected final int capacity -
component
-
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
-
getInfo
public net.minecraft.network.chat.MutableComponent getInfo(net.minecraft.world.item.ItemStack itemStack) Description copied from interface:IInformationProviderGet info for a given itemStack.- Specified by:
getInfoin interfaceIInformationProvider- 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:IInformationProviderAn extended way to provide additional information.- Specified by:
provideInformationin interfaceIInformationProvider- 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.item.Item.TooltipContext context, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag) - Overrides:
appendHoverTextin classnet.minecraft.world.item.Item
-
isBarVisible
public boolean isBarVisible(net.minecraft.world.item.ItemStack stack) - Overrides:
isBarVisiblein classnet.minecraft.world.item.Item
-
getBarWidth
public int getBarWidth(net.minecraft.world.item.ItemStack itemStack) - Overrides:
getBarWidthin classnet.minecraft.world.item.Item
-
getBarColor
public int getBarColor(net.minecraft.world.item.ItemStack stack) - Overrides:
getBarColorin classnet.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.
-