Package dan200.computercraft.api.pocket
Class AbstractPocketUpgrade
java.lang.Object
dan200.computercraft.api.pocket.AbstractPocketUpgrade
- All Implemented Interfaces:
IPocketUpgrade,UpgradeBase
A base class for
IPocketUpgrades.
One does not have to use this, but it does provide a convenient template.
-
Field Summary
Fields inherited from interface dan200.computercraft.api.pocket.IPocketUpgrade
REGISTRY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPocketUpgrade(String adjective, net.minecraft.world.item.ItemStack stack) protectedAbstractPocketUpgrade(net.minecraft.network.chat.Component adjective, net.minecraft.world.item.ItemStack stack) -
Method Summary
Modifier and TypeMethodDescriptionfinal net.minecraft.network.chat.ComponentA description of this upgrade for use in item names.final net.minecraft.world.item.ItemStackReturn an item stack representing the type of item that a computer must be crafted with to create a version which holds this upgrade.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dan200.computercraft.api.pocket.IPocketUpgrade
createPeripheral, getType, onRightClick, updateMethods inherited from interface dan200.computercraft.api.upgrades.UpgradeBase
getUpgradeData, getUpgradeItem, isItemSuitable
-
Constructor Details
-
AbstractPocketUpgrade
protected AbstractPocketUpgrade(net.minecraft.network.chat.Component adjective, net.minecraft.world.item.ItemStack stack) -
AbstractPocketUpgrade
-
-
Method Details
-
getAdjective
public final net.minecraft.network.chat.Component getAdjective()Description copied from interface:UpgradeBaseA 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:
getAdjectivein interfaceUpgradeBase- Returns:
- The text component for this upgrade's adjective.
-
getCraftingItem
public final net.minecraft.world.item.ItemStack getCraftingItem()Description copied from interface:UpgradeBaseReturn 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:
getCraftingItemin interfaceUpgradeBase- Returns:
- The item stack to craft with, or
ItemStack.EMPTYif it cannot be crafted.
-