path_selector:
type: item
material: blaze_rod
mechanisms:
flags: HIDE_ENCHANTS
nbt: way/0|id/-1
display_name: "<green>Path Selector"
enchantments:
- thorns:1
+
+path_selection_effect:
+ type: task
+
path_selector_handle:
type: world
events:
on player right clicks with path_selector:
# Avoiding setting a null place to the selector
- - if <context.location.block.material||air> == air :
+ - if <context.location.block.material||air> == air:
- determine cancelled
# Basic definitions
- define held_item:<context.item||null>
- define place:<context.location.block.center||null>
# If the item has the way
- if <[held_item].has_nbt[way]>:
# Which slot the item is
- define slot:<player.inventory.find.scriptname[path_selector]>
- if <[held_item].nbt[way]> == 0:
- narrate "<yellow>Point <green>0 <yellow>selected."
- - narrate "<context.location.simple> 1, nbt=0"
- - inventory adjust slot:<[slot]> nbt:way/<list[0/<context.location.simple>].escaped>
+ - inventory adjust slot:<[slot]> nbt:way/<list[0/<[place]>].escaped>
+ - narrate <[place]>
+ - wait 15t
+ - narrate <[held_item].nbt[way]>
+ # - repeat 20:
+ # - playeffect effect:redstone at:<[held_item].nbt[way].unescaped.as_list.get_sub_items[2]> quantity:20 data:0 special_data:1.2|orange offset:0.0
+ # - wait 10t
- else:
- define last_key:<[held_item].nbt[way].unescaped.as_list.get_sub_items[1].highest.add[1]>
- narrate "<yellow>Point <green><[last_key]> <yellow>selected."
- - narrate "<context.location.simple> <[last_key]>, nbt!=0"
+ - define new_nbt:<list[<[held_item].nbt[way].unescaped.as_list>|<[last_key]>/<[place]>].escaped>
+ - inventory adjust slot:<[slot]> nbt:way/<[new_nbt]>
+ - repeat 20:
+ - playeffect effect:redstone at:<[held_item].nbt[way].unescaped.as_list.get_sub_items[2]> quantity:20 data:0 special_data:1.2|orange offset:0.0
+ - wait 10t
+
# Setting the new NBT
- - define new_nbt:<list[<[held_item].nbt[way].unescaped.as_list>|<[last_key]>/<context.location.simple>].escaped>
+
- - inventory adjust slot:<[slot]> nbt:way/<[new_nbt]>