Skip to content

Commit

Permalink
docs: Update function docs
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeUtan committed Jul 7, 2021
1 parent af6c71f commit ffbc76a
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Converts a dog into a dog hat and stores its data in the hat
# executor: Dog beeing converted to a hat
# @s: Dog beeing converted to a hat

# Remove 1 lead from the players inventory
clear @p[tag=!global.ignore,distance=..0.001] lead 1
Expand All @@ -10,4 +10,4 @@ execute at @s run playsound minecraft:entity.wolf.pant neutral @a[tag=!global.ig

# Give executing Player a dog hat
loot give @p[tag=!global.ignore,distance=..0.001] loot oran9eutan:hats/dog_hat_from_dog
execute as @s at @s run function oran9eutan:hats/utils/remove_entity_silently
execute as @s at @s run function oran9eutan:hats/utils/remove_entity_silently
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Converts dog to a hat if it is owned by the Player executing this function
# executor: Dog beeing checked for conversion
# @s: Dog beeing checked for conversion

# Check if the Owner matches the stored UUID of the player. 0 if matches, 1 otherwise
execute store result score @s hats.math run data modify storage hats uuid set from entity @s Owner

# Convert dog to hat if the Player is the Owner
execute if score @s hats.math matches 0 run function oran9eutan:hats/dog_mechanism/convert_dog_to_hat
execute if score @s hats.math matches 0 run function oran9eutan:hats/dog_mechanism/convert_dog_to_hat
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Converts all nearby dogs owned by a Player into dog hats
# executor: Player whos dogs are going to be converted
# @s: Player whos dogs are going to be converted

# Store UUID of the Player
data modify storage hats uuid set from entity @s UUID

# Try to convert all nearby dogs that have an Owner
execute as @e[tag=!global.ignore,type=minecraft:wolf,distance=..2,predicate=oran9eutan:hats/entity/is_sitting] if data entity @s Owner run function oran9eutan:hats/dog_mechanism/convert_dog_to_hat_if_player_is_owner
execute as @e[tag=!global.ignore,type=minecraft:wolf,distance=..2,predicate=oran9eutan:hats/entity/is_sitting] if data entity @s Owner run function oran9eutan:hats/dog_mechanism/convert_dog_to_hat_if_player_is_owner
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Converts a dog hat into a dog
# executor: Dog hat item beeing converted to a dog
# @s: Dog hat item beeing converted to a dog

# Move the saved dogs nbt into storage
data modify storage hats dog_data set from entity @s Item.tag.dog_data
Expand All @@ -11,4 +11,4 @@ execute as @p[tag=!global.ignore] at @s run function oran9eutan:hats/dog_mechani
# Remove temporary storage
data remove storage hats dog_data

kill @s
kill @s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Creates a dog from stored dog_data
# executor: Nearest player from recently droped dog hat item
# @s: Nearest player from recently droped dog hat item

# Summon dog
summon minecraft:wolf ~ ~ ~ {Tags:["hats_dog_from_hat"]}
Expand All @@ -11,4 +11,4 @@ execute positioned ~ ~.3 ~ run particle minecraft:poof ~ ~ ~ 0.1 0.1 0.1 .001 5
playsound minecraft:entity.wolf.ambient neutral @a[tag=!global.ignore] ~ ~ ~

# Give player a lead
summon item ~ ~ ~ {PickupDelay:1,Item:{id:"minecraft:lead",Count:1b}}
summon item ~ ~ ~ {PickupDelay:1,Item:{id:"minecraft:lead",Count:1b}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Merges the nbt of a dog with the dog_data in storage
# executor: Dog whose nbt to modify
# @s: Dog whose nbt to modify

data modify entity @s CollarColor set from storage minecraft:hats dog_data.CollarColor
data modify entity @s Age set from storage minecraft:hats dog_data.Age
Expand All @@ -11,4 +11,4 @@ data modify entity @s CustomNameVisible set from storage minecraft:hats dog_data
data modify entity @s Tags set from storage minecraft:hats dog_data.Tags
data modify entity @s Owner set from storage minecraft:hats dog_data.Owner

tag @s remove hats_dog_from_hat
tag @s remove hats_dog_from_hat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: Player
# descr: Tries to dress all undressed mobs near the player
# Tries to dress all undressed mobs near a player
# @s: Player

execute as @e[type=zombie,tag=!global.ignore,distance=0..64,tag=!hats.mob.dont_dress,predicate=!oran9eutan:hats/entity/wears_helmet] at @s run function oran9eutan:hats/dress/zombie
execute as @e[type=husk,tag=!global.ignore,distance=0..64,tag=!hats.mob.dont_dress,predicate=!oran9eutan:hats/entity/wears_helmet] at @s run function oran9eutan:hats/dress/husk
Expand All @@ -10,4 +10,4 @@ execute as @e[type=wandering_trader,tag=!global.ignore,distance=0..64,tag=!hats.
execute as @e[type=vindicator,tag=!global.ignore,distance=0..64,tag=!hats.mob.dont_dress,predicate=!oran9eutan:hats/entity/wears_helmet] at @s run function oran9eutan:hats/dress/vindicator

# Only dress Villagers with a profession
execute as @e[type=villager,tag=!global.ignore,distance=0..64,tag=!hats.mob.dont_dress,predicate=oran9eutan:hats/villager/has_profession] at @s run function oran9eutan:hats/dress/villager
execute as @e[type=villager,tag=!global.ignore,distance=0..64,tag=!hats.mob.dont_dress,predicate=oran9eutan:hats/villager/has_profession] at @s run function oran9eutan:hats/dress/villager
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# executor: Drowned beeing dressed
# descr: Try dressing a Drowned with a hat
# Try dressing a Drowned with a hat
# @s: Drowned beeing dressed

execute if predicate oran9eutan:hats/chance_hostile_mob_has_hat run loot replace entity @s armor.head loot oran9eutan:hats/dress/drowned
execute if predicate oran9eutan:hats/entity/wears_helmet run data modify entity @s ArmorDropChances[3] set value 1.0f

tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
6 changes: 3 additions & 3 deletions datapack/data/oran9eutan/functions/hats/dress/husk.mcfunction
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# executor: The Husk beeing dressed
# descr: Try dressing a Husk with a hat
# Try dressing a Husk with a hat
# @s: The Husk beeing dressed

execute if predicate oran9eutan:hats/chance_hostile_mob_has_hat run loot replace entity @s armor.head loot oran9eutan:hats/dress/husk
execute if predicate oran9eutan:hats/entity/wears_helmet run data modify entity @s ArmorDropChances[3] set value 1.0f

tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# executor: Mob that is going to be dressed as a ghost
# requires: Executor must have ArmorItems nbt and a hat slot
# descr: Dresses a mob with a ghost hat and gives it invisibility
# Dresses a mob with a ghost hat and gives it invisibility
# @s: Mob that is going to be dressed as a ghost
# requires: @s must have ArmorItems nbt and a hat slot

loot replace entity @s armor.head loot oran9eutan:hats/hat_on_head/halloween/wiggly_ghast
data modify entity @s ArmorDropChances[3] set value 1.0f
effect give @s minecraft:invisibility 99999 1 true
tag @s add hats.mob.is_ghost
tag @s add hats.mob.is_ghost
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: The Skeleton beeing dressed
# descr: Try dressing a Skeleton with a hat
# Try dressing a Skeleton with a hat
# @s: The Skeleton beeing dressed

# Try to make the Skeleton a ghost
execute if predicate oran9eutan:hats/is_in_mansion if predicate oran9eutan:hats/is_dark_night if predicate oran9eutan:hats/chance_mob_is_ghost run function oran9eutan:hats/dress/mob_as_ghost
Expand All @@ -8,4 +8,4 @@ execute if predicate oran9eutan:hats/is_in_mansion if predicate oran9eutan:hats/
execute as @s[tag=!hats.mob.is_ghost] if predicate oran9eutan:hats/chance_hostile_mob_has_hat run loot replace entity @s armor.head loot oran9eutan:hats/dress/skeleton
execute as @s[tag=!hats.mob.is_ghost] if predicate oran9eutan:hats/entity/wears_helmet run data modify entity @s ArmorDropChances[3] set value 1.0f

tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# executor: The Stray beeing dressed
# descr: Try dressing a Stray with a hat
# Try dressing a Stray with a hat
# @s: The Stray beeing dressed

execute if predicate oran9eutan:hats/chance_hostile_mob_has_hat run loot replace entity @s armor.head loot oran9eutan:hats/dress/stray
execute if predicate oran9eutan:hats/entity/wears_helmet run data modify entity @s ArmorDropChances[3] set value 1.0f

tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: Villager beeing dressed
# Descr: Adds offer of the favorite cat the Villager Trader is wearing
# Adds offer of the favorite cat the Villager Trader is wearing
# @s: Villager beeing dressed

# Add template offer
data modify entity @s Offers.Recipes append value {sell:{id:"{{ hats.default_item_inventory }}",Count:1b}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: Villager beeing dressed
# descr: Adds profession dependent special offer to the Villager
# Adds profession dependent special offer to the Villager
# @s: Villager beeing dressed

# Add template offer
data modify entity @s Offers.Recipes append value {buy:{id:"minecraft:emerald", Count:1b}, sell:{id:"{{ hats.default_item_inventory }}",Count:1b}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: Vindicator being dressed
# @s: Vindicator being dressed

execute if predicate oran9eutan:hats/is_in_mansion if predicate oran9eutan:hats/is_dark_night if predicate oran9eutan:hats/chance_mob_is_ghost run function oran9eutan:hats/dress/mob_as_ghost

tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: The Wandering Trader beeing dressed
# descr: Try to dress the Wandering Trader with a hat and add some trades
# Try to dress the Wandering Trader with a hat and add some trades
# @s: The Wandering Trader beeing dressed

# Add optional favorite cat hat
execute if predicate oran9eutan:hats/wandering_trader/chance_has_fav_cat run function oran9eutan:hats/dress/wandering_trader/add_fav_cat
Expand All @@ -8,4 +8,4 @@ execute if predicate oran9eutan:hats/wandering_trader/chance_has_fav_cat run fun
execute if predicate oran9eutan:hats/wandering_trader/chance_has_villager_trade run function oran9eutan:hats/dress/wandering_trader/add_villager_trade

# Mark Wandering Trader as dressed
tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: Wandering Trader beeing dressed
# Descr: Adds offer of the favorite cat the Wandering Trader is wearing
# Adds offer of the favorite cat the Wandering Trader is wearing
# @s: Wandering Trader beeing dressed

# Add template offer
data modify entity @s Offers.Recipes append value {buy:{id:"minecraft:emerald", Count:1b}, sell:{id:"{{ hats.default_item_inventory }}",Count:1b}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: Wandering Trader beeing dressed
# descr: Adds a hat trade related to Villagers
# Adds a hat trade related to Villagers
# @sr: Wandering Trader beeing dressed

# Add template offer that is modified later
data modify entity @s Offers.Recipes append value {buy:{id:"minecraft:emerald", Count:1b}, sell:{id:"{{ hats.default_item_inventory }}",Count:1b}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: The Zombie beeing dressed
# descr: Dress a Zombie with a hat
# Dress a Zombie with a hat
# @s: The Zombie beeing dressed

# Try to make the Zombie a ghost
execute if predicate oran9eutan:hats/is_in_mansion if predicate oran9eutan:hats/is_dark_night if predicate oran9eutan:hats/chance_mob_is_ghost run function oran9eutan:hats/dress/mob_as_ghost
Expand All @@ -8,4 +8,4 @@ execute if predicate oran9eutan:hats/is_in_mansion if predicate oran9eutan:hats/
execute as @s[tag=!hats.mob.is_ghost] if predicate oran9eutan:hats/chance_hostile_mob_has_hat run loot replace entity @s armor.head loot oran9eutan:hats/dress/zombie
execute as @s[tag=!hats.mob.is_ghost] if predicate oran9eutan:hats/entity/wears_helmet run data modify entity @s ArmorDropChances[3] set value 1.0f

tag @s add hats.mob.dont_dress
tag @s add hats.mob.dont_dress
2 changes: 1 addition & 1 deletion datapack/data/oran9eutan/functions/hats/load.mcfunction
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Initialises the datapack
# executor: World
# @: World

# Install datapack if it is not already
scoreboard objectives add hats.cfg dummy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# executor: World
# descr: This function is scheduled as a proxy, so that another function call can be scheduled with a desired context
# This function is scheduled as a proxy, so that another function call can be scheduled with a desired context
# @s: World

# Execute proxied function as Players with helmet hats on their head
execute as @a[tag=!global.ignore] if predicate oran9eutan:hats/entity/wears_inventory_hat run function oran9eutan:hats/hat_mechanism/equip_player_with_correct_hat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Kills an entity without showing its death animation or a death message
# executor: Entity to be removed
# @s: Entity to be removed

# Save state of gamerule
execute store result score #gamerule_tmp hats.math run gamerule showDeathMessages
Expand All @@ -12,4 +12,4 @@ kill @s

# Reset gamerule to its previous state
execute if score #gamerule_tmp hats.math matches 1 run gamerule showDeathMessages true
scoreboard players reset #gr_tmp hats.math
scoreboard players reset #gr_tmp hats.math

0 comments on commit ffbc76a

Please sign in to comment.