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

Allow turtle upgrades to act as tools and peripherals

This may be useful when you want your tool to also provide additional
methods. For instance, a pickaxe could provide methods to check whether
it can break the block in front.
This commit is contained in:
SquidDev
2017-05-03 17:28:54 +01:00
parent 58e6e9ea46
commit a021a072b5
5 changed files with 22 additions and 4 deletions

View File

@@ -649,7 +649,7 @@ public class TileTurtle extends TileComputerBase
case 5: upgrade = getUpgrade( TurtleSide.Left ); break;
default: return false;
}
if( upgrade != null && upgrade.getType() == TurtleUpgradeType.Peripheral )
if( upgrade != null && upgrade.getType().isPeripheral() )
{
return true;
}

View File

@@ -950,7 +950,7 @@ public class TurtleBrain implements ITurtleAccess
{
ITurtleUpgrade upgrade = getUpgrade( side );
IPeripheral peripheral = null;
if( upgrade != null && upgrade.getType() == TurtleUpgradeType.Peripheral )
if( upgrade != null && upgrade.getType().isPeripheral() )
{
peripheral = upgrade.createPeripheral( this, side );
}

View File

@@ -31,7 +31,7 @@ public class TurtleToolCommand implements ITurtleCommand
if( !m_side.isPresent() || m_side.get() == side )
{
ITurtleUpgrade upgrade = turtle.getUpgrade( side );
if( upgrade != null && upgrade.getType() == TurtleUpgradeType.Tool )
if( upgrade != null && upgrade.getType().isTool() )
{
TurtleCommandResult result = upgrade.useTool( turtle, side, m_verb, m_direction.toWorldDir( turtle ) );
if( result.isSuccess() )