Class AnvilMenuMixin

java.lang.Object
johnsmith.enchantingoverhauled.mixin.menu.ItemCombinerMenuMixin
johnsmith.enchantingoverhauled.mixin.menu.AnvilMenuMixin
All Implemented Interfaces:
AnvilMenuAccessor

public class AnvilMenuMixin extends ItemCombinerMenuMixin implements AnvilMenuAccessor
Loader-agnostic part of the anvil overhaul.

This mixin only contains injections whose targets are identical on every loader (mayPickup, getCost, onTake) plus the hook implementations from AnvilMenuAccessor. Injections into the vanilla createResult body are declared per loader because NeoForge moves that body into createResultInternal: see AnvilMenuCreateResultMixin (Fabric/Forge) and NeoForgeAnvilMenuMixin.

  • Constructor Details

    • AnvilMenuMixin

      public AnvilMenuMixin()
  • Method Details

    • enchanting_overhauled$mayPickup

      public void enchanting_overhauled$mayPickup(net.minecraft.world.entity.player.Player player, boolean present, org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable<Boolean> cir)
    • enchanting_overhauled$getCost

      public void enchanting_overhauled$getCost(org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable<Integer> cir)
    • enchanting_overhauled$noRepairCostInject

      protected void enchanting_overhauled$noRepairCostInject(net.minecraft.world.entity.player.Player instance, int levels, com.llamalad7.mixinextras.injector.wrapoperation.Operation<Void> original)
    • enchanting_overhauled$canStoreOrTransmuteEnchantments

      public boolean enchanting_overhauled$canStoreOrTransmuteEnchantments(boolean original, net.minecraft.world.item.ItemStack target)
      Description copied from interface: AnvilMenuAccessor
      Decides whether the target item may enter the anvil evaluation pipeline (STORED_ENCHANTMENTS holders or a valid EnchantRecipe). Resets and re-resolves the active recipe.
      Specified by:
      enchanting_overhauled$canStoreOrTransmuteEnchantments in interface AnvilMenuAccessor
    • enchanting_overhauled$applyEnchantRecipeTarget

      public net.minecraft.world.item.ItemStack enchanting_overhauled$applyEnchantRecipeTarget(net.minecraft.world.item.ItemStack itemstack1)
      Description copied from interface: AnvilMenuAccessor
      Transmutes the working result copy when an EnchantRecipe is active.
      Specified by:
      enchanting_overhauled$applyEnchantRecipeTarget in interface AnvilMenuAccessor
    • enchanting_overhauled$disallowEnchantedBooks

      public net.minecraft.world.item.ItemStack enchanting_overhauled$disallowEnchantedBooks(net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: AnvilMenuAccessor
      Blocks stored-enchantment sources when anvil enchanting is disabled.
      Specified by:
      enchanting_overhauled$disallowEnchantedBooks in interface AnvilMenuAccessor
    • enchanting_overhauled$restrictInstabuildArbitraryEnchanting

      public boolean enchanting_overhauled$restrictInstabuildArbitraryEnchanting(boolean instabuild, net.minecraft.world.item.ItemStack workingStack)
      Description copied from interface: AnvilMenuAccessor
      Restricts creative-mode bypass of canEnchant to enchantable / stored-enchantment items.
      Specified by:
      enchanting_overhauled$restrictInstabuildArbitraryEnchanting in interface AnvilMenuAccessor
    • enchanting_overhauled$allowTargetEnchantmentLib

      public net.minecraft.world.item.enchantment.ItemEnchantments enchanting_overhauled$allowTargetEnchantmentLib(net.minecraft.world.item.ItemStack workingStack)
      Description copied from interface: AnvilMenuAccessor
      Enchantments of the working stack, including stored enchantments.
      Specified by:
      enchanting_overhauled$allowTargetEnchantmentLib in interface AnvilMenuAccessor
    • enchanting_overhauled$allowEnchantRecipeInput

      public net.minecraft.world.item.enchantment.ItemEnchantments enchanting_overhauled$allowEnchantRecipeInput()
      Description copied from interface: AnvilMenuAccessor
      Enchantments of the second input slot, including stored enchantments.
      Specified by:
      enchanting_overhauled$allowEnchantRecipeInput in interface AnvilMenuAccessor
    • enchanting_overhauled$allowExceededMaxLevel

      public int enchanting_overhauled$allowExceededMaxLevel(int original, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> holder, net.minecraft.world.item.ItemStack workingStack)
      Description copied from interface: AnvilMenuAccessor
      Preserves overleveled enchantments from either input without allowing further increments.
      Specified by:
      enchanting_overhauled$allowExceededMaxLevel in interface AnvilMenuAccessor
    • enchanting_overhauled$setEnchantmentsInCorrectComponent

      public void enchanting_overhauled$setEnchantmentsInCorrectComponent(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.enchantment.ItemEnchantments enchantments, com.llamalad7.mixinextras.injector.wrapoperation.Operation<Void> original)
      Description copied from interface: AnvilMenuAccessor
      Writes merged enchantments into the correct component (STORED / VOID / default).
      Specified by:
      enchanting_overhauled$setEnchantmentsInCorrectComponent in interface AnvilMenuAccessor
    • enchanting_overhauled$preventRedundantEnchanting

      public void enchanting_overhauled$preventRedundantEnchanting()
      Description copied from interface: AnvilMenuAccessor
      Cancels no-op or cap-violating anvil results right before the menu broadcasts them.
      Specified by:
      enchanting_overhauled$preventRedundantEnchanting in interface AnvilMenuAccessor
    • enchanting_overhauled$disallowEnchantmentCombination

      public Iterator<?> enchanting_overhauled$disallowEnchantmentCombination(Iterator<?> iterator)
      Description copied from interface: AnvilMenuAccessor
      Disables combining enchantments from the second input when anvil enchanting is disabled.
      Specified by:
      enchanting_overhauled$disallowEnchantmentCombination in interface AnvilMenuAccessor
    • enchanting_overhauled$canEnchantWorkingStack

      public boolean enchanting_overhauled$canEnchantWorkingStack(net.minecraft.world.item.ItemStack workingStack, Predicate<net.minecraft.world.item.ItemStack> defaultCheck)
      Specified by:
      enchanting_overhauled$canEnchantWorkingStack in interface AnvilMenuAccessor