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.
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.
The compilation failed with this error:
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.
Match the block-break callback’s current
ServerPlayerEntitysignature.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.AFTERhandler to acceptServerPlayerEntity.Replaced unsupported registry
getEntry(...)call withgetEntryOrThrow(DRILL).Preserved server-side 3×3 tunnel mining and recursion prevention.
The compilation failed with this error:
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.
Use Fabric’s
World/PlayerEntitycallback signature.Restrict the handler to
ServerWorldandServerPlayerEntitybefore 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.
The compilation failed with this error:
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.
Replace the ambiguous method reference with an inferred Fabric callback lambda.
Keep the handler’s broad
World/PlayerEntityarguments 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.
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();
}
}