Yahia Elzayat

a mod that removes the xp cost for enchanting table and anvil for 26.3

Kodari AI
KodariOct 13 at 7:14 am 2
FreeEnchanting
A Minecraft Fabric mod for version 26.3 that eliminates experience point costs for both enchanting tables and anvils. Players can enchant items and combine or repair gear at anvils without spending any XP levels. The mod intercepts the vanilla cost calculation logic and sets all experience requirements to zero while preserving the item durability and enchantment mechanics. It provides a seamless quality-of-life improvement for players who want to focus on crafting and progression without grinding for experience points. The mod is lightweight, client and server compatible, and configurable to allow players to toggle the feature on or off through a simple in-game configuration option.
  • Create the 26.3 Fabric project skeleton and metadata.

  • Add mixins that make enchanting-table and anvil operations require no XP levels.

  • Keep normal enchanting ingredients (lapis) and anvil inputs intact.

Created the 26.3 Fabric mod. Enchanting and anvil operations no longer require or consume XP levels; lapis is still required for enchanting, and the anvil’s “Too Expensive” limit is removed.

The anvil cost label is hidden. Enchanting tables still display their normal offer-level numbers, although those levels aren’t charged.

Yahia Elzayat

make me a mod that removes the xp cost for everything for fabric 26.3

Kodari AI
KodariOct 13 at 7:21 am 1
  1. Add a player-level safeguard so XP level deductions are blocked regardless of which vanilla action requests them.

  2. Keep the enchanting/anvil affordability bypasses and register the new mixin.

Added a global safeguard against XP-level deductions and removed the enchantment-level charge. Enchanting tables and anvils still work without levels; lapis and anvil materials are still required.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 172
src/main/java/com/kodari/freexp/mixin/AnvilMenuMixin.java
package com.kodari.freexp.mixin;

import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AnvilMenu;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(AnvilMenu.class)
public abstract class AnvilMenuMixin {
    @Inject(method = "mayPickup", at = @At("HEAD"), cancellable = true)
    private void freelevels$allowPickupWithoutLevels(Player player, boolean hasItem, CallbackInfoReturnable<Boolean> cir) {
        cir.setReturnValue(hasItem);
    }

    @ModifyArg(
        method = "onTake",
        at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;giveExperienceLevels(I)V"),
        index = 0
    )
    private int freelevels$removeLevelCharge(int levels) {
        return 0;
    }

    @ModifyConstant(method = "createResult", constant = @Constant(intValue = 40))
    private int freelevels$removeTooExpensiveLimit(int levelLimit) {
        return Integer.MAX_VALUE;
    }

    @Inject(method = "getCost", at = @At("HEAD"), cancellable = true)
    private void freelevels$hideDisplayedCost(CallbackInfoReturnable<Integer> cir) {
        cir.setReturnValue(0);
    }
}