User:Aeldrion/Projects/AESTD

AESTD is a utility datapack written by Aeldrion for Minecraft vanilla 1.14 that adds useful functions and tools to help making complex command systems easier. Its development started in July 2018.

= Features =

AESTD function library
The AESTD function library is the biggest feature of AESTD. It is divided in seven folders:,  ,  ,  ,  ,   and. Every function contains a comment documentation stating in what snapshot or version the function was last tested.

anger.mcfunction
Simulates the damaging of the sender by a 'target entity' whose UUID was saved in the save chunk with the  function. If the entity is neutral or hostile, it will become angry at the target entity. If the target entity is a player, the entity's death will count as a player kill and experience orbs will drop.

damage.mcfunction
Damages the sender by a score divided by 100. Can be set to burn or anger the damaged the entity with  function. Input:

get_direction.mcfunction
Returns the direction of the sender to three scores, scaled up by 1000 and rounded to integers. Output:,  ,

get_motion.mcfunction
Returns the motion of the sender to three scores, scaled up by 1000 and rounded to integers. Output:,  ,

get_rotation.mcfunction
Returns the direction of the sender to two scores, rounded to integers. Output: ,

get_position.mcfunction
Returns the position of the sender to three scores, rounded to integers. Output:,  ,

get_uuid.mcfunction
Saves the /  pair to the save chunk, which can then be used by other functions such as. Output: (1519204 6 0), (1519204 6 0)

set_direction.mcfunction
Sets the direction of the sender from three scores. Does not work for players. Input:,  ,

set_motion.mcfunction
Sets the motion of the sender from three scores. Does not work for players. Input:,  ,

set_position.mcfunction
Sets the position of the sender from three scores. Does not work for players: use  instead. Input:,  ,

set_rotation.mcfunction
Sets the rotation of the sender from two scores. Does not work for players. Input: ,

tame.mcfunction
Tames the sender and sets its owner to a player whose UUID was saved in the save chunk with the  function. Input: (1519204 6 0)

teleport_to_chunk_corner.mcfunction
Teleports the sender to the westernmost, northernmost corner of the chunk it is in. Does not work for players.

Item
Item functions modify an item of a player's or a mob's inventory. The item slot that is used is defined by the  score of the sender. If set to -1, it will select the sender's mainhand item. If set to -2 or -106, it will selected the sender's offhand item. If set to any other value, it will select the corresponding slot ID (example: 4 will select the fifth hotbar slot, 101 the legs slot. Armor slots will work for mobs even though there is no slot ID for mobs' item slots).

add_count.mcfunction
Adds a score to the count of an item, limiting to the item's stack size. Input:

add_custom_model_data.mcfunction
Adds a score to the custom model data field of an item. Input:

add_damage.mcfunction
Adds a score to the damage of an item. If this score is negative, the item will be repaired instead of damaged. Input:

add_lore.mcfunction
Adds a line of lore to an item from a text component saved to the save chunk. Input: (1519204 6 0)

load.mcfunction
Loads an item from the save chunk, previously saved with the.

remove_attribute_modifiers.mcfunction
Removes attribute modifiers from an item.

remove_data.mcfunction
Clear the entire item's NBT data (name, enchantments, lore, damage…)

remove_enchantments.mcfunction
Removes enchantments 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:

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

highlight_block.mcfunction
Highlights a block 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  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 coordinates of the block the player is looking at, in a distance defined by a score. Resets scores if the player isn't looking at a block. The maximum raycasting distance is 256. Any value below 0 will be set to 3. Input:, output:  ,  ,

get_name.mcfunction
Saves the name of the player to the save chunk. Output: (1519204 6 0)

get_spawnpoint.mcfunction
Saves the player's spawnpoint to three scores. Output:,  ,

get_uuid.mcfunction
Saves the entire UUID of the player to the save chunk (not the same as, which saves the  /  pair). Output: (1519204 6 0)

set_experience_levels.mcfunction
Sets the player's experience levels to a score. Input:

set_position.mcfunction
Teleports the player to coordinates from three scores. does not work on players. Input:,  ,

Math
Most math functions take input from the sender's aestd.math.in and aestd.math.in2 scores and send output to the sender's aestd.math.out score. If there is no sender, input will be taken from and output will be sent to #aestd's scores.

absolute.mcfunction
Returns |x|

cos.mcfunction
Returns 1000*cos(x) where x is an angle in degrees

power.mcfunction
Returns x^x2 where x2 is in the range [1;30]

random.mcfunction
Returns a random integer between 0 and aestd.random.max (excluded)

random_range.mcfunction
Returns a random integer in the [aestd.random.min;aestd.random.max[ range

sin.mcfunction
Returns 1000*sin(x) where x is an angle in degrees

add_marker.mcfunction
Summons a marker entity (area effect cloud) at given coordinates with an  tag for the current tick. Only one marker can exist at any given time; adding a marker will remove the last marker. Input:,  ,

get_daytime.mcfunction
Saves the current period of the day to the sender's  score.

get_moon_phase.mcfunction
Saves the current moon phase to the sender's  score.

get_weather.mcfunction
Saves the current weather to the sender's  score.

Useful tags
AESTD also features several item, block and entity tags.

Summary of item tags
,,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,

Summary of entity type flags
,,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,

Summary of block tags
,,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,

TPS calculator
The TPS calculator is a tool of the  namespace. It evaluates the ticks per second on a ten second period. To use the TPS calculator, use the command.

It uses the shrinking of the world border to compare ticks and actual time. When a TPS test has started, it must end before another TPS test starts.

Save chunk
The save chunk (positioned at x=1519204, z=0) is a chunk that AESTD uses to save data used by other functions. When AESTD is loaded for the first time in a new world, it will ask players to run a /forceload command to mark that chunk for force loading. Its loading is essential for many functions to work.

= Datapack structure =

= Guides =

Setting up the save chunk
When you first load AESTD in your world, a message should appear in the chat, saying "WARNING - AESTD is not fully loaded. This may cause datapacks to malfunction." with a link suggesting a  command. Click it, and AESTD should load.
 * If you are not an administrator of the server: contact an administrator and ask them to run the following command:
 * If you are in singleplayer with cheats disabled: pause the game, click Open to LAN, set Allow Cheats to ON and click Start LAN world. You should now be able to run the command by clicking the link.

Merging your datapack with AESTD
If you want to share your datapack but don't want to tell people to download two datapacks, you can merge your datapack with AESTD by going through the following steps:


 * 1) Copy namespaces to your datapack. Open the AESTD datapack. Copy the ,   and   namespaces and move them to your datapack's   folder.
 * 2) Move loot tables to your datapack. Open the AESTD datapack. Go in   and copy loot tables to your datapack, under the   namespace. If your datapack modifies the player loot table or the orange shulker box loot table, make sure players still drop their heads when killed with   tag and that orange shulker boxes still drop only their contents when broken with a tool with the   NBT data.
 * 3) Merge  . Open your datapack. Go in   and add the following function:  . If there is no such file or directory, create it and copy from.
 * 4) Merge  . Open your datapack. Go in   and add the following functions: ,   and  . If there is no such file or directory, create it and copy from.

= Download =

= Links =

GitHub repository

“Aeldrion Creations” Discord server