Package org.cyclops.cyclopscore.item
Class DamageIndicatedItemFluidContainer
java.lang.Object
net.minecraft.world.item.Item
net.minecraftforge.fluids.capability.ItemFluidContainer
org.cyclops.cyclopscore.item.DamageIndicatedItemFluidContainer
- All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement
,net.minecraft.world.level.ItemLike
,net.minecraftforge.common.extensions.IForgeItem
,IInformationProvider
public abstract class DamageIndicatedItemFluidContainer
extends net.minecraftforge.fluids.capability.ItemFluidContainer
implements IInformationProvider
This extension on
ItemFluidContainer
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
Modifier and TypeFieldDescriptionprotected DamageIndicatedItemComponent
protected Supplier<net.minecraft.world.level.material.Fluid>
Fields inherited from class net.minecraftforge.fluids.capability.ItemFluidContainer
capacity
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
ConstructorDescriptionDamageIndicatedItemFluidContainer
(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 TypeMethodDescriptionvoid
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
getFluid()
Get the fluid.net.minecraft.network.chat.MutableComponent
getInfo
(net.minecraft.world.item.ItemStack itemStack) Get info for a given itemStack.net.minecraftforge.common.capabilities.ICapabilityProvider
initCapabilities
(net.minecraft.world.item.ItemStack stack, net.minecraft.nbt.CompoundTag nbt) 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, 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.minecraftforge.common.extensions.IForgeItem
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, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
-
Field Details
-
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:IInformationProvider
Get info for a given itemStack.- Specified by:
getInfo
in 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:IInformationProvider
An extended way to provide additional information.- Specified by:
provideInformation
in 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.level.Level world, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flag) - Overrides:
appendHoverText
in classnet.minecraft.world.item.Item
-
isBarVisible
public boolean isBarVisible(net.minecraft.world.item.ItemStack stack) - Overrides:
isBarVisible
in classnet.minecraft.world.item.Item
-
getBarWidth
public int getBarWidth(net.minecraft.world.item.ItemStack itemStack) - Overrides:
getBarWidth
in classnet.minecraft.world.item.Item
-
getBarColor
public int getBarColor(net.minecraft.world.item.ItemStack stack) - Overrides:
getBarColor
in 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.
-
initCapabilities
public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(net.minecraft.world.item.ItemStack stack, net.minecraft.nbt.CompoundTag nbt) - Specified by:
initCapabilities
in interfacenet.minecraftforge.common.extensions.IForgeItem
- Overrides:
initCapabilities
in classnet.minecraftforge.fluids.capability.ItemFluidContainer
-