Package com.petrolpark.core.trade
Record Class VillagerTradeListingReference
java.lang.Object
java.lang.Record
com.petrolpark.core.trade.VillagerTradeListingReference
- All Implemented Interfaces:
ITradeListingReference,IVillagerTradeListingReference
public record VillagerTradeListingReference(net.minecraft.world.entity.npc.VillagerProfession profession, int level, int index)
extends Record
implements IVillagerTradeListingReference
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.petrolpark.core.trade.ITradeListingReference
ITradeListingReference.TypeNested classes/interfaces inherited from interface com.petrolpark.core.trade.IVillagerTradeListingReference
IVillagerTradeListingReference.Factory<REF extends ITradeListingReference> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<VillagerTradeListingReference> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, VillagerTradeListingReference> Fields inherited from interface com.petrolpark.core.trade.ITradeListingReference
FAILURE, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionVillagerTradeListingReference(net.minecraft.world.entity.npc.VillagerProfession profession, int level, int index) Creates an instance of aVillagerTradeListingReferencerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Map<net.minecraft.world.entity.npc.VillagerProfession, it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraft.world.entity.npc.VillagerTrades.ItemListing[]>> getType()final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.intlevel()Returns the value of thelevelrecord component.net.minecraft.world.entity.npc.VillagerProfessionReturns the value of theprofessionrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.petrolpark.core.trade.IVillagerTradeListingReference
get
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,VillagerTradeListingReference> STREAM_CODEC
-
-
Constructor Details
-
VillagerTradeListingReference
public VillagerTradeListingReference(net.minecraft.world.entity.npc.VillagerProfession profession, int level, int index) Creates an instance of aVillagerTradeListingReferencerecord class.- Parameters:
profession- the value for theprofessionrecord componentlevel- the value for thelevelrecord componentindex- the value for theindexrecord component
-
-
Method Details
-
getAllListings
public Map<net.minecraft.world.entity.npc.VillagerProfession,it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraft.world.entity.npc.VillagerTrades.ItemListing[]>> getAllListings()- Specified by:
getAllListingsin interfaceIVillagerTradeListingReference
-
getType
- Specified by:
getTypein interfaceITradeListingReference
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
profession
public net.minecraft.world.entity.npc.VillagerProfession profession()Returns the value of theprofessionrecord component.- Specified by:
professionin interfaceIVillagerTradeListingReference- Returns:
- the value of the
professionrecord component
-
level
public int level()Returns the value of thelevelrecord component.- Specified by:
levelin interfaceIVillagerTradeListingReference- Returns:
- the value of the
levelrecord component
-
index
public int index()Returns the value of theindexrecord component.- Specified by:
indexin interfaceIVillagerTradeListingReference- Returns:
- the value of the
indexrecord component
-