本帖最后由 ruhuasiyu 于 2018-8-19 09:42 编辑 
版本是18w32a+ (1.13-18w30b记分板操作略有不同),思路基于pineapple的帖子并做了较多的变动和改进。
首先弄一个进度,用于判断生物群系
cpp/advancements/generate/root.json
复制代码我这里设定的结构只能在沙漠、平顶山和黑森林生成。
玩家进入指定群系后,执行剥夺进度,检测玩家是否在区域药水云标记的东南32*32区域内
cpp/functions/generate/generate.mcfunction
复制代码若不在,则将玩家坐标对齐到32的倍数处,并放置药水云,并生成用于随机结构的蝙蝠,spread之后杀死之。
cpp/functions/generate/generate.mcfunction
复制代码然后弄一个loot_table
cpp/loot_tables/generate/bat.json
复制代码在主循环中,检测蝙蝠的掉落物
cpp/functions/tick.mcfunction (在minecraft:tick函数标签中添加该函数)
复制代码根据掉落物的不同,构建相应的建筑
cpp:generate/build.mcfunction
复制代码例如爬行者地牢
cpp/functions/generate/structures/creeper_dungeon.mcfunction
复制代码这个方法也适用于生成于同生物群系的多种建筑,只需添加多种掉落物并分配权重即可。
版本是18w32a+ (1.13-18w30b记分板操作略有不同),思路基于pineapple的帖子并做了较多的变动和改进。
首先弄一个进度,用于判断生物群系
cpp/advancements/generate/root.json
- {
 
-     "criteria":{
 
-         "desert":{"trigger":"minecraft:location","conditions": {"biome": "desert"}},
 
-         "desert_hills":{"trigger":"minecraft:location","conditions": {"biome": "desert_hills"}},
 
-         "mutated_desert":{"trigger":"minecraft:location","conditions": {"biome": "mutated_desert"}},
 
-         "mesa":{"trigger":"minecraft:location","conditions": {"biome": "mesa"}},
 
-         "mesa_rock":{"trigger":"minecraft:location","conditions": {"biome": "mesa_rock"}},
 
-         "mesa_clear_rock":{"trigger":"minecraft:location","conditions": {"biome": "mesa_clear_rock"}},
 
-         "mutated_mesa":{"trigger":"minecraft:location","conditions": {"biome": "mutated_mesa"}},
 
-         "mutated_mesa_rock":{"trigger":"minecraft:location","conditions": {"biome": "mutated_mesa_rock"}},
 
-         "mutated_mesa_clear_rock":{"trigger":"minecraft:location","conditions": {"biome": "mutated_mesa_clear_rock"}},
 
-         "roofed_forest":{"trigger":"minecraft:location","conditions": {"biome": "roofed_forest"}}
 
-     },
 
-         "requirements":[[
 
-                 "desert",
 
-                 "desert_hills",
 
-                 "mutated_desert",
 
-                 "mesa",
 
-                 "mesa_rock",
 
-                 "mesa_clear_rock",
 
-                 "mutated_mesa",
 
-                 "mutated_mesa_rock",
 
-                 "mutated_mesa_clear_rock",
 
-                 "roofed_forest"
 
-         ]],
 
-     "rewards":{
 
-         "function":"cpp:generate/creeper_dungeon"
 
-     }
 
- }
 
玩家进入指定群系后,执行剥夺进度,检测玩家是否在区域药水云标记的东南32*32区域内
cpp/functions/generate/generate.mcfunction
- advancement revoke @s only cpp:generate/root
 
- execute at @s positioned ~-33 -2 ~-33 unless entity @e[tag=cpp_chunk,dx=34,dy=256,dz=34] run function cpp:generate/mark
cpp/functions/generate/generate.mcfunction
- summon armor_stand ~ -1 ~ {Tags:["cpp_chunk","cpp_undet"],Invulnerable:1b,Invisible:1b,Marker:1b,NoGravity:1b,Small:1b,DisabledSlots:7967}
 
- scoreboard players set #32 cppValue 32
 
- execute store result score @s cppValue run data get entity @s Pos[0]
 
- scoreboard players operation @s cppValue /= #32 cppValue
 
- execute store result entity @e[tag=cpp_undet,sort=nearest,limit=1] Pos[0] double 1 run scoreboard players operation @s cppValue *= #32 cppValue
 
- execute store result score @s cppValue run data get entity @s Pos[2]
 
- scoreboard players operation @s cppValue /= #32 cppValue
 
- execute store result entity @e[tag=cpp_undet,sort=nearest,limit=1] Pos[2] double 1 run scoreboard players operation @s cppValue *= #32 cppValue
 
 
- summon bat ~ ~ ~ {Silent:1b,NoAI:1,DeathLootTable:"cpp:generate/bat",Tags:["cpp_generate"]}
 
- execute at @e[tag=cpp_undet,sort=nearest,limit=1] run spreadplayers ~ ~ 7 13 false @e[tag=cpp_generate]
 
- tag @e[tag=cpp_undet] remove cpp_undet
 
- kill @e[tag=cpp_generate]
cpp/loot_tables/generate/bat.json
- {
 
-     "pools": [
 
-         {
 
-             "rolls": 1,
 
-             "entries": [
 
-                 {
 
-                     "type": "item",
 
-                     "name": "minecraft:wheat_seeds",
 
-                     "weight": 50,
 
-                     "functions": [
 
-                         {
 
-                             "function": "set_nbt",
 
-                             "tag": "{Tags:["cpp_dead"]}"
 
-                         }
 
-                     ]
 
-                 },
 
-                 {
 
-                     "type": "item",
 
-                     "name": "minecraft:wheat_seeds",
 
-                     "weight": 25,
 
-                     "functions": [
 
-                         {
 
-                             "function": "set_nbt",
 
-                             "tag": "{Tags:["cpp_dead","cpp_wool_tree"]}"
 
-                         }
 
-                     ]
 
-                 },
 
-                 {
 
-                     "type": "item",
 
-                     "name": "minecraft:wheat_seeds",
 
-                     "weight": 1,
 
-                     "functions": [
 
-                         {
 
-                             "function": "set_nbt",
 
-                             "tag": "{Tags:["cpp_dead","cpp_creeper_dungeon"]}"
 
-                         }
 
-                     ]
 
-                 },
 
-                 {
 
-                     "type": "item",
 
-                     "name": "minecraft:wheat_seeds",
 
-                     "weight": 1,
 
-                     "functions": [
 
-                         {
 
-                             "function": "set_nbt",
 
-                             "tag": "{Tags:["cpp_dead","cpp_enchanting_room"]}"
 
-                         }
 
-                     ]
 
-                 },
 
-                 {
 
-                     "type": "item",
 
-                     "name": "minecraft:wheat_seeds",
 
-                     "weight": 1,
 
-                     "functions": [
 
-                         {
 
-                             "function": "set_nbt",
 
-                             "tag": "{Tags:["cpp_dead","cpp_totem_pillar"]}"
 
-                         }
 
-                     ]
 
-                 }
 
-             ]
 
-         }
 
-     ]
 
- }
 
 
cpp/functions/tick.mcfunction (在minecraft:tick函数标签中添加该函数)
- execute as @e[type=item,nbt={Item:{tag:{Tags:["cpp_dead"]}}}] at @s run function cpp:generate/build
 
cpp:generate/build.mcfunction
- execute as @s[nbt={Item:{tag:{Tags:["cpp_creeper_dungeon"]}}}] if block ~ 15 ~ cave_air run function cpp:generate/structures/creeper_dungeon
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_enchanting_room"]}}}] unless block ~ 62 ~ water run function cpp:generate/structures/enchanting_room
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water run function cpp:generate/structures/totem_pillar
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water positioned ~ ~32 ~ run function cpp:generate/structures/totem_pillar
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water positioned ~ ~64 ~ run function cpp:generate/structures/totem_pillar
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water positioned ~ ~96 ~ run function cpp:generate/structures/totem_pillar
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water positioned ~ ~128 ~ run function cpp:generate/structures/totem_pillar
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water positioned ~ ~160 ~ run function cpp:generate/structures/totem_pillar
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_totem_pillar"]}}}] unless block ~ 62 ~ water positioned ~ ~192 ~ run function cpp:generate/structures/totem_pillar
 
 
- execute as @s[nbt={Item:{tag:{Tags:["cpp_wool_tree"]}}}] if block ~ ~-1 ~ grass_block run function cpp:plants/trees/wool_sapling
 
 
- kill @s
 
cpp/functions/generate/structures/creeper_dungeon.mcfunction
- fill ~ 13 ~ ~6 19 ~6 minecraft:air
 
- setblock ~2 14 ~1 minecraft:structure_block{posX:-2,posY:-1,posZ:-1,name:"cpp:build/mossybox",mode:"LOAD",integrity:0.5f}
 
- setblock ~1 14 ~1 minecraft:redstone_block
 
- fill ~ 13 ~ ~6 19 ~6 minecraft:cobblestone keep
 
- fill ~1 14 ~1 ~5 18 ~5 minecraft:air
 
- setblock ~3 14 ~3 minecraft:spawner{MaxNearbyEntities:6s,RequiredPlayerRange:16s,SpawnCount:4s,SpawnData:{id:"minecraft:creeper"},MaxSpawnDelay:800s,MaxSpawnDelay:200s,SpawnRange:4s}
 
- setblock ~3 14 ~5 minecraft:chest{LootTable:"minecraft:chests/simple_dungeon"}
 
- setblock ~3 14 ~1 minecraft:chest[facing=south]{LootTable:"minecraft:chests/simple_dungeon"}
 
已阅 不过好像没@   到pineapple......(然而是什么高级的补充?看不懂)
@pineapple
@pineapple
6666666666666666
很棒的作品!
把计分板操作修改了一下,满足18w32a+版本。
哇,,真的好乱,看不懂
1756746217 发表于 2018-8-19 22:46
哇,,真的好乱,看不懂
好乱??