mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-07-17 08:42:44 +00:00
Convert computer sides to an enum
Previously we just relied on magic int values, which was confusing and potentially error-prone. We could use EnumFacing, but that's a) dependent on MC and b) incorrect, as we're referring to local coordinates.
This commit is contained in:
@@ -9,8 +9,8 @@ package dan200.computercraft.shared.command;
|
||||
import com.google.common.collect.Sets;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.core.apis.IAPIEnvironment;
|
||||
import dan200.computercraft.core.computer.Computer;
|
||||
import dan200.computercraft.core.computer.ComputerSide;
|
||||
import dan200.computercraft.core.tracking.ComputerTracker;
|
||||
import dan200.computercraft.core.tracking.Tracking;
|
||||
import dan200.computercraft.core.tracking.TrackingContext;
|
||||
@@ -115,12 +115,12 @@ public final class CommandComputerCraft extends CommandDelegate
|
||||
table.row( header( "Position" ), linkPosition( context, computer ) );
|
||||
table.row( header( "Family" ), text( computer.getFamily().toString() ) );
|
||||
|
||||
for( int i = 0; i < 6; i++ )
|
||||
for( ComputerSide side : ComputerSide.values() )
|
||||
{
|
||||
IPeripheral peripheral = computer.getPeripheral( i );
|
||||
IPeripheral peripheral = computer.getPeripheral( side );
|
||||
if( peripheral != null )
|
||||
{
|
||||
table.row( header( "Peripheral " + IAPIEnvironment.SIDE_NAMES[i] ), text( peripheral.getType() ) );
|
||||
table.row( header( "Peripheral " + side.getName() ), text( peripheral.getType() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user