Minecraft 1.18.2模组 传送门教程
我们今天在模组中实现一个传送门,让我们可以传送到自己的维度中。(文末附数据包下载链接)
1.在src\main\resources\data
中新建一个我们的传送门的数据包tf_portals
:
2.在tf_portals包中新建三个文件夹:functions、predicates、tags。
3.blocks中新建entity_types包 -> 包中新建一个p1_can_tp.json
文件指明合法传送者
p1_can_tp.json
{
"replace": false,
"values": [
"minecraft:player"
]
}
4.在predicates包中新建in_overworld
文件和我们的维度文件in_re8_dimension
,用于记录维度之间传送的坐标:
主世界文件
in_overworld.json
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"location": {
"dimension": "minecraft:overworld"
}
}
}
我们的维度文件,里面的dimension字段为我们维度的名称
in_re8_dimension.json
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"location": {
"dimension": "re8joymod:re8_dimension"
}
}
}
5.在functions包中新建load.mcfunction
文件和loop.mcfunction
文件
load.mcfunction
tellraw @p {"text":"1.16 CUSTOM DIMENSION PORTALS","color":"green","bold":true}
scoreboard objectives add portal_one minecraft.used:minecraft.water_bucket
loop.mcfunction
# 查看传送门是否被激活
execute as @a[scores={portal_one=1..}] at @s rotated as @s anchored eyes positioned ^ ^ ^ run function tf_portals:portal1/cast
# Run cloud checks on raycast clouds if not cancelled
execute as @e[type=minecraft:area_effect_cloud,tag=p1_cloud] at @s run function tf_portals:portal1/cloud
# 如果是传送门就执行tf_portals:portal1路径下的portal1函数
execute as @e[tag=portal1] at @s run function tf_portals:portal1/portal1
在functions包中新建portal1
包 -> portal1
包中新建cloud.mcfunction
文件:
cloud.mcfunction
# 判断传送门是否合法,minecraft:water是我们用水桶激活后的填充的水方块,re8joymod:dhands_block是我们的框架方块,类似于地狱门的黑曜石
# 你可以使用全局替换,将这两种方块换成你自己模组中的方块
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
# After cloud reaches water with potential frame, run full detection
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
execute at @s[tag=!p1_cancelled] run tp @s ^ ^ ^0.1
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-1 ~ re8joymod:dhands_block run function tf_portals:portal1/low_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-2 ~ re8joymod:dhands_block run function tf_portals:portal1/mid_check
execute at @s[tag=!p1_cancelled] if block ~ ~ ~ minecraft:water[level=0] if block ~ ~-3 ~ re8joymod:dhands_block run function tf_portals:portal1/top_check
portal1
包中新建cast.mcfunction
文件
cast.mcfunction
summon minecraft:area_effect_cloud ^ ^ ^ {Duration:120,Tags:["p1_cloud"]}
execute as @e[type=minecraft:area_effect_cloud,tag=p1_cloud] run tp @s ^ ^ ^ ~ ~
# 重置计分板
scoreboard players reset @s portal_one
portal1
包中新建destroy.mcfunction
文件
destroy.mcfunction
# 破坏了传送门后,传送门会破裂,无法传送
kill @s
tag @s add dead
kill @e[tag=p1_extra,distance=0..2]
# 破坏的声音,此处为打破草方块的声音,可以自定义
playsound minecraft:block.glass.break block @a[distance=0..25] ~ ~ ~ 1 0.7 1
portal1
包中新建teleport.mcfunction
文件
teleport.mcfunction
# 用于实现玩家在两个维度间传送的功能
tp @s ^ ^-1 ^ ~ ~
tag @s add p1_teleported
# IF Portal
execute at @e[tag=portal1,distance=0..20] run tp @s ^ ^-1 ^ ~ ~
# 查看玩家是否搭建了框架,里面是我们的框架方块
execute unless entity @e[tag=portal1,distance=0..20] run fill ^1.5 ^2 ^ ^-1.5 ^-2 ^ re8joymod:dhands_block
execute unless entity @e[tag=portal1,distance=0..20] run fill ^0.5 ^1 ^ ^-0.5 ^-1 ^ air
# 召唤盔甲架作为传送门的填充物
execute unless entity @e[tag=portal1,distance=0..20] run summon minecraft:armor_stand ^ ^ ^ {Invisible:1b,ArmorItems:[{},{},{},{id:"minecraft:nether_brick",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1","forced"]}
execute as @e[tag=forced,distance=0..20] run tp @s ^ ^ ^ ~ ~
execute as @e[tag=forced,distance=0..20] run tag @s remove forced
execute at @e[tag=portal1,distance=0..20] run tp @s ^ ^-1 ^ ~ ~
# 传送时播放的音效,可以自定义
playsound minecraft:block.portal.travel block @a[distance=0..15] ~ ~ ~ 0.5 2 0.1
playsound minecraft:block.water.ambient block @a[distance=0..15] ~ ~ ~ 2 2 1
playsound minecraft:entity.generic.splash block @a[distance=0..15] ~ ~ ~ 0.5 1.2 0.1
portal1
包中新建portal1.mcfunction
文件
portal1.mcfunction
# AS AT ALL PORTAL1 ARMORSTANDS
tag @s remove stable
# 判断我们是否用框架方块搭建了传送门,你可以替换为自己的方块
execute if block ^-0.5 ^-2 ^ re8joymod:dhands_block if block ^-1.5 ^-2 ^ re8joymod:dhands_block if block ^0.5 ^-2 ^ re8joymod:dhands_block if block ^1.5 ^-2 ^ re8joymod:dhands_block if block ^1.5 ^-1 ^ re8joymod:dhands_block if block ^-1.5 ^-1 ^ re8joymod:dhands_block if block ^1.5 ^ ^ re8joymod:dhands_block if block ^-1.5 ^ ^ re8joymod:dhands_block if block ^1.5 ^1 ^ re8joymod:dhands_block if block ^-1.5 ^1 ^ re8joymod:dhands_block if block ^1.5 ^2 ^ re8joymod:dhands_block if block ^-1.5 ^2 ^ re8joymod:dhands_block if block ^0.5 ^2 ^ re8joymod:dhands_block if block ^-0.5 ^2 ^ re8joymod:dhands_block run tag @s add stable
execute as @s[tag=!stable] at @s run function tf_portals:portal1/destroy
# If teleportable nearby, use better detection
execute as @s[tag=!dead] if entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] unless entity @e[tag=p1_extra1,distance=0..2] run summon armor_stand ^0.5 ^ ^ {Invisible:1b,NoGravity:1b,Small:1b,Tags:["p1_extra1","p1_extra"]}
execute as @s[tag=!dead] if entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] unless entity @e[tag=p1_extra2,distance=0..2] run summon armor_stand ^-0.5 ^ ^ {Invisible:1b,NoGravity:1b,Small:1b,Tags:["p1_extra2","p1_extra"]}
execute as @s[tag=!dead] if entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] unless entity @e[tag=p1_extra3,distance=0..2] run summon armor_stand ^0.5 ^1 ^ {Invisible:1b,NoGravity:1b,Small:1b,Tags:["p1_extra3","p1_extra"]}
execute as @s[tag=!dead] if entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] unless entity @e[tag=p1_extra4,distance=0..2] run summon armor_stand ^-0.5 ^1 ^ {Invisible:1b,NoGravity:1b,Small:1b,Tags:["p1_extra4","p1_extra"]}
execute as @s[tag=!dead] if entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] unless entity @e[tag=p1_extra5,distance=0..2] run summon armor_stand ^0.5 ^-1 ^ {Invisible:1b,NoGravity:1b,Small:1b,Tags:["p1_extra5","p1_extra"]}
execute as @s[tag=!dead] if entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] unless entity @e[tag=p1_extra6,distance=0..2] run summon armor_stand ^-0.5 ^-1 ^ {Invisible:1b,NoGravity:1b,Small:1,Tags:["p1_extra6","p1_extra"]}
#### Teleport ####
# 从主世界传送到我们的维度
execute as @e[type=#tf_portals:p1_can_tp,tag=!p1_teleported] at @s if predicate tf_portals:in_overworld if entity @e[tag=p1_extra,distance=..0.8] at @e[tag=portal1,distance=0..2] rotated as @e[tag=portal1,distance=0..2] in re8joymod:re8_dimension run function tf_portals:portal1/teleport
# 从我们的维度回到主世界,注意把in_re8_dimension换成我们自己的维度名称
execute as @e[type=#tf_portals:p1_can_tp,tag=!p1_teleported] at @s if predicate tf_portals:in_re8_dimension if entity @e[tag=p1_extra,distance=..0.8] at @e[tag=portal1,distance=0..2] rotated as @e[tag=portal1,distance=0..2] in minecraft:overworld run function tf_portals:portal1/teleport
# Kill extras if nothing nearby
execute unless entity @e[tag=!p1_extra,tag=!portal1,type=#tf_portals:p1_can_tp,distance=0..3] if entity @e[tag=p1_extra,distance=0..2] run kill @e[tag=p1_extra,distance=0..2]
# Remove teleported tag if left portal
execute as @e[type=#tf_portals:p1_can_tp] at @s unless entity @e[tag=p1_extra,distance=..0.8] if entity @e[tag=p1_extra,distance=0.8..] run tag @s remove p1_teleported
在portal1
包中新建low_check.mcfunction
文件、mid_check.mcfunction
和top_check.mcfunction
文件,用于对我们搭建的传送门的下中上进行方块检测:
low_check.mcfunction
# Align to the block with item frame
execute unless entity @e[tag=portal1_align,type=minecraft:item_frame,distance=0..1] run summon item_frame ~ ~ ~ {Tags:["portal1_align"],Facing:1,Invisible:1}
# 查看是否是我们的框架方块,可以把re8joymod:dhands_block换成你模组中的方块
execute if block ~ ~-1 ~1 re8joymod:dhands_block if block ~ ~-1 ~2 re8joymod:dhands_block if block ~ ~-1 ~-1 re8joymod:dhands_block if block ~ ~ ~-1 re8joymod:dhands_block if block ~ ~ ~2 re8joymod:dhands_block if block ~ ~1 ~-1 re8joymod:dhands_block if block ~ ~1 ~2 re8joymod:dhands_block if block ~ ~2 ~-1 re8joymod:dhands_block if block ~ ~2 ~2 re8joymod:dhands_block if block ~ ~3 ~-1 re8joymod:dhands_block if block ~ ~3 ~2 re8joymod:dhands_block if block ~ ~3 ~ re8joymod:dhands_block if block ~ ~3 ~1 re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~ ~1 ~0.5 run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_z","portal1","cloud_active"]}
execute if block ~ ~-1 ~-1 re8joymod:dhands_block if block ~ ~-1 ~-2 re8joymod:dhands_block if block ~ ~-1 ~1 re8joymod:dhands_block if block ~ ~ ~1 re8joymod:dhands_block if block ~ ~ ~-2 re8joymod:dhands_block if block ~ ~1 ~1 re8joymod:dhands_block if block ~ ~1 ~-2 re8joymod:dhands_block if block ~ ~2 ~1 re8joymod:dhands_block if block ~ ~2 ~-2 re8joymod:dhands_block if block ~ ~3 ~1 re8joymod:dhands_block if block ~ ~3 ~-2 re8joymod:dhands_block if block ~ ~3 ~ re8joymod:dhands_block if block ~ ~3 ~-1 re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~ ~1 ~-0.5 run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_z","portal1","cloud_active"]}
execute if block ~1 ~-1 ~ re8joymod:dhands_block if block ~2 ~-1 ~ re8joymod:dhands_block if block ~-1 ~-1 ~ re8joymod:dhands_block if block ~-1 ~ ~ re8joymod:dhands_block if block ~2 ~ ~ re8joymod:dhands_block if block ~-1 ~1 ~ re8joymod:dhands_block if block ~2 ~1 ~ re8joymod:dhands_block if block ~-1 ~2 ~ re8joymod:dhands_block if block ~2 ~2 ~ re8joymod:dhands_block if block ~-1 ~3 ~ re8joymod:dhands_block if block ~2 ~3 ~ re8joymod:dhands_block if block ~ ~3 ~ re8joymod:dhands_block if block ~1 ~3 ~ re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~0.5 ~1 ~ run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_x","portal1","cloud_active"]}
execute if block ~-1 ~-1 ~ re8joymod:dhands_block if block ~-2 ~-1 ~ re8joymod:dhands_block if block ~1 ~-1 ~ re8joymod:dhands_block if block ~1 ~ ~ re8joymod:dhands_block if block ~-2 ~ ~ re8joymod:dhands_block if block ~1 ~1 ~ re8joymod:dhands_block if block ~-2 ~1 ~ re8joymod:dhands_block if block ~1 ~2 ~ re8joymod:dhands_block if block ~-2 ~2 ~ re8joymod:dhands_block if block ~1 ~3 ~ re8joymod:dhands_block if block ~-2 ~3 ~ re8joymod:dhands_block if block ~ ~3 ~ re8joymod:dhands_block if block ~-1 ~3 ~ re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~-0.5 ~1 ~ run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_x","portal1","cloud_active"]}
# Tag cloud active means that the portal detection succeeded but the cloud is still detecting
# Execute as position of portal1 armorstand marker
execute at @e[tag=cloud_active,distance=0..2] run playsound minecraft:block.beacon.activate block @a[distance=0..25] ~ ~ ~ 1 2 1
execute at @e[tag=cloud_active,distance=0..2] run playsound minecraft:entity.generic.splash block @a[distance=0..25] ~ ~ ~ 1 1 1
execute at @e[tag=cloud_active,distance=0..2] run playsound minecraft:block.glass.break block @a[distance=0..25] ~ ~ ~ 1 1 1
execute at @e[tag=cloud_active,distance=0..2] run particle minecraft:splash ~ ~ ~ 1 3 1 1 100
# Remove water
execute if entity @e[tag=cloud_active,distance=0..2] run setblock ~ ~ ~ air
# Kill alignment frame
kill @e[tag=portal1_align,distance=0..1]
# Cancel and kill detection cloud
execute if entity @e[tag=cloud_active,distance=0..2] run tag @s add p1_cancelled
execute if entity @e[tag=cloud_active,distance=0..2] run kill @s
# Rotate portal1 marker to face perpendicular to portal frame
execute as @e[tag=cloud_active,tag=portal1_x,distance=0..2] at @s run tp @s ~ ~ ~ 0 0
execute as @e[tag=cloud_active,tag=portal1_z,distance=0..2] at @s run tp @s ~ ~ ~ 90 0
# Remove cloud active tag after it has been deactivated
execute if entity @e[tag=cloud_active,distance=0..2] run tag @e[tag=cloud_active,distance=0..2] remove cloud_active
mid_check.mcfunction
# AS AT UNCOMPLETED PORTAL CLOUD
execute unless entity @e[tag=portal1_align,type=minecraft:item_frame,distance=0..1] run summon item_frame ~ ~ ~ {Tags:["portal1_align"],Facing:1,Invisible:1}
# 查看是否是我们的框架方块,可以把re8joymod:dhands_block换成你模组中的方块
execute if block ~ ~-2 ~1 re8joymod:dhands_block if block ~ ~-2 ~2 re8joymod:dhands_block if block ~ ~-2 ~-1 re8joymod:dhands_block if block ~ ~-1 ~-1 re8joymod:dhands_block if block ~ ~-1 ~2 re8joymod:dhands_block if block ~ ~ ~-1 re8joymod:dhands_block if block ~ ~ ~2 re8joymod:dhands_block if block ~ ~1 ~-1 re8joymod:dhands_block if block ~ ~1 ~2 re8joymod:dhands_block if block ~ ~2 ~-1 re8joymod:dhands_block if block ~ ~2 ~2 re8joymod:dhands_block if block ~ ~2 ~ re8joymod:dhands_block if block ~ ~2 ~1 re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~ ~ ~0.5 run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_z","portal1","cloud_active"]}
execute if block ~ ~-2 ~-1 re8joymod:dhands_block if block ~ ~-2 ~-2 re8joymod:dhands_block if block ~ ~-2 ~1 re8joymod:dhands_block if block ~ ~-1 ~1 re8joymod:dhands_block if block ~ ~-1 ~-2 re8joymod:dhands_block if block ~ ~ ~1 re8joymod:dhands_block if block ~ ~ ~-2 re8joymod:dhands_block if block ~ ~1 ~1 re8joymod:dhands_block if block ~ ~1 ~-2 re8joymod:dhands_block if block ~ ~2 ~1 re8joymod:dhands_block if block ~ ~2 ~-2 re8joymod:dhands_block if block ~ ~2 ~ re8joymod:dhands_block if block ~ ~2 ~-1 re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~ ~ ~-0.5 run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_z","portal1","cloud_active"]}
execute if block ~1 ~-2 ~ re8joymod:dhands_block if block ~2 ~-2 ~ re8joymod:dhands_block if block ~-1 ~-2 ~ re8joymod:dhands_block if block ~-1 ~-1 ~ re8joymod:dhands_block if block ~2 ~-1 ~ re8joymod:dhands_block if block ~-1 ~ ~ re8joymod:dhands_block if block ~2 ~ ~ re8joymod:dhands_block if block ~-1 ~1 ~ re8joymod:dhands_block if block ~2 ~1 ~ re8joymod:dhands_block if block ~-1 ~2 ~ re8joymod:dhands_block if block ~2 ~2 ~ re8joymod:dhands_block if block ~ ~2 ~ re8joymod:dhands_block if block ~1 ~2 ~ re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~0.5 ~ ~ run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_x","portal1","cloud_active"]}
execute if block ~-1 ~-2 ~ re8joymod:dhands_block if block ~-2 ~-2 ~ re8joymod:dhands_block if block ~1 ~-2 ~ re8joymod:dhands_block if block ~1 ~-1 ~ re8joymod:dhands_block if block ~-2 ~-1 ~ re8joymod:dhands_block if block ~1 ~ ~ re8joymod:dhands_block if block ~-2 ~ ~ re8joymod:dhands_block if block ~1 ~1 ~ re8joymod:dhands_block if block ~-2 ~1 ~ re8joymod:dhands_block if block ~1 ~2 ~ re8joymod:dhands_block if block ~-2 ~2 ~ re8joymod:dhands_block if block ~ ~2 ~ re8joymod:dhands_block if block ~-1 ~2 ~ re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~-0.5 ~ ~ run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:aterrimus_glass_pane",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_x","portal1","cloud_active"]}
execute if entity @e[tag=cloud_active,distance=0..2] run playsound minecraft:block.beacon.activate block @a[distance=0..25] ~ ~ ~ 1 1 1
execute if entity @e[tag=cloud_active,distance=0..2] run playsound minecraft:entity.generic.splash block @a[distance=0..25] ~ ~ ~ 1 1 1
execute at @e[tag=cloud_active,distance=0..2] run playsound minecraft:block.glass.break block @a[distance=0..25] ~ ~ ~ 1 1 1
execute at @e[tag=cloud_active,distance=0..2] run particle minecraft:splash ~ ~ ~ 1 3 1 1 100
execute if entity @e[tag=cloud_active,distance=0..2] run setblock ~ ~ ~ air
kill @e[tag=portal1_align,distance=0..1]
execute if entity @e[tag=cloud_active,distance=0..2] run tag @s add p1_cancelled
execute if entity @e[tag=cloud_active,distance=0..2] run kill @s
execute as @e[tag=cloud_active,tag=portal1_x,distance=0..2] at @s run tp @s ~ ~ ~ 0 0
execute as @e[tag=cloud_active,tag=portal1_z,distance=0..2] at @s run tp @s ~ ~ ~ 90 0
execute if entity @e[tag=cloud_active,distance=0..2] run tag @e[tag=cloud_active,distance=0..2] remove cloud_active
top_check.mcfunction
# AS AT UNCOMPLETED PORTAL CLOUD
execute unless entity @e[tag=portal1_align,type=minecraft:item_frame,distance=0..1] run summon item_frame ~ ~ ~ {Tags:["portal1_align"],Facing:1,Invisible:1}
# 查看是否是我们的框架方块,可以把re8joymod:dhands_block换成你模组中的方块
execute if block ~ ~-3 ~1 re8joymod:dhands_block if block ~ ~-3 ~2 re8joymod:dhands_block if block ~ ~-3 ~-1 re8joymod:dhands_block if block ~ ~-2 ~-1 re8joymod:dhands_block if block ~ ~-2 ~2 re8joymod:dhands_block if block ~ ~-1 ~-1 re8joymod:dhands_block if block ~ ~-1 ~2 re8joymod:dhands_block if block ~ ~ ~-1 re8joymod:dhands_block if block ~ ~ ~2 re8joymod:dhands_block if block ~ ~1 ~-1 re8joymod:dhands_block if block ~ ~1 ~2 re8joymod:dhands_block if block ~ ~1 ~ re8joymod:dhands_block if block ~ ~1 ~1 re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~ ~-1 ~0.5 unless entity @e[tag=cloud_active,distance=0..1] run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:panic_rose",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_z","portal1","cloud_active"]}
execute if block ~ ~-3 ~-1 re8joymod:dhands_block if block ~ ~-3 ~-2 re8joymod:dhands_block if block ~ ~-3 ~1 re8joymod:dhands_block if block ~ ~-2 ~1 re8joymod:dhands_block if block ~ ~-2 ~-2 re8joymod:dhands_block if block ~ ~-1 ~1 re8joymod:dhands_block if block ~ ~-1 ~-2 re8joymod:dhands_block if block ~ ~ ~1 re8joymod:dhands_block if block ~ ~ ~-2 re8joymod:dhands_block if block ~ ~1 ~1 re8joymod:dhands_block if block ~ ~1 ~-2 re8joymod:dhands_block if block ~ ~1 ~ re8joymod:dhands_block if block ~ ~1 ~-1 re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~ ~-1 ~-0.5 unless entity @e[tag=cloud_active,distance=0..1] run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:panic_rose",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_z","portal1","cloud_active"]}
execute if block ~1 ~-3 ~ re8joymod:dhands_block if block ~2 ~-3 ~ re8joymod:dhands_block if block ~-1 ~-3 ~ re8joymod:dhands_block if block ~-1 ~-2 ~ re8joymod:dhands_block if block ~2 ~-2 ~ re8joymod:dhands_block if block ~-1 ~-1 ~ re8joymod:dhands_block if block ~2 ~-1 ~ re8joymod:dhands_block if block ~-1 ~ ~ re8joymod:dhands_block if block ~2 ~ ~ re8joymod:dhands_block if block ~-1 ~1 ~ re8joymod:dhands_block if block ~2 ~1 ~ re8joymod:dhands_block if block ~ ~1 ~ re8joymod:dhands_block if block ~1 ~1 ~ re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~0.5 ~-1 ~ run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:panic_rose",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_x","portal1","cloud_active"]}
execute if block ~-1 ~-3 ~ re8joymod:dhands_block if block ~-2 ~-3 ~ re8joymod:dhands_block if block ~1 ~-3 ~ re8joymod:dhands_block if block ~1 ~-2 ~ re8joymod:dhands_block if block ~-2 ~-2 ~ re8joymod:dhands_block if block ~1 ~-1 ~ re8joymod:dhands_block if block ~-2 ~-1 ~ re8joymod:dhands_block if block ~1 ~ ~ re8joymod:dhands_block if block ~-2 ~ ~ re8joymod:dhands_block if block ~1 ~1 ~ re8joymod:dhands_block if block ~-2 ~1 ~ re8joymod:dhands_block if block ~ ~1 ~ re8joymod:dhands_block if block ~-1 ~1 ~ re8joymod:dhands_block at @e[type=minecraft:item_frame,distance=0..1,tag=portal1_align] positioned ~-0.5 ~-1 ~ run summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:"re8joymod:panic_rose",Count:1b,tag:{CustomModelData:919190}}],Small:1b,NoGravity:1b,Invulnerable:1b,Tags:["portal1_x","portal1","cloud_active"]}
execute if entity @e[tag=cloud_active,distance=0..2] run playsound minecraft:block.beacon.activate block @a[distance=0..25] ~ ~ ~ 1 1.5 1
execute if entity @e[tag=cloud_active,distance=0..2] run playsound minecraft:entity.generic.splash block @a[distance=0..25] ~ ~ ~ 1 1 1
execute at @e[tag=cloud_active,distance=0..2] run playsound minecraft:block.glass.break block @a[distance=0..25] ~ ~ ~ 1 1 1
execute at @e[tag=cloud_active,distance=0..2] run particle minecraft:splash ~ ~ ~ 1 3 1 1 100
execute if entity @e[tag=cloud_active,distance=0..2] run setblock ~ ~ ~ air
kill @e[tag=portal1_align,distance=0..1]
execute if entity @e[tag=cloud_active,distance=0..2] run tag @s add p1_cancelled
execute if entity @e[tag=cloud_active,distance=0..2] run kill @s
execute as @e[tag=cloud_active,tag=portal1_x,distance=0..2] at @s run tp @s ~ ~ ~ 0 0
execute as @e[tag=cloud_active,tag=portal1_z,distance=0..2] at @s run tp @s ~ ~ ~ 90 0
execute if entity @e[tag=cloud_active,distance=0..2] run tag @e[tag=cloud_active,distance=0..2] remove cloud_active
6.在resources\data\minecraft\tags\functions
中新建load.json
和tick.json
监视我们的传送门
load.json
{
"values": [
"tf_portals:load"
]
}
tick.json
{
"values": [
"tf_portals:loop"
]
}
7.保存所有文件 -> 进入游戏
我们是默认用模组中的方块进行框架搭建 -> 然后用水来对传送门进行激活