#1.20.1 storage item id list
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
@oblique folio does the list of item ids to check for change?
do you mean will i change it?
if it doesn't, don't do macros, don't use storage. Use a predicate and just hardcode each item, way better for performance.
There are no easy ways to loop through a list and combining that loop with a macro is going to tank performance.
what is meaning?
a predicate is a json file. It is used to describe a check that returns true or false and can be a list of conditions or other predicates.
even with the list of item ids in storage, since you want to check on a single item (I think?) you would first have to write some function that loops through the list.
Then call another function which looks like:
$execute as @a[nbt={Inventory:[{id:$(id)}]}]
This can be called like:
function ns:check_for_item with {id:"minecraft:stone"}
or
function ns:check_for_item with storage ns:something your_path
$? im on 1 20 1
Instead of doing this, consider creating a predicate that checks for the list of items you want to check for. If this list is not fixed... I don't think there are any easy ways to do so
ah you are trying to do something you cant do in that case
so your way to go is predicates
unless this list in storage can be changed by your datapack somehow.
ye, but idk how to adept this to command
and where i can write ids
but in all honesty, if you are not more precise with the actual goal of this... you can't get a better answer.
thx
example start file:
{
"condition": "minecraft:any_of",
"terms": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:player",
"nbt": "{Inventory:[{id:\"minecraft:netherite_sword\"}]}"
}
}
]
}
You can add the other items to the terms list. As it say on the top this predicate would check if any of the terms is true.
The type can be ommitted if you want to specifically check for other entities with an inventory
The answer to your original question is that you can't in 1.20.1 as far as I can tell.
wow, i can some ways use detected id in other command?
execute as @a[nbt={Inventory:[{id:"minecraft:netherite_sword"}]}] at @s run clear @s netherite_sword 64
One thing you could do is enable/disable it for items in the term list, each term can be an all_of where one is the inventory check and one is a score check.
as for removing only a specific type of item, in 1.20.1 that needs hardcoding.
thank you, really helpful
if enabling/disabling isn't required you could instead make an item tag in your datapack for all items to filter. This also allows a single clear command like:
clear @s #ns:tag_name
Example: /clear @s #minecraft:doors removes all doors from your inventory. whether this is an oak, acacia, iron or spruce door. Trapdoors are not in this tag however.
but before clear i have a few other actions
that is why I am asking, be more precise. The use of storage right now would be very hard (especially with player inventories)
i detect item, i spawn stone, copy nbt (and id of item) to stone, clear item in inventory
if you are looking to change the content of a chest however
this is blocker of items for players with one nbt
and because that i dont want delete items
they can be need for other players with other rpg class (nbt)
i made this system but with SelectedItem for weapons
but artifacts may be used without main hand
sorry for my bad english
So you want a class to be unable to use certain items?
or "disable" items that don't belong to that class.
this is 2 same questions?
i have a few classes
delete all items for other classes i dont need
only drop
how to unable use artifacts what can be dressed on the accessory slots i dont have ideas
you mean armor?
no
modded slots
not that is general
players cant dress up items without their been in inventory (or hotbar)
i need leave for a two hours
sorry
I don't think I can help much with this, I feel like you are better off trying to change or configure the mod itself rather than using a datapack to customize it.
I still don't get what you actually are trying to modify, but that won't change soon because I do not know the mod.
<@&1166082198152159386> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)
brief information:
i want to make an RPG server but i don't want players of a certain class to use a certain list of items of other classes. i can't delete them because it's a server. i already made a system for weapons (via selected item) but there might be a problem with accessories and armor because they can be used or worn without the main hand.
Below I will indicate my test system for SelectedItem and highlight in bold what I need to change so as not to write 4 commands for each item.
execute as @a[nbt={SelectedItem:{id:"minecraft:command_block"}}] at @s run summon item ~ ~ ~ {Item:{id:"minecraft:stone",Count:1b},Tags:["dropped"],PickupDelay:30}
execute as @a[nbt={SelectedItem:{id:"minecraft:command_block"}}] run data modify entity @e[type=item,tag=dropped,limit=1] Item set from entity @s SelectedItem
execute as @a[nbt={SelectedItem:{id:"minecraft:command_block"}}] at @s run tag @e[type=item,sort=nearest,limit=1] remove dropped
execute as @a[nbt={SelectedItem:{id:"minecraft:command_block"}}] at @s run clear @s minecraft:command_block 64
Well highlighting doesn't work in code blocks, as you can see
oh sorry
But don't use NBT checks for this, use predicates. That will allow you to check multiple/all slots for the items
Just code block and don't worry about the bold
Also, loosely related, you can optimize this code a fair bit. Instead of executing as all players every line, you can just do one line that is execute as @a at @s run <new function>, and have the new function run all these commands but just with execute if entity @s[...]
Or, when you change to predicates, execute if predicate ...
How?
Predicates are separate JSON files that you can define conditions in, then when you check them with execute if predicate, they will be either true or false.
You can make one with Misode, and put it in data/<namespace>/predicates
Misode's Datapack Generators are useful when creating files such as loot tables, predicates, advancement, worldgen files, and more!
Yes but how I can detect list of items in one command?
You would make the predicate check multiple items or slots
Using an any_of predicate type
Oh, ty, some people tell me but without this point
Now I can detect but how can I clear that item what I detect? Player can pickup few items monentally
OK, thx