Class AbstractPocketUpgrade

java.lang.Object
dan200.computercraft.api.pocket.AbstractPocketUpgrade
All Implemented Interfaces:
IPocketUpgrade, UpgradeBase

public abstract class AbstractPocketUpgrade extends Object implements IPocketUpgrade
A base class for IPocketUpgrades.

One does not have to use this, but it does provide a convenient template.

  • Constructor Details

    • AbstractPocketUpgrade

      protected AbstractPocketUpgrade(net.minecraft.resources.ResourceLocation id, String adjective, net.minecraft.world.item.ItemStack stack)
    • AbstractPocketUpgrade

      protected AbstractPocketUpgrade(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.ItemStack stack)
  • Method Details

    • getUpgradeID

      public final net.minecraft.resources.ResourceLocation getUpgradeID()
      Description copied from interface: UpgradeBase
      Gets a unique identifier representing this type of turtle upgrade. eg: "computercraft:wireless_modem" or "my_mod:my_upgrade".

      You should use a unique resource domain to ensure this upgrade is uniquely identified. The upgrade will fail registration if an already used ID is specified.

      Specified by:
      getUpgradeID in interface UpgradeBase
      Returns:
      The unique ID for this upgrade.
    • getUnlocalisedAdjective

      public final String getUnlocalisedAdjective()
      Description copied from interface: UpgradeBase
      Return an unlocalised string to describe this type of computer in item names.

      Examples of built-in adjectives are "Wireless", "Mining" and "Crafty".

      Specified by:
      getUnlocalisedAdjective in interface UpgradeBase
      Returns:
      The localisation key for this upgrade's adjective.
    • getCraftingItem

      public final net.minecraft.world.item.ItemStack getCraftingItem()
      Description copied from interface: UpgradeBase
      Return an item stack representing the type of item that a computer must be crafted with to create a version which holds this upgrade. This item stack is also used to determine the upgrade given by turtle.equipLeft() or pocket.equipBack()

      This should be constant over a session (or at least a datapack reload). It is recommended that you cache the stack too, in order to prevent constructing it every time the method is called.

      Specified by:
      getCraftingItem in interface UpgradeBase
      Returns:
      The item stack to craft with, or ItemStack.EMPTY if it cannot be crafted.