Record Class TradedItem

java.lang.Object
java.lang.Record
net.minecraft.village.TradedItem
Record Components:
item -
count -
components -
itemStack -

public record TradedItem(RegistryEntry<Item> item, int count, ComponentPredicate components, ItemStack itemStack) extends Record
Mappings:
Namespace Name
official cyz
intermediary net/minecraft/class_9306
named net/minecraft/village/TradedItem
official d
intermediary comp_2424
named item
official e
intermediary comp_2425
named count
official f
intermediary comp_2426
named components
official g
intermediary comp_2427
named itemStack
  • Field Details

    • item

      private final RegistryEntry<Item> item
      The field for the item record component.
    • count

      private final int count
      The field for the count record component.
    • components

      private final ComponentPredicate components
      The field for the components record component.
    • itemStack

      private final ItemStack itemStack
      The field for the itemStack record component.
    • CODEC

      public static final com.mojang.serialization.Codec<TradedItem> CODEC
      Mappings:
      Namespace Name Mixin selector
      official a Lcyz;a:Lcom/mojang/serialization/Codec;
      intermediary field_49393 Lnet/minecraft/class_9306;field_49393:Lcom/mojang/serialization/Codec;
      named CODEC Lnet/minecraft/village/TradedItem;CODEC:Lcom/mojang/serialization/Codec;
    • PACKET_CODEC

      public static final PacketCodec<RegistryByteBuf,TradedItem> PACKET_CODEC
      Mappings:
      Namespace Name Mixin selector
      official b Lcyz;b:Lys;
      intermediary field_49394 Lnet/minecraft/class_9306;field_49394:Lnet/minecraft/class_9139;
      named PACKET_CODEC Lnet/minecraft/village/TradedItem;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
    • OPTIONAL_PACKET_CODEC

      public static final PacketCodec<RegistryByteBuf,Optional<TradedItem>> OPTIONAL_PACKET_CODEC
      Mappings:
      Namespace Name Mixin selector
      official c Lcyz;c:Lys;
      intermediary field_49395 Lnet/minecraft/class_9306;field_49395:Lnet/minecraft/class_9139;
      named OPTIONAL_PACKET_CODEC Lnet/minecraft/village/TradedItem;OPTIONAL_PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
  • Constructor Details

    • TradedItem

      public TradedItem(ItemConvertible item)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcyz;<init>(Ldac;)V
      intermediary <init> Lnet/minecraft/class_9306;<init>(Lnet/minecraft/class_1935;)V
      named <init> Lnet/minecraft/village/TradedItem;<init>(Lnet/minecraft/item/ItemConvertible;)V
    • TradedItem

      public TradedItem(ItemConvertible item, int count)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcyz;<init>(Ldac;I)V
      intermediary <init> Lnet/minecraft/class_9306;<init>(Lnet/minecraft/class_1935;I)V
      named <init> Lnet/minecraft/village/TradedItem;<init>(Lnet/minecraft/item/ItemConvertible;I)V
    • TradedItem

      public TradedItem(RegistryEntry<Item> item, int count, ComponentPredicate components)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcyz;<init>(Liw;ILjy;)V
      intermediary <init> Lnet/minecraft/class_9306;<init>(Lnet/minecraft/class_6880;ILnet/minecraft/class_9329;)V
      named <init> Lnet/minecraft/village/TradedItem;<init>(Lnet/minecraft/registry/entry/RegistryEntry;ILnet/minecraft/predicate/ComponentPredicate;)V
    • TradedItem

      public TradedItem(RegistryEntry<Item> registryEntry, int int2, ComponentPredicate componentPredicate, ItemStack itemStack)
  • Method Details

    • withComponents

      public TradedItem withComponents(UnaryOperator<ComponentPredicate.Builder> builderCallback)
      Mappings:
      Namespace Name Mixin selector
      official a Lcyz;a(Ljava/util/function/UnaryOperator;)Lcyz;
      intermediary method_57554 Lnet/minecraft/class_9306;method_57554(Ljava/util/function/UnaryOperator;)Lnet/minecraft/class_9306;
      named withComponents Lnet/minecraft/village/TradedItem;withComponents(Ljava/util/function/UnaryOperator;)Lnet/minecraft/village/TradedItem;
    • createDisplayStack

      private static ItemStack createDisplayStack(RegistryEntry<Item> item, int count, ComponentPredicate components)
      Mappings:
      Namespace Name Mixin selector
      official a Lcyz;a(Liw;ILjy;)Lcsz;
      intermediary method_57553 Lnet/minecraft/class_9306;method_57553(Lnet/minecraft/class_6880;ILnet/minecraft/class_9329;)Lnet/minecraft/class_1799;
      named createDisplayStack Lnet/minecraft/village/TradedItem;createDisplayStack(Lnet/minecraft/registry/entry/RegistryEntry;ILnet/minecraft/predicate/ComponentPredicate;)Lnet/minecraft/item/ItemStack;
    • matches

      public boolean matches(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a Lcyz;a(Lcsz;)Z
      intermediary method_57552 Lnet/minecraft/class_9306;method_57552(Lnet/minecraft/class_1799;)Z
      named matches Lnet/minecraft/village/TradedItem;matches(Lnet/minecraft/item/ItemStack;)Z
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • item

      public RegistryEntry<Item> item()
      Returns the value of the item record component.
      Returns:
      the value of the item record component
    • count

      public int count()
      Returns the value of the count record component.
      Returns:
      the value of the count record component
    • components

      public ComponentPredicate components()
      Returns the value of the components record component.
      Returns:
      the value of the components record component
    • itemStack

      public ItemStack itemStack()
      Returns the value of the itemStack record component.
      Returns:
      the value of the itemStack record component