Record Class Weighted<T>

java.lang.Object
java.lang.Record
net.minecraft.util.collection.Weighted<T>
Record Components:
value -
weight -

public record Weighted<T>(T value, int weight) extends Record
A data value with an associated weight. Weighted values are used in pools.
Mappings:
Namespace Name
named net/minecraft/util/collection/Weighted
intermediary net/minecraft/class_6010
official bzz
named value
intermediary comp_2542
official a
named weight
intermediary comp_2543
official b
  • Field Details

    • value

      private final T value
      The field for the value record component.
    • weight

      private final int weight
      The field for the weight record component.
    • LOGGER

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/util/collection/Weighted;LOGGER:Lorg/slf4j/Logger;
      intermediary field_55645 Lnet/minecraft/class_6010;field_55645:Lorg/slf4j/Logger;
      official c Lbzz;c:Lorg/slf4j/Logger;
  • Constructor Details

    • Weighted

      public Weighted(T value, int weight)
      Creates an instance of a Weighted record class.
      Parameters:
      value - the value for the value record component
      weight - the value for the weight record component
  • Method Details

    • createCodec

      public static <E> com.mojang.serialization.Codec<Weighted<E>> createCodec(com.mojang.serialization.Codec<E> dataCodec)
      Mappings:
      Namespace Name Mixin selector
      named createCodec Lnet/minecraft/util/collection/Weighted;createCodec(Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      intermediary method_34981 Lnet/minecraft/class_6010;method_34981(Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
      official a Lbzz;a(Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
    • createCodec

      public static <E> com.mojang.serialization.Codec<Weighted<E>> createCodec(com.mojang.serialization.MapCodec<E> dataCodec)
      Mappings:
      Namespace Name Mixin selector
      named createCodec Lnet/minecraft/util/collection/Weighted;createCodec(Lcom/mojang/serialization/MapCodec;)Lcom/mojang/serialization/Codec;
      intermediary method_66211 Lnet/minecraft/class_6010;method_66211(Lcom/mojang/serialization/MapCodec;)Lcom/mojang/serialization/Codec;
      official a Lbzz;a(Lcom/mojang/serialization/MapCodec;)Lcom/mojang/serialization/Codec;
    • createPacketCodec

      public static <B extends ByteBuf, T> PacketCodec<B,Weighted<T>> createPacketCodec(PacketCodec<B,T> dataCodec)
      Mappings:
      Namespace Name Mixin selector
      named createPacketCodec Lnet/minecraft/util/collection/Weighted;createPacketCodec(Lnet/minecraft/network/codec/PacketCodec;)Lnet/minecraft/network/codec/PacketCodec;
      intermediary method_73184 Lnet/minecraft/class_6010;method_73184(Lnet/minecraft/class_9139;)Lnet/minecraft/class_9139;
      official a Lbzz;a(Laae;)Laae;
    • transform

      public <U> Weighted<U> transform(Function<T,U> function)
      Mappings:
      Namespace Name Mixin selector
      named transform Lnet/minecraft/util/collection/Weighted;transform(Ljava/util/function/Function;)Lnet/minecraft/util/collection/Weighted;
      intermediary method_68255 Lnet/minecraft/class_6010;method_68255(Ljava/util/function/Function;)Lnet/minecraft/class_6010;
      official a Lbzz;a(Ljava/util/function/Function;)Lbzz;
    • 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.
    • value

      public T value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • weight

      public int weight()
      Returns the value of the weight record component.
      Returns:
      the value of the weight record component