Record Class LootItemRandomChanceWithEnchantedBonusCondition
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceWithEnchantedBonusCondition
- All Implemented Interfaces:
Predicate<LootContext>,LootContextUser,LootItemCondition
public record LootItemRandomChanceWithEnchantedBonusCondition(float unenchantedChance, LevelBasedValue enchantedChance, Holder<Enchantment> enchantment)
extends Record
implements LootItemCondition
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.world.level.storage.loot.predicates.LootItemCondition
LootItemCondition.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<LootItemRandomChanceWithEnchantedBonusCondition> private final LevelBasedValueThe field for theenchantedChancerecord component.private final Holder<Enchantment> The field for theenchantmentrecord component.private final floatThe field for theunenchantedChancerecord component.Fields inherited from interface net.minecraft.world.level.storage.loot.predicates.LootItemCondition
DIRECT_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionLootItemRandomChanceWithEnchantedBonusCondition(float unenchantedChance, LevelBasedValue enchantedChance, Holder<Enchantment> enchantment) Creates an instance of aLootItemRandomChanceWithEnchantedBonusConditionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theenchantedChancerecord component.Returns the value of theenchantmentrecord component.final booleanIndicates whether some other object is "equal to" this one.Set<LootContextParam<?>> getType()final inthashCode()Returns a hash code value for this object.static LootItemCondition.BuilderrandomChanceAndLootingBoost(HolderLookup.Provider p_343257_, float p_343637_, float p_342446_) booleantest(LootContext p_343845_) final StringtoString()Returns a string representation of this record class.floatReturns the value of theunenchantedChancerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
validate
-
Field Details
-
unenchantedChance
private final float unenchantedChanceThe field for theunenchantedChancerecord component. -
enchantedChance
The field for theenchantedChancerecord component. -
enchantment
The field for theenchantmentrecord component. -
CODEC
public static final com.mojang.serialization.MapCodec<LootItemRandomChanceWithEnchantedBonusCondition> CODEC
-
-
Constructor Details
-
LootItemRandomChanceWithEnchantedBonusCondition
public LootItemRandomChanceWithEnchantedBonusCondition(float unenchantedChance, LevelBasedValue enchantedChance, Holder<Enchantment> enchantment) Creates an instance of aLootItemRandomChanceWithEnchantedBonusConditionrecord class.- Parameters:
unenchantedChance- the value for theunenchantedChancerecord componentenchantedChance- the value for theenchantedChancerecord componentenchantment- the value for theenchantmentrecord component
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceLootItemCondition
-
getReferencedContextParams
- Specified by:
getReferencedContextParamsin interfaceLootContextUser
-
test
- Specified by:
testin interfacePredicate<LootContext>
-
randomChanceAndLootingBoost
public static LootItemCondition.Builder randomChanceAndLootingBoost(HolderLookup.Provider p_343257_, float p_343637_, float p_342446_) -
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 '=='. -
unenchantedChance
public float unenchantedChance()Returns the value of theunenchantedChancerecord component.- Returns:
- the value of the
unenchantedChancerecord component
-
enchantedChance
Returns the value of theenchantedChancerecord component.- Returns:
- the value of the
enchantedChancerecord component
-
enchantment
Returns the value of theenchantmentrecord component.- Returns:
- the value of the
enchantmentrecord component
-