#How to detect blocks around player, run command at detected blocks
1 messages · Page 1 of 1 (latest)
mc.system.runInterval(() => {
const size = 9;
const offset = Math.ceil(size / 2);
for (let plr of world.getAllPlayers()) {
for ( let x = -offset; x < size - offset; x++) {
for ( let y = -offset; y < size - offset; y++) {
for ( let z = -offset; z < size - offset; z++) {
const block = plr.dimension.getBlock({ x: x + plr.location.x, y: y + plr.location.y, z: z + plr.location.z })
if ( block.type.id =='minecraft:diamond_block') {
}
}
}
}
}
});
Ty, is this in stable?
Should be it's nothing special
Although I don't recommend being any larger than 9x9x9 cuz ar more will cuase lag
I changed it btw
I understand