-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Constructors #36
Comments
Under no circumstances should you add values to an existing enum, for the same reason as we don't use enums in the API. See this article which talks about doing it with reflection but ultimately the reasons are the same. You cannot instance a mixin because a mixin isn't a class, it only makes sense in terms of its target, and in this particular scenario creating additional instances would be bad. The recommended way of handling custom "constructor" logic would be to mix in a If you're talking about creating "extra" [pseudo-enum] instances of your mixin, then the optimal solution is to have a surrogate class which also acts as a target for the mixin, and provides the additional values. |
Ah, why would I add the surrogate class instead of just using the surrogate class and no mixin? |
@modwizcode Do you need further assistance with this or can I close this issue? |
I think you covered exactly what I needed to know. Thanks, as always, for
the thorough explanation.
|
Ok cool, re-open if any further related queries. |
This isn't an issue so much as a question.
For Map implementation I can mix my interface into the vanilla MapColor, however I need to create instances of my interface to complete colors that aren't in the original enum (shades). I can work around this, but is it possible to just do new MixinMapColor(MapColor nmsMapColor, int shade)?
Or am I stuck with a static method that creates these?
Sorry if the explanation isn't very clear.
The text was updated successfully, but these errors were encountered: