Server Registry Stuff#1085
Conversation
| var registry = cx.lookupRegistry(param, from); | ||
|
|
||
| if (from instanceof Holder<?> h) { | ||
| return Holder.Reference.createStandAlone(Cast.to(registry.holderOwner()), h.getKey()); |
There was a problem hiding this comment.
Is createStandAlone guaranteed to be safe?
There was a problem hiding this comment.
In what context? When serializing with a registry present (the intent & use case I have), yes. For retrieving a value/id from the registry itself (or the holder even), no
Mind explaining / giving a brief example on why this is needed and why we specifically need to create a new RAC instance here? |
It is quite common for server registry objects to reference other objects via holders (placed features are literally a configured feature holder and a list of placement modifiers) and holder sets (TFC's forest feature; builder). Kube's wrappers for these two types requires the registry they're for to be present and the codecs will only serialize to the object/tag id if the registry is present in the Even if scriptors passed in a I tried to find a place where these registries existed and that was before datapacks were parsed, but there does not seem to be such a place. |
|
I need to give this a proper look before actually merging, but from what I can tell, this is kind of a mirror of what vanilla does for its own datagen in |
|
more-or-less, vanilla has some extra validation/safeguards by virtue of having a known set of registries and registry entries that this doesn't and the objects are actually added to those registry stubs, otherwise same principle |
Makes some adjustments so dealing with
ServerEvents.registryis relatively nice.RegistryAccessContainerhas 'access' to non-static registries by making an empty registry on demand and providing that. This is needed for wrappingHolders andHolderSets of server registriesDeferredHolderwhich is typically made cannot serializeThese changes were tested locally against this commit