Trying to summon tnt at a player's feet when they eat a specific food.
I'm having trouble with the query.position syntax for the player and im not sure it's even applicable in this situation
Current code in foodSpawnTnt.js
import {
world,
system
} from "@minecraft/server";
world.afterEvents.itemCompleteUse.subscribe(event => {
if (event.itemStack.typeId === "minecraft:bread") {
const p = event.source;
const d = p.dimension;
(async () => {
//This is to test functionality
await d.runCommandAsync("effect " + p.name + " invisibility 1 1 true");
//I want to query the player's position and replace the ~ ~ ~ with that attained position
await d.runCommandAsync("summon tnt ~ ~ ~")
})();
world.sendMessage("food eaten");
}
});