jhuckaby / magic-sorting-system

A data pack for Minecraft 1.13, 1.14 and 1.15 (Java) for automatically sorting every item in the game.
39 stars 15 forks source link

Option to target frames with named items #28

Open omwah opened 4 years ago

omwah commented 4 years ago

Add option to configuration that when enabled will allow items in the item frame to be named a certain name for those frames to be target. This is a way to ensure that items are sorted only to the intended item frames. Requires naming the item in the frame, not the frame itself. I couldn't find a way to target a named item frame.

p-hennessy commented 4 years ago

Looked into this as well; item frames don't seem to expose a name attribute on it's NBT data; not sure why, maybe its a bug in the game? Either way this method works well!

isaaclepes commented 3 years ago

I re-wrote a lot of this datapack to create a version customized for my server. My tagger function checks for named item in frame and sets tags. I used command_block to restrict usage to operators, but the item should not matter. You can even omit the id: part. No reason you can't use the same check for a teleport command.

execute as @e[type=minecraft:item_frame,tag=!sss_shulker_target,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Shulker Target"}'}}}}] run function sss:targetshulker execute as @e[type=minecraft:item_frame,tag=!sss_sort_target,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Sort Target"}'}}}}] run function sss:targetsort execute as @e[type=minecraft:item_frame,tag=!sss_furnace_target,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Furnace Target"}'}}}}] run function sss:targetfurnace execute as @e[type=minecraft:item_frame,tag=!sss_smelt_target,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Smelt Target"}'}}}}] run function sss:targetsmelt execute as @e[type=minecraft:item_frame,tag=!sss_smoker_target,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Smoker Target"}'}}}}] run function sss:targetsmoker execute as @e[type=minecraft:item_frame,tag=!sss_furnace_fuel,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Furnace Fuel"}'}}}}] run function sss:targetfuelfurnace execute as @e[type=minecraft:item_frame,tag=!sss_smelt_fuel,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Smelt Fuel"}'}}}}] run function sss:targetfuelsmelt execute as @e[type=minecraft:item_frame,tag=!sss_smoker_fuel,nbt={Item:{id:"minecraft:command_block",tag:{display:{Name:'{"text":"Smoker Fuel"}'}}}}] run function sss:targetfuelsmoker