Add type to represent unimplemented data component types#12222
Conversation
|
Call me crazy, but do you think it might be a good idea to add the unimplemented types to DataComponentTypes? ex: /**
* Not Currently Implemented
*/
@Deprecated (or some other annotation)
static final DataComponentType.Unimplemented CUSTOM_DATA; |
|
That was originally something I wanted to do (although just using I guess data components are already generally marked as 'unstable', but I don't think it's worth it to add the fields anyway. |
|
Backward compatibility with the fields is never guaranteed, FYI. However this is defo a tricky part of the API, so most likely more feedback will need to be collected here. |
|
I'd rather not expose un-implemented types to the API fields. Having something actively exposed that does not work seem pretty unintuitive for people. |
|
I think something like |
|
Not sure if that'd be particularly useful, especially since most of the time you'd have something like: DataComponentType type = ...;
switch (type) {
case DataComponentType.Valued<?> valued -> ...;
case DataComponentType.NonValued nonValued -> ...;
case DataComponentType unimplemented -> ...;
} |
Adds an
Unimplementedtype for data component types that have yet to receive an API implementation. This replaces usingDataComponentType.NonValuedfor such cases. UsingDataComponentType.NonValuedhere causes issues as you're able to get instances of unimplemented data component types using methods likeRegistry#getandItemStack#getDataTypes.Tested with
ItemStack#hasData,ItemStack#resetData, andItemStack#unsetData.Not a big fan of using raw types for the converters, but unsure of a better way to do it.