public interface ITurtleUpgrade
ComputerCraftAPI#registerTurtleUpgrade(ITurtleUpgrade)
Modifier and Type | Method and Description |
---|---|
IPeripheral |
createPeripheral(ITurtleAccess turtle,
TurtleSide side)
Will only be called for peripheral upgrades.
|
ItemStack |
getCraftingItem()
Return an item stack representing the type of item that a turtle must be crafted
with to create a turtle which holds this upgrade.
|
int |
getLegacyUpgradeID()
Gets a numerical identifier representing this type of turtle upgrade,
for backwards compatibility with pre-1.76 worlds.
|
<any> |
getModel(ITurtleAccess turtle,
TurtleSide side)
Called to obtain the model to be used when rendering a turtle peripheral.
|
TurtleUpgradeType |
getType()
Return whether this turtle adds a tool or a peripheral to the turtle.
|
java.lang.String |
getUnlocalisedAdjective()
Return an unlocalised string to describe this type of turtle in turtle item names.
|
ResourceLocation |
getUpgradeID()
Gets a unique identifier representing this type of turtle upgrade.
|
default void |
update(ITurtleAccess turtle,
TurtleSide side)
Called once per tick for each turtle which has the upgrade equipped.
|
TurtleCommandResult |
useTool(ITurtleAccess turtle,
TurtleSide side,
TurtleVerb verb,
EnumFacing direction)
Will only be called for Tool turtle.
|
ResourceLocation getUpgradeID()
ComputerCraftAPI#registerTurtleUpgrade(ITurtleUpgrade)
int getLegacyUpgradeID()
ComputerCraftAPI#registerTurtleUpgrade(ITurtleUpgrade)
java.lang.String getUnlocalisedAdjective()
TurtleUpgradeType getType()
for the differences between them.
ItemStack getCraftingItem()
turtle.equip()
ItemStack#EMPTY
if it cannot be crafted.IPeripheral createPeripheral(ITurtleAccess turtle, TurtleSide side)
update(ITurtleAccess, TurtleSide)
. It will be attached, detached and have methods called in the same
manner as a Computer peripheral.turtle
- Access to the turtle that the peripheral is being created for.side
- Which side of the turtle (left or right) that the upgrade resides on.null
if this upgrade is a Tool
and this method is not expected to be called.TurtleCommandResult useTool(ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, EnumFacing direction)
turtle
- Access to the turtle that the tool resides on.side
- Which side of the turtle (left or right) the tool resides on.verb
- Which action (dig or attack) the turtle is being called on to perform.direction
- Which world direction the action should be performed in, relative to the turtles
position. This will either be up, down, or the direction the turtle is facing, depending on
whether dig, digUp or digDown was called.turtle.dig()
or turtle.attack()
lua method should return true. If true is returned, the tool will perform
a swinging animation. You may return null
if this turtle is a Peripheral and this method is not expected
to be called.<any> getModel(ITurtleAccess turtle, TurtleSide side)
net.minecraft.client.renderer.ItemModelMesher#getItemModel(ItemStack)
,
net.minecraft.client.renderer.block.model.ModelManager#getModel(ModelResourceLocation)
or any other
source.turtle
- Access to the turtle that the upgrade resides on. This will be null when getting item models!side
- Which side of the turtle (left or right) the upgrade resides on.null
has the same effect as the identify matrix.default void update(ITurtleAccess turtle, TurtleSide side)
turtle
- Access to the turtle that the upgrade resides on.side
- Which side of the turtle (left or right) the upgrade resides on.