Class DataComponentEditor
java.lang.Object
fr.fidorial.item.data.DataComponentEditor
- All Implemented Interfaces:
DataComponentHolder
The writing half of the component model: a mutable, chainable editor over one
holder's components.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptioncopy()static DataComponentEditorempty()booleaninthashCode()booleanisEmpty()static DataComponentEditorof(DataComponentMap components) remove(DataComponentType<?> type) Takes the item's own default away, so the component ends up absent from the item rather than back at its default.reset(DataComponentType<?> type) Drops this editor's opinion on a component, letting the item's default show through again.set(DataComponentType<T> type, T value) setOrReset(DataComponentType<T> type, @Nullable T value) toString()Methods inherited from interface DataComponentHolder
get, getOrDefault, has
-
Method Details
-
empty
- Returns:
- an editor patching nothing
- Since:
- 0.1.0
-
of
- Parameters:
components- the patch to start from- Returns:
- an editor over that patch
- Since:
- 0.1.0
-
components
- Specified by:
componentsin interfaceDataComponentHolder- Returns:
- the patch this holder carries
-
copy
- Returns:
- an independent editor holding the same components
- Since:
- 0.1.0
-
isEmpty
public boolean isEmpty()- Returns:
truewhen this editor patches nothing- Since:
- 0.1.0
-
set
- Type Parameters:
T- the component's value type- Parameters:
type- the component to setvalue- the value- Returns:
- this editor
- Since:
- 0.1.0
-
setOrReset
- Type Parameters:
T- the component's value type- Parameters:
type- the component to setvalue- the value, ornullto stop patching the component- Returns:
- this editor
- Since:
- 0.1.0
-
remove
Takes the item's own default away, so the component ends up absent from the item rather than back at its default.- Parameters:
type- the component to remove- Returns:
- this editor
- Since:
- 0.1.0
-
reset
Drops this editor's opinion on a component, letting the item's default show through again.- Parameters:
type- the component to stop patching- Returns:
- this editor
- Since:
- 0.1.0
-
equals
-
hashCode
-
toString
-