-
Bug
-
Resolution: Unresolved
-
None
-
1.21.3
-
None
-
Confirmed
-
Commands, Loot tables
-
Normal
-
Platform
The item stacks used internally in the loot-tables allow users to specify their count greater than their max_stack_size. This is actually normal, because at the end of the loot-table execution, these "overstacked" items will be split into multiple item stacks to fit their max_stack_size. This behavior can be tested with this command.
/loot give @s loot {pools:[{rolls:1,entries:[{type:item,name:snowball,functions:[{function:set_count,count:64}]}]}]}
You specified 64 as the number of snowballs, which is greater than the max_stack_size of 16 for snowballs, but it works fine, and you get 4 stacks of 16 snowballs.
The problem is, this "overstacking" behavior does not seem to be supported when changing max_stack_size with set_components item modifier, and it fails to change its max_stack_size. Compared to the above, this seems unintentional.
/loot give @s loot {pools:[{rolls:1,entries:[{type:item,name:snowball,functions:[{function:set_count,count:64},{function:set_components,components:{max_stack_size:32}}]}]}]}
You tried to change the max_stack_size to 32, but it didn't work, and you get 4 stacks of 16 snowballs again.
Here's the error message from the log.
Failed to apply component patch '{minecraft:max_stack_size=>32}' to item: 'Item stack with stack size of 64 was larger than maximum: 32'