#burns_in_daylight without player.json
1 messages · Page 1 of 1 (latest)
Get id the player has a block on top of it with a raycast, if it doesn’t set it on fire
thx I'll try
it doesn't seem to work
function isInSunlight(entity) {
if (entity.dimension.id != "overworld") return false;
const ray = entity.dimension.getBlockFromRay(entity.getHeadLocation(), { x: 0, y: 1, z: 0 }, { includeLiquidBlocks: true, includePassableBlocks: false, maxDistance: 50 });
return ray === undefined;
};```
Idk
This works fine with me.
system.runInterval(() => {
const time = world.getTimeOfDay();
// Sunrise, Day, Noon
if (time >= 0 && time < 13000 || time >= 23000 && time < 24000) {
for (const player of world.getPlayers()) {
const { location, dimension } = player;
const { min, max } = dimension.heightRange;
if (location.y < min || location.y > max) return;
const blocks = dimension.getBlockFromRay(location, { x: 0, y: 1, z: 0 }, { maxDistance: max - location.y, includeLiquidBlocks: true, includePassableBlocks: false });
if (!blocks) player.setOnFire(1, true);
}
}
});```
-# I know yes very unnecessary codes lmfao
yo this worked tysm 😭