Record Class ResourceVariant
java.lang.Object
java.lang.Record
fr.robie.machineengine.api.resource.ResourceVariant
public record ResourceVariant(@NotNull ResourceType type, @NotNull ResourceComponents components)
extends Record
What a resource is, without an amount: a
ResourceType plus its components. Storages are
keyed by variant; two stacks of equal variants always stack.-
Constructor Summary
ConstructorsConstructorDescriptionResourceVariant(@NotNull ResourceType type, @NotNull ResourceComponents components) Creates an instance of aResourceVariantrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull ResourceCategorycategory()@NotNull ResourceComponentsReturns the value of thecomponentsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static @NotNull ResourceVariantof(@NotNull ResourceType type) @NotNull ResourceStackstack(long amount) @NotNull StringtoString()Returns a string representation of this record class.@NotNull ResourceTypetype()Returns the value of thetyperecord component.<T> @NotNull ResourceVariantwith(@NotNull ResourceComponentType<T> component, T value)
-
Constructor Details
-
ResourceVariant
public ResourceVariant(@NotNull @NotNull ResourceType type, @NotNull @NotNull ResourceComponents components) Creates an instance of aResourceVariantrecord class.- Parameters:
type- the value for thetyperecord componentcomponents- the value for thecomponentsrecord component
-
-
Method Details
-
of
-
category
-
with
@NotNull public <T> @NotNull ResourceVariant with(@NotNull @NotNull ResourceComponentType<T> component, @NotNull T value) -
stack
-
toString
-
hashCode
-
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). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
components
Returns the value of thecomponentsrecord component.- Returns:
- the value of the
componentsrecord component
-