【我的世界】全自动递归地皮

(视频里的地皮高度:150,传送到坐标0 150 0输指令)
记录坐标1:对角台阶后5格位置
记录坐标2:地皮内部任意坐标
一、建造地皮模板(聊天栏输入)
填充道路:/fill ~~~ ~59~~59 calcite
填充拒绝:/fill ~~-2~ ~59~-2~59 deny
填充草块:/fill ~~-1~ ~49~-6~49 grass
填充基岩:/fill ~~-7~ ~49~-7~49 bedrock
填充台阶:/fill ~~~ ~49~~49 stone_slab3 2
填充空气:/fill ~1~~1 ~48~~48 air
填充边界:/fill ~~-8~ ~49~-8~49 border_block
填充空气:/fill ~1~-8~1 ~48~-8~48 air
填充墙面:/fill ~~~ ~59~4~ quartz_block
关闭边界方块粒子:/gamerule showbordereffect false
二、建密码门:
①execute @p ~~~ detect ~ y ~ bedrock 0 tp @s ~-4 ~~ (y是地皮高度减6)
②testforblocks ~~3~ ~~3~ ~1~~
③setblock ~~4~ chest 4 destroy
④kill @e[type=item,x=~,y=~5,z=~,r=2,name=箱子]
⑤tp @e[type=item,x=~,y=~7,z=~,r=2] ~5 ~6 ~
⑥tp @p ~5~7~
⑦title @p[x=~5,y=~8,z=~,r=2] actionbar §l§a密码正确
禁物品和实体(不建议做)
①execute @a[dx=60,dy=100,dz=55] ~~~ clear @s chorus_fruit
②execute @a[dx=60,dy=100,dz=55] ~~~ clear @s ender_pearl
③kill @e[type=tnt,dx=60,dy=100,dz=55]
④kill @e[type=boat,dx=60,dy=100,dz=55]
⑤tp @e[type=wither,dx=60,dy=100,dz=55] ~ -65 ~
⑥kill @e[type=ender_pearl,dx=60,dy=100,dz=55]
放结构方块,/give @s structure_block 然后再确保密码门上下两个箱子都是空的,xyz调成60 50 55 偏移调为0 1 0,命名为地皮模板,保存结构。
三、购买地皮(需要先做金币系统)
地皮id=0 : 没买过地皮的人
地皮id=1.. : 买过地皮的人
①title @p[scores={金币=..999,地皮id=0},r=5] title §l§c金币不足!
②execute @p[scores={地皮id=1..},r=5] ~~~ title @s title §l§c您已买过地皮!
③execute @p[scores={金币=1000..,地皮id=0},r=5] ~~~ tag @s add 创建
④execute @p[tag=创建] ~~~ scoreboard players remove @s 金币 1000
⑤execute @p[tag=创建] ~~~ scoreboard players add 地皮数量 地皮id 1
⑥scoreboard players operation @p[tag=创建] 地皮id = 地皮数量 地皮id
⑦tp @p[tag=创建] x y z(坐标1的z坐标减55)
⑧execute @p[tag=创建] ~~~ scoreboard players operation @s 地皮传送 = @s 地皮id
⑨tag @p[tag=创建] add 生成
⑩tag @a remove 创建
四、返回地皮
①tag @p[scores={地皮id=1..},r=5] add 返回
②tp @a[tag=返回] x y z(坐标2的z坐标-55)
③execute @a[tag=返回] ~~~ scoreboard players operation @s 地皮传送 = @s 地皮id
④title @a[tag=返回] title §l§aWelcome back
⑤title @a[tag=返回] subtitle §7- §d@a[tag=返回] §7-
⑥tag @a remove 返回
五、指令区(这部分都要放在常加载区)
前置指令:
①/scoreboard objectives add 地皮id dummy
②/scoreboard objectives add 地皮传送 dummy
③/scoreboard players set 地皮数量 地皮id 0
生成地皮:
①scoreboard players add @a 地皮id 0
②execute @a[scores={地皮传送=1..}] ~~~ tp @s ~ y ~55(y是地皮高度+1,55是地皮边长50+道路宽度5=55)
③execute @a[scores={地皮传送=1..}] ~~~ scoreboard players remove @s 地皮传送 1
④execute @a[tag=生成,scores={地皮传送=0}] ~~~ structure load 地皮模板 ~~-8~
⑤execute @a[tag=生成,scores={地皮传送=0}] ~~~ tp @s ~15~15~15
⑥execute @a[tag=生成,scores={地皮传送=0}] ~~~ tellraw @s {"rawtext":[{"text":"§l§a创建地皮成功!§r
-请及时在地皮门口下方的箱子里放入物品充当钥匙。
-设置完密码可以用草方块堵上箱子。
-地皮区禁用末影珍珠、紫颂果、船、TNT和召唤凋零。"}]}
⑦execute @a[tag=生成,scores={地皮传送=0}] ~~~ effect @s slow_falling 10 255 true
⑧tag @a[scores={地皮传送=0}] remove 生成
重置地皮(慎用):
①scoreboard players reset * 地皮id
②scoreboard players reset * 地皮传送
③scoreboard players set 地皮数量 地皮id 0
六、访客传送(选做)
①/scoreboard objectives add 输入 dummy
②/scoreboard players set 十 输入 10
③scoreboard players operation @p 输入 *= 十 输入
④scoreboard players add @p 输入 数字
⑤scoreboard players operation @p 输入 /= 十 输入
数字过大重置:
①execute @a[scores={输入=99999..}] ~~~ title @s title §l§d输入数字过大!
②execute @a[scores={输入=99999..}] ~~~
scoreboard players reset @s 输入
范围显示:execute @a[r=6] ~~~ titleraw @s actionbar {"rawtext":[{"text":"§l§b当前输入访问的地皮id§f: "},{"score":{"name":"@s","objective":"输入"}},{"text":"\n§d您的地皮id§f: "},{"score":{"name":"@s","objective":"地皮id"}}]}
确定传送:
①execute @p[scores={输入=1..}] ~~~ scoreboard players operation 地皮数量 输入 = @s 输入
②scoreboard players operation 地皮数量 输入 -= 地皮数量 地皮id
③scoreboard players test 地皮数量 输入 1 *
④title @p[scores={输入=1..}] title §l§d您输入的地皮id不存在!
⑤scoreboard players test 地皮数量 输入 * 0
⑥tag @p[scores={输入=1..}] add 访客
⑦tp @a[tag=访客] x y z(坐标1的z坐标减55)
⑧scoreboard players operation @a[tag=访客] 地皮传送 = @a[tag=访客] 输入
⑨title @a[tag=访客] title §l§a传送成功!
⑩tag @a remove 访客
⑪scoreboard players reset @a 输入
⑫scoreboard players reset 地皮数量 输入
关闭传送指令刷屏:/gamerule sendcommandfeedback false