Record Class TradeSet
java.lang.Object
java.lang.Record
net.minecraft.world.item.trading.TradeSet
public record TradeSet(HolderSet<VillagerTrade> trades, Holder<ContextIntProvider> amount, boolean allowDuplicates, Optional<Identifier> randomSequence)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for theallowDuplicatesrecord component.private final Holder<ContextIntProvider> The field for theamountrecord component.static final com.mojang.serialization.Codec<TradeSet> private final Optional<Identifier> The field for therandomSequencerecord component.private final HolderSet<VillagerTrade> The field for thetradesrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionTradeSet(HolderSet<VillagerTrade> trades, Holder<ContextIntProvider> amount, boolean allowDuplicates, Optional<Identifier> randomSequence) Creates an instance of aTradeSetrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowDuplicatesrecord component.amount()Returns the value of theamountrecord component.intcalculateNumberOfTrades(LootContext lootContext) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of therandomSequencerecord component.final StringtoString()Returns a string representation of this record class.trades()Returns the value of thetradesrecord component.
-
Field Details
-
trades
The field for thetradesrecord component. -
amount
The field for theamountrecord component. -
allowDuplicates
private final boolean allowDuplicatesThe field for theallowDuplicatesrecord component. -
randomSequence
The field for therandomSequencerecord component. -
CODEC
-
-
Constructor Details
-
TradeSet
public TradeSet(HolderSet<VillagerTrade> trades, Holder<ContextIntProvider> amount, boolean allowDuplicates, Optional<Identifier> randomSequence) Creates an instance of aTradeSetrecord class.- Parameters:
trades- the value for thetradesrecord componentamount- the value for theamountrecord componentallowDuplicates- the value for theallowDuplicatesrecord componentrandomSequence- the value for therandomSequencerecord component
-
-
Method Details
-
calculateNumberOfTrades
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
trades
Returns the value of thetradesrecord component.- Returns:
- the value of the
tradesrecord component
-
amount
Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-
allowDuplicates
public boolean allowDuplicates()Returns the value of theallowDuplicatesrecord component.- Returns:
- the value of the
allowDuplicatesrecord component
-
randomSequence
Returns the value of therandomSequencerecord component.- Returns:
- the value of the
randomSequencerecord component
-