1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-08 17:33:01 +00:00

Add a whole tonne of documentation

There's a bit of duplication here, so we might try to clean this up, but
it's a good starting point.
This commit is contained in:
SquidDev
2020-07-09 21:59:19 +01:00
committed by Jonathan Coates
parent 3f277a7a7b
commit a6a1b9b8e5
19 changed files with 424 additions and 170 deletions

View File

@@ -108,6 +108,8 @@ public class TurtleAPI implements ILuaAPI
* Rotate the turtle 90 degress to the left.
*
* @return The turtle command result.
* @cc.treturn boolean Whether the turtle could successfully turn.
* @cc.treturn string|nil The reason the turtle could not turn.
*/
@LuaFunction
public final MethodResult turnLeft()
@@ -119,6 +121,8 @@ public class TurtleAPI implements ILuaAPI
* Rotate the turtle 90 degress to the right.
*
* @return The turtle command result.
* @cc.treturn boolean Whether the turtle could successfully turn.
* @cc.treturn string|nil The reason the turtle could not turn.
*/
@LuaFunction
public final MethodResult turnRight()
@@ -279,6 +283,7 @@ public class TurtleAPI implements ILuaAPI
* @param slot The slot to select.
* @return The turtle command result.
* @throws LuaException If the slot is out of range.
* @cc.treturn true When the slot has been selected.
* @see #getSelectedSlot
*/
@@ -525,18 +530,39 @@ public class TurtleAPI implements ILuaAPI
return trackCommand( new TurtleEquipCommand( TurtleSide.RIGHT ) );
}
/**
* Get information about the block in front of the turtle.
*
* @return The turtle command result.
* @cc.treturn boolean Whether there is a block in front of the turtle.
* @cc.treturn table|string Information about the block in front, or a message explaining that there is no block.
*/
@LuaFunction
public final MethodResult inspect()
{
return trackCommand( new TurtleInspectCommand( InteractDirection.FORWARD ) );
}
/**
* Get information about the block above the turtle.
*
* @return The turtle command result.
* @cc.treturn boolean Whether there is a block above the turtle.
* @cc.treturn table|string Information about the above below, or a message explaining that there is no block.
*/
@LuaFunction
public final MethodResult inspectUp()
{
return trackCommand( new TurtleInspectCommand( InteractDirection.UP ) );
}
/**
* Get information about the block below the turtle.
*
* @return The turtle command result.
* @cc.treturn boolean Whether there is a block below the turtle.
* @cc.treturn table|string Information about the block below, or a message explaining that there is no block.
*/
@LuaFunction
public final MethodResult inspectDown()
{

View File

@@ -36,11 +36,8 @@ public class TurtleDetectCommand implements ITurtleCommand
BlockPos oldPosition = turtle.getPosition();
BlockPos newPosition = oldPosition.offset( direction );
if( !WorldUtil.isLiquidBlock( world, newPosition ) && !world.isAirBlock( newPosition ) )
{
return TurtleCommandResult.success();
}
return TurtleCommandResult.failure();
return !WorldUtil.isLiquidBlock( world, newPosition ) && !world.isAirBlock( newPosition )
? TurtleCommandResult.success()
: TurtleCommandResult.failure();
}
}