Run /item modify, /summon stacks and generic attributes as vanilla
Inline and registered item modifiers now apply (26.3's type-dispatched functions, set_lore, set_custom_data, set_components, toggle_tooltips, filtered), counting every set slot like CountingModifier. Item stacks keep components Horizon does not model, display names follow ItemStack.getDisplayName, /data prints compounds in CompoundTag's HashMap order, summoned passengers snap to the position, and living entities other than the player get vanilla attribute maps (waypoint transmit range included, tracked as ServerWaypointManager does). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -173,7 +173,7 @@ def player_state():
|
||||
cmd('/enchant @s minecraft:efficiency 9'),
|
||||
cmd('/item replace entity @s armor.head with minecraft:golden_helmet'),
|
||||
cmd('/clear @s minecraft:golden_helmet 0'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_count",count:1}'),
|
||||
cmd('/clear @s'),
|
||||
cmd('/clear @s'),
|
||||
cmd('/attribute @s minecraft:max_health get'),
|
||||
@@ -338,6 +338,8 @@ def execute():
|
||||
cmd('/execute align xyz run summon minecraft:armor_stand ~ ~-20 ~ {NoGravity:1b,Tags:["ex"]}'),
|
||||
cmd('/execute if entity @e[tag=ex]'),
|
||||
cmd('/execute as @e[tag=ex] run data get entity @s Pos'),
|
||||
cmd('/data get entity @e[tag=ex,limit=1]'),
|
||||
cmd('/data get entity @e[tag=ex,limit=1] Pose'),
|
||||
cmd('/execute anchored eyes run tp @s ^ ^ ^'),
|
||||
cmd('/execute rotated 90 0 run tp @s ~ ~ ~ ~ ~'),
|
||||
cmd('/execute rotated as @e[tag=ex,limit=1] run tp @s ~ ~ ~ ~ ~'),
|
||||
@@ -392,45 +394,46 @@ def execute():
|
||||
def items_and_loot():
|
||||
return [
|
||||
*setup('/clear @s', '/gamemode survival'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_count",count:3}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_count",count:3}'),
|
||||
cmd('/item replace entity @s weapon.mainhand with minecraft:stone 10'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_count",count:3}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_count",count:3}'),
|
||||
cmd('/clear @s minecraft:stone 0'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_count",count:5,add:true}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_count",count:5,add:true}'),
|
||||
cmd('/clear @s minecraft:stone 0'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:limit_count",limit:{max:4}}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:limit_count",limit:{max:4}}'),
|
||||
cmd('/clear @s minecraft:stone 0'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_name",name:"Rock"}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_name",name:"Rock"}'),
|
||||
cmd('/data get entity @s SelectedItem'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_name",name:{text:"Item",color:"red"},target:"item_name"}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_lore",lore:["one","two"],mode:"replace_all"}'),
|
||||
cmd('/item modify entity @s weapon.mainhand [{function:"minecraft:set_count",count:2},{function:"minecraft:set_custom_data",tag:{a:1b}}]'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_name",name:{text:"Item",color:"red"},target:"item_name"}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_lore",lore:["one","two"],mode:"replace_all"}'),
|
||||
cmd('/item modify entity @s weapon.mainhand [{type:"minecraft:set_count",count:2},{type:"minecraft:set_custom_data",tag:{a:1b}}]'),
|
||||
cmd('/data get entity @s SelectedItem'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_components",components:{"minecraft:max_stack_size":16}}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:filtered",item_filter:{items:"minecraft:dirt"},on_pass:{function:"minecraft:set_count",count:1}}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_components",components:{"minecraft:max_stack_size":16}}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:filtered",item_filter:{items:"minecraft:dirt"},on_pass:{type:"minecraft:set_count",count:1}}'),
|
||||
cmd('/clear @s minecraft:stone 0'),
|
||||
cmd('/item replace entity @s weapon.mainhand with minecraft:diamond_sword'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_damage",damage:0.5}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_damage",damage:0.5}'),
|
||||
cmd('/data get entity @s SelectedItem.components'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_enchantments",enchantments:{"minecraft:sharpness":3}}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_enchantments",enchantments:{"minecraft:sharpness":3}}'),
|
||||
cmd('/data get entity @s SelectedItem.components."minecraft:enchantments"'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:set_enchantments",enchantments:{"minecraft:sharpness":1},add:true}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:set_enchantments",enchantments:{"minecraft:sharpness":1},add:true}'),
|
||||
cmd('/data get entity @s SelectedItem.components."minecraft:enchantments"'),
|
||||
cmd('/item modify entity @s weapon.mainhand {function:"minecraft:toggle_tooltips",toggles:{"minecraft:enchantments":false}}'),
|
||||
cmd('/item modify entity @s armor.head {function:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s weapon.offhand {function:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s hotbar.* {function:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s weapon.mainhand {type:"minecraft:toggle_tooltips",toggles:{"minecraft:enchantments":false}}'),
|
||||
cmd('/item modify entity @s armor.head {type:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s weapon.offhand {type:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s hotbar.* {type:"minecraft:set_count",count:1}'),
|
||||
cmd('/item modify entity @s weapon.mainhand minecraft:nonexistent'),
|
||||
cmd('/item replace entity @s hotbar.1 from entity @s weapon.mainhand'),
|
||||
cmd('/item replace entity @s hotbar.2 from entity @s weapon.mainhand {function:"minecraft:set_count",count:1}'),
|
||||
cmd('/item replace entity @s hotbar.2 from entity @s weapon.mainhand {type:"minecraft:set_count",count:1}'),
|
||||
cmd('/clear @s minecraft:diamond_sword 0'),
|
||||
cmd('/setblock 3 206 3 minecraft:barrel'),
|
||||
cmd('/item replace block 3 206 3 container.4 with minecraft:emerald 7'),
|
||||
cmd('/item modify block 3 206 3 container.4 {function:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 206 3 container.5 {function:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 206 3 container.99 {function:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 207 3 container.0 {function:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 206 3 container.4 {type:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 206 3 container.5 {type:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 206 3 container.99 {type:"minecraft:set_count",count:2}'),
|
||||
cmd('/item modify block 3 207 3 container.0 {type:"minecraft:set_count",count:2}'),
|
||||
cmd('/data get block 3 206 3 Items'),
|
||||
cmd('/data get block 3 206 3'),
|
||||
cmd('/item replace entity @s hotbar.3 from block 3 206 3 container.4'),
|
||||
cmd('/item replace block 3 206 3 container.0 from entity @s hotbar.3'),
|
||||
cmd('/data get block 3 206 3 Items'),
|
||||
@@ -440,7 +443,7 @@ def items_and_loot():
|
||||
cmd('/loot replace block 3 206 3 container.8 loot minecraft:blocks/cobblestone'),
|
||||
cmd('/loot replace entity @s hotbar.5 loot minecraft:blocks/glass'),
|
||||
cmd('/loot spawn 3 210 3 loot minecraft:blocks/stone'),
|
||||
cmd('/loot give @s loot {pools:[{rolls:1,entries:[{type:"minecraft:item",name:"minecraft:apple",functions:[{function:"minecraft:set_count",count:4}]}]}]}'),
|
||||
cmd('/loot give @s loot {pools:[{rolls:1,entries:[{type:"minecraft:item",name:"minecraft:apple",functions:[{type:"minecraft:set_count",count:4}]}]}]}'),
|
||||
cmd('/setblock 2 205 2 minecraft:stone'),
|
||||
cmd('/loot give @s mine 2 205 2'),
|
||||
cmd('/loot give @s mine 2 205 2 mainhand'),
|
||||
@@ -524,17 +527,43 @@ def world_misc():
|
||||
cmd('/spectate'),
|
||||
cmd('/spectate @e[tag=nothing,limit=1]'),
|
||||
cmd('/gamemode creative'),
|
||||
# The waypoint manager is a HashSet of entities (identity hash order),
|
||||
# so at most one transmitter at a time. Range changes take effect when
|
||||
# the entity ticks.
|
||||
cmd('/attribute @s minecraft:waypoint_transmit_range base set 0'),
|
||||
cmd('/waypoint list'),
|
||||
{'op': 'tick', 'n': 1},
|
||||
cmd('/waypoint list'),
|
||||
cmd('/attribute @e[type=minecraft:pig,tag=w,limit=1] minecraft:waypoint_transmit_range base set 100'),
|
||||
cmd('/attribute @e[type=minecraft:pig,tag=w,limit=1] minecraft:waypoint_transmit_range get'),
|
||||
cmd('/waypoint list'),
|
||||
{'op': 'tick', 'n': 1},
|
||||
cmd('/waypoint list'),
|
||||
cmd('/waypoint modify @e[type=minecraft:pig,tag=w,limit=1] color gold'),
|
||||
cmd('/waypoint modify @e[tag=mk,limit=1] color gold'),
|
||||
cmd('/waypoint list'),
|
||||
cmd('/waypoint modify @e[tag=w] color gold'),
|
||||
cmd('/attribute @s minecraft:waypoint_transmit_range base set 0'),
|
||||
cmd('/waypoint list'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:max_health get'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:scale modifier add harness:big 1 add_multiplied_base'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:scale get'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:scale modifier add harness:big 1 add_value'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:scale modifier value get harness:big'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:scale modifier remove harness:big'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:scale modifier remove harness:big'),
|
||||
cmd('/attribute @e[type=minecraft:armor_stand,tag=w,limit=1] minecraft:attack_damage get'),
|
||||
cmd('/attribute @e[tag=mk,limit=1] minecraft:scale get'),
|
||||
cmd('/attribute @e[type=minecraft:pig,tag=w,limit=1] minecraft:waypoint_transmit_range base set 0'),
|
||||
{'op': 'tick', 'n': 1},
|
||||
cmd('/waypoint list'),
|
||||
cmd('/waypoint modify @e[type=minecraft:pig,tag=w,limit=1] style set minecraft:bowtie'),
|
||||
cmd('/waypoint list'),
|
||||
{'op': 'tick', 'n': 1},
|
||||
cmd('/waypoint list'),
|
||||
cmd('/kill @e[type=minecraft:pig,tag=w]'),
|
||||
{'op': 'tick', 'n': 1},
|
||||
cmd('/waypoint list'),
|
||||
cmd('/attribute @s minecraft:waypoint_transmit_range base reset'),
|
||||
{'op': 'tick', 'n': 1},
|
||||
cmd('/waypoint list'),
|
||||
cmd('/dialog show @s minecraft:custom_options'),
|
||||
cmd('/dialog show @s minecraft:nonexistent'),
|
||||
|
||||
Reference in New Issue
Block a user