I'm interested in playing in a world where food can't stack (similar how it was in early versions of Minecraft). It would make the game a bit more challenging (and hopefully entertaining) for me and my friends. I've worked on some small data packs before but the ideas I've had for how to make this one sounded harder than what I'm capable of.
I imagine one way to make the data pack work would be to check every player's inventory and if they are carrying a stack of a food item then copy the item and stack size and delete the original stack from the player's inventory. From there, run a give command to give the player a single of the item with a unique tag attached to it (probably an incrementing score). Then continue to repeatedly run this give command a number of times equal to the original stack size while making sure each single item has a unique tag to prevent them from stacking. You also wouldn't have to worry too much about this exceeding the player's inventory slots either because I'm pretty sure using the give command on a "full" player's inventory just drops the item on top of the player which is fine.
This data pack may also need to be expanded to check a player's ender chest inventory (unless this data pack is running faster than they could pick up a stack and open an ender chest). Also, it would need to check inside any shulker boxes in their inventory (in case they used a hopper to deposit stacks of naturally-dropped-food inside a shulker box without the player touching any of the food. E.g. killing a cow on top of a hopper on top of a shulker box).
Here's a pretty neat video of someone doing a similar thing to the method I described where the unique tags use the world's "gametime" stat:
https://www.youtube.com/watch?v=OqWbKTY8A4c&ab_channel=Exxabite
Obviously, if you find a better way to make this data pack concept a reality that's cool. I just would like to play with whatever works.
Please let me know if you think you can help with this datapack idea or if there is already a datapack that can do this. I looked around but couldn't find one.
Many thanks.
I imagine one way to make the data pack work would be to check every player's inventory and if they are carrying a stack of a food item then copy the item and stack size and delete the original stack from the player's inventory. From there, run a give command to give the player a single of the item with a unique tag attached to it (probably an incrementing score). Then continue to repeatedly run this give command a number of times equal to the original stack size while making sure each single item has a unique tag to prevent them from stacking. You also wouldn't have to worry too much about this exceeding the player's inventory slots either because I'm pretty sure using the give command on a "full" player's inventory just drops the item on top of the player which is fine.
This data pack may also need to be expanded to check a player's ender chest inventory (unless this data pack is running faster than they could pick up a stack and open an ender chest). Also, it would need to check inside any shulker boxes in their inventory (in case they used a hopper to deposit stacks of naturally-dropped-food inside a shulker box without the player touching any of the food. E.g. killing a cow on top of a hopper on top of a shulker box).
Here's a pretty neat video of someone doing a similar thing to the method I described where the unique tags use the world's "gametime" stat:
https://www.youtube.com/watch?v=OqWbKTY8A4c&ab_channel=Exxabite
Obviously, if you find a better way to make this data pack concept a reality that's cool. I just would like to play with whatever works.
Please let me know if you think you can help with this datapack idea or if there is already a datapack that can do this. I looked around but couldn't find one.
Many thanks.
