Started by
ChaosColin
on
Topic category: Help with Minecraft modding (Java Edition)
Specifically, what I need is...
(Set custom data text tag "tagName" of (get item in slot "x" of block at x y z) to "tagValue")But I dont see a (get item in slot "x" of block) block, only the (get copy of item in slot "x" of block) which then seems to apply the data to a copy of what I want, but not the existing item in said block slot. I have done some research and found this is easy to do if you want to apply data to an item in GUI slot, but I wish to have a block that runs this on block tick using its own inventory, setting the data under certain conditions. Is this possible to achieve or do I need to work around this?
Edited by ChaosColin on Thu, 10/23/2025 - 21:30
Yes, there is a way to achieve it, sort of a workaround, but one that works well. You will need to create an itemstack variable, call it something like outputitem, then set it to be a copy of the item in slot x. Then you set the data text tag of outputitem. Lastly, you set outputitem in slot x of the block. You can use get number of items from slot x for the amount of outputitem to set in slot x.
This will basically just save the copy of the item, set the nbt tag, then set it back into the slot.