forked from Gamemode4Dev/GM4_Datapacks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Gamemode4Dev:master' into master
- Loading branch information
Showing
72 changed files
with
2,458 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Double Doors<!--$headerTitle--><!--$pmc:delete--> | ||
|
||
Tired of clicking twice to open a double door? Annoyed by the fact that doors are only two blacks tall? This data pack automatically opens adjecent doors, making double doors fully functional! Additionally, bottom trapdoors of matching wood type placed above a door are opened alongside the door when it is opened by a player. <!--$pmc:headerSize--> | ||
|
||
### Features | ||
- When a player interacts with a door that is part of a double door, both doors are opened/closed automatically! | ||
- Open bottom-half trapdoors placed above a door will open/close alongside the door! | ||
- Only doors and trapdoors which are of the same type and adjacent show this behavior. | ||
- Hold shift to enforce normal 'vanilla' door behavior! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
id: gm4_double_doors | ||
name: Double Doors | ||
version: 1.0.0 | ||
|
||
data_pack: | ||
load: . | ||
|
||
pipeline: | ||
- gm4_double_doors.generate | ||
- gm4.plugins.extend.module | ||
|
||
meta: | ||
gm4: | ||
versioning: | ||
schedule_loops: [] | ||
website: | ||
description: Tired of clicking twice to open a double door? Annoyed by the fact that doors are only two blacks tall? This data pack automatically opens adjecent doors, making double doors fully functional! Additionally, bottom trapdoors of matching wood type placed above a door are opened alongside the door when it is opened by a player. | ||
recommended: [] | ||
notes: [] | ||
video: null | ||
wiki: https://wiki.gm4.co/wiki/Double_Doors | ||
credits: | ||
Creator: | ||
- Bloo |
8 changes: 8 additions & 0 deletions
8
gm4_double_doors/data/gm4_double_doors/functions/init.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
execute unless score double_doors gm4_modules matches 1 run data modify storage gm4:log queue append value {type:"install",module:"Double Doors"} | ||
execute unless score double_doors gm4_earliest_version < double_doors gm4_modules run scoreboard players operation double_doors gm4_earliest_version = double_doors gm4_modules | ||
scoreboard players set double_doors gm4_modules 1 | ||
|
||
scoreboard objectives add gm4_double_doors_data dummy | ||
execute unless score $trap_door_limit gm4_double_doors_data matches 0.. run scoreboard players set $trap_door_limit gm4_double_doors_data 2 | ||
|
||
#$moduleUpdateList |
35 changes: 35 additions & 0 deletions
35
gm4_double_doors/data/gm4_double_doors/templates/advancements/use_door.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"criteria": { | ||
"requirement": { | ||
"trigger": "minecraft:item_used_on_block", | ||
"conditions": { | ||
"player": [ | ||
{ | ||
"condition": "minecraft:entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"flags": { | ||
"is_sneaking": false | ||
} | ||
} | ||
} | ||
], | ||
"location": [ | ||
{ | ||
"condition": "minecraft:location_check", | ||
"predicate": { | ||
"block": { | ||
"blocks": [ | ||
"minecraft:{{ material_name }}_door" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"rewards": { | ||
"function": "gm4_double_doors:{{ material_name }}/use_door" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
gm4_double_doors/data/gm4_double_doors/templates/functions/door/east/get_hinge.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Checks the hinge block state of the door which was clicked. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/get_facing | ||
|
||
# check the hinge block state of this door | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/east/left/check_neighbours | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/east/right/check_neighbours |
11 changes: 11 additions & 0 deletions
11
...oors/data/gm4_double_doors/templates/functions/door/east/left/check_neighbours.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Checks for neighbouring doors which may also have to be opened alongside this door. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/east/left/get_hinge | ||
|
||
# open this door | ||
function gm4_double_doors:{{ material_name }}/door/east/left/toggle | ||
|
||
# check for potential neighbouring doors which should also be opened | ||
execute positioned ~ ~ ~1 if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/east/right/toggle | ||
execute positioned ~1 ~ ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/west/right/toggle |
17 changes: 17 additions & 0 deletions
17
gm4_double_doors/data/gm4_double_doors/templates/functions/door/east/left/toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Toggles the double door the player has interacted with. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the left door of the double door the player has interacted with | ||
# run from check_neighbours functions in gm4_double_doors:{{ material_name }}/door/... | ||
|
||
# player just closed a door | ||
execute if score $target_door_state gm4_double_doors_data matches 0 run place template gm4_double_doors:{{ material_name }}/door/east/left/closed ~ ~ ~ | ||
|
||
# player just opened a door | ||
execute if score $target_door_state gm4_double_doors_data matches 1 run place template gm4_double_doors:{{ material_name }}/door/east/left/open ~ ~ ~ | ||
|
||
# get target trapdoor state (0->1, 1->0 for this direction) | ||
execute store result score $target_trapdoor_state gm4_double_doors_data if score $target_door_state gm4_double_doors_data matches 0 | ||
|
||
# check for potential trapdoors which should also be opened | ||
scoreboard players operation $trap_door_recursion_level gm4_double_doors_data = $trap_door_limit gm4_double_doors_data | ||
execute positioned ~ ~2 ~ if block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[open=true,half=bottom] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=west] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=north] run function gm4_double_doors:{{ material_name }}/trapdoor/south_east/check_neighbours |
11 changes: 11 additions & 0 deletions
11
...ors/data/gm4_double_doors/templates/functions/door/east/right/check_neighbours.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Checks for neighbouring doors which may also have to be opened alongside this door. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/east/right/get_hinge | ||
|
||
# open this door | ||
function gm4_double_doors:{{ material_name }}/door/east/right/toggle | ||
|
||
# check for potential neighbouring doors which should also be opened | ||
execute positioned ~ ~ ~-1 if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/east/left/toggle | ||
execute positioned ~1 ~ ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/west/left/toggle |
17 changes: 17 additions & 0 deletions
17
gm4_double_doors/data/gm4_double_doors/templates/functions/door/east/right/toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Toggles the double door the player has interacted with. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the left door of the double door the player has interacted with | ||
# run from check_neighbours functions in gm4_double_doors:{{ material_name }}/door/... | ||
|
||
# player just closed a door | ||
execute if score $target_door_state gm4_double_doors_data matches 0 run place template gm4_double_doors:{{ material_name }}/door/east/right/closed ~ ~ ~ | ||
|
||
# player just opened a door | ||
execute if score $target_door_state gm4_double_doors_data matches 1 run place template gm4_double_doors:{{ material_name }}/door/east/right/open ~ ~ ~ | ||
|
||
# get target trapdoor state (0->1, 1->0 for this direction) | ||
execute store result score $target_trapdoor_state gm4_double_doors_data if score $target_door_state gm4_double_doors_data matches 0 | ||
|
||
# check for potential trapdoors which should also be opened | ||
scoreboard players operation $trap_door_recursion_level gm4_double_doors_data = $trap_door_limit gm4_double_doors_data | ||
execute positioned ~ ~2 ~ if block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[open=true,half=bottom] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=west] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=south] run function gm4_double_doors:{{ material_name }}/trapdoor/north_east/check_neighbours |
9 changes: 9 additions & 0 deletions
9
gm4_double_doors/data/gm4_double_doors/templates/functions/door/get_facing.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Checks the facing block state of the door which was clicked. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/get_lower_half | ||
|
||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[facing=south] run function gm4_double_doors:{{ material_name }}/door/south/get_hinge | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[facing=west] run function gm4_double_doors:{{ material_name }}/door/west/get_hinge | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[facing=north] run function gm4_double_doors:{{ material_name }}/door/north/get_hinge | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[facing=east] run function gm4_double_doors:{{ material_name }}/door/east/get_hinge |
13 changes: 13 additions & 0 deletions
13
gm4_double_doors/data/gm4_double_doors/templates/functions/door/get_lower_half.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Forces the block selected by the raycast to be the lower half of a door | ||
# @s = player that interacted with a door | ||
# at location of the door the player has interacted with | ||
# run from gm4_double_doors:player/ray | ||
|
||
# store whether the player opened a door (=1) or closed a door (=0) | ||
scoreboard players set $target_door_state gm4_double_doors_data 0 | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[open=true] run scoreboard players set $target_door_state gm4_double_doors_data 1 | ||
|
||
# if the targeted block is an upper half, get the lower half and reposition execution location | ||
# also ensure that the door is not broken (aka actually has both blocks present) | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[half=upper] positioned ~ ~-1 ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[half=lower] run function gm4_double_doors:{{ material_name }}/door/get_facing | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[half=lower] if block ~ ~1 ~ minecraft:{{ material_name }}_door[half=upper] run function gm4_double_doors:{{ material_name }}/door/get_facing |
8 changes: 8 additions & 0 deletions
8
gm4_double_doors/data/gm4_double_doors/templates/functions/door/north/get_hinge.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Checks the hinge block state of the door which was clicked. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/get_facing | ||
|
||
# check the hinge block state of this door | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/north/left/check_neighbours | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/north/right/check_neighbours |
11 changes: 11 additions & 0 deletions
11
...ors/data/gm4_double_doors/templates/functions/door/north/left/check_neighbours.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Checks for neighbouring doors which may also have to be opened alongside this door. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/north/left/get_hinge | ||
|
||
# open this door | ||
function gm4_double_doors:{{ material_name }}/door/north/left/toggle | ||
|
||
# check for potential neighbouring doors which should also be opened | ||
execute positioned ~1 ~ ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/north/right/toggle | ||
execute positioned ~ ~ ~-1 if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/south/right/toggle |
17 changes: 17 additions & 0 deletions
17
gm4_double_doors/data/gm4_double_doors/templates/functions/door/north/left/toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Toggles the double door the player has interacted with. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the left door of the double door the player has interacted with | ||
# run from check_neighbours functions in gm4_double_doors:{{ material_name }}/door/... | ||
|
||
# player just closed a door | ||
execute if score $target_door_state gm4_double_doors_data matches 0 run place template gm4_double_doors:{{ material_name }}/door/north/left/closed ~ ~ ~ | ||
|
||
# player just opened a door | ||
execute if score $target_door_state gm4_double_doors_data matches 1 run place template gm4_double_doors:{{ material_name }}/door/north/left/open ~ ~ ~ | ||
|
||
# get target trapdoor state (0->0, 1->1 for this direction) | ||
execute store result score $target_trapdoor_state gm4_double_doors_data if score $target_door_state gm4_double_doors_data matches 1 | ||
|
||
# check for potential trapdoors which should also be opened | ||
scoreboard players operation $trap_door_recursion_level gm4_double_doors_data = $trap_door_limit gm4_double_doors_data | ||
execute positioned ~ ~2 ~ if block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[open=true,half=bottom] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=west] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=south] run function gm4_double_doors:{{ material_name }}/trapdoor/north_east/check_neighbours |
11 changes: 11 additions & 0 deletions
11
...rs/data/gm4_double_doors/templates/functions/door/north/right/check_neighbours.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Checks for neighbouring doors which may also have to be opened alongside this door. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/north/right/get_hinge | ||
|
||
# open this door | ||
function gm4_double_doors:{{ material_name }}/door/north/right/toggle | ||
|
||
# check for potential neighbouring doors which should also be opened | ||
execute positioned ~-1 ~ ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/north/left/toggle | ||
execute positioned ~ ~ ~-1 if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/south/left/toggle |
17 changes: 17 additions & 0 deletions
17
...double_doors/data/gm4_double_doors/templates/functions/door/north/right/toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Toggles the double door the player has interacted with. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the left door of the double door the player has interacted with | ||
# run from check_neighbours functions in gm4_double_doors:{{ material_name }}/door/... | ||
|
||
# player just closed a door | ||
execute if score $target_door_state gm4_double_doors_data matches 0 run place template gm4_double_doors:{{ material_name }}/door/north/right/closed ~ ~ ~ | ||
|
||
# player just opened a door | ||
execute if score $target_door_state gm4_double_doors_data matches 1 run place template gm4_double_doors:{{ material_name }}/door/north/right/open ~ ~ ~ | ||
|
||
# get target trapdoor state (0->0, 1->1 for this direction) | ||
execute store result score $target_trapdoor_state gm4_double_doors_data if score $target_door_state gm4_double_doors_data matches 1 | ||
|
||
# check for potential trapdoors which should also be opened | ||
scoreboard players operation $trap_door_recursion_level gm4_double_doors_data = $trap_door_limit gm4_double_doors_data | ||
execute positioned ~ ~2 ~ if block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[open=true,half=bottom] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=east] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=south] run function gm4_double_doors:{{ material_name }}/trapdoor/north_west/check_neighbours |
8 changes: 8 additions & 0 deletions
8
gm4_double_doors/data/gm4_double_doors/templates/functions/door/south/get_hinge.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Checks the hinge block state of the door which was clicked. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/get_facing | ||
|
||
# check the hinge block state of this door | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/south/left/check_neighbours | ||
execute if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/south/right/check_neighbours |
11 changes: 11 additions & 0 deletions
11
...ors/data/gm4_double_doors/templates/functions/door/south/left/check_neighbours.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Checks for neighbouring doors which may also have to be opened alongside this door. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/south/left/get_hinge | ||
|
||
# open this door | ||
function gm4_double_doors:{{ material_name }}/door/south/left/toggle | ||
|
||
# check for potential neighbouring doors which should also be opened | ||
execute positioned ~-1 ~ ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/south/right/toggle | ||
execute positioned ~ ~ ~1 if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=right] run function gm4_double_doors:{{ material_name }}/door/north/right/toggle |
17 changes: 17 additions & 0 deletions
17
gm4_double_doors/data/gm4_double_doors/templates/functions/door/south/left/toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Toggles the double door the player has interacted with. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the left door of the double door the player has interacted with | ||
# run from check_neighbours functions in gm4_double_doors:{{ material_name }}/door/... | ||
|
||
# player just closed a door | ||
execute if score $target_door_state gm4_double_doors_data matches 0 run place template gm4_double_doors:{{ material_name }}/door/south/left/closed ~ ~ ~ | ||
|
||
# player just opened a door | ||
execute if score $target_door_state gm4_double_doors_data matches 1 run place template gm4_double_doors:{{ material_name }}/door/south/left/open ~ ~ ~ | ||
|
||
# get target trapdoor state (0->0, 1->1 for this direction) | ||
execute store result score $target_trapdoor_state gm4_double_doors_data if score $target_door_state gm4_double_doors_data matches 1 | ||
|
||
# check for potential trapdoors which should also be opened | ||
scoreboard players operation $trap_door_recursion_level gm4_double_doors_data = $trap_door_limit gm4_double_doors_data | ||
execute positioned ~ ~2 ~ if block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[open=true,half=bottom] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=east] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=north] run function gm4_double_doors:{{ material_name }}/trapdoor/south_west/check_neighbours |
11 changes: 11 additions & 0 deletions
11
...rs/data/gm4_double_doors/templates/functions/door/south/right/check_neighbours.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Checks for neighbouring doors which may also have to be opened alongside this door. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the door the player has interacted with | ||
# run from gm4_double_doors:{{ material_name }}/door/south/right/get_hinge | ||
|
||
# open this door | ||
function gm4_double_doors:{{ material_name }}/door/south/right/toggle | ||
|
||
# check for potential neighbouring doors which should also be opened | ||
execute positioned ~1 ~ ~ if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/south/left/toggle | ||
execute positioned ~ ~ ~1 if block ~ ~ ~ minecraft:{{ material_name }}_door[hinge=left] run function gm4_double_doors:{{ material_name }}/door/north/left/toggle |
17 changes: 17 additions & 0 deletions
17
...double_doors/data/gm4_double_doors/templates/functions/door/south/right/toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Toggles the double door the player has interacted with. | ||
# @s = player that interacted with a door | ||
# at location of the lower half of the left door of the double door the player has interacted with | ||
# run from check_neighbours functions in gm4_double_doors:{{ material_name }}/door/... | ||
|
||
# player just closed a door | ||
execute if score $target_door_state gm4_double_doors_data matches 0 run place template gm4_double_doors:{{ material_name }}/door/south/right/closed ~ ~ ~ | ||
|
||
# player just opened a door | ||
execute if score $target_door_state gm4_double_doors_data matches 1 run place template gm4_double_doors:{{ material_name }}/door/south/right/open ~ ~ ~ | ||
|
||
# get target trapdoor state (0->0, 1->1 for this direction) | ||
execute store result score $target_trapdoor_state gm4_double_doors_data if score $target_door_state gm4_double_doors_data matches 1 | ||
|
||
# check for potential trapdoors which should also be opened | ||
scoreboard players operation $trap_door_recursion_level gm4_double_doors_data = $trap_door_limit gm4_double_doors_data | ||
execute positioned ~ ~2 ~ if block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[open=true,half=bottom] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=west] unless block ~ ~ ~ minecraft:{{ material_name }}_trapdoor[facing=north] run function gm4_double_doors:{{ material_name }}/trapdoor/south_east/check_neighbours |
Oops, something went wrong.