-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Remove hard-coded max stack sizes from Material #13518
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
Remove hard-coded max stack sizes from Material #13518
Conversation
This removes hard-coded max stack sizes from Material, and defers to ItemType instead. I've kept the old behavior of returning 64 for all blocks (since maxStack was initialized to that value for all blocks) and 0 for LEGACY_AIR, to prevent old plugins that expect those values from breaking. This could be replaced by ``` Preconditions.checkArgument(type != null, "The Material is not an item!"); ``` but that could break legacy plugins, which is the whole reason for maintaining `Material` I suppose.
|
Might as well fix the legacy material conversion (didn't really cared about it at the time) for example take the following in the TestPlugin (onEnable): Material.LEGACY_RECORD_3.getMaxStackSize() <-- return 1 OK
Material.LEGACY_RECORD_4.getMaxStackSize() <-- return 64 WRONGIn all case you would need to update the generator for the non legacy material. |
|
@Lulu13022002 Done! #13529 |
|
Thanks, can you update the generator too for this PR? |
|
Of course! I've updated the generator, but I'm unfamiliar with if there is currently any test to verify it~ (apart from a review) |
|
The way to test it is generally to run it, normally you would have used the generator in the first place ^^ |
|
I don't know how to run it haha. I've tried running all the tasks under |
|
Ah sorry the only documentation for this is on my original commit (which has probably been squashed during the update). Make sure to uncomment the line in |
|
I did get |
Yes it's fine you already did what the generator was already supposed to generate but manually. |
This removes hard-coded max stack sizes from Material, and defers to ItemType instead.
I've kept the old behavior of returning 64 for all blocks (since maxStack was initialized to that value for all blocks) and 0 for LEGACY_AIR, to prevent old plugins that expect those values from breaking. This could be replaced by
but that could break legacy plugins, which is the whole reason for maintaining
MaterialI suppose.EDIT: This would break max stack sizes for legacy materials because legacy conversion is currently broken, but that is fixed by #13529