dan200.computercraft.api.turtle

## Interface ITurtleAccess

    public interface ITurtleAccess

The interface passed to turtle by turtles, providing methods that they can call. This should not be implemented by your classes. Do not interact with turtles except via this interface and ITurtleUpgrade.

### Method Summary

Methods
`void` `addFuel(int fuel)` TODO: Document me
`boolean` `consumeFuel(int fuel)` Removes some fuel from the turtles fuel supply.
`java.lang.Object[]` `executeCommand(ILuaContext context, ITurtleCommand command)` Adds a custom command to the turtles command queue.
`EnumFacing` `getDirection()` Returns the world direction the turtle is currently facing.
`int` `getDyeColour()` Gets the colour the turtle has been dyed.
`int` `getFuelLevel()` TODO: Document me
`int` `getFuelLimit()` TODO: Document me
`IInventory` `getInventory()` TODO: Document me
`IPeripheral` `getPeripheral(TurtleSide side)` Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.
`BlockPos` `getPosition()` Returns a vector containing the integer co-ordinates at which the turtle resides.
`int` `getSelectedSlot()` TODO: Document me
`ITurtleUpgrade` `getUpgrade(TurtleSide side)` Returns the turtle on the specified side of the turtle, if there is one.
`NBTTagCompound` `getUpgradeNBTData(TurtleSide side)` TODO: Document me
`Vec3d` `getVisualPosition(float f)` Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
`float` `getVisualYaw(float f)` TODO: Document me
`World` `getWorld()` Returns the world in which the turtle resides.
`boolean` `isFuelNeeded()` TODO: Document me
`void` `playAnimation(TurtleAnimation animation)` TODO: Document me
`void` `setDirection(EnumFacing dir)` TODO: Document me
`void` `setDyeColour(int dyeColour)` Sets the colour of the turtle, as if the player had dyed it with a dye item.
`void` `setFuelLevel(int fuel)` TODO: Document me
`void` `setSelectedSlot(int slot)` TODO: Document me
`void` `setUpgrade(TurtleSide side, ITurtleUpgrade upgrade)` TODO: Document me
`boolean` `teleportTo(World world, BlockPos pos)` TODO: Document me
`void` `updateUpgradeNBTData(TurtleSide side)` TODO: Document me

### Method Detail

#### getWorld

    World getWorld()

Returns the world in which the turtle resides.

Returns:
  the world in which the turtle resides.

#### getPosition

    BlockPos getPosition()

Returns a vector containing the integer co-ordinates at which the turtle resides.

Returns:
  a vector containing the integer co-ordinates at which the turtle resides.

#### teleportTo

    boolean teleportTo(World world,
                     BlockPos pos)

TODO: Document me

#### getVisualPosition

    Vec3d getVisualPosition(float f)

Returns a vector containing the floating point co-ordinates at which the turtle is rendered. This will shift when the turtle is moving.

Parameters:
  `f` - The subframe fraction
Returns:
  a vector containing the floating point co-ordinates at which the turtle resides.

#### getVisualYaw

    float getVisualYaw(float f)

TODO: Document me

#### getDirection

    EnumFacing getDirection()

Returns the world direction the turtle is currently facing.

Returns:
  the world direction the turtle is currently facing.

#### setDirection

    void setDirection(EnumFacing dir)

TODO: Document me

#### getSelectedSlot

    int getSelectedSlot()

TODO: Document me

#### setSelectedSlot

    void setSelectedSlot(int slot)

TODO: Document me

#### setDyeColour

    void setDyeColour(int dyeColour)

Sets the colour of the turtle, as if the player had dyed it with a dye item.

Parameters:
  `dyeColour` - 0-15 to dye the turtle one of the 16 standard minecraft colours, or -1 to remove the dye from the turtle.

#### getDyeColour

    int getDyeColour()

Gets the colour the turtle has been dyed.

Returns:
  0-15 if the turtle has been dyed one of the 16 standard minecraft colours, -1 if the turtle is clean.

#### getInventory

    IInventory getInventory()

TODO: Document me

#### isFuelNeeded

    boolean isFuelNeeded()

TODO: Document me

#### getFuelLevel

    int getFuelLevel()

TODO: Document me

#### setFuelLevel

    void setFuelLevel(int fuel)

TODO: Document me

#### getFuelLimit

    int getFuelLimit()

TODO: Document me

#### consumeFuel

    boolean consumeFuel(int fuel)

Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle.

Returns:
  Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number greater than the current fuel level of the turtle.

#### addFuel

    void addFuel(int fuel)

TODO: Document me

#### executeCommand

    java.lang.Object[] executeCommand(ILuaContext context,
                                    ITurtleCommand command)
                                      throws LuaException,
                                             java.lang.InterruptedException

Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed on the main thread, so are guaranteed to be able to access Minecraft objects safely, and will be queued up with the turtles standard movement and tool commands. An issued command will return an unique integer, which will be supplied as a parameter to a "turtle_response" event issued to the turtle after the command has completed. Look at the lua source code for "rom/apis/turtle" for how to build a lua wrapper around this functionality.

Parameters:
  `command` - an object which will execute the custom command when its point in the queue is reached
Returns:
  the objects the command returned when executed. you should probably return these to the player unchanged if called from a peripheral method.
Throws:
  `LuaException`
  `java.lang.InterruptedException`
See Also:
  `ITurtleCommand`

#### playAnimation

    void playAnimation(TurtleAnimation animation)

TODO: Document me

#### getUpgrade

    ITurtleUpgrade getUpgrade(TurtleSide side)

Returns the turtle on the specified side of the turtle, if there is one.

Returns:
  the turtle on the specified side of the turtle, if there is one.

#### setUpgrade

    void setUpgrade(TurtleSide side,
                  ITurtleUpgrade upgrade)

TODO: Document me

#### getPeripheral

    IPeripheral getPeripheral(TurtleSide side)

Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.

Returns:
  the peripheral created by the upgrade on the specified side of the turtle, if there is one.

#### getUpgradeNBTData

    NBTTagCompound getUpgradeNBTData(TurtleSide side)

TODO: Document me

#### updateUpgradeNBTData

    void updateUpgradeNBTData(TurtleSide side)

TODO: Document me