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
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<LootItemRandomChanceWithEnchantedBonusCondition> private final LevelBasedValue
The field for theenchantedChance
record component.private final Holder
<Enchantment> The field for theenchantment
record component.private final float
The field for theunenchantedChance
record component.Fields inherited from interface net.minecraft.world.level.storage.loot.predicates.LootItemCondition
DIRECT_CODEC, TYPED_CODEC
-
Constructor Summary
ConstructorDescriptionLootItemRandomChanceWithEnchantedBonusCondition
(float unenchantedChance, LevelBasedValue enchantedChance, Holder<Enchantment> enchantment) Creates an instance of aLootItemRandomChanceWithEnchantedBonusCondition
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theenchantedChance
record component.Returns the value of theenchantment
record component.final boolean
Indicates whether some other object is "equal to" this one.Set
<LootContextParam<?>> getType()
final int
hashCode()
Returns a hash code value for this object.static LootItemCondition.Builder
randomChanceAndLootingBoost
(HolderLookup.Provider p_343257_, float p_343637_, float p_342446_) boolean
test
(LootContext p_343845_) final String
toString()
Returns a string representation of this record class.float
Returns the value of theunenchantedChance
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
validate
-
Field Details
-
unenchantedChance
private final float unenchantedChanceThe field for theunenchantedChance
record component. -
enchantedChance
The field for theenchantedChance
record component. -
enchantment
The field for theenchantment
record 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 aLootItemRandomChanceWithEnchantedBonusCondition
record class.- Parameters:
unenchantedChance
- the value for theunenchantedChance
record componentenchantedChance
- the value for theenchantedChance
record componentenchantment
- the value for theenchantment
record component
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceLootItemCondition
-
getReferencedContextParams
- Specified by:
getReferencedContextParams
in interfaceLootContextUser
-
test
- Specified by:
test
in 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 theunenchantedChance
record component.- Returns:
- the value of the
unenchantedChance
record component
-
enchantedChance
Returns the value of theenchantedChance
record component.- Returns:
- the value of the
enchantedChance
record component
-
enchantment
Returns the value of theenchantment
record component.- Returns:
- the value of the
enchantment
record component
-