User:Aeldrion/Projects/AESTD/Function library

The AESTD function library is the biggest feature of AESTD. It is a collection of functions that can be used by other datapacks. Functions are sorted in seven categories:,  ,  ,  ,  ,   and.

Some functions take the executing entity's scores and tags as input. In these cases, setting the right tags and scores should always be done right before executing the function as some functions in AESTD can modify these scores and tags.

anger.mcfunction
Makes the executing entity angry at an entity with a given UUID if it can (see aestd:entity/get_uuid). Also includes the effects of aestd:entity/fake_damage for technical reasons. If the executing entity is neutral or hostile, it will become angry at the target entity. If the entity whose UUID was last saved in the save chunk is a player, the entity's death will count as a player kill and experience orbs will drop. Does not work for players (obviously).

execute as @p run function aestd:entity/get_uuid function aestd:entity/anger
 * 1) This function will make the executing entity angry against the nearest player

damage.mcfunction
Damages the executing entity by (damage/100) HP, does not work on players. Input:

Settings:
 * : if the executing mob has this tag, it will act as if it was hit by the latest entity whose UUID was previously saved to the save chunk (see aestd:entity/get_uuid)
 * : if the executing mob has this tag, it will be set on fire

scoreboard players set @s aestd.damage 600 tag @s add aestd.damage.hurt_by_player tag @s add aestd.damage.fire function aestd:entity/damage tag @s remove aestd.damage.hurt_by_player tag @s remove aestd.damage.fire
 * 1) This function will damage the executing entity by 6HP, make it angry against the nearest player and set it on fire

fake_damage.mcfunction
Hurts the executing entity without actually dealing damage, playing its hurt sound and turning it red. Does not work on players.

execute as @e[type=minecraft:cow] at @s if block ~ ~-1 ~ #aestd:concrete run function aestd:entity/fake_damage
 * 1) This command will simulate the damaging of all cows that stand on concrete

get_direction.mcfunction
Saves the executing entity's direction multiplied by 1000 to its direction scores. Output: | |

execute as @e[type=minecraft:fireball,limit=1,sort=nearest] run function aestd:entity/get_direction execute as @e[type=minecraft:fireball,limit=1,sort=nearest] run tellraw @a {"score":{"name":"@s","objective":"aestd.dir.y"}}
 * 1) This function will display the nearest fireball's vertical direction in the chat

get_distance.mcfunction
Gets the distance (x50) between the executing entity's position and the context position. Caps at 46300 or 926 blocks away (otherwise overflows happen). Output:

execute as @a at @s at @e[type=minecraft:creeper,limit=1,sort=nearest] run function aestd:entity/get_distance execute as @a run title @s actionbar {"score":{"name":"@s","objective":"aestd.math.out"}}
 * 1) This function displays to all players their distance to the nearest creeper
 * 1) Executing entity: the player, context position: the position of the nearest creeper (because the command is ran as the player, at the creeper)
 * 2) Therefore, the measured distance is the distance from the player to the creeper
 * 3) The first at only ensures the selected creeper is the nearest to the player

get_motion.mcfunction
Saves the executing entity's motion multiplied by 1000 to its motion scores. Output: | |

execute as @e[type=minecraft:arrow] run function aestd:entity/get_motion execute as @e[type=minecraft:arrow] at @s[scores={aestd.motion.y=1..}] run particle minecraft:end_rod ~ ~ ~ 0 0 0 0 1 force execute as @e[type=minecraft:arrow] at @s[scores={aestd.motion.y=..-1}] run particle minecraft:flame ~ ~ ~ 0 0 0 0 1 force
 * 1) This function will display end rod particles at arrows that are going upwards, flame particles at arrows that are going downwards

get_motion_magnitude.mcfunction
Gets the magnitude of the executing entity's motion vector multiplied by 1000. Example: if the executing entity's motion is 1.784; 5.139; 3.396, the magnitude is 6412. Output:

execute as @e[type=minecraft:arrow] run function aestd:entity/get_motion_magnitude execute at @e[type=minecraft:arrow,scores={aestd.math.out=1000..}] run particle minecraft:flame ~ ~ ~ 0 0 0 0 1 force
 * 1) This function will display flame particles at arrows whose motion is more than 1

get_position.mcfunction
Saves the executing entity's position to its position scores. Output: | |

tag @a[nbt={SelectedItem:{id:"minecraft:compass"}}] add holding_compass execute as @a[tag=holding_compass] run function aestd:entity/get_position execute as @a[tag=holding_compass] run title @s actionbar [{"score":{"name":"@s","objective":"aestd.coords.x"}}," ",{"score":{"name":"@s","objective":"aestd.coords.y"}}," ",{"score":{"name":"@s","objective":"aestd.coords.z"}}] tag @a remove holding_compass
 * 1) This function will display a player's position in their actionbar if they are holding a compass

get_position_scale50.mcfunction
Saves the executing entity's position (x50) to its position scores. Output: | |

get_rotation.mcfunction
Saves the executing entity's rotation to its rotation scores. Output: |

get_uuid.mcfunction
Saves the UUID least/most pair of the executing entity to the save chunk's data item. The entity whose UUID was last saved has the  tag. This UUID can then be used in aestd:entity/anger, aestd:entity/damage, aestd:entity/projectile/set_owner_uuid and aestd:entity/wolf/tame. Output: save chunk (1519204 6 0 | )

knockback.mcfunction
Simulates the hitting of the executing entity from another at context position. Caps horizontal motion at 0.3 in both axes, and vertical motion is always 0.3. Does not work on players.

execute as @e[type=minecraft:cow,limit=1,sort=nearest] at @p run function aestd:entity/knockback execute as @p run function aestd:entity/get_uuid scoreboard players set @e[type=minecraft:cow,limit=1,sort=nearest] aestd.damage 100 tag @e[type=minecraft:cow,limit=1,sort=nearest] add aestd.damage.hurt_by_entity execute as @e[type=minecraft:cow,limit=1,sort=nearest] run function aestd.damage.hurt_by_entity
 * 1) This function simulates the hitting of the nearest cow by the nearest player (see also aestd:entity/damage)

offset_position.mcfunction
Offsets the executing entity's position by its vector scores, in millimeters (1000 = 1 block). Input: | |.

scoreboard players set @s aestd.vector.x 4000 scoreboard players set @s aestd.vector.y 500 scoreboard players set @s aestd.vector.z -2000 function aestd:entity/offset_position
 * 1) This function will have the same effect as teleport @s ~4 ~0.5 ~-2

scoreboard players set @s aestd.random.max 32000 function aestd:math/random_lcg scoreboard players operation @s aestd.vector.x = @s aestd.random function aestd:math/random_lcg scoreboard players operation @s aestd.vector.z = @s aestd.random scoreboard players set @s aestd.random.max 256000 function aestd:math/random_lcg scoreboard players operation @s aestd.vector.y = @s aestd.random function aestd:entity/teleport_to_chunk_corner execute at @s run teleport @s ~ 0 ~ function aestd:entity/offset_position
 * 1) Another, more useful example: this function will teleport the executing entity randomly in the current chunk
 * 2) (see random functions and aestd:entity/teleport_to_chunk_corner)

set_direction.mcfunction
Sets the executing entity's direction from its direction scores divided by 1000. Input: | | Does not work on players and entities that use  instead of.

execute as @e[type=minecraft:fireball,limit=1,sort=nearest] run function aestd:entity/get_direction scoreboard players set $-1 aestd.math.var -1 scoreboard players operation @e[type=minecraft:fireball,limit=1,sort=nearest] aestd.dir.y *= $-1 aestd.math.var execute as @e[type=minecraft:fireball,limit=1,sort=nearest] run function aestd:entity/set_direction
 * 1) This function mirrors the nearest fireball's vertical direction (if it is going upwards, it will go downwards at the same speed instead)
 * 1) Multiply by -1

set_head.mcfunction
Places a player head on executing entity's head slot, replacing any helmet the entity may be wearing. The skin corresponds to the player name saved in the save chunk (see function aestd:player/get_name). For players, the player function alternative (aestd:player/set_head) should be more efficient. Input: save chunk (1519204 6 0 )

execute as @p run function aestd:player/get_name function aestd:entity/set_head
 * 1) This function copies the nearest player's head to the executing entity

set_head_to_block.mcfunction
Places a block with a given numerical block ID on the executing entity's head slot (see aestd:block/get_block_id). Input:

execute as @e[type=#aestd:mobs] positioned ~ ~-1 ~ run function aestd:block/get_block_id execute as @e[type=#aestd:mobs] run function aestd:entity/set_head_to_block
 * 1) This function places on every mob's head the block it is standing on

set_motion.mcfunction
Sets the executing entity's motion from its motion scores divided by 1000. Input: | |. Does not work on players and entities that use  instead of   (eg fireballs).

scoreboard players set @s aestd.random.min -500 scoreboard players set @s aestd.random.max 500 function aestd:math/random_range_lcg scoreboard players operation @s aestd.motion.x = @s aestd.random function aestd:math/random_range_lcg scoreboard players operation @s aestd.motion.y = @s aestd.random function aestd:math/random_range_lcg scoreboard players operation @s aestd.motion.z = @s aestd.random function aestd:entity/set_motion
 * 1) This function gives a random motion to the executing entity

set_motion_from_position.mcfunction
Sets the motion of the executing entity towards the context position. The magnitude of the motion vector is defined by distance to context position. Further than 40 blocks away, direction is not guaranteed to be exact due to Motion resetting values above 10. Does not work on players.

execute as @e[type=minecraft:creeper] at @p run function aestd:entity/set_motion_from_position
 * 1) This command shoots creepers to the nearest player (the further away the faster)

execute as @e[type=minecraft:creeper] at @s facing entity @p eyes positioned ^ ^ ^5 run function aestd:entity/set_motion_from_position
 * 1) This one shoots creepers to the nearest player with a constant motion regardless of the player's distance, because the command is ran five blocks away from the creeper and facing the player

set_motion_from_rotation.mcfunction
Sets the motion of the executing entity following context rotation. Does not work on players. This is just a simple implementation of aestd:entity/set_motion_from_position. The context position is five blocks in front of the executing entity, so the motion will have a magnitude of 1.25.

execute as @e[type=minecraft:creeper] at @s facing entity @p eyes run function aestd:entity/set_motion_from_rotation
 * 1) This command shoots creepers to the nearest player, similarly to the above command
 * 2) Note: running the function at the creeper (with at @s) is important because the context rotation needs to be the rotation from the creeper to the player

set_motion_magnitude.mcfunction
Sets the magnitude (/1000) of the executing entity's motion vector. Does not work on players. Input:

execute as @e[type=#aestd:mobs] run function aestd:entity/get_motion_magnitude scoreboard players set #aestd aestd.math.var 3 execute as @e[type=#aestd:mobs] run scoreboard players operation @s aestd.math.out *= #aestd aestd.math.var execute as @e[type=#aestd:mobs] run scoreboard players operation @s aestd.math.in = @s aestd.math.out execute as @e[type=#aestd:mobs] run function aestd:entity/set_motion_magnitude
 * 1) This function triples the motion of all mobs

scoreboard players set @e[type=minecraft:creeper] aestd.math.in 1000 execute as @e[type=minecraft:creeper] run function aestd:entity/set_motion_magnitude
 * 1) Simpler example: this function gives all creepers a constant motion magnitude of 1

set_position.mcfunction
Loads the executing entity's position from its position scores. For players, the player function alternative (aestd:player/set_position) should be more efficient. Input: | |

execute as @e[type=minecraft:arrow,tag=!shot] run function aestd:entity/get_position tag @e[type=minecraft:arrow] add shot execute as @e[type=minecraft:arrow,tag=shot,nbt={inGround:1b},tag=!in_ground] run function aestd:entity/set_position execute as @e[type=minecraft:arrow,tag=shot,nbt={inGround:1b},tag=!in_ground] run data merge entity @s {Color:-1} tag @e[type=minecraft:arrow,tag=shot,nbt={inGround:1b}] add in_ground
 * 1) This function teleports all arrows that hit the ground back to where they were shot
 * 1) The Color tag ensures the arrow doesn't make potion particles once teleported (Minecraft bug)

set_position_scale50.mcfunction
Loads the executing entity's position (/50) from its position scores. For players, the player function alternative (aestd:player/set_position_scale50) should be more efficient. Input: | |

set_rotation.mcfunction
Loads the executing entity's rotation from its rotation scores. For players, the player function alternative (aestd:player/set_rotation) should be more efficient. Input: |

teleport_surface.mcfunction
Teleports the executing entity to the highest block matching the x and z coordinates of the context position. For players, the player function alternative (aestd:player/teleport_surface) should be more efficient.

execute as @a[nbt={SelectedItem:{id:"minecraft:clock"}}] at @s run function aestd:entity/teleport_surface
 * 1) This command teleports all players who hold a clock to the surface

teleport_to_chunk_corner.mcfunction
Teleports the executing entity to the minimum x and z coordinates in the chunk it is in. For players, the player function alternative (aestd:player/teleport_to_chunk_corner) should be more efficient.

projectile/set_owner_uuid.mcfunction
Sets the executing entity's owner to an entity with a given UUID (see aestd:entity/get_uuid). Input: save chunk (1519204 6 0 | )

execute anchored eyes run summon minecraft:arrow ^ ^ ^1 {Tags:["new"],Color:-1,pickup:1b} execute anchored eyes positioned ^ ^ ^13 as @e[type=minecraft:arrow,tag=new,limit=1] run function aestd:entity/set_motion_from_position function aestd:entity/get_uuid execute as @e[type=minecraft:arrow,tag=new,limit=1] run function aestd:entity/projectile/set_owner_uuid tag @e[type=arrow] remove new playsound entity.arrow.shoot master @a
 * 1) This function shoots an arrow from the executing player. The arrow's owner is the player, registrating all damage dealt by the arrow as player damage, triggering neutral behaviours and counting as player deaths
 * 2) Summon arrow in front of the player's eyes
 * 1) Set motion forward
 * 1) Set arrow's owner UUID to the player's
 * 1) Play shooting sound

wandering_trader/set_wandertarget_position.mcfunction
Sets a wandering trader's  position from its position scores. Input: | |

wolf/tame.mcfunction
Tames the executing wolf and sets its owner to a player with a given UUID (see aestd:player/get_uuid) Input: save chunk (1519204 6 0 )

execute as @r run function aestd:player/get_uuid execute as @e[type=minecraft:wolf,nbt={OwnerUUID:""}] run function aestd:entity/wolf/tame
 * 1) This function makes all wild wolves tamed to a random player

Item functions
Most item functions modify an item. The item that is modified can be an item entity or an inventory item, in a block or in a mob's or a player's inventory. The item slot that is selected is defined by the  score of the executing entity and the tags it has.

If the executing entity has the  tag, an item will be selected in a block entity at context position. If there is no block entity there, nothing will happen. The executing entity's  score corresponds to the   tag of the selected item (0-26 in a chest, for example).

If the executing entity doesn't have the  tag and is an item entity, it will be directly modified. If it doesn't have the tag but is a mob, a player or an armor stand, its  score will tell what item is being modified. For players, the score corresponds to the  tag of the selected item: 0-8 is in the hotbar, 9-35 is in the inventory, 100-103 is the armor and -106 is the offhand slot. -1 will select the mainhand and -2 the offhand. For mobs and armor stands, 100-103 corresponds to armor items, -1 will select the mainhand and -2 the offhand.

add_count.mcfunction
Adds to the count of an item, limiting to the item's stack size (see aestd:item/save for slot index and details) Input: |

scoreboard players set @s aestd.item.slot -2 scoreboard players set @s aestd.item.count -1 function aestd:item/add_count
 * 1) This function reduces the count of a player's or mob's offhand item

add_custom_model_data.mcfunction
Adds a value to the custom model data field of an item (see aestd:item/save for slot index and details) Input: |

add_damage.mcfunction
Adds to the damage of an item (see aestd:item/save for slot index and details). Breaks the item if durability becomes negative. Negative inputs will repair the item instead of damaging it. Input: |

scoreboard players set @a aestd.item.dmg 5 scoreboard players set @a aestd.item.slot -1 execute as @a run function aestd:item/add_damage
 * 1) This function damages all player's selected items

add_enchantment.mcfunction
Adds an enchantment to an item (see aestd:item/save for slot index and details). Input: | |

Enchantments use the following values for, corresponding to their protocol ID:
 * 0 - Protection
 * 1 - Fire Protection
 * 2 - Feather Falling
 * 3 - Blast Protection
 * 4 - Projectile Protection
 * 5 - Respiration
 * 6 - Aqua Affinity
 * 7 - Thorns
 * 8 - Depth Strider
 * 9 - Frost Walker
 * 10 - Curse of Binding
 * 11 - Sharpness
 * 12 - Smite
 * 13 - Bane of Arthropods
 * 14 - Knockback
 * 15 - Fire Aspect
 * 16 - Looting
 * 17 - Sweeping Edge
 * 18 - Efficiency
 * 19 - Silk Touch
 * 20 - Unbreaking
 * 21 - Fortune
 * 22 - Power
 * 23 - Punch
 * 24 - Flame
 * 25 - Infinity
 * 26 - Luck of the Sea
 * 27 - Lure
 * 28 - Loyalty
 * 29 - Impaling
 * 30 - Riptide
 * 31 - Channeling
 * 32 - Multishot
 * 33 - Quick Charge
 * 34 - Piercing
 * 35 - Mending
 * 36 - Curse of Vanishing

These values do not all correspond to the ones previously used in the  NBT tag.

scoreboard players set @s aestd.item.slot -1 scoreboard players set @s aestd.item.ench 11 scoreboard players set @s aestd.item.lvl 5 function aestd:item/add_enchantment
 * 1) This function adds sharpness V to a player's or mob's held item

add_lore.mcfunction
Adds a line of lore to an item (see aestd:item/save for slot index and details). If the executing entity has the  tag, text will not be formatted to JSON. Input: |save chunk (1519204 6 0  )

data modify block 1519204 6 0 RecordItem.tag.aestd.text set value "Hello world" scoreboard players set @p aestd.item.slot 4 function aestd:item/add_lore data modify block 1519204 6 0 RecordItem.tag.aestd.text set value '{"text":"Hello world","color":"aqua","italic":false}' tag @s add aestd.preformatted_text function aestd:item/add_lore
 * 1) This function adds the text "Hello world" to the item contained in the fifth hotbar slot of the nearest player, with default formatting then with a different color and style.

break.mcfunction
Simulates the breaking of an item (see aestd:item/save for slot index and details). Input:

get_max_durability.mcfunction
Returns the durability of an item (see aestd:item/save for slot index and details). This will only work for vanilla items. Input:, output:

load.mcfunction
Loads an item to the executing entity's inventory (see details below and aestd:item/save). Used internally along with aestd:item/save by most item functions. Input: save chunk (1519204 6 0 )|

If the executing entity is an item entity, its data will be changed directly from the save chunk.

If the executing is a player or a mob, its  score determines in what slot the item will be loaded: Slot index

If the executing entity has the  tag, the item will be loaded in a container's slot at context position instead. corresponds to the item's  tag (eg. 4 for the middle of a dropper)

scoreboard players set @a aestd.item.slot -2 execute as @a run function aestd:item/save scoreboard players set @a aestd.item.slot 103 execute as @a run function aestd:item/load
 * 1) This function moves all players' offhand item to their head slot

merge_nbt.mcfunction
Merges NBT from the save chunk to the 'tag' tag of an item. This can be used to add custom tags as well as default vanilla tags. '''In Minecraft 1.14.4 Pre-release 5, it is already possible to do with the data merge command. However, this will not work if the item does not already have metadata and this relies on a bug which may be fixed in the future.''' Input: |save chunk (1519204 6 0  )

data modify block 1519204 6 0 RecordItem.tag.aestd.nbt set value {display:{Name:'"hello"'}} scoreboard players set @s aestd.item.slot 103 function aestd:item/merge_nbt
 * 1) This function sets a player's head item's name to hello

remove_attribute_modifiers.mcfunction
Removes attribute modifiers from an item.

scoreboard players set @s aestd.item.slot 4 tag @s add aestd.item.container scoreboard players set @s aestd.list_mode -1 execute if block ~ ~ ~ minecraft:dropper run function aestd:item/remove_attribute_modifiers
 * 1) This function removes the last attribute modifier of the item in the center of a dropper

remove_data.mcfunction
Removes all NBT data from an item (name, enchantments, lore, damage…) (see aestd:item/save for slot index). Input:

remove_enchantments.mcfunction
Removes enchantments from an item.

scoreboard players set @s aestd.item.slot 103 scoreboard players set @s aestd.list_mode 1 function aestd:item/remove_enchantments
 * 1) This function removes all enchantments on the player's helmet

remove_lore.mcfunction
Removes lines of lore from an item.

save.mcfunction
Saves an item to the save chunk. This function is used internally by most item functions.

set_count.mcfunction
Sets the count of an item to a score, limiting to the item's stack size. Setting the score to 0 or any negative value before running this function will delete the item. Input:

set_custom_model_data.mcfunction
Sets the custom model data field of an item to a score. Input:

set_damage.mcfunction
Sets the damage of an item to a score. Input:

set_nbt.mcfunction
Sets an item 'tag' tag's NBT to NBT from the save chunk. This can be used to add custom tags as well as default vanilla tags. '''In Minecraft 1.14.4 Pre-release 5, it is already possible to do with the data modify command. However, this will not work if the item does not already have metadata and this relies on a bug which may be fixed in the future.''' Input:  tag in the jukebox placed at (1519204, 6, 0)

data modify block 1519204 6 0 RecordItem.tag.aestd.nbt set value {display:{Name:'"hello"'}} scoreboard players set @s aestd.item.slot 103 function aestd:item/set_nbt
 * 1) Resets a player's head item NBT and sets the NBT {display:{Name:'"hello"'}}

get_block_id.mcfunction
Saves a block's numerical ID to a score. This numerical ID corresponds to a protocol ID in the  file. This ID is used in other functions. Output:

highlight_block.mcfunction
Highlights the block at context position with end rod particles.

load.mcfunction
Loads a previously saved block to the block at context position.

randomize_structure_block.mcfunction
Randomizes the mirror and the rotation of the load structure block at context position.

save.mcfunction
Copies the block at context position to the save chunk.

set_skull_owner.mcfunction
Sets the owner of the player head at context position to a player whose name was previously saved by the aestd:player/get_name function.

get_biome.mcfunction
Saves the biome ID at context position to the sender's  score.

get_position.mcfunction
Saves the context position to 3 scores, rounded to integers.

get_rotation.mcfunction
Saves the context rotation to 2 scores, rounded to integers.

load_chunk.mcfunction
Loads the chunk in which this function runs for the current tick.

get_block_looking_at.mcfunction
Finds the block the player is looking at, up to 64 blocks away. Looks through water and lava. Resets scores if no block is found. Output: | |

get_name.mcfunction
Saves the name of the executing player to the save chunk. This name can then be used by other functions such as aestd:entity/set_head and aestd:block/set_skull_owner. The player whose name is currently saved has the tag. Output: save chunk (1519204 6 0 )

get_spawnpoint.mcfunction
Saves the coordinates of the executing player's spawnpoint to its position scores. Output: | |

get_uuid.mcfunction
Saves the string UUID of the executing player to the save chunk's data item. This UUID can then be used by other functions such as aestd:entity/wolf/tame. Not to be confused with aestd:entity/get_uuid.mcfunction, which saves the UUID as two tags which can be used in different situations by different functions (e.g. aestd:entity/anger and aestd:entity/projectile/set_owner_uuid). The player whose UUID is currently saved has the tag. Output: save chunk (1519204 6 0 )

set_damage.mcfunction
Sets the attack damage of the executing player (default = 100 = half a heart). Stacks with strength/weakness effects, attribute modifiers and weapon damage. Damage is reset at death. Input:

set_experience_levels.mcfunction
Sets the executing player's experience levels to a fixed value. Input:

set_head.mcfunction
See aestd:entity/set_head

set_knockback_resistance.mcfunction
Sets the knockback resistance chance (in percents) of the executing player (default = 0). Stacks with attribute modifiers. Knockback resistance is reset at death. Input:

set_movement_speed.mcfunction
Sets the movement speed of the executing player (default = 100). Stacks with swiftness/slowness effects, sprinting, crouching and attribute modifiers. Movement speed is reset at death. Input:

set_position.mcfunction
See aestd:entity/set_position

set_position_scale50.mcfunction
See aestd:entity/set_position_scale50

set_rotation.mcfunction
See aestd:entity/set_rotation

teleport_surface.mcfunction
See aestd:entity/teleport_surface

teleport_to_chunk_corner.mcfunction
See aestd:entity/teleport_to_chunk_corner

Math
Most math functions take input from the executing entity's  and   scores and send output to its   score. This means that a math function needs to be executed by an entity and not directly ran from a command block or from.

absolute.mcfunction
Returns the absolute value of an integer. Input:, output:

Examples: 316 -> 316; -752 -> 752

cos.mcfunction
Returns the cosine of an integer (in degrees) multiplied by 1000. Input:, output:

Examples: 0 -> 1000, 30 -> 866, 120 -> -500

get_vector_magnitude.mcfunction
Gets the magnitude of a vector with given coordinates. Input: | |, output:

Example: (1784, 5139, 3396) -> 6412

linear_interpolation.mcfunction
Calculates an interpolation between two inputs (in and in2) for a parameter (var) in the closed interval [0, 1000] When var is 0, returns in. When var is 1000, returns in2. Input: | |, output:

Example: (in=3, in2=68, var=400) -> 29

perlin_noise.mcfunction
Uses a modified Perlin noise algorithm to generate values between -1000 and 1000. Interpolates between thousands (actual Perlin noise interpolates between integers but the scoreboard cannot compute decimals). Input: | |, output:

power.mcfunction
Calculates pow(a,b) with b in [1;30]. Input: |, output:

Example: (in=2, in2=26) -> 67108864

random.mcfunction
Generates a random integer from 0 (included) to aestd.random.max (excluded). Input:, output:

random_lcg.mcfunction
Generates a random integer from 0 (included) to aestd.random.max (excluded). Uses a linear congruential generator, which is more efficient than the UUID method used in aestd:math/random. Input:, output:

random_range.mcfunction
Generates a random integer from min (included) to max (excluded). Input: |, output:

random_range_lcg.mcfunction
Generates a random integer from min (included) to max (excluded). Uses a linear congruential generator, which is more efficient than the UUID method used in aestd:math/random_range. Input: |, output:

set_vector_magnitude.mcfunction
Modifies the magnitude of a vector. Input: | |, output:

Example: (1784, 5139, 3396), magnitude=5000 -> (1391, 4007, 2648)

sin.mcfunction
Calculates the sine of an integer (in degrees) multiplied by 1000. Input:, output:

Examples: 0 -> 0, 30 -> 500, 240 -> -866

smoothstep.mcfunction
Returns S1(x)=3x^2 - 2x^3. x should be between 0 and 1000 and will be divided by 1000 in the operation. Clamps x to the interval [0, 1000]: if x<0, returns 0; if x>1000, returns 1000. Input:, output:

Example: 400 -> 352

square_root.mcfunction
Calculates the square root of a given number using the Babylonian method. If input is strictly negative, resets output. Input:, output:

Example: 2 147 395 600 -> 46 340

ticks_to_time.mcfunction
Converts a time in ticks into hours, minutes, seconds and hundredths. Input:, output:   (Playernames:  ,  ,  ,  )

add_marker.mcfunction
Summons an area_effect_cloud entity at given coordinates for this tick only with tag This marker can be targeted with the UUID. There can only be a single marker at the same time. Input: | |

get_daytime.mcfunction
Returns the period of the day to a score. Output:

get_moon_phase.mcfunction
Calculates the moon phase of the current night/upcoming night, updates at sunrise. Output:

get_weather.mcfunction
Returns the current weather. Output:

remove_time.mcfunction
Removes a duration in ticks from the world time (opposite operation of ). If an entity is executing this function, its score will be used. Otherwise (function ran from a command block or from ), uses the score of. Input:

set_time.mcfunction
Sets the world time to any value. If an entity is executing this function, its score will be used. Otherwise (function ran from a command block or from ), uses the score of. Input: