Class AbstractTurtleUpgrade

java.lang.Object
dan200.computercraft.api.turtle.AbstractTurtleUpgrade
All Implemented Interfaces:
ITurtleUpgrade, UpgradeBase

public abstract class AbstractTurtleUpgrade extends Object implements ITurtleUpgrade
A base class for ITurtleUpgrades.

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

  • Constructor Details

    • AbstractTurtleUpgrade

      protected AbstractTurtleUpgrade(TurtleUpgradeType type, net.minecraft.network.chat.Component adjective, net.minecraft.world.item.ItemStack stack)
    • AbstractTurtleUpgrade

      protected AbstractTurtleUpgrade(TurtleUpgradeType type, String adjective, net.minecraft.world.item.ItemStack stack)
  • Method Details

    • getAdjective

      public final net.minecraft.network.chat.Component getAdjective()
      Description copied from interface: UpgradeBase
      A description of this upgrade for use in item names.

      This should typically be a translation key, rather than a hard coded string.

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

      Specified by:
      getAdjective in interface UpgradeBase
      Returns:
      The text component for this upgrade's adjective.
    • getUpgradeType

      public final TurtleUpgradeType getUpgradeType()
      Description copied from interface: ITurtleUpgrade
      Return whether this turtle adds a tool or a peripheral to the turtle.
      Specified by:
      getUpgradeType in interface ITurtleUpgrade
      Returns:
      The type of upgrade this is.
      See Also:
    • 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.