Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Links
Details
[RB]ę¹åęæę¢ (ReplaceBlock)
The English description is below.
ē®ä»
ę¤ę°ę®å ęä¾äŗäøäøŖå¼ŗå¤§ē APIļ¼åÆä»„仄å®å Øåēēę¹å¼åØäøēēęåé«ę§č½å°ęæę¢äøēäøēę¹åć
åč½
ę¤ę°ę®å 仄åŗåäøŗåä½éåå¹¶ęæę¢ę¹åļ¼ęÆę¬”č°ēØä¼ä»ē®ę å®ä½ęåØåŗååčæå¤éåļ¼ē“å°ęåęø é¤äøäøŖåŗåļ¼ęč éåå®å č½½čå“å ęęåŗåćéåčå“åÆä»„čæč”é ē½®ļ¼č§äøęć
č°ēØ
č¦č°ēØ APIļ¼čÆ·å
åØęØå½ä»¤ååØē {}.replace_block äøååØ API é
ē½®ļ¼åÆč°ēØ replace_block:api/reset_settings å½ę°å¹¶ä¼ å
„ {storage:"ęØå½ä»¤ååØēå½åē©ŗé“ ID"} ēę示ä¾é
ē½®ļ¼ē¶åč°ēØ replace_block:api/execute å½ę°å¹¶ä¼ å
„ {storage:"ęØå½ä»¤ååØēå½åē©ŗé“ ID"}ćę¹åęæę¢å°ē«å³å¼å§ļ¼å¹¶åØåäø tick å
ē»ęć请å”åæ
甮认ęØēé
ē½®å
å«ęęč¦ę±ēę°ę®ļ¼ReplaceBlock ä¼éŖčÆęØēé
ē½®åę°ļ¼č„缺失åę°ä¼åÆ¼č“ API č°ēØå¤±č“„ć
é ē½®
仄äøäøŗå®ę“ēé ē½®å蔨ļ¼å¦åÆę„ē reset_settings.mcfunction äøē示ä¾ć
- ē®ę éę©åØļ¼
- č·Æå¾ļ¼
{}.replace_block.selector - å 容ļ¼äøäøŖē®ę éę©åØļ¼åÆå å«åę°ć
- 示ä¾ļ¼
"@e[type=player]"
- č·Æå¾ļ¼
- ęæę¢čå“ļ¼
- č·Æå¾ļ¼
{}.replace_block.search_range - å 容ļ¼éåč·ē¦»ļ¼äøŗ 1 å³ä»„ē©å®¶äøŗäøåæē 9 äøŖåŗåć
- 示ä¾ļ¼
3
- č·Æå¾ļ¼
- ęåę°éļ¼
- č·Æå¾ļ¼
{}.replace_block.success_threshold - å 容ļ¼äøę¬”åŗåęæę¢č§äøŗęåęéēę¹åęæę¢ę°éļ¼å¦ęęåŗåęęę¹å对ęåęæę¢ēę¹åę°éę»åęŖč¾¾å°ę¤ę°å¼ļ¼åē»§ē»éåäøäøåŗåć
- 示ä¾ļ¼
50
- č·Æå¾ļ¼
- č¦ęæę¢ēę¹å对å蔨ļ¼
- target_block
- č·Æå¾ļ¼
{}.replace_block.replace_pairs[].target_block - å 容ļ¼å°č¢«ęæę¢ę¹åēå½åē©ŗé“ ID
- 示ä¾ļ¼
"stone"
- č·Æå¾ļ¼
- replace_with
- č·Æå¾ļ¼
{}.replace_block.replace_pairs[].replace_with - å 容ļ¼ę°ę¹åēå½åē©ŗé“ ID
- 示ä¾ļ¼
"air"
- č·Æå¾ļ¼
- target_block
- ęæę¢ēę结度å蔨ļ¼
- dimension
- č·Æå¾ļ¼
{}.replace_block.dimensions[].dimension - å 容ļ¼ęæę¢ēę结度ēå½åē©ŗé“ ID
- 示ä¾ļ¼
"minecraft:overworld"
- č·Æå¾ļ¼
- min_y
- č·Æå¾ļ¼
{}.replace_block.dimensions[].min_y - å 容ļ¼ęæę¢ēęēęå°é«åŗ¦
- 示ä¾ļ¼
-64
- č·Æå¾ļ¼
- max_y
- č·Æå¾ļ¼
{}.replace_block.dimensions[].max_y - å 容ļ¼ęæę¢ēęēę大é«åŗ¦
- 示ä¾ļ¼
319
- č·Æå¾ļ¼
- dimension
Introduction
This datapack provides a powerful API that can replace blocks in the world with high performance in a completely vanilla way after world generation.
Features
This datapack traverses and replaces blocks chunk by chunk. Each call will traverse from the target entity's current chunk outward until successfully clearing one chunk or traversing all chunks within the loaded range. The traversal range can be configured as described below.
Usage
To use the API, first store the API configuration in your command storage at {}.replace_block. You can call the replace_block:api/reset_settings function with {storage:"your command storage namespace ID"} to generate example configuration, then call the replace_block:api/execute function with {storage:"your command storage namespace ID"}. Block replacement will start immediately and end within the same tick. Please ensure your configuration contains all required data. ReplaceBlock will validate your configuration parameters, and missing parameters will cause API calls to fail.
Configuration
Below is the complete configuration list. You can also view the example in reset_settings.mcfunction.
- Target Selector:
- Path:
{}.replace_block.selector - Content: A target selector that can include parameters.
- Example:
"@e[type=player]"
- Path:
- Search Range:
- Path:
{}.replace_block.search_range - Content: Traversal distance, where 1 means 9 chunks centered on the player.
- Example:
3
- Path:
- Success Threshold:
- Path:
{}.replace_block.success_threshold - Content: Number of block replacements required for a chunk replacement to be considered successful. If the total number of successfully replaced blocks in a chunk does not reach this value, traversal continues to the next chunk.
- Example:
50
- Path:
- Replacement Block Pairs List:
- target_block
- Path:
{}.replace_block.replace_pairs[].target_block - Content: Namespace ID of the block to be replaced
- Example:
"stone"
- Path:
- replace_with
- Path:
{}.replace_block.replace_pairs[].replace_with - Content: Namespace ID of the new block
- Example:
"air"
- Path:
- target_block
- Effective Dimensions List:
- dimension
- Path:
{}.replace_block.dimensions[].dimension - Content: Namespace ID of the dimension where replacement takes effect
- Example:
"minecraft:overworld"
- Path:
- min_y
- Path:
{}.replace_block.dimensions[].min_y - Content: Minimum height where replacement takes effect
- Example:
-64
- Path:
- max_y
- Path:
{}.replace_block.dimensions[].max_y - Content: Maximum height where replacement takes effect
- Example:
319
- Path:
- dimension




