-
-
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
base: main
Are you sure you want to change the base?
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 |
| ACACIA_TRAPDOOR(-1, TrapDoor.class), | ||
| ACACIA_WALL_HANGING_SIGN(-1, WallHangingSign.class), | ||
| ACACIA_WALL_SIGN(-1, 16, WallSign.class), | ||
| ACACIA_WALL_SIGN(-1, WallSign.class), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to note is that this one will now have a max stack size of 64 instead of 16 idk how much you care about it? since it doesn't make sense for blocks to have a max stack size anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't care about it, and I agree it makes no sense at all. I could totally see existing plugins checking for max stack size being 0 for LEGACY_AIR, but any existing plugin actually somehow producing any practical difference based on the return value of max stack size for wall signs seems very unlikely!
|
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