tim1438746

Create a mod for a new pickaxe enchantment: the drill automatically digs when you break 1 block, then it digs a 3 x 3 tunnel.

Kodari AI
KodariAug 20 at 7:56 am 8
DrillEnchantment
Adds a new "Drill" enchantment for pickaxes. When a player breaks a block, the drill automatically excavates a 3x3 tunnel in the direction the player is facing. The enchantment works on all breakable blocks, respects tool durability, and integrates with vanilla mining speeds. Includes configurable radius and depth settings.
  • Set up a Fabric 1.21.11 Yarn project named Tunnel Drill.

  • Define the data-driven Drill enchantment and make it available from enchanting and trades.

  • Add a server-side break handler that mines the adjacent 3×3 tunnel face using vanilla player break logic.

Created the Fabric 1.21.11 Tunnel Drill mod. The Drill enchantment applies to pickaxes and mines the surrounding 3×3 face after a block is broken, preserving vanilla break handling, drops, durability, and permissions.

tim1438746

The compilation failed with this error:

code
Compilation failed with 4 error(s):

ERROR in src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 30: incompatible types: invalid method reference
        PlayerBlockBreakEvents.AFTER.register(DrillMiningHandler::afterBlockBreak);
                                              ^

ERROR in src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 70: no suitable method found for getEntry(RegistryKey<Enchantment>)
        return enchantments.getEntry(DRILL)
                           ^

ERROR in   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 70: no suitable method found for getEntry(RegistryKey<Enchantment>)
          return enchantments.getEntry(DRILL)
                             ^

ERROR in   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 30: incompatible types: invalid method reference
          PlayerBlockBreakEvents.AFTER.register(DrillMiningHandler::afterBlockBreak);
                                                ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: invalid method reference
  - incompatible types: invalid method reference
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java
  -   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariAug 20 at 8:01 am 3
  • Match the block-break callback’s current ServerPlayerEntity signature.

  • Resolve the data-driven enchantment through the world registry manager’s keyed entry lookup.

  • Retain the existing server-side 3×3 mining behavior.

Corrected DrillMiningHandler for Fabric 1.21.11:

  • Updated PlayerBlockBreakEvents.AFTER handler to accept ServerPlayerEntity.

  • Replaced unsupported registry getEntry(...) call with getEntryOrThrow(DRILL).

  • Preserved server-side 3×3 tunnel mining and recursion prevention.

tim1438746

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 29: incompatible types: invalid method reference
        PlayerBlockBreakEvents.AFTER.register(DrillMiningHandler::afterBlockBreak);
                                              ^

ERROR in   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 29: incompatible types: invalid method reference
          PlayerBlockBreakEvents.AFTER.register(DrillMiningHandler::afterBlockBreak);
                                                ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: invalid method reference
  - incompatible types: invalid method reference
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java
  -   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariAug 20 at 8:08 am 3
  • Use Fabric’s World/PlayerEntity callback signature.

  • Restrict the handler to ServerWorld and ServerPlayerEntity before mining.

  • Preserve the existing registry lookup and recursion guard.

Updated DrillMiningHandler to use the actual Fabric PlayerBlockBreakEvents.AFTER callback signature: World and PlayerEntity.

The handler now safely narrows those parameters to ServerWorld and ServerPlayerEntity before performing server-side 3×3 mining.

tim1438746

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 29: incompatible types: invalid method reference
        PlayerBlockBreakEvents.AFTER.register(DrillMiningHandler::afterBlockBreak);
                                              ^

ERROR in   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java at line 29: incompatible types: invalid method reference
          PlayerBlockBreakEvents.AFTER.register(DrillMiningHandler::afterBlockBreak);
                                                ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: invalid method reference
  - incompatible types: invalid method reference
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java
  -   src/main/java/com/kodari/tunneldrill/DrillMiningHandler.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariAug 20 at 9:53 am 7
  • Replace the ambiguous method reference with an inferred Fabric callback lambda.

  • Keep the handler’s broad World/PlayerEntity arguments and server-side narrowing.

  • Preserve the existing 3×3 mining logic and enchantment lookup.

Replaced the failing method reference with a callback lambda, allowing Fabric to infer the exact AFTER event parameter types. The server-side 3×3 tunnel behavior remains unchanged.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
11 226
src/main/java/com/kodari/tunneldrill/TunnelDrillMod.java
package com.kodari.tunneldrill;

import net.fabricmc.api.ModInitializer;

public class TunnelDrillMod implements ModInitializer {
    public static final String MOD_ID = "tunneldrill";

    @Override
    public void onInitialize() {
        DrillMiningHandler.initialize();
    }
}