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.TooltipContextNested 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_CODECFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionEnchantedPageItem(net.minecraft.world.item.Item.Properties properties) Constructs a new EnchantedPageItem. -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.item.ItemStackenchantRandomly(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.ItemStackenchantWithThemeAndSchool(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 specifiedEnchantmentThemeand/orMagicSchool.@NotNull net.minecraft.network.chat.ComponentgetName(@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 dominantMagicSchoolof 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 dominantEnchantmentThemeof the given Enchanted Page stack.booleanisFoil(@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, useOnReleaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem
allowComponentsUpdateAnimation, allowContinuingBlockBreaking, canBeEnchantedWith, getCreatorNamespace, getRecipeRemainderMethods 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:
isFoilin classnet.minecraft.world.item.Item
-
getName
@NotNull public @NotNull net.minecraft.network.chat.Component getName(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
getNamein classnet.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 dominantEnchantmentThemeof 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 dominantMagicSchoolof 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 specifiedEnchantmentThemeand/orMagicSchool. -
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.
-