Skip to content

Commit

Permalink
Zauber Cauldrons: Only Allow Magicol Bottling at Night (Gamemode4Dev#956
Browse files Browse the repository at this point in the history
)

Changes the requirement for bottling Magicol to having the right moon phase AND the moon being visible (clear night sky).

Also fixes Zauber Crystals not being restored properly when placed down.
  • Loading branch information
Bloo-dev authored Feb 13, 2024
1 parent 158e9e3 commit 68a6e8d
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ execute unless score @s gm4_zc_bottled_vex_escape_timer matches -2147483648..214
execute if score @s gm4_zc_bottled_vex_escape_timer matches 0.. run function gm4_zauber_cauldrons:cauldron/extra_items/release_from_bottle/crack_bottle

# break free (if the moon phase is right, the bottle survives an additional tick)
execute if score @s gm4_zc_bottled_vex_escape_timer matches 1 unless score @s gm4_zc_moon_phase = $current gm4_zc_moon_phase run function gm4_zauber_cauldrons:cauldron/extra_items/release_from_bottle/release
execute if score @s gm4_zc_bottled_vex_escape_timer matches 1 unless function gm4_zauber_cauldrons:cauldron/liquid/magicol/check_moon_phase run function gm4_zauber_cauldrons:cauldron/extra_items/release_from_bottle/release
execute if score @s gm4_zc_bottled_vex_escape_timer matches ..0 run function gm4_zauber_cauldrons:cauldron/extra_items/release_from_bottle/release
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ playsound minecraft:block.glass.break block @a[distance=..8] ~ ~ ~ 0.1 1.9
particle minecraft:block glass ~ ~ ~ 0.1 0.1 0.1 0 1

# players wearing zauber armor can tell if its the right moon phase
execute if score @s gm4_zc_moon_phase = $current gm4_zc_moon_phase run particle minecraft:electric_spark ~ ~.2 ~ 0.15 0.15 0.15 0.01 3 normal @a[distance=..8,advancements={gm4_zauber_cauldrons:equipment/has_full_armor=true}]
execute if score @s gm4_zc_moon_phase = $current gm4_zc_moon_phase if function gm4_zauber_cauldrons:cauldron/liquid/magicol/check_moon_phase run particle minecraft:electric_spark ~ ~.2 ~ 0.15 0.15 0.15 0.01 3 normal @a[distance=..8,advancements={gm4_zauber_cauldrons:equipment/has_full_armor=true}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Checks the moon phase, time, and weather for the correct conditions for magicol bottling. Used to display sparkle particles and to bottle magicol.
# @s = varies
# at varies
# run in if function conditions from gm4_zauber_cauldrons:cauldron/extra_items/release_from_bottle/check_timer, gm4_zauber_cauldrons:recipes/magicol/bottled/<...>/<...>/<...>, and gm4_zauber_cauldrons:cauldron/liquid/magicol/particles

# require clear night and correct moon phase
execute unless predicate gm4_zauber_cauldrons:cauldron/clear_night run return fail
execute unless score $preferred gm4_zc_moon_phase = $current gm4_zc_moon_phase run return fail
return 1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# display enchant particles for players with full zauber armor during the correct moon phase
scoreboard players reset $preferred gm4_zc_moon_phase
execute store result score $preferred gm4_zc_moon_phase run data get storage gm4_zauber_cauldrons:temp/cauldron/ingredients liquid.magicol.moon_phase
execute if score $preferred gm4_zc_moon_phase = $current gm4_zc_moon_phase run particle minecraft:electric_spark ~.5 ~.78 ~.5 0.25 0.25 0.25 0.01 6 normal @a[distance=..8,advancements={gm4_zauber_cauldrons:equipment/has_full_armor=true}]
execute if function gm4_zauber_cauldrons:cauldron/liquid/magicol/check_moon_phase run particle minecraft:electric_spark ~.5 ~.78 ~.5 0.25 0.25 0.25 0.01 6 normal @a[distance=..8,advancements={gm4_zauber_cauldrons:equipment/has_full_armor=true}]

# make sure the cauldron is in loaded chunks to avoid entity buildup
execute unless loaded ~ ~ ~ run return -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ execute if score $item gm4_zc_data matches 1.. store result score $slot gm4_zc_d

# remove firework star specific data
data remove storage gm4_zauber_cauldrons:temp/item/crystal Item.tag.Explosion
data remove storage gm4_zauber_cauldrons:temp/item/crystal Item.tag.HideFlags

# replace item
execute if score $slot gm4_zc_data matches 0..8 run function gm4_zauber_cauldrons:player/crystal/swap/restore_player_head/hotbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ playsound minecraft:block.glass.break block @a[distance=..8] ~ ~ ~ 1 1.3
# consume liquid
scoreboard players remove @s gm4_zc_liquid_level 1
execute align xyz run function gm4_zauber_cauldrons:cauldron/liquid/update/from_score

# return
return fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"condition": "minecraft:all_of",
"terms": [
{
"condition": "minecraft:time_check",
"value": {
"min": 13000,
"max": 23000
},
"period": 24000
},
{
"condition": "minecraft:weather_check",
"raining": false,
"thundering": false
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ execute align xyz run kill @e[type=item,dx=0,dy=0,dz=0]
# set flag
scoreboard players set $recipe_success gm4_zc_data 1

# if the moon phase is wrong, spawn vexes instead
execute unless score $current gm4_zc_moon_phase = $preferred gm4_zc_moon_phase run function gm4_zauber_cauldrons:recipes/magicol/bottled/wrong_moon_phase
execute unless score $current gm4_zc_moon_phase = $preferred gm4_zc_moon_phase run return -1
# cancel execution via return and spawn vexes, unless it is a clear night and the correct moon phase
execute unless function gm4_zauber_cauldrons:cauldron/liquid/magicol/check_moon_phase run return run function gm4_zauber_cauldrons:recipes/magicol/bottled/wrong_moon_phase

# summon item
loot spawn ~ ~.2 ~ loot gm4_zauber_cauldrons:items/bottled_magicol/{{bottle}}/{{color}}/{{weather_modifier}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"name": {
"translate": "item.gm4.zauber_cauldrons.crystal.{{effect}}",
"fallback": "{{translate_fallback}}",
"color": "yellow",
"italic": false
}
},
Expand Down

0 comments on commit 68a6e8d

Please sign in to comment.