Command works in command_block, but no in /function:
execute @a[tag=IsBucheron,score_XpLog_min=2] ~ ~ ~ /scoreboard players tag @e[type=Item,r=6] add BucheXP {Item:{id:"minecraft:log"},Age:0s}
Command works in command_block, and in /function:
execute @a[tag=IsBucheron,score_XpLog_min=2] ~ ~ ~ /scoreboard players tag @e[type=Item,r=6] add BucheXP {Item:{id:"minecraft:log"},Age:1s}
Edit:
In command_block, we can execute a command for an item with Age:0s
In a function, this same command doesn't work, but if we replace Age:0s by Age:1s, it works.
Linked issues
duplicates 1
Comments 6
@unknown, did you use gameLoopFunction
for your function? (MC-117360)
Yes i use my function with gameLoopFunction (and in the first function directly, not with "function in function")
I can confirm the problem. To simplify I used the command execute @a ~ ~ ~ testfor @e[type=item] {Age:0s}
with commandBlockOutput enabled. The command block will have output, while the function will not. That changes when I change the age value in the function to 1s.
I suspect that this happens because of the order within a tick. Probably the order is something like that:
tick entities (and thus increase the Age-value)
execute gameLoopFunction
process packages (like player drops an item)
process tile ticks (and with that command blocks)
That would lead to the command block recognizing the item in the tick it got created with an Age-value of 0 and the gameLoopFunction not recognizing it.
Could you attach the function file here?