minecraft-expanded-datapack/data/undeadm-m1/functions/potions.mcfunction

72 lines
3.0 KiB
Mcfunction
Raw Permalink Normal View History

tellraw @a[scores={me-debugging=1..}] "undeadmaelys-m1:potions"
## KNOWN BUGS:
# fake thrown potions (love, stink) assignation fails if assignation has dead assigners (i.e. it start at 1 instead of 0, -- cos potion 0 already died but potion 1 didnt, so summoning another will cause the new potion to also share id 1 with the already existing potion D:) maybe change the count custom to make it get the highest id?
# count potions to manage new!
function undeadm-m1:potion/_count_custom_potions
# 1 Gender Change Potion 2101
execute as @a if score @s me-core_drinkM matches 1 at @s run function undeadm-m1:potion/_clear_effects
# 2 Gravitation Potion 2102
# "Press SHIFT to reverse gravity"
# who drinks potion receives effect
execute as @e[nbt={SelectedItem:{tag:{CustomModelData:2102}}}] if score @s me-core_drinkP matches 1 run function undeadm-m1:potion/use_potion_gravitation
# do the effect for the effect carriers
execute as @e[tag=GravitationPotionEffect] at @s run function undeadm-m1:potion/effect_do_gravitation
# 3 Inferno Potion 2103
# "Nearby enemies are ignited"
# who drinks potion receives effect
execute as @e[nbt={SelectedItem:{tag:{CustomModelData:2103}}}] if score @s me-core_drinkP matches 1 run function undeadm-m1:potion/use_potion_inferno
# do the effect for the effect carriers
execute as @e[tag=InfernoPotionEffect] at @s run function undeadm-m1:potion/effect_do_inferno
# 4 Ironskin Potion 2104
# "Increase defense by 2"
# 5 Lifeforce Potion 2105
# "20% increased maximum health"
# 6 Love Potion 2106
# "Throw this to make someone fall in love"
# if a potion is thrown, create and assign a scoreboard that will propagate the custom effect
#data merge entity @s {Item:{tag:{Assigned:1b}}}
execute as @e[type=minecraft:potion,nbt={Item:{tag:{CustomModelData:2106}}}] unless entity @s[nbt={Item:{tag:{Assigned:1b}}}] run function undeadm-m1:potion/assign_potion_love
# tp potion armor stand to its vanilla potion
execute as @e[tag=Potion,tag=LovePotion] at @s as @e[type=potion] if score @s me-core_uid = @e[limit=1,sort=nearest,type=minecraft:armor_stand,tag=LovePotion] me-core_uid run tp @e[limit=1,sort=nearest,type=minecraft:armor_stand,tag=LovePotion] @s
#if potion crashes on ground, grant potion effect @e[distance=..2]
execute as @e[tag=LovePotion,type=minecraft:armor_stand] unless entity @s[nbt={OnGround:1b}] at @s run function undeadm-m1:potion/use_potion_love
#kill armor stand as potion crashed
execute as @e[tag=Potion,type=minecraft:armor_stand,nbt={OnGround:0b}] unless entity @s[nbt={OnGround:1b}] run kill @s
# do the effect for the effect carriers
execute as @e[tag=LovePotionEffect] at @s run function undeadm-m1:potion/effect_do_love
# 7 Recall Potion 2107
# "Teleports you home"
# 8 Return Potion 2108
# "This teleports you home and creates a portal"
# "Use portal to return when you are done"
# "'Good for one round trip!'"
# 9 Stink Potion 2109
# "Throw this to make someone smell terrible"
#10 Teleport Potion 2110
# "Teleports you to a random location"
#11 Water Walking Potion 2111
# "Press SHIFT to enter water"