Class LensItem

java.lang.Object
net.minecraft.world.item.Item
vazkii.botania.common.item.lens.LensItem
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, BasicLensItem, CompositableLensItem, ControlLensItem, LensEffectItem, TinyPlanetExcempt

public class LensItem extends net.minecraft.world.item.Item implements ControlLensItem, CompositableLensItem, TinyPlanetExcempt
  • 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
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     

    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
    LensItem(net.minecraft.world.item.Item.Properties builder, Lens lens, int props)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    allowBurstShooting(net.minecraft.world.item.ItemStack stack, ManaSpreader spreader, boolean redstone)
     
    void
    appendHoverText(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item.TooltipContext context, List<net.minecraft.network.chat.Component> stacks, net.minecraft.world.item.TooltipFlag flags)
     
    void
    apply(net.minecraft.world.item.ItemStack stack, BurstProperties props, net.minecraft.world.level.Level level)
    Called when a mana spreader that has this focus shoots a burst.
    boolean
    canCombineLenses(net.minecraft.world.item.ItemStack sourceLens, net.minecraft.world.item.ItemStack compositeLens)
    Can the source lens be combined with the composite lens? This is called for both the BasicLensItem instance of ItemStack.getItem() of sourceLens and compositeLens.
    boolean
    collideBurst(ManaBurst burst, net.minecraft.world.phys.HitResult pos, boolean isManaBlock, boolean shouldKill, net.minecraft.world.item.ItemStack stack)
    Called when a mana burst fired from a mana spreader with this focus collides against any block or entity.
    boolean
    doParticles(ManaBurst burst, net.minecraft.world.item.ItemStack stack)
    Called when the mana burst should do it's particles.
    net.minecraft.world.item.ItemStack
    getCompositeLens(net.minecraft.world.item.ItemStack stack)
    Gets the composite lens in the stack passed in, return empty for none.
    static Lens
    getLens(net.minecraft.world.item.ItemStack stack)
     
    static @Nullable net.minecraft.world.item.DyeColor
    getLensColor(net.minecraft.world.item.ItemStack stack)
     
    int
    getLensColor(net.minecraft.world.item.ItemStack stack, @UnknownNullability net.minecraft.world.level.Level level)
     
    int
    getManaToTransfer(ManaBurst burst, net.minecraft.world.item.ItemStack stack, ManaReceiver receiver)
    Gets the amount of mana to transfer to the passed in mana receiver block.
    @NotNull net.minecraft.network.chat.Component
    getName(@NotNull net.minecraft.world.item.ItemStack stack)
     
    int
    getProps(net.minecraft.world.item.ItemStack stack)
    Returns the properties of the itemstack, used to check if two lenses can combine.
    static boolean
    isBlacklisted(net.minecraft.world.item.ItemStack lens1, net.minecraft.world.item.ItemStack lens2)
     
    boolean
    isCombinable(net.minecraft.world.item.ItemStack stack)
    Checks if the lens is combinable.
    boolean
    isControlLens(net.minecraft.world.item.ItemStack stack)
     
    static boolean
    isLensRainbow(net.minecraft.world.item.ItemStack stack)
     
    static boolean
    isLensTinted(net.minecraft.world.item.ItemStack stack)
     
    void
    onControlledSpreaderPulse(net.minecraft.world.item.ItemStack stack, ManaSpreader spreader)
    Used for when a redstone spreader gets a pulse.
    void
    onControlledSpreaderTick(net.minecraft.world.item.ItemStack stack, ManaSpreader spreader, boolean redstone)
    Used for the tick of a non-redstone spreader.
    net.minecraft.world.item.ItemStack
    setCompositeLens(net.minecraft.world.item.ItemStack sourceLens, net.minecraft.world.item.ItemStack compositeLens)
    Sets the composite lens for the sourceLens as the compositeLens, returns the ItemStack with the combination.
    static void
    setLensColor(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.DyeColor color)
     
    static void
    setLensRainbow(net.minecraft.world.item.ItemStack stack)
     
    boolean
    shouldPull(net.minecraft.world.item.ItemStack stack)
     
    void
    updateBurst(ManaBurst burst, net.minecraft.world.item.ItemStack stack)
    Called when a mana burst fired from a mana spreader with this focus is updated.

    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, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isValidRepairItem, mineBlock, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, use, 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
  • Field Details

  • Constructor Details

    • LensItem

      public LensItem(net.minecraft.world.item.Item.Properties builder, Lens lens, int props)
  • Method Details

    • appendHoverText

      public void appendHoverText(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item.TooltipContext context, List<net.minecraft.network.chat.Component> stacks, net.minecraft.world.item.TooltipFlag flags)
      Overrides:
      appendHoverText 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
    • apply

      public void apply(net.minecraft.world.item.ItemStack stack, BurstProperties props, net.minecraft.world.level.Level level)
      Description copied from interface: LensEffectItem
      Called when a mana spreader that has this focus shoots a burst. This is where you change the properties of the burst.
      Specified by:
      apply in interface LensEffectItem
    • collideBurst

      public boolean collideBurst(ManaBurst burst, net.minecraft.world.phys.HitResult pos, boolean isManaBlock, boolean shouldKill, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: LensEffectItem
      Called when a mana burst fired from a mana spreader with this focus collides against any block or entity. This is called after the collision is handled.
      Specified by:
      collideBurst in interface LensEffectItem
      Returns:
      True to kill the burst. False to keep it alive.
    • updateBurst

      public void updateBurst(ManaBurst burst, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: LensEffectItem
      Called when a mana burst fired from a mana spreader with this focus is updated. This is called before the update is handled.
      Specified by:
      updateBurst in interface LensEffectItem
    • getLensColor

      public int getLensColor(net.minecraft.world.item.ItemStack stack, @UnknownNullability net.minecraft.world.level.Level level)
      Specified by:
      getLensColor in interface BasicLensItem
    • isLensTinted

      public static boolean isLensTinted(net.minecraft.world.item.ItemStack stack)
    • getLensColor

      @Nullable public static @Nullable net.minecraft.world.item.DyeColor getLensColor(net.minecraft.world.item.ItemStack stack)
    • isLensRainbow

      public static boolean isLensRainbow(net.minecraft.world.item.ItemStack stack)
    • setLensColor

      public static void setLensColor(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.DyeColor color)
    • setLensRainbow

      public static void setLensRainbow(net.minecraft.world.item.ItemStack stack)
    • doParticles

      public boolean doParticles(ManaBurst burst, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: LensEffectItem
      Called when the mana burst should do it's particles. Return false to not do any particles.
      Specified by:
      doParticles in interface LensEffectItem
    • isBlacklisted

      public static boolean isBlacklisted(net.minecraft.world.item.ItemStack lens1, net.minecraft.world.item.ItemStack lens2)
    • getLens

      public static Lens getLens(net.minecraft.world.item.ItemStack stack)
    • canCombineLenses

      public boolean canCombineLenses(net.minecraft.world.item.ItemStack sourceLens, net.minecraft.world.item.ItemStack compositeLens)
      Description copied from interface: BasicLensItem
      Can the source lens be combined with the composite lens? This is called for both the BasicLensItem instance of ItemStack.getItem() of sourceLens and compositeLens.
      Specified by:
      canCombineLenses in interface BasicLensItem
    • getCompositeLens

      public net.minecraft.world.item.ItemStack getCompositeLens(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: BasicLensItem
      Gets the composite lens in the stack passed in, return empty for none.
      Specified by:
      getCompositeLens in interface BasicLensItem
    • setCompositeLens

      public net.minecraft.world.item.ItemStack setCompositeLens(net.minecraft.world.item.ItemStack sourceLens, net.minecraft.world.item.ItemStack compositeLens)
      Description copied from interface: BasicLensItem
      Sets the composite lens for the sourceLens as the compositeLens, returns the ItemStack with the combination. If compositeLens is empty, this removes the composite.
      Specified by:
      setCompositeLens in interface BasicLensItem
    • getManaToTransfer

      public int getManaToTransfer(ManaBurst burst, net.minecraft.world.item.ItemStack stack, ManaReceiver receiver)
      Description copied from interface: LensEffectItem
      Gets the amount of mana to transfer to the passed in mana receiver block.
      Specified by:
      getManaToTransfer in interface LensEffectItem
    • shouldPull

      public boolean shouldPull(net.minecraft.world.item.ItemStack stack)
      Specified by:
      shouldPull in interface TinyPlanetExcempt
    • isControlLens

      public boolean isControlLens(net.minecraft.world.item.ItemStack stack)
      Specified by:
      isControlLens in interface ControlLensItem
    • allowBurstShooting

      public boolean allowBurstShooting(net.minecraft.world.item.ItemStack stack, ManaSpreader spreader, boolean redstone)
      Specified by:
      allowBurstShooting in interface ControlLensItem
    • onControlledSpreaderTick

      public void onControlledSpreaderTick(net.minecraft.world.item.ItemStack stack, ManaSpreader spreader, boolean redstone)
      Description copied from interface: ControlLensItem
      Used for the tick of a non-redstone spreader.
      Specified by:
      onControlledSpreaderTick in interface ControlLensItem
    • onControlledSpreaderPulse

      public void onControlledSpreaderPulse(net.minecraft.world.item.ItemStack stack, ManaSpreader spreader)
      Description copied from interface: ControlLensItem
      Used for when a redstone spreader gets a pulse.
      Specified by:
      onControlledSpreaderPulse in interface ControlLensItem
    • getProps

      public int getProps(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: CompositableLensItem
      Returns the properties of the itemstack, used to check if two lenses can combine.
      Specified by:
      getProps in interface CompositableLensItem
    • isCombinable

      public boolean isCombinable(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: CompositableLensItem
      Checks if the lens is combinable.
      Specified by:
      isCombinable in interface CompositableLensItem