Record Class ItemDefinition
java.lang.Object
java.lang.Record
fr.fidorial.item.ItemDefinition
- Record Components:
key- the identifier the item is created and saved undernetworkType- the vanilla item the client renderscomponents- the components every stack of this item starts with
- All Implemented Interfaces:
DataComponentHolder
public record ItemDefinition(Key key, Key networkType, DataComponentMap components)
extends Record
implements DataComponentHolder
Everything the server needs to build an item a plugin invented.
- Since:
- 0.1.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intWhat an item stacks to when it says nothing about it. -
Constructor Summary
ConstructorsConstructorDescriptionItemDefinition(Key key, Key networkType, DataComponentMap components) Creates an instance of aItemDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ItemDefinition.BuilderReturns 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.key()Returns the value of thekeyrecord component.Returns the value of thenetworkTyperecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface DataComponentHolder
get, getOrDefault, has
-
Field Details
-
DEFAULT_MAX_STACK_SIZE
public static final int DEFAULT_MAX_STACK_SIZEWhat an item stacks to when it says nothing about it.- See Also:
-
-
Constructor Details
-
ItemDefinition
Creates an instance of aItemDefinitionrecord class.- Parameters:
key- the value for thekeyrecord componentnetworkType- the value for thenetworkTyperecord componentcomponents- the value for thecomponentsrecord component
-
-
Method Details
-
builder
- Parameters:
key- the identifier the item is created and saved undernetworkType- the vanilla item the client renders- Returns:
- a builder pre-filled with the defaults of a plain, unstackable tool
- Since:
- 0.1.0
-
toBuilder
- Returns:
- a builder pre-populated with this definition
- Since:
- 0.1.0
-
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). -
key
-
networkType
Returns the value of thenetworkTyperecord component.- Returns:
- the value of the
networkTyperecord component
-
components
Returns the value of thecomponentsrecord component.- Specified by:
componentsin interfaceDataComponentHolder- Returns:
- the value of the
componentsrecord component
-