This datapack for Java Edition gives any player the ability to craft a new block called: Block protec lv1 which will protect a 11x11x11 square centered on this block. This block can be upgraded to extend its protection zone. Within this zone, unauthorized players are unable to break or place blocks, harm passive entities, or open containers.
Note that this datapack requires no Resource pack.
Crafting this yields the block: which is the level 1 protection block.
The protection block consists of 5 levels.
Protection Square (top view) | Protection Height | |
---|---|---|
Level_1 | ||
Level 2 | ||
Level 3 | ||
Level 4 | ||
Level 5 |
To upgrade your protection block to the next level, you need to have the correct number of diamonds in your inventory. Then, you must go to page 3 of the Menu Book (accessible by right-clicking on the protection block) and choose the action: [ Upgrade ].
Default costs:
Cost | |
---|---|
from level 1 to level 2: | 5 |
from level 2 to level 3: | 26 |
from level 3 to level 4: | 64 |
from level 4 to level 5: | 128 |
The costs to advance to the next level can be adjusted by administrators using the following commands:
/scoreboard players set .#level_2 bp_diamond 5
/scoreboard players set .#level_3 bp_diamond 26
/scoreboard players set .#level_4 bp_diamond 64
/scoreboard players set .#level_5 bp_diamond 128
Visual limit of the protection zone:
- An unauthorized player switches to Adventure mode (gamemode 3) when within 13 blocks of a protected zone (referred to as the Intermediate Zone), preventing them from placing or breaking blocks.
- PvP is disabled.
- TNT (enabled), TNT minecarts, and Ender crystals are instantly removed.
- All passive entities are protected (List of protected entities).
- Protected entities cannot take projectile damage within a protected zone.
- Unauthorized players cannot throw potions that inflict negative effects.
This is a 13-block zone beyond the protection limit (visual limit), regardless of the protection block's level. It is possible from outside this zone to destroy blocks within the intermediate zone by various means: player reach to break blocks, TNT, pistons, etc. Therefore, blocks in this zone are not fully protected.
Within this zone:
- Pistons are destroyed to prevent attacks by flying machines.
- TNT (enabled), TNT minecarts, Ender crystals, and chicken eggs are instantly removed.
Example:
Here, two protection blocks could be placed by two different players because it is the shortest distance between two zones belonging to different owners. In the case of overlapping intermediate zones with protection blocks owned by different players, no player can place or break blocks once within this overlapping zone.
By default, a placed block is a main block, visible in the form of an enchantment table. Extensions are smaller and are automatically formed when a protection block you own and its protection boundaries touch. Players added as members in your zone are also added to your extensions.
Example:
When in creative mode, you have full control over any protection block. You can access the menu book to execute any action as if you were the owner.
This option allows changing whether players revert to survival mode when leaving a protected zone:
/scoreboard players set bp_survivalInFreeZone gamerule 1
- 1 = true
- 0 = false
The maximum number of main protection blocks and extensions is limited by default:
- 3 main protection blocks
- 5 extensions per player
This global limit for all players can be changed by an administrator using two commands:
/scoreboard players set .#default bp_maxMainArea 3
for main blocks
/scoreboard players set .#default bp_maxExtArea 5
for extensions
The administrator can also create limits for specific players, and these limits will take precedence over default limits.
Example:
/scoreboard players set Dinnerbone bp_maxMainArea -1
sets no limit on the total number of main blocks only for the player Dinnerbone.
Tutorials/Installing a Data Pack
If you're using this Datapack on a server, you need to enable command blocks in the server options. In the server.properties file, modify the following line:
enable-command-block=true
* This Datapack does not require Resource Packs to function.
Passionate about Minecraft since the very beginning, I always felt like there was something missing to enhance the multiplayer aspect, and I try to add it through my developments and Datapacks.
Useful Links:
You can also email me at: flo.dev.yt@gmail.com for any issues or feedback.