Class EnchantedPageItem

java.lang.Object
net.minecraft.world.item.Item
johnsmith.enchantingoverhauled.item.EnchantedPageItem
All Implemented Interfaces:
net.fabricmc.fabric.api.item.v1.FabricItem, net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike

public class EnchantedPageItem extends net.minecraft.world.item.Item
A custom item representing an Enchanted Page (a fleeting enchantment source). Supports dynamic "<Theme> <Item Name> of <School>" attribution and naming.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.item.Item

    net.minecraft.world.item.Item.Properties, net.minecraft.world.item.Item.TooltipContext

    Nested classes/interfaces inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem

    net.fabricmc.fabric.api.item.v1.FabricItem.Settings
  • Field Summary

    Fields inherited from class net.minecraft.world.item.Item

    ABSOLUTE_MAX_STACK_SIZE, APPROXIMATELY_INFINITE_USE_DURATION, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, CODEC, DEFAULT_MAX_STACK_SIZE, descriptionId, MAX_BAR_WIDTH, STREAM_CODEC

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnchantedPageItem(net.minecraft.world.item.Item.Properties properties)
    Constructs a new EnchantedPageItem.
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.item.ItemStack
    enchantRandomly(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, net.minecraft.util.RandomSource random, net.minecraft.tags.TagKey<net.minecraft.world.item.enchantment.Enchantment> specialTag, net.minecraft.tags.TagKey<net.minecraft.world.item.enchantment.Enchantment> commonTag)
    Enchants a given Enchanted Page ItemStack using biome-specific trades.
    static net.minecraft.world.item.ItemStack
    enchantWithThemeAndSchool(net.minecraft.world.item.ItemStack itemStack, net.minecraft.core.RegistryAccess registryAccess, net.minecraft.util.RandomSource random, @Nullable net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey, @Nullable net.minecraft.resources.ResourceKey<MagicSchool> schoolKey)
    Enchants a given Enchanted Page ItemStack with 1 enchantment at level 1, prioritizing enchantments matching the specified EnchantmentTheme and/or MagicSchool.
    @NotNull net.minecraft.network.chat.Component
    getName(@NotNull net.minecraft.world.item.ItemStack stack)
     
    static Optional<net.minecraft.resources.ResourceKey<MagicSchool>>
    getSchool(net.minecraft.world.item.ItemStack stack)
     
    static Optional<net.minecraft.resources.ResourceKey<MagicSchool>>
    getSchool(net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.core.RegistryAccess registryAccess)
    Resolves the dominant MagicSchool of the given Enchanted Page stack.
    static Optional<net.minecraft.resources.ResourceKey<EnchantmentTheme>>
    getTheme(net.minecraft.world.item.ItemStack stack)
     
    static Optional<net.minecraft.resources.ResourceKey<EnchantmentTheme>>
    getTheme(net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.core.RegistryAccess registryAccess)
    Resolves the dominant EnchantmentTheme of the given Enchanted Page stack.
    boolean
    isFoil(@NotNull net.minecraft.world.item.ItemStack stack)
     

    Methods inherited from class net.minecraft.world.item.Item

    appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canDestroyBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getCraftingRemainder, getDefaultInstance, getDefaultMaxStackSize, getDescriptionId, getDestroySpeed, getId, getItemDamageSource, getName, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hurtEnemy, interactLivingEntity, inventoryTick, isBarVisible, isCorrectToolForDrops, mineBlock, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, shouldPrintOpWarning, toString, use, useOn, useOnRelease

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem

    allowComponentsUpdateAnimation, allowContinuingBlockBreaking, canBeEnchantedWith, getCreatorNamespace, getRecipeRemainder

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled
  • Constructor Details

    • EnchantedPageItem

      public EnchantedPageItem(net.minecraft.world.item.Item.Properties properties)
      Constructs a new EnchantedPageItem.
      Parameters:
      properties - The item properties (stack size, rarity, etc.).
  • Method Details

    • isFoil

      public boolean isFoil(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Overrides:
      isFoil in class net.minecraft.world.item.Item
    • getName

      @NotNull public @NotNull net.minecraft.network.chat.Component getName(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Overrides:
      getName in class net.minecraft.world.item.Item
    • getTheme

      public static Optional<net.minecraft.resources.ResourceKey<EnchantmentTheme>> getTheme(net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.core.RegistryAccess registryAccess)
      Resolves the dominant EnchantmentTheme of the given Enchanted Page stack.
    • getTheme

      public static Optional<net.minecraft.resources.ResourceKey<EnchantmentTheme>> getTheme(net.minecraft.world.item.ItemStack stack)
    • getSchool

      public static Optional<net.minecraft.resources.ResourceKey<MagicSchool>> getSchool(net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.core.RegistryAccess registryAccess)
      Resolves the dominant MagicSchool of the given Enchanted Page stack.
    • getSchool

      public static Optional<net.minecraft.resources.ResourceKey<MagicSchool>> getSchool(net.minecraft.world.item.ItemStack stack)
    • enchantWithThemeAndSchool

      public static net.minecraft.world.item.ItemStack enchantWithThemeAndSchool(net.minecraft.world.item.ItemStack itemStack, net.minecraft.core.RegistryAccess registryAccess, net.minecraft.util.RandomSource random, @Nullable @Nullable net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey, @Nullable @Nullable net.minecraft.resources.ResourceKey<MagicSchool> schoolKey)
      Enchants a given Enchanted Page ItemStack with 1 enchantment at level 1, prioritizing enchantments matching the specified EnchantmentTheme and/or MagicSchool.
    • enchantRandomly

      public static net.minecraft.world.item.ItemStack enchantRandomly(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, net.minecraft.util.RandomSource random, net.minecraft.tags.TagKey<net.minecraft.world.item.enchantment.Enchantment> specialTag, net.minecraft.tags.TagKey<net.minecraft.world.item.enchantment.Enchantment> commonTag)
      Enchants a given Enchanted Page ItemStack using biome-specific trades. Prefers enchantments from the COMMON tag before falling back to the SPECIAL tag. Restricts the page to 1 enchantment strictly at level 1.