```command /gui:
trigger:
set metadata tag "AdAnvil" of player to chest inventory with 3 rows named "Better anvil"
set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 and 27 of metadata tag "AdAnvil" of player to gray stained glass pane
set slot 14 of metadata tag "AdAnvil" of player to anvil
open (metadata tag "AdAnvil" of player) to player
on inventory click:
if event-inventory = (metadata tag "AdAnvil" of player):
if index of event-slot is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 or 27:
cancel event
else if index of event-slot is 14:
cancel event
send "yesa"
if item in slot 10 of metadata tag "AdAnvil" of player is enchanted with fortune:
#works with items enchanted with the enchantment but not with books
send "yes1"
if item in slot 12 of metadata tag "AdAnvil" of player is enchanted with fortune:
send "yes2"
set {_i1} to item in slot 10 of metadata tag "AdAnvil" of player
set {_e1} to level of fortune of item in slot 10 of metadata tag "AdAnvil" of player
set {_e2} to level of fortune of item in slot 12 of metadata tag "AdAnvil" of player
if {_e1} - {_e2} is equal to 0:
set {_e3} to {_e1} + 1
set slot 10 and 12 of metadata tag "AdAnvil" of player to air
set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 and 27 of metadata tag "AdAnvil" of player to gray stained glass pane
set slot 15 of metadata tag "AdAnvil" of player to stick
#not able to set the result to the fist item to the fortune of the first and the second
open (metadata tag "AdAnvil" of player) to player``` errors in comments.
trigger:
set metadata tag "AdAnvil" of player to chest inventory with 3 rows named "Better anvil"
set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 and 27 of metadata tag "AdAnvil" of player to gray stained glass pane
set slot 14 of metadata tag "AdAnvil" of player to anvil
open (metadata tag "AdAnvil" of player) to player
on inventory click:
if event-inventory = (metadata tag "AdAnvil" of player):
if index of event-slot is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 or 27:
cancel event
else if index of event-slot is 14:
cancel event
send "yesa"
if item in slot 10 of metadata tag "AdAnvil" of player is enchanted with fortune:
#works with items enchanted with the enchantment but not with books
send "yes1"
if item in slot 12 of metadata tag "AdAnvil" of player is enchanted with fortune:
send "yes2"
set {_i1} to item in slot 10 of metadata tag "AdAnvil" of player
set {_e1} to level of fortune of item in slot 10 of metadata tag "AdAnvil" of player
set {_e2} to level of fortune of item in slot 12 of metadata tag "AdAnvil" of player
if {_e1} - {_e2} is equal to 0:
set {_e3} to {_e1} + 1
set slot 10 and 12 of metadata tag "AdAnvil" of player to air
set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 and 27 of metadata tag "AdAnvil" of player to gray stained glass pane
set slot 15 of metadata tag "AdAnvil" of player to stick
#not able to set the result to the fist item to the fortune of the first and the second
open (metadata tag "AdAnvil" of player) to player``` errors in comments.