From 0da9a66dc717b5b18fbba7cffa41ebd1c01f8a8a Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 20 Mar 2024 01:35:40 +0100 Subject: use predicate for nether check and init --- data/vanilla_skyblock/functions/initialize.mcfunction | 8 ++++++++ data/vanilla_skyblock/functions/initialize_nether.mcfunction | 6 ++++-- data/vanilla_skyblock/functions/tick.mcfunction | 8 +------- data/vanilla_skyblock/predicates/in_nether.json | 6 ++++++ 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 data/vanilla_skyblock/predicates/in_nether.json (limited to 'data') diff --git a/data/vanilla_skyblock/functions/initialize.mcfunction b/data/vanilla_skyblock/functions/initialize.mcfunction index 7d36e93..66630e3 100644 --- a/data/vanilla_skyblock/functions/initialize.mcfunction +++ b/data/vanilla_skyblock/functions/initialize.mcfunction @@ -21,3 +21,11 @@ execute in the_end run forceload remove -1 -1 1 1 # set flag scoreboard players set initialized vanilla_skyblock_data 1 + + +# debug +fill -1 63 -2 2 63 -2 obsidian +fill -1 63 -2 -1 68 -2 obsidian +fill 2 63 -2 2 68 -2 obsidian +fill -1 68 -2 2 68 -2 obsidian +execute in overworld run item replace block 4 64 0 container.2 with flint_and_steel 1 diff --git a/data/vanilla_skyblock/functions/initialize_nether.mcfunction b/data/vanilla_skyblock/functions/initialize_nether.mcfunction index 4dcb5a5..5b5fe61 100644 --- a/data/vanilla_skyblock/functions/initialize_nether.mcfunction +++ b/data/vanilla_skyblock/functions/initialize_nether.mcfunction @@ -1,6 +1,8 @@ -tellraw @a "hi@nether!" +execute as @a in the_nether run setblock ~1 ~-1 0 glowstone +execute in the_nether run spawnpoint @s 5 5 5 -execute in the_nether run setblock 0 61 0 bedrock +execute as @s in the_nether run setblock ~2 ~-2 2 glowstone +# todo: get current location of nether spawn in # set flag scoreboard players set initialized_nether vanilla_skyblock_data 1 diff --git a/data/vanilla_skyblock/functions/tick.mcfunction b/data/vanilla_skyblock/functions/tick.mcfunction index 5e32c7a..ac0dd41 100644 --- a/data/vanilla_skyblock/functions/tick.mcfunction +++ b/data/vanilla_skyblock/functions/tick.mcfunction @@ -6,10 +6,4 @@ # re-place end_portal_frame # set scoreboard values to 1 for processed chunk -execute in the_nether unless score initialized_nether vanilla_skyblock_data matches 1 run function vanilla_skyblock:initialize_nether - -execute in the_nether unless score initialized_nether vanilla_skyblock_data matches 1 run tellraw @a "COOL" -execute unless score initialized_nether vanilla_skyblock_data matches 1 run tellraw @a "COOL!!" - -execute in overworld run tellraw @a "OI!!O" -execute in the_nether run tellraw @a "OI!!N" +execute as @a[predicate=vanilla_skyblock:in_nether] unless score initialized_nether vanilla_skyblock_data matches 1 run function vanilla_skyblock:initialize_nether diff --git a/data/vanilla_skyblock/predicates/in_nether.json b/data/vanilla_skyblock/predicates/in_nether.json new file mode 100644 index 0000000..7f8bb16 --- /dev/null +++ b/data/vanilla_skyblock/predicates/in_nether.json @@ -0,0 +1,6 @@ +{ + "condition": "minecraft:location_check", + "predicate": { + "dimension": "minecraft:the_nether" + } +} -- cgit v1.2.3