Topic category: Feature requests and ideas for MCreator
- MCreator Version: 2025.3.45720
- Minecraft version (generator): NeoForge for 1.21.1 (21.1.190)
So making a command with an "item parameter" block allows the user to make commands that utilize item lists as auto-complete suggestions (similar to how "/give" grabs a list of all items.)
But an inconsistency I found is although you can use brackets [] to specify component data, NONE of that gets carried over to the command item.
So purely as an example making a custom command like "/giveme @p minecraft:wooden_sword[minecraft:damage=30]" won't behave like "/give" would.
Looking at the actual generated code shows the cause of this appears to be "getDefaultInstance"
(ItemArgument.getItem(arguments, "item").getItem().getDefaultInstance());
So without looking at the code I thought this was a bug. But now I see that makes this post a "feature request" for consistency.
We will look into this, good catch!
I worked on a fix that will come in a future update (I do not know if Klemen will release a second patch or not). However, if you want to fix it for yourself until this fix arrives, you can do the following steps:
ItemArgument.getItem(arguments, "item").getItem().getDefaultInstance()bycommandParameterItemStack(arguments, "item"). (If you have multiple different item argument, change"item'by"<parameterName>"where <parameterName> is the text you wrote inside the procedure block's field.)You can use this fix for both versions as the code is the same.
I hope this will help you for your mod :)
Thanks for the responses, Goldorion and Klemen! I'm in no rush so I'll probably just wait for the update. Appreciate the coding help too! Either way I'm sure anyone sticking to older versions or needing a more immediate fix will find this useful.
This oversight isn't a huge barrier for me at the moment but I decided this would probably effect other people more, so it'd be worth posting about.
Glad to hear this!
You can also monitor the fix at https://github.com/MCreator/MCreator/pull/5913