[TUTOTIAL] 5x5 pickaxe with enchantment support | Using loot table | 2024.2-2025.2 | NeoForge 1.20.4-1.21.4

Started by doomsday_fire on

Topic category: User side tutorials

Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTOTIAL] 5x5 pickaxe with enchantment support | Using loot table | 2024.2-2025.2 | NeoForge 1.20.4-1.21.4
Fri, 08/08/2025 - 12:20 (edited)

I was trying to make my own mod, but have no time to develop it solo sadly.
So I'm here to share some feature, which probably will help somebody.
Procedure that behaves like hammer (3x3, 5x5, etc)
NeoForge 1.20.4-1.21.4, 2024.2-2025.2 (tested), but should work in future versions too.

IF ANY LINKS OR IMAGES ARE BROKEN IN THIS GUIDE, CONTACT ME IN DISCORD - @doomsdayfire


Features:

  • Universal to use with any blocks - you don't need to check for each block material manually
  • Breaks only mineable by pickaxe blocks
  • Supports enchantments (Silk touch, Fortune, Your custom ones like Auto-Smelting)
  • Any direction
  • Customizable for other sizes
  • Clear & easy procedure (as far as I think...)

Step 1. Creating tool - pickaxe

There you choose your preferred properties: tier, efficiency, durability.

You have to create a trigger: When block destroyed with tool

Step 2. Procedure import
Open it and import Pickaxe_guide.ptpl file (Procedure file):

There are some of Local variables created automatically, they will be explained later

Step 3. Work explanation
Breaking the block makes procedure to check 5x5x5 area, where middle block is originally breaking one. Depending on the direction of breaking, the extra direction is blocked, making the area for checking 5x5 (25 blocks) instead of 5x5x5 (125 blocks). This is done to make the procedure compact.

Scheme: Green block is main that breaks

Step 4. Procedure overview

There we have 5x5x5 matrix. Using 3 repeating blocks (green ones) we incrementing x, y, z parameters step by step and breaking block.

If any lock_x / lock_y / lock_y variable set to 0, repeating block looks like this: Repeat ((0 * 4) + 1) times -> Incrementing coordinate & break block
So in that case there is no actual repeat, using part of procedure just ones.

But it every direction case we locking just 1 lock, every time checking for 5x5 area we need.

First of all, we read procedure from inside to outside.
Lets assume we looking North or West, so we need to lock extra direction from incrementing - procedure sets lock_z = 0. Others are = 1. 
Now we read procedure:
1) Repeat ((1*4) + 1) times (So 5 times): Break block with coordinates (local_x, local_y, local_z), then increment local_x by 1 to move to next block of layer

2) Repeat ((1*4) + 1) times (So 5 times): Break block witch coordinates (local_x, local_y, local_z), then increment local_x by 1 and decrement local_x by 5 to move to next layer

3) Repeat ((0*4) + 1) times (So 1 time only): Break block... But there is nothing left to break in that case - we cleared 5x5 area we wanted. But still increment local_z by 1 and decrement local_y by 5. It's needed since procedure is universal for any directions.
- We made 5x5=25 block breaks because of these repeating blocks.

Block breaking, part 1.

  • Formatting registry_name of broken block with local coordinates.

    Format example: minecraft:diamond_ore -> minecraft:blocks/diamond_ore (this formatting is used for loot tables later)
    This can be used with all custom blocks from your mod as well

  • Store each loot table item from [ broken block ] granted for Player, making possible to consider enchantments of holding pickaxe as Itemstack iterator
  • Itemstack iterator will be used to spawn loot for each block individually. For example, we have 5x5 area, where part of blocks is diamond ore, another part is iron ore.
  • By modifying vanilla loot tables, we can work with custom enchantments (check This site to make loot tables with vanilla presets)

    - Example: Auto-smelting enchantment -> Create enchantment mod element -> Copy silk_touch part of vanilla loot table -> Input your enchantment name and loot
    [Loot table example for iron ore with auto-smelting]

Block breaking, part 2.

  • Check 1: Loot for block is not empty (to prevent bedrock from trying to drop for example)
    Check 2: Can pickaxe break block with local coordinates (to check tool tier, if we set pickaxe to wood level)
  • Exclude original block from counting to reduce durability. So we lose -24 durability and -1 extra because of breaking event itself
    - If pickaxe able to break only 10 blocks because of durability or block material, it will lose only 10
  • Spawn loot table of each block at original block / each broken block coordinates (see variants below)
  • Remove block at local cooridnates (without original drop, because we use loot table) and spawn particles

    [Full procedure overview]


    Ingame examples

  • Applying Unbreaking enchantments work aswell

     

    Addition: procedure.ptpl based on enchantment value (Efficiency by default), enchantment_level_1 = 3x3, enchantment_level_2 = 5x5 etc.
    For any type of tools (Use global trigger: A block is broken)


    If you have any questions or suggestions, feel free to ask in comments or discord (@doomsdayfire).

    Procedure link

Edited by doomsday_fire on Fri, 08/08/2025 - 12:20
Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@doomsday_fire  if I try to…
Fri, 02/07/2025 - 16:53

@doomsday_fire  if I try to break something like a cross, only the block in the middle breaks visually, but in fact it is there and it is impossible not to pass through it and break it, since it has become transparent.

Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@alikd Sorry for late…
Mon, 02/17/2025 - 19:29

@alikd Sorry for late response, I've been busy with work. Sadly, tested it on NeoForge aswell. Feels like a bug we facing is for Forge version only. Probably rearrange block-breaking part in procedure somehow does help, but honestly have no idea why this happened

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I know im a little late to…
Fri, 08/22/2025 - 03:55

I know im a little late to the party, but is there any way to use the face of the block being broken instead of the players camera pitch/yaw to determine what direction to break in?

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I figured it out. it wasnt…
Fri, 08/22/2025 - 05:10

I figured it out. it wasnt too hard, just needed to get used to procedures.