Vous pouvez résoudre ce problème à l'aide d'un datapack, j'ai utilisé l'espace de noms maze
.
Pour que le système sache où remplacer les blocs, vous devez placer un support d'armure de racine avec les éléments suivants ( {Marker:1,Tags:[root,rootTwo,rootThree,stoneBricks],Invisible:1}
) NBT à la position présentant les valeurs x, y et z les plus faibles. Cette configuration peut remplacer n'importe quel bloc non aérien qui se trouve dans un bloc de 100x4x100 et environ 33% restent identiques à ce qu'ils étaient à l'origine. Vous pouvez modifier le nombre de couches dans la troisième commande.
La commande pour placer le support d'armure racine devrait ressembler à ceci :
/summon minecraft:armor_stand ~ ~ ~ {Marker:1,Tags:[root,rootTwo,rootThree,stoneBricks],Invisible:1}
La fonction principale (à appeler après avoir placé le support de l'armure racine) :
#set up a scoreboard objective, increase placementsPerLayer for fewer regular stone bricks
scoreboard objectives add repeats dummy
scoreboard players set placementsPerLayer repeats 36
scoreboard players set layers repeats 4
#summon 99 tagged armor stands in a diagonal line based on the position of the root armor stand
execute at @e[tag=stoneBricks] run summon minecraft:armor_stand ~10 ~ ~10 {Marker:1,Tags:[rootThree,rootTwo,stoneBricks],Invisible:1}
execute at @e[tag=stoneBricks] run summon minecraft:armor_stand ~20 ~ ~20 {Marker:1,Tags:[rootThree,rootTwo,stoneBricks],Invisible:1}
execute at @e[tag=stoneBricks] run summon minecraft:armor_stand ~40 ~ ~40 {Marker:1,Tags:[rootThree,rootTwo,stoneBricks],Invisible:1}
execute at @e[tag=root] run summon minecraft:armor_stand ~80 ~ ~80 {Marker:1,Tags:[rootThree,rootTwo,stoneBricks],Invisible:1}
execute at @e[tag=root] run summon minecraft:armor_stand ~90 ~ ~90 {Marker:1,Tags:[rootThree,rootTwo,stoneBricks],Invisible:1}
execute at @e[tag=stoneBricks] run summon minecraft:armor_stand ~1 ~ ~1 {Marker:1,Tags:[rootThree,stoneBricks],Invisible:1}
execute at @e[tag=stoneBricks] run summon minecraft:armor_stand ~2 ~ ~2 {Marker:1,Tags:[rootThree,stoneBricks],Invisible:1}
execute at @e[tag=stoneBricks] run summon minecraft:armor_stand ~4 ~ ~4 {Marker:1,Tags:[rootThree,stoneBricks],Invisible:1}
execute at @e[tag=rootTwo] run summon minecraft:armor_stand ~8 ~ ~8 {Marker:1,Tags:[rootThree,stoneBricks],Invisible:1}
execute at @e[tag=rootTwo] run summon minecraft:armor_stand ~9 ~ ~9 {Marker:1,Tags:[rootThree,stoneBricks],Invisible:1}
#summon 100 armor stands that should be used to determin where to put blocks
execute as @e[tag=stoneBricks] at @s run summon minecraft:armor_stand ~ ~ ~ {Marker:1,Tags:[stoneBricks],Invisible:1}
#set a score for how many more placements should be made in this layer
scoreboard players operation placements repeats = placementsPerLayer repeats
#call the function responsible for replacing blocks
function maze:place
En maze:place
(appelée par la fonction principale) :
#teleport all armor stands to a random location within the 100x100 square of the current layer
#only along the x axis, there is one armor stand per z value
execute as @e[tag=stoneBricks,tag=!rootThree] run data modify entity @s Pos[0] set from entity @e[tag=rootThree,sort=random,limit=1] Pos[0]
#set all non-air blocks at the location of an armor stand to a mossy stone bricks block
execute as @e[tag=stoneBricks,tag=!rootThree] at @s unless block ~ ~ ~ minecraft:air run setblock ~ ~ ~ minecraft:mossy_stone_bricks
#repeat for cracked stone bricks blocks
execute as @e[tag=stoneBricks,tag=!rootThree] run data modify entity @s Pos[0] set from entity @e[tag=rootThree,sort=random,limit=1] Pos[0]
execute as @e[tag=stoneBricks,tag=!rootThree] at @s unless block ~ ~ ~ minecraft:air run setblock ~ ~ ~ minecraft:cracked_stone_bricks
#repeat for polished andesite
execute as @e[tag=stoneBricks,tag=!rootThree] run data modify entity @s Pos[0] set from entity @e[tag=rootThree,sort=random,limit=1] Pos[0]
execute as @e[tag=stoneBricks,tag=!rootThree] at @s unless block ~ ~ ~ minecraft:air run setblock ~ ~ ~ minecraft:polished_andesite
#keep track of how many more placements to make on this layer
scoreboard players remove placements repeats 1
#teleport the placing armor stands one block up if the current layer is finished
execute if score placements repeats matches ..0 as @e[tag=stoneBricks,tag=!rootThree] at @s run tp ~ ~1 ~
#keep track of how many more layers there are
execute if score placements repeats matches ..0 run scoreboard players remove layers repeats 1
#reset the placements value to the placementsPerLayer value
execute if score placements repeats matches ..0 run scoreboard players operation placements repeats = placementsPerLayer repeats
#schedule the next iteration to the next tick (repeats this function)
execute if score layers repeats matches 1.. run schedule function maze:place 1t
#kills all armor stands used for this after this function is done
execute if score layers repeats matches ..0 run kill @e[tag=stoneBricks]
#remove the scoreboard objective
execute if score layers repeats matches ..0 run scoreboard objectives remove repeats
Il a fallu 10 secondes à mon ordinateur pour l'exécuter, mais j'ai pu continuer à jouer en douceur avec un taux de rafraîchissement acceptable. Il est possible d'accélérer le processus, mais les performances risquent d'en pâtir.
Dans un échantillon de 10000 blocs, il y avait
- 3390 briques de pierre
- 2252 andésite polie
- 2203 briques de pierre fissurées
- 2155 briques en pierre moussue