To Elaborate, I want an item with a custom data, to not be possible IN ANY WAY to be added to any container, this includes armor slots, enderchests, horses, crafting interface, villagers, or containers (probably the most difficult one)
This is one of the most challenging things I have tried to do in the past few years, and am wondering if anyone here has figured out a way to do this.
#[1.21] Trying to make an item not be addable to a container
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1727065921:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
What are you doing that required you to do this?
Maybe there’s a way to avoid needing this at all.
yeah it's like the xy problem
sa
I'm trying to make a base datapack for smp owners (or myself), to build off of, and most smp owners want items, that can't be removed from the player's inventory
I'm wondering if there's a scoreboard or advancement to check when the player opens a container (brewing stand, barrel, chest, enderchest, smithing table, furnaces, loom, anvils, encahnt table, stonecutter, crafting table, grindstone, cartography table, shulker boxes, or even campfires)
Unfortunately this isn't something data packs excel at, especially if you're trying to prevent the item from being put in the container in ANY WAY, as you said. All of the methods we'd have to do this would require scanning nearby containers for said item, removing it, and returning it to the player.
The result could be smooth enough for the player to not really notice a difference, but it also could not, and these scans are fairly performance heavy.
Why can't the items be removed from the player's inventories?
What are you/the server owners worried of?
Given how I've interpreted what you said, I don't see this as very necessary at all. 
And if it is, it's probably something better done with a plugin
For example, something like the Bliss SMP, the players have gems, and the server owner didn't want players to have more than one
I see.
I don't think there's an easy way to do what you want, I would reccomend changing what you do to balance the item instead.
Like, instead of locking it to the player's inventory, drop the item if they have more than 1 in their inv or smt.
if would be faster to give the player a score based on whatever "gem" they have when they obtain it and make it so it clears all but the one they're supposed to have