⛰️ 环境(Environment)#

#bs.environment:help

与天气和生物群系属性相关的综合信息和工具。

../../_images/environment.png

“最危险的世界观是那些从未观察过世界的人的世界观。”

—亚历山大·冯·洪堡(Alexander von Humboldt)


🔧 函数#

你可以在下方找到此模块中的所有可用函数。


获取生物群系#

#bs.environment:get_biome

获取函数执行位置的生物群系数据。

输入:

执行 at <实体>positioned <x> <y> <z>:你想要获取生物群系数据的位置。

输出:

命令存储 bs:out environment.get_biome

  • 群系数据

    • type: 群系id的完整字符串表示(比如:minecraft:plains)。

    • temperature: 群系的基础温度。

    • has_precipitation: 群系能否降水。

示例:获取当前位置的生物群系数据:

# Once
function #bs.environment:get_biome
data get storage bs:out environment.get_biome

制作人员:Aksiome


获取温度#

#bs.environment:get_temperature {scale:<scaling>}

获取函数执行位置的温度,考虑海拔高度对温度的影响。

输入:

执行 at <实体>positioned <x> <y> <z>:你想要获取温度的位置。

函数宏

  • 参数

    • scale: 应用于函数输出的比例因子。

输出:

返回值 | 分数 $environment.get_temperature bs.out:给定位置的温度。

示例:获取当前海拔高度的温度:

# Once
function #bs.environment:get_temperature {scale:1000}

制作人员:Aksiome、theogiraudet


Get Celestial Angle#

#bs.environment:get_current_sun_angle {scale:<scaling>}

Get the current sun’s angle on the Y axis relative to the horizon, in degrees.

输入:

函数宏

  • 参数

    • scale: A scalar applied to the output.

输出:

Return: Sun’s angle in degrees (scaled by scale).

Storage bs:out environment.celestial_angle : Sun’s angle in degrees.

Example: Get the sun’s current angle:

# Once
function #bs.environment:get_current_sun_angle {scale: 1000}
tellraw @a [{"text":"Sun angle: "},{"nbt":"environment.celestial_angle","storage":"bs:out","interpret":true},{"text":"°"}]

备注

This feature also works when the advance_time game rule is set to false. In such situation, the returned value is the sun’s angle at the time of daylight cycle freeze.

#bs.environment:get_current_moon_angle {scale:<scaling>}

Get the current moon’s angle on the Y axis relative to the horizon, in degrees.

输入:

函数宏

  • 参数

    • scale: A scalar applied to the output.

输出:

Return: Moon’s angle in degrees (scaled by scale).

Storage bs:out environment.celestial_angle : Moon’s angle in degrees.

Example: Get the moon’s current angle:

# Once
function #bs.environment:get_current_moon_angle {scale: 1000}
tellraw @a [{"text":"Moon angle: "},{"nbt":"environment.celestial_angle","storage":"bs:out","interpret":true},{"text":"°"}]

备注

This feature also works when the advance_time game rule is set to false. In such situation, the returned value is the moon’s angle at the time of daylight cycle freeze.

#bs.environment:get_sun_angle {scale:<scaling>}

Get the sun’s angle on the Y axis relative to the horizon at a specific time.

输入:

Scores $environment.celestial_angle.day bs.in: The day number.

Scores $environment.celestial_angle.daytime bs.in: The time of day in ticks (0-24000).

函数宏

  • 参数

    • scale: A scalar applied to the output.

输出:

Return: Sun’s angle at the given time, in degrees (scaled by scale).

Storage bs:out environment.celestial_angle : Sun’s angle in degrees.

Example: Get the sun’s angle on day 100 at noon (6000 ticks):

# Once
scoreboard players set $environment.celestial_angle.day bs.in 100
scoreboard players set $environment.celestial_angle.daytime bs.in 6000

function #bs.environment:get_sun_angle {scale: 1000}
tellraw @a [{"text":"Sun angle at day 100, noon: "},{"nbt":"environment.celestial_angle","storage":"bs:out","interpret":true},{"text":"°"}]
#bs.environment:get_moon_angle {scale:<scaling>}

Get the moon’s angle on the Y axis relative to the horizon at a specific time.

输入:

Scores $environment.celestial_angle.day bs.in: The day number.

Scores $environment.celestial_angle.daytime bs.in: The time of day in ticks (0-24000).

函数宏

  • 参数

    • scale: A scalar applied to the output.

输出:

Return: Moon’s angle at the given time, in degrees (scaled by scale).

Storage bs:out environment.celestial_angle : Moon’s angle in degrees.

Example: Get the moon’s angle on day 100 at midnight (18000 ticks):

# Once
scoreboard players set $environment.celestial_angle.day bs.in 100
scoreboard players set $environment.celestial_angle.daytime bs.in 18000

function #bs.environment:get_moon_angle {scale: 1000}
tellraw @a [{"text":"Moon angle at day 100, midnight: "},{"nbt":"environment.celestial_angle","storage":"bs:out","interpret":true},{"text":"°"}]

Credits: theogiraudet


Get Moon Phase#

#bs.environment:get_moon_phase

Get the current moon phase as a string identifier.

输出:

Storage bs:out environment.get_moon_phase: Moon phase identifier.

Return: Moon phase identifier (see the note below).

Example: Get the current moon phase:

# Once
function #bs.environment:get_moon_phase
data get storage bs:out environment.get_moon_phase

Moon Phase Values

The function returns one of the following string values:

  • "full_moon" (id: 0)

  • "waning_gibbous" (id: 1)

  • "third_quarter" (id: 2)

  • "waning_crescent" (id: 3)

  • "new_moon" (id: 4)

  • "waxing_crescent" (id: 5)

  • "first_quarter" (id: 6)

  • "waxing_gibbous" (id: 7)

The moon phase cycle follows Minecraft’s 8-day lunar cycle.

Credits: theogiraudet


Look at Celestial Object#

#bs.environment:look_at_sun

Orient the executing entity to look at the sun.

输入:

Execution as <entity>: The entity to orient.

输出:

State: The entity’s rotation is modified to face the sun.

Example: Make the current entity look at the sun:

# Once
function #bs.environment:look_at_sun
#bs.environment:look_at_moon

Orient the executing entity to look at the moon.

输入:

Execution as <entity>: The entity to orient.

输出:

State: The entity’s rotation is modified to face the moon.

Example: Make the current entity look at the moon:

# Once
function #bs.environment:look_at_moon

Credits: theogiraudet


👁️ 谓词#

你可以在下方找到此模块中的所有可用判据。


能否下雨?#

bs.environment:can_rain

判断能否下雨。

制作人员:Aksiome


能否下雪?#

bs.environment:can_snow

判断能否下雪。

制作人员:Aksiome


能否降水?#

bs.environment:has_precipitation

判断生物群系能否降水。

制作人员:Aksiome


是否正在下雨?#

bs.environment:is_raining

判断现在是否正在下雨。

制作人员:Aksiome、theogiraudet


是否正在打雷?#

bs.environment:is_thundering

判断现在是否正在打雷。

制作人员:Aksiome、theogiraudet


Time Predicates#

bs.environment:is_day_time

Determine if it is currently daytime (between 07:00 and 18:00).

Credits: theogiraudet

bs.environment:is_night_time

Determine if it is currently nighttime (between 19:00 and 06:00).

Credits: theogiraudet

bs.environment:is_sunrise_time

Determine if it is currently sunrise (between 06:00 and 07:00).

Credits: theogiraudet

bs.environment:is_sunset_time

Determine if it is currently sunset (between 18:00 and 19:00).

Credits: theogiraudet


Villager Behavior#

bs.environment:is_villager_sleeping_time

Determine if villagers are currently in their working phase (between 08:00 and 15:00).

Credits: theogiraudet

bs.environment:is_villager_socializing_time

Determine if villagers are currently in their socializing phase (between 15:00 and 18:00).

Credits: theogiraudet

bs.environment:is_villager_sleeping_time

Determine if villagers are currently in their sleeping phase (between 18:00 and 07:00).

Credits: theogiraudet


Is It Bed Time?#

bs.environment:is_bed_time

Determine if beds can currently be used by players (between 18:32 and 05:27 in clear weather, or 18:00 and 05:59 in rainy weather).

Credits: theogiraudet


Is It Undead Burning Time?#

bs.environment:is_undead_burning_time

Determine if undead mobs (zombies, skeletons, etc.) can currently burn in sunlight (between 05:27 and 18:32 in clear weather).

Credits: theogiraudet


Is It Monster Spawning Time?#

bs.environment:is_monster_spawning_time

Determine if hostile monsters can currently spawn outdoors (between 19:11 and 04:48 in clear weather, or 18:58 and 05:01 in rainy weather).

Credits: theogiraudet


Is It Bee Sleeping Time?#

bs.environment:is_bee_sleeping_time

Determine if bees are currently in their sleeping phase (between 18:32 and 05:27 in clear weather).

Credits: theogiraudet


Is It Creaking Spawning Time?#

bs.environment:is_creaking_spawning_time

Determine if creakings can currently spawn (between 18:32 and 05:27 in clear weather, or 18:00 and 05:59 in rainy weather).

Credits: theogiraudet


💬 这对你有帮助吗?

欢迎在下方留下你的问题和反馈!