Class ItemPowerableHelpers

java.lang.Object
org.cyclops.evilcraft.item.ItemPowerableHelpers

public class ItemPowerableHelpers extends Object
Helpers for items.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addPostInformation(net.minecraft.world.item.ItemStack itemStack, List<net.minecraft.network.chat.Component> lines)
    Add the power to the item information, should be called after super.
    static void
    addPreInformation(net.minecraft.world.item.ItemStack itemStack, List<net.minecraft.network.chat.Component> lines)
    Add the power to the item information, should be called before super.
    static int
    getPower(net.minecraft.world.item.ItemStack itemStack)
    Get the power level of the given ItemStack.
    static boolean
    onPowerableItemItemRightClick(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, int powerLevels, boolean onSneak)
    Should be called by powerable items on right click.
    static void
    setPower(net.minecraft.world.item.ItemStack itemStack, int power)
    Set the power level of the given ItemStack.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemPowerableHelpers

      public ItemPowerableHelpers()
  • Method Details

    • getPower

      public static int getPower(net.minecraft.world.item.ItemStack itemStack)
      Get the power level of the given ItemStack.
      Parameters:
      itemStack - The item to check.
      Returns:
      The power this Mace currently has.
    • setPower

      public static void setPower(net.minecraft.world.item.ItemStack itemStack, int power)
      Set the power level of the given ItemStack.
      Parameters:
      itemStack - The item to change.
      power - The new power level.
    • onPowerableItemItemRightClick

      public static boolean onPowerableItemItemRightClick(net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, int powerLevels, boolean onSneak)
      Should be called by powerable items on right click.
      Parameters:
      itemStack - The item stack, this will possibly have an updated power level.
      world - The world.
      player - The player
      powerLevels - The maximum power levels.
      onSneak - If the action should be executed for a sneaking player.
      Returns:
      If the power level was changed.
    • addPreInformation

      public static void addPreInformation(net.minecraft.world.item.ItemStack itemStack, List<net.minecraft.network.chat.Component> lines)
      Add the power to the item information, should be called before super.
      Parameters:
      itemStack - The itemstack with a power
      lines - The lines to add the information to.
    • addPostInformation

      public static void addPostInformation(net.minecraft.world.item.ItemStack itemStack, List<net.minecraft.network.chat.Component> lines)
      Add the power to the item information, should be called after super.
      Parameters:
      itemStack - The itemstack with a power
      lines - The lines to add the information to.