Enum Class ApplicableUpgradesDB

java.lang.Object
java.lang.Enum<ApplicableUpgradesDB>
me.desht.pneumaticcraft.common.util.upgrade.ApplicableUpgradesDB
All Implemented Interfaces:
Serializable, Comparable<ApplicableUpgradesDB>, Constable, IUpgradeRegistry

public enum ApplicableUpgradesDB extends Enum<ApplicableUpgradesDB> implements IUpgradeRegistry
  • Enum Constant Details

  • Method Details

    • values

      public static ApplicableUpgradesDB[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ApplicableUpgradesDB valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInstance

      public static ApplicableUpgradesDB getInstance()
    • addApplicableUpgrades

      public void addApplicableUpgrades(net.minecraft.world.level.block.entity.BlockEntityType<?> type, IUpgradeRegistry.Builder builder)
      Description copied from interface: IUpgradeRegistry
      Register the given upgrade builder with the given block entity type. Note that the upgrades in the given builder will overwrite and/or augment any upgrades already registered for the block entity.
      Specified by:
      addApplicableUpgrades in interface IUpgradeRegistry
      Parameters:
      type - the block entity type
      builder - the builder helper object
    • addApplicableUpgrades

      public void addApplicableUpgrades(net.minecraft.world.entity.EntityType<?> type, IUpgradeRegistry.Builder builder)
      Description copied from interface: IUpgradeRegistry
      Register the given upgrade builder with the given entity type. Note that the upgrades in the given builder will overwrite and/or augment any upgrades already registered for the entity.
      Specified by:
      addApplicableUpgrades in interface IUpgradeRegistry
      Parameters:
      type - the entity type
      builder - the builder helper object
    • addApplicableUpgrades

      public void addApplicableUpgrades(net.minecraft.world.item.Item item, IUpgradeRegistry.Builder builder)
      Description copied from interface: IUpgradeRegistry
      Register the given upgrade builder with the given item. Note that the upgrades in the given builder will overwrite and/or augment any upgrades already registered for the item.
      Specified by:
      addApplicableUpgrades in interface IUpgradeRegistry
      Parameters:
      item - the item
      builder - the builder helper object
    • getMaxUpgrades

      public int getMaxUpgrades(net.minecraft.world.level.block.entity.BlockEntity te, PNCUpgrade upgrade)
      Description copied from interface: IUpgradeRegistry
      Get the maximum number of upgrades of the given type accepted by the given block entity
      Specified by:
      getMaxUpgrades in interface IUpgradeRegistry
      Parameters:
      te - the block entity
      upgrade - the upgrade to check
      Returns:
      maximum number of that upgrade which can be installed
    • getMaxUpgrades

      public int getMaxUpgrades(net.minecraft.world.entity.Entity entity, PNCUpgrade upgrade)
      Description copied from interface: IUpgradeRegistry
      Get the maximum number of upgrades of the given type accepted by the given entity
      Specified by:
      getMaxUpgrades in interface IUpgradeRegistry
      Parameters:
      entity - the entity
      upgrade - the upgrade to check
      Returns:
      maximum number of that upgrade which can be installed
    • getMaxUpgrades

      public int getMaxUpgrades(net.minecraft.world.item.Item item, PNCUpgrade upgrade)
      Description copied from interface: IUpgradeRegistry
      Get the maximum number of upgrades of the given type accepted by the given block entity
      Specified by:
      getMaxUpgrades in interface IUpgradeRegistry
      Parameters:
      item - the item
      upgrade - the upgrade to check
      Returns:
      maximum number of that upgrade which can be installed
    • addUpgradeTooltip

      public void addUpgradeTooltip(PNCUpgrade upgrade, List<net.minecraft.network.chat.Component> tooltip)
      Description copied from interface: IUpgradeRegistry
      Convenience method which adds a list of the items which accept the given upgrade to the upgrade item's tooltip. This list is intended to be displayed while Shift is held down while hovering over the upgrade item, and will scroll if larger than 12 lines.

      This is automatically used by custom upgrades created via IUpgradeRegistry.makeUpgradeItem(Supplier, int). You can also call this yourself for custom upgrades that you create (i.e. items which implement IUpgradeItem).

      Specified by:
      addUpgradeTooltip in interface IUpgradeRegistry
      Parameters:
      upgrade - the upgrade
      tooltip - the tooltip to append to
    • makeUpgradeItem

      public net.minecraft.world.item.Item makeUpgradeItem(Supplier<PNCUpgrade> upgrade, int tier)
      Description copied from interface: IUpgradeRegistry
      Convenience method to create an Item implementing the IUpgradeItem interface, which can be used as a PneumaticCraft upgrade. This item has the default PneumaticCraft tooltip behaviour in that IUpgradeRegistry.addUpgradeTooltip(PNCUpgrade, List) is called when Shift is held while hovering over the item.

      You can use this method when registering upgrade items as an alternative to creating an Item which implements IUpgradeItem yourself.

      The item created by this method will be in the PneumaticCraft creative tab and have no other special item properties; see IUpgradeRegistry.makeUpgradeItem(Supplier, int, Item.Properties) if you need custom behaviour here.

      Specified by:
      makeUpgradeItem in interface IUpgradeRegistry
      Parameters:
      upgrade - a supplier for the upgrade object, which will not yet be registered
      tier - upgrade tier of this item
      Returns:
      an item, which should be registered in the usual way
    • makeUpgradeItem

      public net.minecraft.world.item.Item makeUpgradeItem(Supplier<PNCUpgrade> upgrade, int tier, net.minecraft.world.item.Item.Properties properties)
      Description copied from interface: IUpgradeRegistry
      Same as IUpgradeRegistry.makeUpgradeItem(Supplier, int) but allows a custom item properties object to be supplied for use when the Item is created.
      Specified by:
      makeUpgradeItem in interface IUpgradeRegistry
      Parameters:
      upgrade - a supplier for the upgrade object, which will not yet be registered
      tier - upgrade tier of this item
      properties - an item properties object
      Returns:
      an item, which should be registered in the usual way
    • getUpgradeCount

      public int getUpgradeCount(net.minecraft.world.item.ItemStack stack, PNCUpgrade upgrade)
      Description copied from interface: IUpgradeRegistry
      Helper method to get the number of the given upgrade which is installed in the given itemstack.
      Specified by:
      getUpgradeCount in interface IUpgradeRegistry
      Parameters:
      stack - the item holding the upgrades
      upgrade - the upgrade to check for
      Returns:
      the number of that upgrade installed in the item
    • getAllUpgrades

      public Map<PNCUpgrade,Integer> getAllUpgrades(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: IUpgradeRegistry
      Helper method to get all the upgrades currently installed in the given itemstack
      Specified by:
      getAllUpgrades in interface IUpgradeRegistry
      Parameters:
      stack - the item holding the upgrades
      Returns:
      an immutable map of (upgrade->count)
    • getItemsWhichAccept

      public Collection<net.minecraft.world.item.Item> getItemsWhichAccept(PNCUpgrade upgrade)
    • getApplicableUpgrades

      public Map<PNCUpgrade,Integer> getApplicableUpgrades(net.minecraft.world.level.block.entity.BlockEntity te)
    • getApplicableUpgrades

      public Map<PNCUpgrade,Integer> getApplicableUpgrades(net.minecraft.world.entity.Entity e)
    • getApplicableUpgrades

      public Map<PNCUpgrade,Integer> getApplicableUpgrades(net.minecraft.world.item.Item item)