? 翻译
? Smart Ore Generation
? 一个用于处理自定义矿石生成的 Minecraft 数据包库,通过使用智能的矿石位置系统来实现。
- ? 该库是对原版矿石生成系统的补充,而非替代。
- ? 它被设计为与其他矿石生成库兼容。
- ? 该库仅提供一种智能生成矿石的方式,不提供自定义方块功能。
- ? 你可以配置该库以在特定维度或所有维度中生成矿石。
- ⚡ 它与自定义主世界最低高度配合工作;仅当需要时才会为主世界计算恒定分数(score)。
- ? 该库支持自定义维度,但你必须将它们添加到
denied_dimensions 函数标签中,以防止在你不希望扫描它们时被扫描。
- ✨ 即使世界是在安装该库之前生成的,该库也能正常工作,因为它不依赖于世界生成。
? 这是一个嵌入式库,因此你需要将其打包在你的数据包内,而不是单独下载。运行需要 LanternLoad。
? 你可以在下图中看到矿石斑块始终与空气方块相邻。

? 系统说明
每 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

? Translations
? Smart Ore Generation
? A Minecraft datapack library for handling custom ore generation by using a smart system for ore location.
- ? This library is an addition to the vanilla ore generation system. It does not replace it.
- ? It has been designed to be compatible with other ore generation libraries.
- ? This library only provide a way to generate ores in a smart way, it does not provide custom block functions.
- ? You can configure the library to generate ores in a specific dimension, or in all dimensions.
- ⚡ It is working with custom overworld minimum height, a constant score is calculated for overworld only if needed.
- ? This library supports customs dimensions, but you must add them to the
denied_dimensions function tag to prevent them from being scanned if you don't want them to be scanned.
- ✨ The library will be working even if the world was generated before installing the library because it does not depend on world generation.
? This is an embedded library, so you package it inside your datapack as opposed to having a separate download. Requires LanternLoad to operate.
? You can see on this image how ore patches are always adjacent to air blocks.

? System explanation
Every 5 seconds, the library run at the location of every player the following steps:
- ⚡ Run a the function tag
denied_dimensions to allow you to deny some dimensions from being scanned.
- ? If the dimension is allowed, 8 regions around players are scanned. (Default region size is 96x96)
- ? For each region, the library will check if is has already been scanned. If not, it will launch ore generation for this region.
- ? Then, the function tag
generate_ores is called at the origin of the region (0, 0, 0).
- ? You can add your own ore generation function to this tag where you will be generating your ores depending on self-chosen conditions. (like dimensions, biomes, etc...)
- ? For every patch of ore you generate, you must use the random position function tag
random_position to get a random position inside the region. This function tag will move the position to a random position and the nearest air block. Doing this way will prevent ores from being generated inside blocks and never be found by players (Adding lag to the server if the ore use an entity). So ores will be easier to find.
- ? And after every check, the library will save the region as "scanned" to prevent it from being scanned again by adding a
barrier block at the origin of the region.
- ✨ Finally, the function tag
post_generation is called to allow you to do some post-generation tasks like running a function to all your newly generated ores to add some nbt tags to them or something else.
? Function Tag
? Signals
#smart_ore_generation:v1/denied_dimensions
- ? This function tag is called when the library want to scan a region. You can add which dimension you want to deny from being scanned by adding a function to this tag.
- ? To use this signal, you must add a function to the tag list located in
data/smart_ore_generation/tags/function/v1/signals/denied_dimensions.json.
- ? Refer to this template for the content of the function here.
#> 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
- ? This function tag is called when the library want to generate ores in a region. You can add your own ore generation function to this tag.
- ? To use this signal, you must add a function to the tag list located in
data/smart_ore_generation/tags/function/v1/signals/generate_ores.json.
- ? Refer to this template for the content of the function here
#> 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
# Generate Simplunium Ore (x4) in the overworld only
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
# See the template in the link for the content of the function smart_ore_generation:v1.7.2/signals/example/simplunium_ore.mcfunction
#smart_ore_generation:v1/post_generation
- ? This function tag is called when the library has finished generating ores in regions. You can add your own post-generation function to this tag.
- ? To use this signal, you must add a function to the tag list located in
data/smart_ore_generation/tags/function/v1/signals/post_generation.json.
- ? Refer to this template for the content of the function here
#> 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)
#
# This function is executed once after all the ore generation is done.
# For example, if 6 regions are generated, this function will be executed 1 time after all the regions are generated.
# It can be used to do some post-generation tasks, like running a function on all the ores you generated
# instead of running it on each ore individually when you generate it.
# Useful for optimisation.
#
# @example from SimplEnergy datapack
# This example will edit entity nbt for simplunium ore and deepslate simplunium ore
# if they have been generated all along the generation process.
# This is useful for optimisation because you run the "secondary" function only once
# instead of running it on each ore individually when you generate it.
# Place simplunium ore if it has been generated
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
# Place deepslate simplunium ore if it has been generated
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
? Slots
#smart_ore_generation:v1/slots/random_position
- This function tag should be called when you need a random position in the region.
- To use properly this slot, see the template here
#> smart_ore_generation:v1.7.2/signals/example/simplunium_ore
#
# @example from SimplEnergy datapack
# Always launch the random position function tag before anything else
# @TIP: The random position is not flat, is has a digit.
# You can use the digit to generate ore on a specific way like below
# It will try to place the ore patch depending on the digit
# so on every line below, somes can fail making it more realistic
# resulting in an ore patch containing between 2 and 6 ores (in this example)
## Try to find a random position adjacent to air in the region to generate the ore
function #smart_ore_generation:v1/slots/random_position
# Placing Simplunium Ore Patch
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

评论 0
登录后参与评分
还没有评论,来抢沙发吧