Previously ItemStack.EMPTY used new ItemStack((Item) null);
which returned AirItem which had the same defaults as all other Item's, however during the change to components ItemStack.EMPTY was changed to use new ItemStack((Void)null)
which create a AirItem with DataComponentMap.EMPTY
for it's components which leads it's default stack size and stats to be what is specified in the getOrDefault, this seems like a oversight and it should be initalized with DataComponents.COMMON_ITEM_COMPONENTS
instead properly giving it the defaults it should get.
Comments 5
Reproduction steps aren't needed, i've explained the issue, which is that ItemStack.EMPTY should be initalized with DataComponents.COMMON_ITEM_COMPONENTS instead of DataComponentMap.EMPTY, previously even empty itemstacks had a size of 64 but since 1.20.5 they no longer do, this skews up calculations where you expect empty item stacks to have a max stack size of 64 as they should but in reality they don't because of a regression in 1.20.5.
> "Reproduction steps aren't needed"
I asked for steps to reproduce because without them there is no way to confirm the report. If this requires code analysis to confirm, then an example needs to be provided for where in the code this can be confirmed from. Additionally, issues which do not have an impact on the game clearly outlined are not accepted, because it is considered code critique instead of a bug. Currently, while I partially understand the gist of this report, it comes across as criticism, or a request to change functionality which was altered instead of a bug.
Having clear steps to reproduce or confirm this report, with an expected vs. observed result from testing would be very helpful here.
Righto,
private ItemStack(@Nullable Void lvt1) {
this.item = null;
this.components = new PatchedDataComponentMap(DataComponentMap.EMPTY);
}
This is the constructor used for ItemStack#EMPTY, it should be initialized with the default components since for as long as i know it was intended that even empty item stacks would have a max stack size of the default 64, this likely causes issues anywhere minecraft grabs from the component or calls getMaxStackSize since instead of getting 64 for a empty item it now gets 1, not to mention this also causes issues for mods which assumed the same thing, albeit mods being less important here, the simplest change would be replacing new PatchedDataComponentMap(DataComponentMap.EMPTY);
with DataComponents.COMMON_ITEM_COMPONENTS;
, that way it'll only default to 1 if a item purposely removes the max stack size component or is initialized without it.
Thank you for your report!
After consideration, the issue is being closed as Invalid.
This report does not describe a bug.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
What is the gameplay impact of this? How can this be reproduced and confirmed? Please provide clear steps to reproduce, and if possible, a video of the issue occurring in game.