Smart Ore Generation

数据包

· 作者 Stoupy51

一个用于 Minecraft 的数据包库,通过使用智能的矿石位置系统来处理自定义矿石生成。

0 本站下载 0 关注 更新于 2 个月前

最新 1.7.4 · 26.3 · 数据包

一键开服(送7天)

? 翻译

? Smart Ore Generation

? 一个用于处理自定义矿石生成的 Minecraft 数据包库,通过使用智能的矿石位置系统来实现。

  • ? 该库是对原版矿石生成系统的补充,而非替代。
  • ? 它被设计为与其他矿石生成库兼容。
  • ? 该库仅提供一种智能生成矿石的方式,不提供自定义方块功能。
  • ? 你可以配置该库以在特定维度或所有维度中生成矿石。
  • ⚡ 它与自定义主世界最低高度配合工作;仅当需要时才会为主世界计算恒定分数(score)。
  • ? 该库支持自定义维度,但你必须将它们添加到 denied_dimensions 函数标签中,以防止在你不希望扫描它们时被扫描。
  • ✨ 即使世界是在安装该库之前生成的,该库也能正常工作,因为它不依赖于世界生成。

? 这是一个嵌入式库,因此你需要将其打包在你的数据包内,而不是单独下载。运行需要 LanternLoad。

? 你可以在下图中看到矿石斑块始终与空气方块相邻。 image


? 系统说明

每 5 秒,该库会在每个玩家的位置执行以下步骤:

  • ⚡ 检查函数标签 denied_dimensions,以允许你禁止某些维度被扫描。
  • ? 如果维度被允许,则扫描玩家周围的 8 个区域。(默认区域大小为 96x96)
  • ? 对于每个区域,该库会检查是否已经扫描过。如果没有,则对该区域启动矿石生成。
  • ? 然后,在区域的原点 (0, 0, 0) 调用函数标签 generate_ores。
  • ? 你可以将你自己的矿石生成功能添加到此标签中,根据你自选的条件(如维度、生物群系等)生成矿石。
  • ? 对于你生成的每一组矿石斑块,你必须使用随机位置函数标签 random_position 来获取区域内的随机位置。此函数标签会将位置移动到最近的空气方块的随机位置。这样做可以防止矿石生成在方块内部从而永远无法被玩家发现(如果矿石使用实体,还会导致服务器卡顿)。这样矿石就更容易被发现。
  • ? 每次检查后,该库会将该区域保存为“已扫描”,通过在区域原点添加 barrier block(屏障方块)来防止再次扫描。
  • ✨ 最后,调用函数标签 post_generation,以允许你执行一些生成后任务,例如对所有新生成的矿石运行一个函数以添加 NBT 标签或其他操作。

? 函数标签

? 信号

#smart_ore_generation:v1/denied_dimensions

  • ? 当库想要扫描一个区域时,会调用此函数标签。你可以通过向此标签添加函数来禁止某些维度被扫描。
  • ? 要使用此信号,你必须在位于 data/smart_ore_generation/tags/function/v1/signals/denied_dimensions.json 的标签列表中添加一个函数。
  • ? 请参阅此处获取函数的内容模板 这里。
#> smart_ore_generation:v1.7.2/signals/denied_dimensions
#
# @within			#smart_ore_generation:v1/signals/denied_dimensions
# @executed			as & at the player who triggered the event
# @input score		#authorized smart_ore_generation.data equals to 1 or 0 if another datapack has already denied generation
#
## WARNING!
# - You must check the #authorized score matching 1 before executing any commands to prevent reenable generation in a dimension that is disabled by another datapack.
# - Putting the #authorized score to 0 will disable generation in the dimension for every datapack.

## Here is an example to disable generation in a dimension:
execute if score #authorized smart_ore_generation.data matches 1 if predicate simplenergy:in_overworld run scoreboard players set #authorized smart_ore_generation.data 0

## Another example:
execute if score #authorized smart_ore_generation.data matches 1 if dimension minecraft:overworld run scoreboard players set #authorized smart_ore_generation.data 0

#smart_ore_generation:v1/generate_ores

  • ? 当库想要在一个区域生成矿石时,会调用此函数标签。你可以将你自己的矿石生成功能添加到此标签中。
  • ? 要使用此信号,你必须在位于 data/smart_ore_generation/tags/function/v1/signals/generate_ores.json 的标签列表中添加一个函数。
  • ? 请参阅此处获取函数的内容模板 这里
#> smart_ore_generation:v1.7.2/signals/generate_ores
#
# @within			#smart_ore_generation:v1/signals/generate_ores
# @executed			as a special marker & at a position you shouldn't care about
#
## WARNING!
# - You must not use /kill @s in this file, or the entire library will stop working.
# - Don't forget to edit #min_height and #max_height scores before trying to generate ores.
#
# @example from SimplEnergy datapack
# This example generates 4 patches of Simplunium Ore in the overworld only
# Per region and between world bottom (minecraft default: -64) and y=40

# Dimension score, 0 = overworld
scoreboard players set #dimension smart_ore_generation.data -1
execute if predicate simplenergy:in_overworld run scoreboard players set #dimension smart_ore_generation.data 0

# 仅在主世界生成 Simplunium 矿石(x4)
scoreboard players operation #min_height smart_ore_generation.data = _OVERWORLD_BOTTOM smart_ore_generation.data
scoreboard players set #max_height smart_ore_generation.data 40
execute if score #dimension smart_ore_generation.data matches 0 run function smart_ore_generation:v1.7.2/signals/example/simplunium_ore
execute if score #dimension smart_ore_generation.data matches 0 run function smart_ore_generation:v1.7.2/signals/example/simplunium_ore
execute if score #dimension smart_ore_generation.data matches 0 run function smart_ore_generation:v1.7.2/signals/example/simplunium_ore
execute if score #dimension smart_ore_generation.data matches 0 run function smart_ore_generation:v1.7.2/signals/example/simplunium_ore
# 请参阅链接中的模板,以了解函数 smart_ore_generation:v1.7.2/signals/example/simplunium_ore.mcfunction 的内容

#smart_ore_generation:v1/post_generation

  • ? 当库在区域中完成矿石生成后,将调用此函数标签。你可以将自己的后处理函数添加到此标签中。
  • ? 要使用此信号,你必须将函数添加到位于 data/smart_ore_generation/tags/function/v1/signals/post_generation.json 的标签列表中。
  • ? 参考 此处 的模板以获取函数的内容
#> smart_ore_generation:v1.7.2/signals/post_generation
#
# @within			#smart_ore_generation:v1/signals/post_generation
# @executed			as none at none (default of a /schedule)
#
# 该函数在所有矿石生成完成后执行一次。
# 例如,如果生成了 6 个区域,则该函数将在所有区域生成完成后执行 1 次。
# 它可用于执行一些后处理任务,例如对所有生成的矿石运行一个函数,
# 而不是在生成每个矿石时单独对其运行。
# 有助于优化性能。
#
# @example from SimplEnergy datapack
# 此示例将编辑实体 NBT,针对在整个生成过程中生成的 simplunium 矿石和深板岩 simplunium 矿石。
# 这有助于优化,因为你只运行一次“次要”函数,
# 而不是在生成每个矿石时单独对其运行。

# 如果已生成,则放置 simplunium 矿石
execute if score #generated_ore simplenergy.data matches 1 as @e[tag=simplenergy.new_simplunium_ore] at @s run function simplenergy:place/simplunium_ore/secondary
execute if score #generated_ore simplenergy.data matches 1 run scoreboard players reset #generated_ore simplenergy.data

# 如果已生成,则放置深板岩 simplunium 矿石
execute if score #generated_deepslate_ore simplenergy.data matches 1 as @e[tag=simplenergy.new_deepslate_simplunium_ore] at @s run function simplenergy:place/deepslate_simplunium_ore/secondary
execute if score #generated_deepslate_ore simplenergy.data matches 1 run scoreboard players reset #generated_deepslate_ore simplenergy.data

? 插槽

#smart_ore_generation:v1/slots/random_position

  • 当你需要在区域内获得随机位置时,应调用此函数标签。
  • 要正确使用此插槽,请参见 此处 的模板
#> smart_ore_generation:v1.7.2/signals/example/simplunium_ore
#
# @example from SimplEnergy datapack
# 始终在其他任何操作之前启动随机位置函数标签
# @TIP: 随机位置不是平面的,它具有数字位。
# 你可以使用该数字位以特定方式生成矿石,如下所示
# 它将尝试根据数字放置矿石群
# 因此,下面每一行都可能会失败,使其更加逼真
# 最终导致矿石群中包含 2 到 6 个矿石(在此示例中)

## 尝试在区域内找到与空气相邻的随机位置以生成矿石
function #smart_ore_generation:v1/slots/random_position

# 放置 Simplunium 矿石群
execute at @s if block ~ ~ ~ #simplenergy:for_simplunium_ore run function simplenergy:calls/smart_ore_generation/simplunium_type
execute at @s positioned ~0.8 ~0.8 ~0.8 if block ~ ~ ~ #simplenergy:for_simplunium_ore run function simplenergy:calls/smart_ore_generation/simplunium_type
execute at @s positioned ~0.0 ~0.8 ~0.8 if block ~ ~ ~ #simplenergy:for_simplunium_ore run function simplenergy:calls/smart_ore_generation/simplunium_type
execute at @s positioned ~0.8 ~0.8 ~0.0 if block ~ ~ ~ #simplenergy:for_simplunium_ore run function simplenergy:calls/smart_ore_generation/simplunium_type
execute at @s positioned ~0.8 ~0.0 ~0.8 if block ~ ~ ~ #simplenergy:for_simplunium_ore run function simplenergy:calls/smart_ore_generation/simplunium_type
execute at @s positioned ~0.0 ~0.8 ~0.0 if block ~ ~ ~ #simplenergy:for_simplunium_ore run function simplenergy:calls/smart_ore_generation/simplunium_type

⭐ Star History

Star History Chart

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源