Skip to content

Commit

Permalink
Implement Crafting Recipe for Bottled Magicol
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloo-dev committed Nov 14, 2023
1 parent 3ff4647 commit 18b57ec
Show file tree
Hide file tree
Showing 12 changed files with 310 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ execute unless score $recipe_success gm4_zc_data matches 1.. if score $has_water
execute unless score $recipe_success gm4_zc_data matches 1.. if score $has_water gm4_zc_data matches 1 if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:"bottled_vex"}}}] if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:"enchanted_prismarine_shard"}}}] run function gm4_zauber_cauldrons:recipes/magicol/select_color

# bottled magicol
execute unless score $recipe_success gm4_zc_data matches 1.. if score $current gm4_zc_moon_phase = $preferred gm4_zc_moon_phase if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients liquid{id:"magicol"} if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:"minecraft:prismarine_crystals"}}}] run say check for snowball/slimeball/magma cream and bottle type!
execute unless score $recipe_success gm4_zc_data matches 1.. if score @s gm4_zc_liquid_level matches 1..3 if score $current gm4_zc_moon_phase = $preferred gm4_zc_moon_phase if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients liquid{id:"magicol"} if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{Potion:"minecraft:water"}}] if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:"minecraft:prismarine_crystals"}}}] run function gm4_zauber_cauldrons:recipes/magicol/bottled/select_bottle

# reset fake players and storage
scoreboard players reset $recipe_success gm4_zc_data
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @s = magicol zauber cauldron with water bottle and prismarine crystals inside
# at center of block
# run from cauldron/recipe_checks

# set expected fullness for these recipes
scoreboard players set $expected_item_amount gm4_zc_fullness 3

# set sip level returned when crafting multi-sips, in case another module messed with these presets
execute if score $has_soul_fire_heatsource gm4_zc_data matches 1.. run data modify storage gm4_zauber_cauldrons:blueprint/item/multi_sip gm4_zauber_cauldrons.bottle set value {sips:9,size:9,multi_use:1b}

# select bottle type
# called functions are generated via beet from templates
# generated with the help of bolt
for bottle_data in ctx.meta['potion_bottles']:
execute unless score $recipe_success gm4_zc_data matches 1.. if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:bottle_data['item_id']}}}] run function f"gm4_zauber_cauldrons:recipes/magicol/bottled/{bottle_data['bottle']}/select_color"

# use water or powder snow and play sound once a recipe ran
execute if score $recipe_success gm4_zc_data matches 1 run function gm4_zauber_cauldrons:recipes/magicol/bottled/use_cauldron

# reset fake players
scoreboard players reset $expected_item_amount gm4_zc_fullness
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @s = boiling zauber cauldron with recipe inside
# at @s (center of block)
# run from recipes/magicol/bottled/select_bottle

# calculate amount of vexes to spawn
execute if score @s gm4_zc_fullness > $expected_item_amount gm4_zc_fullness run function gm4_zauber_cauldrons:cauldron/structure/use_extra_items

# make items in cauldron pickup-able instantly
execute align xyz as @e[type=item,dx=0,dy=0,dz=0] run data modify entity @s PickupDelay set value 0s

# sounds and visuals
playsound minecraft:block.brewing_stand.brew block @a[distance=..16] ~ ~ ~ 0.6 0.66

# consume liquid
scoreboard players remove @s gm4_zc_liquid_level 1
execute align xyz run function gm4_zauber_cauldrons:cauldron/liquid/update/from_score
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# @s = boiling zauber cauldron with recipe inside
# at @s (center of block)
# run from recipes/armor/zauber_armor
# run from recipes/magicol/select_color

# calculate amount of vexes to spawn
execute if score @s gm4_zc_fullness > $expected_item_amount gm4_zc_fullness run function gm4_zauber_cauldrons:cauldron/structure/use_extra_items

# update cauldron liquid
execute align xyz run function gm4_zauber_cauldrons:cauldron/liquid/update/from_score

# sounds and visuals
particle entity_effect ~ ~.4 ~ .1 .1 .1 1 10
playsound entity.player.levelup block @a[distance=..16] ~ ~ ~ 1 1.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# @s = heated {{color}} magicol zauber cauldron with bottled {{color}} magicol recipe inside
# at @s (center of block)
# run from recipes/magicol/bottled/{{bottle}}/{{color}}/select_weather_modifier

# templates/functions/magicol/craft_bottled_magicol.mcfunction

# remove ingredients
execute align xyz run kill @e[type=item,dx=0,dy=0,dz=0]

# summon item
loot spawn ~ ~.2 ~ loot gm4_zauber_cauldrons:items/bottled_magicol/{{bottle}}/{{color}}/{{weather_modifier}}

# set flag
scoreboard players set $recipe_success gm4_zc_data 1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ data modify entity @s data.gm4_zauber_cauldrons.liquid set value {id:"magicol",m
data modify entity @s data.gm4_zauber_cauldrons.liquid.magicol.moon_phase set from storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:"bottled_vex"}}}].tag.gm4_zauber_cauldrons.preferred_moon_phase

# visuals
summon minecraft:item_display ~ ~.0781 ~ {item:{id:"minecraft:{{color}}_concrete_powder",Count:1b,tag:{CustomModelData:{{custom_model_data}}}},item_display:"fixed",transformation:[1.984f,0f,0f,0f,0f,0f,0f,0f,0f,0f,1.984f,0f,0f,0f,0f,1f],Tags:["gm4_zc_liquid","gm4_zc_magicol","gm4_zc_{{color}}_magicol"]}
execute align xyz run function gm4_zauber_cauldrons:cauldron/liquid/update/from_score
summon minecraft:item_display ~ ~.0781 ~ {item:{id:"minecraft:{{color}}_concrete_powder",Count:1b,tag:{CustomModelData:{{liquid_custom_model_data}}}},item_display:"fixed",transformation:[1.984f,0f,0f,0f,0f,0f,0f,0f,0f,0f,1.984f,0f,0f,0f,0f,1f],Tags:["gm4_zc_liquid","gm4_zc_magicol","gm4_zc_{{color}}_magicol"]}

# set flag
scoreboard players set $recipe_success gm4_zc_data 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @s = heated magicol zauber cauldron with bottled magicol recipe inside
# at @s (center of block)
# run from recipes/magicol/bottled/select_bottle

# templates/functions/magicol/select_color.mcfunction

# check which color of bottled magicol to craft
# called functions are generated via beet from templates
# generated with the help of bolt
for color_data in ctx.meta['magicol_colors']:
execute unless score $recipe_success gm4_zc_data matches 1.. if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients liquid.magicol{color:color_data['color']} run function f"gm4_zauber_cauldrons:recipes/magicol/bottled/{{bottle}}/{color_data['color']}/select_weather_modifier"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @s = heated magicol zauber cauldron with bottled magicol recipe inside
# at @s (center of block)
# run from recipes/magicol/bottled/select_bottle

# templates/functions/magicol/select_weather_modifier.mcfunction

# check which weather modifier to use
# called functions are generated via beet from templates
# generated with the help of bolt
for modifier_data in ctx.meta['weather_modifiers']:
execute unless score $recipe_success gm4_zc_data matches 1.. if data storage gm4_zauber_cauldrons:temp/cauldron/ingredients items[{Count:1b,tag:{gm4_zauber_cauldrons:{item:modifier_data['item_id']}}}] run function f"gm4_zauber_cauldrons:recipes/magicol/bottled/{{bottle}}/{{color}}/{modifier_data['modifier']}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "{{bottle_item_id}}",
"functions": [
{
"function": "minecraft:set_nbt",
"tag": "{gm4_zauber_cauldrons:{item:\"bottled_magicol\",color:\"{{color}}\",weather_modifier:\"{{weather_modifier}}\",bottle:{multi_use:0}},HideFlags:32,CustomPotionColor:{{particle_color}},CustomModelData:{{bottle_custom_model_data}}}"
},
{
"function": "minecraft:set_name",
"name": {
"translate": "item.gm4.zauber_cauldrons.bottled_magicol.{{translate_name}}",
"fallback": "{{translate_fallback}}",
"italic": false
}
},
{
"function": "minecraft:set_name",
"entity": "this",
"name": {
"translate": "item.gm4.zauber_cauldrons.multi_use_bottle.bottled_magicol.{{translate_name}}",
"fallback": "{{soulution_translate_fallback}}",
"italic": false
},
"conditions": [
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": {
"type": "minecraft:fixed",
"name": "$has_soul_fire_heatsource"
},
"score": "gm4_zc_data"
},
"range": 1
}
]
},
{
"function": "minecraft:copy_nbt",
"source": {
"type": "minecraft:storage",
"source": "gm4_zauber_cauldrons:blueprint/item/multi_sip"
},
"ops": [
{
"source": "gm4_zauber_cauldrons.bottle",
"target": "gm4_zauber_cauldrons.bottle",
"op": "replace"
}
],
"conditions": [
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": {
"type": "minecraft:fixed",
"name": "$has_soul_fire_heatsource"
},
"score": "gm4_zc_data"
},
"range": 1
}
]
},
{
"function": "minecraft:set_nbt",
"tag": "{CustomModelData:{{soulution_bottle_custom_model_data}}}",
"conditions": [
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": {
"type": "minecraft:fixed",
"name": "$has_soul_fire_heatsource"
},
"score": "gm4_zc_data"
},
"range": 1
}
]
},
{
"function": "minecraft:set_lore",
"entity": "this",
"lore": [
[
{
"nbt": "gm4_zauber_cauldrons.bottle.sips",
"storage": "gm4_zauber_cauldrons:blueprint/item/multi_sip",
"color": "gray",
"italic": false
},
{
"text": "/",
"color": "gray",
"italic": false
},
{
"nbt": "gm4_zauber_cauldrons.bottle.size",
"storage": "gm4_zauber_cauldrons:blueprint/item/multi_sip",
"color": "gray",
"italic": false
},
{
"text": " ",
"color": "gray",
"italic": false
},
{
"translate": "item.gm4.zauber_cauldrons.multi_use_bottle.lore.{{sips_translate_name}}",
"fallback": "{{sips_translate_fallback}}",
"color": "gray",
"italic": false
}
]
],
"replace": false,
"conditions": [
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": {
"type": "minecraft:fixed",
"name": "$has_soul_fire_heatsource"
},
"score": "gm4_zc_data"
},
"range": 1
}
]
},
{
"function": "minecraft:set_lore",
"lore": [
{
"text": ""
},
{
"translate": "potion.whenDrank",
"color": "dark_purple",
"italic": false
},
{
"translate": "item.gm4.zauber_cauldrons.bottled_magicol.tint.{{color}}",
"fallback": "{{color_translate_fallback}}",
"color": "blue",
"italic": false
}
],
"replace": false
}
]
}
]
}
]
}
Loading

0 comments on commit 18b57ec

Please sign in to comment.