#burns_in_daylight without player.json

1 messages · Page 1 of 1 (latest)

granite berry
#

is there a way to replicate the effect of the "minecraft:burns_in_daylight": {} component without modifying the player.json or any other entity file?

mint elk
granite berry
#

thx I'll try

granite berry
lone elm
# granite berry it doesn't seem to work ```js function isInSunlight(entity) { if (entity.dimen...

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);
    }
  }
});```
lone elm
#

-# I know yes very unnecessary codes lmfao

granite berry
#

yo this worked tysm 😭