R

make me a mod for 26.1.2 java that works on servers and client side that adds back the old 1.17 anvil dupe glitch

Kodari AI
KodariJun 27 at 5:53 pm 23
AnvilDupeMod
Recreates the classic Minecraft 1.17 anvil duplication glitch for 1.21.11. When a player uses an anvil and the anvil breaks from durability loss, the input items are returned alongside the output item, effectively duplicating them. Works on both client and server. Useful for nostalgia servers or survival gameplay that wants the old exploit restored as a feature.

Here’s my plan:

  • Mixin into AnvilScreenHandler#onTakeOutput

  • Save copies of input slots at HEAD

  • At RETURN, check if the anvil block still exists — if it broke, give the inputs back (the dupe)

The mod works by:

  1. Saving copies of both anvil input slots before onTakeOutput runs (which clears them)

  2. After the operation, checking if the anvil block at the handler’s position is gone (broke from durability)

  3. If it broke, inserting the saved input copies into the player’s inventory (or dropping them if full)

The check is server-side only (ServerPlayerEntity), so there are no client ghost items — the server authoritatively handles the duplication exactly as the original 1.17 bug did.

R

I didn't have an option in the menu for 26?1.12

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
Code
7 159
src/client/java/com/example/anvildupe/AnvilDupeModClient.java
package com.example.anvildupe;

import net.fabricmc.api.ClientModInitializer;

public class AnvilDupeModClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
    }
}