Package dan200.computercraft.api.turtle
Class AbstractTurtleUpgrade
java.lang.Object
dan200.computercraft.api.turtle.AbstractTurtleUpgrade
- All Implemented Interfaces:
ITurtleUpgrade
,UpgradeBase
A base class for
ITurtleUpgrade
s.
One does not have to use this, but it does provide a convenient template.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractTurtleUpgrade
(net.minecraft.resources.ResourceLocation id, TurtleUpgradeType type, String adjective, net.minecraft.world.item.ItemStack stack) protected
AbstractTurtleUpgrade
(net.minecraft.resources.ResourceLocation id, TurtleUpgradeType type, net.minecraft.world.item.ItemStack stack) -
Method Summary
Modifier and TypeMethodDescriptionfinal net.minecraft.world.item.ItemStack
Return an item stack representing the type of item that a computer must be crafted with to create a version which holds this upgrade.final TurtleUpgradeType
getType()
Return whether this turtle adds a tool or a peripheral to the turtle.final String
Return an unlocalised string to describe this type of computer in item names.final net.minecraft.resources.ResourceLocation
Gets a unique identifier representing this type of turtle upgrade.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dan200.computercraft.api.turtle.ITurtleUpgrade
createPeripheral, getPersistedData, update, useTool
Methods inherited from interface dan200.computercraft.api.upgrades.UpgradeBase
getUpgradeData, getUpgradeItem, isItemSuitable
-
Constructor Details
-
AbstractTurtleUpgrade
protected AbstractTurtleUpgrade(net.minecraft.resources.ResourceLocation id, TurtleUpgradeType type, String adjective, net.minecraft.world.item.ItemStack stack) -
AbstractTurtleUpgrade
protected AbstractTurtleUpgrade(net.minecraft.resources.ResourceLocation id, TurtleUpgradeType type, 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 interfaceUpgradeBase
- Returns:
- The unique ID for this upgrade.
-
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 interfaceUpgradeBase
- Returns:
- The localisation key for this upgrade's adjective.
-
getType
Description copied from interface:ITurtleUpgrade
Return whether this turtle adds a tool or a peripheral to the turtle.- Specified by:
getType
in interfaceITurtleUpgrade
- 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 byturtle.equipLeft()
orpocket.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 interfaceUpgradeBase
- Returns:
- The item stack to craft with, or
ItemStack.EMPTY
if it cannot be crafted.
-