Record Class RandomChanceLootCondition

java.lang.Object
java.lang.Record
net.minecraft.loot.condition.RandomChanceLootCondition
Record Components:
chance -
All Implemented Interfaces:
Predicate<LootContext>, LootCondition, LootContextAware

public record RandomChanceLootCondition(float chance) extends Record implements LootCondition
Mappings:
Namespace Name
named net/minecraft/loot/condition/RandomChanceLootCondition
intermediary net/minecraft/class_219
official etz
named chance
intermediary comp_1881
official b
  • Field Details

    • chance

      private final float chance
      The field for the chance record component.
    • CODEC

      public static final com.mojang.serialization.MapCodec<RandomChanceLootCondition> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/loot/condition/RandomChanceLootCondition;CODEC:Lcom/mojang/serialization/MapCodec;
      intermediary field_45873 Lnet/minecraft/class_219;field_45873:Lcom/mojang/serialization/MapCodec;
      official a Letz;a:Lcom/mojang/serialization/MapCodec;
  • Constructor Details

    • RandomChanceLootCondition

      public RandomChanceLootCondition(float chance)
      Creates an instance of a RandomChanceLootCondition record class.
      Parameters:
      chance - the value for the chance record component
  • Method Details

    • getType

      public LootConditionType getType()
      Specified by:
      getType in interface LootCondition
      Mappings:
      Namespace Name Mixin selector
      named getType Lnet/minecraft/loot/condition/LootCondition;getType()Lnet/minecraft/loot/condition/LootConditionType;
      intermediary method_29325 Lnet/minecraft/class_5341;method_29325()Lnet/minecraft/class_5342;
      official b Letu;b()Letv;
    • test

      public boolean test(LootContext lootContext)
      Specified by:
      test in interface Predicate<LootContext>
      Mappings:
      Namespace Name Mixin selector
      named test Lnet/minecraft/loot/condition/RandomChanceLootCondition;test(Lnet/minecraft/loot/context/LootContext;)Z
      intermediary method_934 Lnet/minecraft/class_219;method_934(Lnet/minecraft/class_47;)Z
      official a Letz;a(Leqk;)Z
    • builder

      public static LootCondition.Builder builder(float chance)
      Mappings:
      Namespace Name Mixin selector
      named builder Lnet/minecraft/loot/condition/RandomChanceLootCondition;builder(F)Lnet/minecraft/loot/condition/LootCondition$Builder;
      intermediary method_932 Lnet/minecraft/class_219;method_932(F)Lnet/minecraft/class_5341$class_210;
      official a Letz;a(F)Letu$a;
    • 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. All components in this record class 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.
    • chance

      public float chance()
      Returns the value of the chance record component.
      Returns:
      the value of the chance record component