Class DataComponents
java.lang.Object
org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents
Wrapper around a map of data components and their respective values.
This map can either be a complete data component map, or a data component patch to another map. The meaning of null values in the map depends on if the map
is a patch or full map. If the map:
- Is a full map,
nullmeans an absence of the component in the map.put(DataComponentType, Object)should not be used withnullvalues, ratherremove(DataComponentType)should be used. - Is a patch,
nullcan mean an absence of the component in the patch, or that the component should be removed from a map the patch is applied to. Usecontains(DataComponentType), which returnstruefor the latter, to check which is the case.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanclone()booleancontains(DataComponentType<?> component) boolean<T> Tget(DataComponentType<T> type) Map<DataComponentType<?>,DataComponent<?, ?>> <T> TgetOrDefault(DataComponentType<T> type, T def) inthashCode()<T> voidput(DataComponentType<T> type, T value) <T> Tremove(DataComponentType<T> component) @NonNull StringtoString()
-
Constructor Details
-
DataComponents
-
-
Method Details
-
get
-
getOrDefault
-
put
- Parameters:
value- should only benullif this map is a patch to another map and specifying the removal of the specific component.
-
contains
-
remove
-
clone
-
getDataComponents
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-