Package net.minecraft.world.item.trading
Record Class ItemCost
java.lang.Object
java.lang.Record
net.minecraft.world.item.trading.ItemCost
public record ItemCost(Holder<Item> item, int count, DataComponentPredicate components, ItemStack itemStack)
extends Record
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemCost> private final DataComponentPredicateThe field for thecomponentsrecord component.private final intThe field for thecountrecord component.The field for theitemrecord component.private final ItemStackThe field for theitemStackrecord component.static final StreamCodec<RegistryFriendlyByteBuf, Optional<ItemCost>> static final StreamCodec<RegistryFriendlyByteBuf, ItemCost> 
- 
Constructor SummaryConstructorsConstructorDescriptionItemCost(Holder<Item> p_331233_, int p_334492_, DataComponentPredicate p_330788_) ItemCost(Holder<Item> item, int count, DataComponentPredicate components, ItemStack itemStack) Creates an instance of aItemCostrecord class.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the value of thecomponentsrecord component.intcount()Returns the value of thecountrecord component.private static ItemStackcreateStack(Holder<Item> p_329043_, int p_329370_, DataComponentPredicate p_330789_) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.item()Returns the value of theitemrecord component.Returns the value of theitemStackrecord component.booleanfinal StringtoString()Returns a string representation of this record class.
- 
Field Details- 
itemThe field for theitemrecord component.
- 
countprivate final int countThe field for thecountrecord component.
- 
componentsThe field for thecomponentsrecord component.
- 
itemStackThe field for theitemStackrecord component.
- 
CODEC
- 
STREAM_CODEC
- 
OPTIONAL_STREAM_CODEC
 
- 
- 
Constructor Details- 
ItemCost
- 
ItemCost
- 
ItemCost
- 
ItemCostpublic ItemCost(Holder<Item> item, int count, DataComponentPredicate components, ItemStack itemStack) Creates an instance of aItemCostrecord class.- Parameters:
- item- the value for the- itemrecord component
- count- the value for the- countrecord component
- components- the value for the- componentsrecord component
- itemStack- the value for the- itemStackrecord component
 
 
- 
- 
Method Details- 
withComponents
- 
createStackprivate static ItemStack createStack(Holder<Item> p_329043_, int p_329370_, DataComponentPredicate p_330789_) 
- 
test
- 
toStringReturns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
- 
hashCodepublic final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
- 
equalsIndicates 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='.
- 
itemReturns the value of theitemrecord component.- Returns:
- the value of the itemrecord component
 
- 
countpublic int count()Returns the value of thecountrecord component.- Returns:
- the value of the countrecord component
 
- 
componentsReturns the value of thecomponentsrecord component.- Returns:
- the value of the componentsrecord component
 
- 
itemStackReturns the value of theitemStackrecord component.- Returns:
- the value of the itemStackrecord component
 
 
-