-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine craft data tag system #687
Conversation
Why exactly did you make the „registry“ private? I made it public on purpose cause i need it for some stuff i have planned. But why were the implementations moved to BaseCraft? Default implementations where used on purpose to avoid exactly that cause baseCraft is already pretty cluttered. |
Directly exposing the registry bypasses type validation on the key/value pairs, which allows the system to get into a bad state. If you need direct access to the registry, it would probably be better to convert the registry to a discreet object that has its own lifecycle/methods that continue to abide by the contracts on the system. I'm totally willing to do so in this PR if you can describe your scenario.
Having the implementation in |
Hm, true, didn't think about the first point. Converting it to a separate proper registry object would be better eventually. On the latter i am not really a fan of classes like BaseCraft, they tend to get and be way too cluttered with all sorts of nonsense, but alright. Having the implementations in the interface doesn't really change that thin exposition layer though. |
Part of my hope is that we can translate most of the stuff in |
You'll never guess how I started doing this (ignore the branch name) |
Thansk for making it more accessible again, i think it would also be beneficial to add a method that gives you a copy of all registered keys as a list. |
Describe in detail what your pull request accomplishes
This PR aims to make improvements to the new
CraftDataTagContainer
system in several areas. While there are API name changes, external consumers should experience no change in behavior under the conditions that were previously required for correct API usage.ConcurrentHashMap
instances, and has proper synchronization to yield improved errorsCraftDataTagContainer
fromCraft
via getterBaseCraft
REGISTERED_TAGS
registryMap
instancenull
in the case of an error state now throw instead. These states in general are likely to be non-recoverable due to requiring failures during program initialization, i.e. they all required invalid tag registrationsCraftDataTagContainer
Checklist