Skip to content

datapack function library for Minecraft 1.20.1, 1.21.1

This data pack provides developers with some useful functions and is compatible with all versions of Minecraft (except for those versions where data packs cannot be installed).

On a server
downloads
1 downloads
views
296 views
Updated
Updated 29.11.2026

About the datapack function library data pack

中文介绍:GitHub | MC 百科

Preface

This datapack is licensed under the GNU LGPL 3.0.

This datapack provides developers with some practical functions (and some dialogs), compatible with all versions of Minecraft (except for versions that cannot install datapacks).

However, due to the large number of commands involved in the datapack, lower versions may not be able to use all functions. The applicable versions of all functions will not be specified below.

Please install the resource pack at the same time to enable localized content. Otherwise, the datapack language will be Simplified Chinese.

This datapack provides a dfl:installed function containing return 1. It is convenient for datapacks or mods that depend on this datapack to detect whether this datapack is loaded.

Example:

Detect

scoreboard objectives add tmp dummy execute store success score loaded tmp run function dfl:installed

If not loaded

execute unless score loaded tmp matches 1 run say DFL is not loaded

If loaded

execute if score loaded tmp matches 1 run say DFL is loaded

Note: Some functions have "prerequisite functions" attached to their usage. These functions must be executed once before executing them.

Some function usages are followed by {xx:"xx"}. These functions are macro functions#Macros). When using them, you need to pass parameters through {:""}. The parameter name (such as num) is expressed as: {num} in the text. The parameter format can refer to the function usage, and special formats will be explained.

If you encounter any problems, please click here to give feedback.

Function Description

Start

Functions in this category are recommended to be executed when the datapack is loaded (reloaded).

Disable Special Damage

Function usage: /function dfl:start/disable_special_damage

  • Fall damage;
  • Fire damage;
  • Freeze damage;
  • Drowning damage.

Fix the respawn point to 0 0

Function usage: /function dfl:start/set_world_spawn

  • Set the world respawn point to 0 0 0;
  • Set the respawn point radius to 0;
  • At this time, the player will be fixed to respawn on the highest block at coordinate 0 0.

Enable death leaderboard

Function usage: /function dfl:start/show/enable_death_scoreboard

  • Create a scoreboard item named death;
  • The number of deaths will be displayed on the right side of the screen;
  • The number of player deaths is sorted from high to low;
  • Note: The death leaderboard will not be displayed when it is first enabled, and it will be displayed only after any player dies.

Display player health

Function usage: /function dfl:start/show/display_health_below_name

  • Create a scoreboard item named health;
  • The player's health will be displayed below the player's ID;
  • It will not be displayed if the distance is slightly far (only the player's ID is displayed);
  • Note: When it is first enabled, the health will be displayed as 0, and it will be displayed only after the value is updated (such as being injured).

Display player experience level

Function usage: /function dfl:start/show/display_level_in_tab

  • Create a scoreboard item named level;
  • The experience level of each player will be displayed in the Tab bar (player list bar);
  • Note: When it is first enabled, the experience level will be displayed as 0, and it will be displayed only after the value is updated (such as leveling up).

Display player health bar

Function usage: /function dfl:start/show/display_health_in_tab

  • Create a scoreboard item named health;
  • The health bar of each player will be displayed in the Tab bar (player list bar).
  • The effect is as follows:

![[DFL] Datapack Function Support Library (datapack function library)-Image 1](https://raw.githubusercontent.com/TouchController/E1epack/main/subprojects/datapack-function-library/README/Scoreboard_Display_List_Hearts.gif)

Quickly create a new team

Function usage: /function dfl:start/create_teams {team_blue:"blue",team_red:"red",prefix_blue:"blue",prefix_red:"red"}

  • Create two teams named {team_blue} and {team_red};
  • The colors are blue and red respectively;
  • Disable friendly fire for players in the same team;
  • Players can only collide with entities not on the same team;
  • The player name prefixes are {prefix_blue}_ and {prefix_red}_ respectively.

Tick

Functions in this category are recommended to be executed every Tick.

Soft ban player

Function usage: /function dfl:tick/soft_ban_player {title:"Ban Reason",subtitle:"Note"}

  • Note: The executor of this function must be the player to be banned, you can use the /execute command;
  • Realize a soft ban by continuously tp the player to 0 0 0, setting the mode to adventure, and continuously giving the player negative buffs;
  • Must be executed every Tick;
  • Title is {title}, subtitle is {subtitle};
  • Example: /execute as @a[tag=ban] run function dfl:tick/soft_ban_player {title:"Ban Reason",subtitle:"Note"}.

The effect is as follows:

![[DFL] Datapack Function Support Library (datapack function library)-Image 2](https://raw.githubusercontent.com/TouchController/E1epack/main/subprojects/datapack-function-library/README/tick.ban.png)

Beacon elytra take-off

Function usage: /function dfl:tick/beacon_fly

  • When there are iron blocks, gold blocks, emerald blocks, diamond blocks or netherite blocks under the beacon, the player will be teleported upwards (spectators will not be teleported);
  • The heights are 20, 40, 60, 80, and 100 blocks in order;
  • The same blocks can be stacked to increase the height (the highest is 400 blocks, using four netherite blocks). If the blocks are different, the block closest to the beacon will be used.

One-click negative Buff

Function usage: /function dfl:tick/apply_debuffs

Give the function executor the following Debuffs:

  • slowness
  • mining_fatigue
  • nausea
  • darkness
  • hunger
  • weakness
  • poison
  • unluck
  • trial_omen

Iron block elevator

Function usage: /function dfl:tick/iron_block_elevator

  • Teleport the player upwards when standing between two iron blocks, one above the other;
  • The maximum teleportation distance is 6 blocks, that is, the maximum distance between two iron blocks is 5 blocks;
  • Will not teleport spectators;
  • Will teleport creatures and non-creature entities.

Clear entities if there are too many

Function usage: /function dfl:tick/kill_excess_entities {num:"1000"}

  • Clear all non-player entities when the number of non-player entities is greater than {num};
  • Will not clear entities with the need tag;
  • Entities with the need tag will not be counted in the number of entities here;
  • Create a scoreboard item named dfl_scoreboard.
  • After execution, a prompt will be displayed in the chat bar, the effect is as follows:

![[DFL] Datapack Function Support Library (datapack function library)-Image 3](https://raw.githubusercontent.com/TouchController/E1epack/main/subprojects/datapack-function-library/README/tick.kill.png)

Clear entities if the entity density is too high

Function usage: /function dfl:tick/kill_by_density {num:"50"}

Prerequisite function: /function dfl:lib/get_entity_density

  • Make all entities clear these entities when the number of entities within 10 blocks is greater than {num};
  • Will not kill players;
  • Will not kill villagers;
  • Will not kill entities with the need tag;
  • Will not leave traces in the chat bar.

Minecraft is too hard

Function usage: /function dfl:tick/mith

  • Enable keep inventory on death;
  • Give the executor night vision;
  • Give the executor glowing;
  • Remove the executor's darkness effect.

Display the number of entities

Function usage: /function dfl:tick/display_entity_count

Prerequisite function: /function dfl:lib/get_entity_count

  • Display the real-time number of entities in the player's action bar (above the shortcut bar).
  • The effect is as follows:

![[DFL] Datapack Function Support Library (datapack function library)-Image 4](https://raw.githubusercontent.com/TouchController/E1epack/main/subprojects/datapack-function-library/README/tick.show_entity.png)

Disable player friendly fire and collision

Function usage: /function dfl:tick/disable_friendly_fire

  • Add a team named dfl and add all players to this team;
  • Note: Since the same entity cannot join multiple teams, please do not enable this function if you want to use the player team function;
  • Disable team friendly fire;
  • Disable collision within the team;
  • If this function is not run every Tick, please make sure to run this function once after each new player joins.

Clear TNT if the TNT entity density is too high

Function usage: /function dfl:tick/kill_tnt_by_density {num:"200"}

  • Clear these TNT entities when the number of TNT entities within five blocks of the TNT is greater than {num};
  • Create a scoreboard item named dfl_tntdensity.

Suicide for players without permission

Function usage: /function dfl:tick/trigger_suicide

  • Create a scoreboard item named kill;
  • Enter /trigger kill to commit suicide (this command does not require any permission).

Replace blocks in a large area

Function usage: /function dfl:tick/change_block {new:"glass",old:"stone",num:"30"}

  • Replace {old} with {new} in a cube with a side length of {num}*2+1 centered on the command executor;
  • Change the game rule max_block_modifications to 2147483647.

Always day + always sunny

Function usage: /function dfl:tick/always_sunny

  • Turn off the day-night cycle;
  • Turn off weather changes;
  • Set the time to day;
  • Set the weather to clear.

Clear a single item and execute a command

Function usage: /function dfl:tick/clear_and_execute_single {namespace:"minecraft",name:"stone",run:"tp ~ 100 ~"}

  • Clear one {namespace}:{name} from all players and execute {run};
  • Note: There should be no extra spaces at the beginning and end of the command in the run parameter, and there should be no slash before the command.

Clear specified items and execute commands multiple times

Function usage: /function dfl:tick/clear_and_execute_multiple {namespace:"minecraft",name:"sand",run:"give @s anvil"}

  • Clear all {namespace}:{name} of the function executor and execute the corresponding number of {run} (within the same tick);
  • Note: There should be no extra spaces at the beginning and end of the command in the run parameter, and there should be no slash before the command.

Keep having an item

Function usage: /function dfl:tick/maintain_item_count {namespace:"minecraft",name:"slime_block",num:"64"}

  • Let the command executor have exactly the specified number of {namespace}:{name}.

How to install datapack function library

With Millida Launcher

  1. Install Millida Launcher

    The launcher is free: download it at millida.net/launcher and sign in with any nickname.

  2. Click “Install” on this page

    The launcher opens and installs the data pack for Minecraft 1.13–26.3 automatically, together with its dependencies: Localization Resource Pack.

  3. Launch the game

    A profile with it appears in the launcher: click “Play”.

Manually

  1. Download the archive

    Pick the file datapack-function-library_v6.0.0_26.1-26.3.zip (169 KB) for your game version.

  2. New world: “Data Packs”

    When creating a world, click “Data Packs”, drag the archive into the window, then move it to “Selected”.

  3. Existing world: the datapacks folder

    Put the archive into saves/<world>/datapacks and type /reload in game.

On a server

  1. Archive goes into the server world’s datapacks

    The world/datapacks folder on the server; players do not need to install anything.

  2. Reload the data

    Type /reload in the server console or restart the server.

  3. Use the “To server” button

    On Millida Hosting, the button at the top of the page uploads the file to your server and restarts it for you.

Versions

With dependencies

MinecraftLoaderFileDateActions
26.3Data pack26.3169 KB
1.21.11Data pack1.21.11169 KB
1.21.10Data pack1.21.10169 KB
26.3Data pack26.3164 KB
1.21.11Data pack1.21.11164 KB
1.21.10Data pack1.21.10164 KB 1
26.3Data pack26.3163 KB
1.21.11Data pack1.21.11163 KB

What it needs to run

Content that requires it

FAQ

Which Minecraft versions does datapack function library work on?

There are files for 1.13–26.3, 51 versions in total. The newest is 26.3.

Does datapack function library work on a server?

Yes: the data pack goes into the datapacks folder of the server world, and players do not need to install anything.

What does datapack function library need to work?

Required: Localization Resource Pack. Without it the data pack will not start.

Where can I download datapack function library safely?

On this page: the file datapack-function-library_v6.0.0_26.1-26.3.zip (169 KB) is stored on Millida’s server, with no link shorteners. SHA-1 checksum: e10e91280768f523c433136aea01ecc951507ee3.

Reviews

Be the first to rate datapack function library

Comments 0

Sign in to commentSign in

Similar data packs

All data packs

More on this

Author: white_elephantLicense: LGPL-3.0-or-laterSource code

Are you the author? Contact us — we will take it down within 48 hours.