Record Class ChargedProjectiles
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.ChargedProjectiles
- All Implemented Interfaces:
TooltipProvider
public record ChargedProjectiles(List<ItemStackTemplate> items)
extends Record
implements TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ChargedProjectiles> static final ChargedProjectilesprivate final List<ItemStackTemplate> The field for theitemsrecord component.static final StreamCodec<RegistryFriendlyByteBuf, ChargedProjectiles> -
Constructor Summary
ConstructorsConstructorDescriptionChargedProjectiles(List<ItemStackTemplate> items) Creates an instance of aChargedProjectilesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddProjectileTooltip(Item.TooltipContext context, Consumer<Component> consumer, ItemStack projectile, int count) voidaddToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) booleanfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty()items()Returns the value of theitemsrecord component.static ChargedProjectilesof(ItemStackTemplate stack) static ChargedProjectilesofNonEmpty(List<ItemStack> items) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
items
The field for theitemsrecord component. -
EMPTY
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
ChargedProjectiles
Creates an instance of aChargedProjectilesrecord class.- Parameters:
items- the value for theitemsrecord component
-
-
Method Details
-
of
-
ofNonEmpty
-
contains
-
itemCopies
-
isEmpty
public boolean isEmpty() -
addToTooltip
public void addToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) - Specified by:
addToTooltipin interfaceTooltipProvider
-
addProjectileTooltip
private static void addProjectileTooltip(Item.TooltipContext context, Consumer<Component> consumer, ItemStack projectile, int count) -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
items
Returns the value of theitemsrecord component.- Returns:
- the value of the
itemsrecord component
-