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.NbtPathThe field for thepathrecord component.private final ResourceLocationThe field for thestoragerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionStorageValue(ResourceLocation storage, NbtPathArgument.NbtPath path) Creates an instance of aStorageValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.floatgetFloat(LootContext pLootContext) intgetInt(LootContext pLootContext) private Optional<NumericTag> getNumericTag(LootContext pContext) getType()final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.storage()Returns the value of thestoragerecord component.final StringtoString()Returns a string representation of this record class.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
getReferencedContextParams, validate
-
Field Details
-
storage
The field for thestoragerecord component. -
path
The field for thepathrecord component. -
CODEC
-
-
Constructor Details
-
StorageValue
Creates an instance of aStorageValuerecord class.- Parameters:
storage- the value for thestoragerecord componentpath- the value for thepathrecord component
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceNumberProvider
-
getNumericTag
-
getFloat
- Specified by:
getFloatin interfaceNumberProvider
-
getInt
- Specified by:
getIntin 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 thestoragerecord component.- Returns:
- the value of the
storagerecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-