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
Per-item (not per-itemstack) metadata #14607
Comments
The none-stacking constraint of metadata items is a real pity, but I don't like the solutions. It causes way too many problems and is still very restrictive. Proper stacking callbacks would be way better. Very briefly functions like can_stack, on_stack, on_destack, on_splitstack, ... For the metadata problem, you could then just serialize the meta for every time in the stack and implement the behavior by yourself. |
I realize that my solution proposal is not optimal because it only covers a narrow use case. Callbacks for manually controlling stacking behavior would be a solution if there was SSCSM. Right now, I think they would break client prediction, resulting in a much worse inventory experience because any inventory action would have to wait for a network roundtrip.
? |
Of course, client side predictions would be nice to increase the responsiveness, but I think you can live without them, since the current inventory item movement prediction is also more or less not-existing. (There is only some for player inventories if I'm not wrong.)
Here are a few problems for you:
I don't say that stacking callbacks wouldn't cause similar problems, but at least mods/games could handle this themselves and don't have to deal with a forced metadata stacking feature. |
-1. Here is what I would do:
There are other alternatives too like have a graffiti bag with its own inventory which fits in one slot of the main inventory but has many of its own slots specifically for graffitied nodes; A global These issues have naturally opinionated answers and I don't think it should be up to the engine to support your specific opinions. |
Closing this issue. cx384's alternative suggestion might be feasible, I'd have to implement it to find out. Not changing anything regarding client-side prediction, i.e. always predicting the default behavior, might be just good enough. Montandalar's suggestion with a queue per itemstack would break in many situations, for example when splitting or joining itemstacks. |
Problem
In my "GGraffiti" mod, I want spray-painted nodes to simply keep their graffiti when they are dug and placed again. In the inventory, spray-painted nodes should still stack normally. You could have a stack of 99 Stone, and some of the nodes in that stack could have graffiti on them and some not.
Because inventory items with metadata don't stack, this is currently impossible.
See grorp/ggraffiti#10.
Solutions
A way to set metadata per-item instead of per-itemstack, something like
ItemStack:get_meta(item_index) -> ItemMetaRef
. When stacking or moving items with per-item metadata, they would keep their metadata. The item indices would change as appropriate.There's probably a lot of special cases to be found here. The only way to figure those out is to implement the thing (and also unittests ;)
Alternatives
I don't currently know any other way to implement the desired behavior in my mod.
Additional context
No response
The text was updated successfully, but these errors were encountered: