Record Class StorageValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.StorageValue
- All Implemented Interfaces:
LootContextUser
,NumberProvider
public record StorageValue(ResourceLocation storage, NbtPathArgument.NbtPath path)
extends Record
implements NumberProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<StorageValue> private final NbtPathArgument.NbtPath
The field for thepath
record component.private final ResourceLocation
The field for thestorage
record component. -
Constructor Summary
ConstructorsConstructorDescriptionStorageValue
(ResourceLocation storage, NbtPathArgument.NbtPath path) Creates an instance of aStorageValue
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.float
getFloat
(LootContext p_335884_) int
getInt
(LootContext p_335703_) private Optional
<NumericTag> getNumericTag
(LootContext p_336045_) getType()
final int
hashCode()
Returns a hash code value for this object.path()
Returns the value of thepath
record component.storage()
Returns the value of thestorage
record component.final String
toString()
Returns a string representation of this record class.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
getReferencedContextParams, validate
-
Field Details
-
storage
The field for thestorage
record component. -
path
The field for thepath
record component. -
CODEC
-
-
Constructor Details
-
StorageValue
Creates an instance of aStorageValue
record class.- Parameters:
storage
- the value for thestorage
record componentpath
- the value for thepath
record component
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceNumberProvider
-
getNumericTag
-
getFloat
- Specified by:
getFloat
in interfaceNumberProvider
-
getInt
- Specified by:
getInt
in interfaceNumberProvider
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
storage
Returns the value of thestorage
record component.- Returns:
- the value of the
storage
record component
-
path
Returns the value of thepath
record component.- Returns:
- the value of the
path
record component
-