Record Class StorageDefinition
java.lang.Object
java.lang.Record
fr.robie.machineengine.api.machine.StorageDefinition
- Record Components:
id- unique within the machine type, e.g.inputcapacityModifier- scales each slot's capacity with the machine's upgrades (e.g. Mekanism's energy upgrade enlarging the energy buffer), ornull
public record StorageDefinition(@NotNull String id, int slots, long capacity, @NotNull ResourcePredicate filter, @Nullable ModifierType capacityModifier)
extends Record
A storage of a machine type:
slots slots of capacity each, accepting variants
matching filter (ARCHITECTURE.md ยง12). The engine creates and persists it.-
Constructor Summary
ConstructorsConstructorDescriptionStorageDefinition(@NotNull String id, int slots, long capacity, @NotNull ResourcePredicate filter) StorageDefinition(@NotNull String id, int slots, long capacity, @NotNull ResourcePredicate filter, @Nullable ModifierType capacityModifier) Creates an instance of aStorageDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongcapacity()Returns the value of thecapacityrecord component.@Nullable ModifierTypeReturns the value of thecapacityModifierrecord component.@NotNull StorageDefinitioncapacityModifier(@NotNull ModifierType modifier) Each slot's capacity followsmodifier(applied tocapacity()with the machine's upgrades).final booleanIndicates whether some other object is "equal to" this one.@NotNull ResourcePredicatefilter()Returns the value of thefilterrecord component.@NotNull StorageDefinitionfilter(@NotNull ResourcePredicate filter) final inthashCode()Returns a hash code value for this object.@NotNull Stringid()Returns the value of theidrecord component.intslots()Returns the value of theslotsrecord component.static @NotNull StorageDefinitioncountslots ofcapacityeach, accepting anything.static @NotNull StorageDefinitionA single slot, e.g.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
StorageDefinition
public StorageDefinition(@NotNull @NotNull String id, int slots, long capacity, @NotNull @NotNull ResourcePredicate filter, @Nullable @Nullable ModifierType capacityModifier) Creates an instance of aStorageDefinitionrecord class.- Parameters:
id- the value for theidrecord componentslots- the value for theslotsrecord componentcapacity- the value for thecapacityrecord componentfilter- the value for thefilterrecord componentcapacityModifier- the value for thecapacityModifierrecord component
-
StorageDefinition
public StorageDefinition(@NotNull @NotNull String id, int slots, long capacity, @NotNull @NotNull ResourcePredicate filter)
-
-
Method Details
-
capacityModifier
@NotNull public @NotNull StorageDefinition capacityModifier(@NotNull @NotNull ModifierType modifier) Each slot's capacity followsmodifier(applied tocapacity()with the machine's upgrades). -
slots
@NotNull public static @NotNull StorageDefinition slots(@NotNull @NotNull String id, int count, long capacity) countslots ofcapacityeach, accepting anything. -
tank
A single slot, e.g. a tank or battery. -
filter
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
-
slots
public int slots()Returns the value of theslotsrecord component.- Returns:
- the value of the
slotsrecord component
-
capacity
public long capacity()Returns the value of thecapacityrecord component.- Returns:
- the value of the
capacityrecord component
-
filter
Returns the value of thefilterrecord component.- Returns:
- the value of the
filterrecord component
-
capacityModifier
Returns the value of thecapacityModifierrecord component.- Returns:
- the value of the
capacityModifierrecord component
-