Class FoliosBookItem

java.lang.Object
net.minecraft.world.item.Item
net.ixdarklord.folios.api.FoliosBookItem
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike

public class FoliosBookItem extends net.minecraft.world.item.Item
An item that opens a guide book when used. Folios registers one, folios:guide_book, that opens the book its folios:guide_book component names (FoliosBooks.createStack(net.minecraft.resources.ResourceLocation)); a mod can register its own for a single book, which then needs no component:

 ITEMS.register("handbook", () -> new FoliosBookItem(properties, MyMod.id("handbook")));
 
Its name is the book's own, unless the stack has a custom name or item_name; under it, who the book is by ("Written by ...", the words and names as its book.json's "credits" give them), when it says.
  • 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
  • Field Summary

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

    ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTH

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

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    FoliosBookItem(net.minecraft.world.item.Item.Properties properties)
    An item that opens whichever book its stack's component names.
    FoliosBookItem(net.minecraft.world.item.Item.Properties properties, @Nullable net.minecraft.resources.ResourceLocation book)
    An item that always opens one book (its stacks' component, if any, wins).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendHoverText(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item.TooltipContext context, List<net.minecraft.network.chat.Component> tooltip, net.minecraft.world.item.TooltipFlag flag)
     
    @Nullable net.minecraft.resources.ResourceLocation
    book(net.minecraft.world.item.ItemStack stack)
    The book a stack of this item opens: its component's, else this item's own; null when it names none.
    net.minecraft.network.chat.Component
    getName(net.minecraft.world.item.ItemStack stack)
     
    void
    inventoryTick(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level, net.minecraft.world.entity.Entity owner, int slot, boolean selected)
     
    net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack>
    use(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
     

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

    asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getId, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, interactLivingEntity, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isValidRepairItem, mineBlock, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, useOn, useOnRelease, verifyComponentsAfterLoad

    Methods inherited from class java.lang.Object

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

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

    isEnabled
  • Constructor Details

    • FoliosBookItem

      public FoliosBookItem(net.minecraft.world.item.Item.Properties properties)
      An item that opens whichever book its stack's component names.
    • FoliosBookItem

      public FoliosBookItem(net.minecraft.world.item.Item.Properties properties, @Nullable @Nullable net.minecraft.resources.ResourceLocation book)
      An item that always opens one book (its stacks' component, if any, wins).
  • Method Details

    • book

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation book(net.minecraft.world.item.ItemStack stack)
      The book a stack of this item opens: its component's, else this item's own; null when it names none.
    • use

      public net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Overrides:
      use in class net.minecraft.world.item.Item
    • inventoryTick

      public void inventoryTick(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level, net.minecraft.world.entity.Entity owner, int slot, boolean selected)
      Overrides:
      inventoryTick in class net.minecraft.world.item.Item
    • appendHoverText

      public void appendHoverText(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item.TooltipContext context, List<net.minecraft.network.chat.Component> tooltip, net.minecraft.world.item.TooltipFlag flag)
      Overrides:
      appendHoverText in class net.minecraft.world.item.Item
    • getName

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