Record Class VillagerOffers
java.lang.Object
java.lang.Record
net.darkhax.bookshelf.common.api.entity.villager.trades.VillagerOffers
- Record Components:
offers- An equally weighted array of offers.
- All Implemented Interfaces:
net.minecraft.world.entity.npc.VillagerTrades.ItemListing
public record VillagerOffers(Supplier<net.minecraft.world.item.trading.MerchantOffer>[] offers)
extends Record
implements net.minecraft.world.entity.npc.VillagerTrades.ItemListing
A simple villager trade entry that selects a random offer from an equally weighted array of offers.
-
Constructor Summary
ConstructorsConstructorDescriptionVillagerOffers(Supplier<net.minecraft.world.item.trading.MerchantOffer>... offers) Creates an instance of aVillagerOffersrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.trading.MerchantOffergetOffer(@NotNull net.minecraft.world.entity.Entity entity, @NotNull net.minecraft.util.RandomSource randomSource) final inthashCode()Returns a hash code value for this object.Supplier<net.minecraft.world.item.trading.MerchantOffer>[]offers()Returns the value of theoffersrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
VillagerOffers
@SafeVarargs public VillagerOffers(Supplier<net.minecraft.world.item.trading.MerchantOffer>... offers) Creates an instance of aVillagerOffersrecord class.- Parameters:
offers- the value for theoffersrecord component
-
-
Method Details
-
getOffer
public net.minecraft.world.item.trading.MerchantOffer getOffer(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull net.minecraft.util.RandomSource randomSource) - Specified by:
getOfferin interfacenet.minecraft.world.entity.npc.VillagerTrades.ItemListing
-
toString
Returns 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. -
hashCode
public 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. -
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). -
offers
Returns the value of theoffersrecord component.- Returns:
- the value of the
offersrecord component
-