/**
 * @param {import("@minecraft/server").Dimension} dimension 
 * @param {import("@minecraft/server").Vector3} location
 * @param {import("@minecraft/server").ItemStack} itemStack
 */
export function dropItem(dimension, location, itemStack) {
    const item = dimension.spawnItem(itemStack, location);
    item.applyImpulse({x: Math.random() * 0.2 - 0.1, y: 0.1, z: Math.random() * 0.2 - 0.1});
}

/**
 * Adds 0.5 to the x, and z coordinates of the location to center it.
 * @param {import("@minecraft/server").Dimension} dimension 
 * @param {import("@minecraft/server").Vector3} location
 * @param {import("@minecraft/server").ItemStack} itemStack
 */
export function dropItemCenterOfBlock(dimension, location, itemStack) {
    dropItem(dimension, { x: location.x + 0.5, y: location.y, z: location.z + 0.5 }, itemStack);
}