Normalise enums to use SHOUTY_CASE

PascalCase is more .NET than Java
This commit is contained in:
SquidDev 2020-01-28 22:28:48 +00:00
parent 044d2b2b06
commit f3a330e330
56 changed files with 262 additions and 262 deletions

View File

@ -17,70 +17,70 @@ public enum TurtleAnimation
/**
* An animation which does nothing. This takes no time to complete.
*
* @see #Wait
* @see #ShortWait
* @see #WAIT
* @see #SHORT_WAIT
*/
None,
NONE,
/**
* Make the turtle move forward. Note that the animation starts from the block <em>behind</em> it, and
* moves into this one.
*/
MoveForward,
MOVE_FORWARD,
/**
* Make the turtle move backwards. Note that the animation starts from the block <em>in front</em> it, and
* moves into this one.
*/
MoveBack,
MOVE_BACK,
/**
* Make the turtle move backwards. Note that the animation starts from the block <em>above</em> it, and
* moves into this one.
*/
MoveUp,
MOVE_UP,
/**
* Make the turtle move backwards. Note that the animation starts from the block <em>below</em> it, and
* moves into this one.
*/
MoveDown,
MOVE_DOWN,
/**
* Turn the turtle to the left. Note that the animation starts with the turtle facing <em>right</em>, and
* the turtle turns to face in the current direction.
*/
TurnLeft,
TURN_LEFT,
/**
* Turn the turtle to the left. Note that the animation starts with the turtle facing <em>right</em>, and
* the turtle turns to face in the current direction.
*/
TurnRight,
TURN_RIGHT,
/**
* Swing the tool on the left.
*/
SwingLeftTool,
SWING_LEFT_TOOL,
/**
* Swing the tool on the right.
*/
SwingRightTool,
SWING_RIGHT_TOOL,
/**
* Wait until the animation has finished, performing no movement.
*
* @see #ShortWait
* @see #None
* @see #SHORT_WAIT
* @see #NONE
*/
Wait,
WAIT,
/**
* Wait until the animation has finished, performing no movement. This takes 4 ticks to complete.
*
* @see #Wait
* @see #None
* @see #WAIT
* @see #NONE
*/
ShortWait,
SHORT_WAIT,
}

View File

@ -13,10 +13,10 @@ public enum TurtleSide
/**
* The turtle's left side (where the pickaxe usually is on a Wireless Mining Turtle).
*/
Left,
LEFT,
/**
* The turtle's right side (where the modem usually is on a Wireless Mining Turtle).
*/
Right,
RIGHT,
}

View File

@ -16,28 +16,28 @@ public enum TurtleUpgradeType
* A tool is rendered as an item on the side of the turtle, and responds to the {@code turtle.dig()}
* and {@code turtle.attack()} methods (Such as pickaxe or sword on Mining and Melee turtles).
*/
Tool,
TOOL,
/**
* A peripheral adds a special peripheral which is attached to the side of the turtle,
* and can be interacted with the {@code peripheral} API (Such as the modem on Wireless Turtles).
*/
Peripheral,
PERIPHERAL,
/**
* An upgrade which provides both a tool and a peripheral. This can be used when you wish
* your upgrade to also provide methods. For example, a pickaxe could provide methods
* determining whether it can break the given block or not.
*/
Both;
BOTH;
public boolean isTool()
{
return this == Tool || this == Both;
return this == TOOL || this == BOTH;
}
public boolean isPeripheral()
{
return this == Peripheral || this == Both;
return this == PERIPHERAL || this == BOTH;
}
}

View File

@ -19,10 +19,10 @@ public enum TurtleVerb
/**
* The turtle called {@code turtle.dig()}, {@code turtle.digUp()} or {@code turtle.digDown()}.
*/
Dig,
DIG,
/**
* The turtle called {@code turtle.attack()}, {@code turtle.attackUp()} or {@code turtle.attackDown()}.
*/
Attack,
ATTACK,
}

View File

@ -130,7 +130,7 @@ public static void onItemColours( ColorHandlerEvent.Item event )
case 2: // Light colour
{
int light = ItemPocketComputer.getLightState( stack );
return light == -1 ? Colour.Black.getHex() : light;
return light == -1 ? Colour.BLACK.getHex() : light;
}
}
}, ComputerCraft.Items.pocketComputerNormal, ComputerCraft.Items.pocketComputerAdvanced );

View File

@ -270,7 +270,7 @@ public static void drawTerminal(
public static void drawEmptyTerminal( @Nonnull Matrix4f transform, @Nonnull IRenderTypeBuffer renderer, float x, float y, float width, float height )
{
Colour colour = Colour.Black;
Colour colour = Colour.BLACK;
drawQuad( transform, renderer.getBuffer( TYPE ), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
}
@ -286,7 +286,7 @@ public static void drawEmptyTerminal( float x, float y, float width, float heigh
public static void drawBlocker( @Nonnull Matrix4f transform, @Nonnull IRenderTypeBuffer renderer, float x, float y, float width, float height )
{
Colour colour = Colour.Black;
Colour colour = Colour.BLACK;
drawQuad( transform, renderer.getBuffer( Type.BLOCKER ), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
}

View File

@ -137,14 +137,14 @@ public void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
switch( m_family )
{
case Normal:
case NORMAL:
default:
minecraft.getTextureManager().bindTexture( BACKGROUND_NORMAL );
break;
case Advanced:
case ADVANCED:
minecraft.getTextureManager().bindTexture( BACKGROUND_ADVANCED );
break;
case Command:
case COMMAND:
minecraft.getTextureManager().bindTexture( BACKGROUND_COMMAND );
break;
}

View File

@ -110,7 +110,7 @@ private void drawSelectionSlot( boolean advanced )
protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
{
// Draw term
boolean advanced = m_family == ComputerFamily.Advanced;
boolean advanced = m_family == ComputerFamily.ADVANCED;
terminal.draw( terminalWrapper.getX(), terminalWrapper.getY() );
// Draw border/inventory

View File

@ -56,10 +56,10 @@ public static ModelResourceLocation getTurtleModel( ComputerFamily family, boole
{
switch( family )
{
case Normal:
case NORMAL:
default:
return coloured ? COLOUR_TURTLE_MODEL : NORMAL_TURTLE_MODEL;
case Advanced:
case ADVANCED:
return coloured ? COLOUR_TURTLE_MODEL : ADVANCED_TURTLE_MODEL;
}
}
@ -121,15 +121,15 @@ public void render( @Nonnull TileTurtle turtle, float partialTicks, @Nonnull Mat
renderModel( transform, buffer, lightmapCoord, overlayLight, getTurtleModel( family, colour != -1 ), colour == -1 ? null : new int[] { colour } );
// Render the overlay
ModelResourceLocation overlayModel = getTurtleOverlayModel( overlay, HolidayUtil.getCurrentHoliday() == Holiday.Christmas );
ModelResourceLocation overlayModel = getTurtleOverlayModel( overlay, HolidayUtil.getCurrentHoliday() == Holiday.CHRISTMAS );
if( overlayModel != null )
{
renderModel( transform, buffer, lightmapCoord, overlayLight, overlayModel, null );
}
// Render the upgrades
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.Left, partialTicks );
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.Right, partialTicks );
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.LEFT, partialTicks );
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.RIGHT, partialTicks );
transform.pop();
}

View File

@ -114,10 +114,10 @@ public IBakedModel getModelWithOverrides( @Nonnull IBakedModel originalModel, @N
{
ItemTurtle turtle = (ItemTurtle) stack.getItem();
int colour = turtle.getColour( stack );
ITurtleUpgrade leftUpgrade = turtle.getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade rightUpgrade = turtle.getUpgrade( stack, TurtleSide.Right );
ITurtleUpgrade leftUpgrade = turtle.getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade rightUpgrade = turtle.getUpgrade( stack, TurtleSide.RIGHT );
ResourceLocation overlay = turtle.getOverlay( stack );
boolean christmas = HolidayUtil.getCurrentHoliday() == Holiday.Christmas;
boolean christmas = HolidayUtil.getCurrentHoliday() == Holiday.CHRISTMAS;
String label = turtle.getLabel( stack );
boolean flip = label != null && (label.equals( "Dinnerbone" ) || label.equals( "Grumm" ));
TurtleModelCombination combo = new TurtleModelCombination( colour != -1, leftUpgrade, rightUpgrade, overlay, christmas, flip );
@ -145,8 +145,8 @@ private IBakedModel buildModel( TurtleModelCombination combo )
IBakedModel baseModel = combo.m_colour ? colourModel : familyModel;
IBakedModel overlayModel = overlayModelLocation != null ? modelManager.getModel( overlayModelLocation ) : null;
TransformationMatrix transform = combo.m_flip ? flip : identity;
TransformedModel leftModel = combo.m_leftUpgrade != null ? combo.m_leftUpgrade.getModel( null, TurtleSide.Left ) : null;
TransformedModel rightModel = combo.m_rightUpgrade != null ? combo.m_rightUpgrade.getModel( null, TurtleSide.Right ) : null;
TransformedModel leftModel = combo.m_leftUpgrade != null ? combo.m_leftUpgrade.getModel( null, TurtleSide.LEFT ) : null;
TransformedModel rightModel = combo.m_rightUpgrade != null ? combo.m_rightUpgrade.getModel( null, TurtleSide.RIGHT ) : null;
return new TurtleMultiModel( baseModel, overlayModel, transform, leftModel, rightModel );
}

View File

@ -609,7 +609,7 @@ private void displayFailure( String message, String extra )
terminal.reset();
// Display our primary error message
if( colour ) terminal.setTextColour( 15 - Colour.Red.ordinal() );
if( colour ) terminal.setTextColour( 15 - Colour.RED.ordinal() );
terminal.write( message );
if( extra != null )
@ -622,7 +622,7 @@ private void displayFailure( String message, String extra )
// And display our generic "CC may be installed incorrectly" message.
terminal.setCursorPos( 0, terminal.getCursorY() + 1 );
if( colour ) terminal.setTextColour( 15 - Colour.White.ordinal() );
if( colour ) terminal.setTextColour( 15 - Colour.WHITE.ordinal() );
terminal.write( "ComputerCraft may be installed incorrectly" );
}

View File

@ -84,17 +84,17 @@ public static void registerBlocks( RegistryEvent.Register<Block> event )
// Computers
ComputerCraft.Blocks.computerNormal = new BlockComputer(
Block.Properties.create( Material.ROCK ).hardnessAndResistance( 2.0f ),
ComputerFamily.Normal, TileComputer.FACTORY_NORMAL
ComputerFamily.NORMAL, TileComputer.FACTORY_NORMAL
);
ComputerCraft.Blocks.computerAdvanced = new BlockComputer(
Block.Properties.create( Material.ROCK ).hardnessAndResistance( 2.0f ),
ComputerFamily.Advanced, TileComputer.FACTORY_ADVANCED
ComputerFamily.ADVANCED, TileComputer.FACTORY_ADVANCED
);
ComputerCraft.Blocks.computerCommand = new BlockComputer(
Block.Properties.create( Material.ROCK ).hardnessAndResistance( -1, 6000000.0F ),
ComputerFamily.Command, TileCommandComputer.FACTORY
ComputerFamily.COMMAND, TileCommandComputer.FACTORY
);
registry.registerAll(
@ -106,12 +106,12 @@ public static void registerBlocks( RegistryEvent.Register<Block> event )
// Turtles
ComputerCraft.Blocks.turtleNormal = new BlockTurtle(
Block.Properties.create( Material.ROCK ).hardnessAndResistance( 2.5f ),
ComputerFamily.Normal, TileTurtle.FACTORY_NORMAL
ComputerFamily.NORMAL, TileTurtle.FACTORY_NORMAL
);
ComputerCraft.Blocks.turtleAdvanced = new BlockTurtle(
Block.Properties.create( Material.ROCK ).hardnessAndResistance( 2.5f ),
ComputerFamily.Advanced, TileTurtle.FACTORY_ADVANCED
ComputerFamily.ADVANCED, TileTurtle.FACTORY_ADVANCED
);
registry.registerAll(
@ -234,8 +234,8 @@ public static void registerItems( RegistryEvent.Register<Item> event )
);
// Pocket computer
ComputerCraft.Items.pocketComputerNormal = new ItemPocketComputer( defaultItem().maxStackSize( 1 ), ComputerFamily.Normal );
ComputerCraft.Items.pocketComputerAdvanced = new ItemPocketComputer( defaultItem().maxStackSize( 1 ), ComputerFamily.Advanced );
ComputerCraft.Items.pocketComputerNormal = new ItemPocketComputer( defaultItem().maxStackSize( 1 ), ComputerFamily.NORMAL );
ComputerCraft.Items.pocketComputerAdvanced = new ItemPocketComputer( defaultItem().maxStackSize( 1 ), ComputerFamily.ADVANCED );
registry.registerAll(
ComputerCraft.Items.pocketComputerNormal.setRegistryName( new ResourceLocation( ComputerCraft.MOD_ID, "pocket_computer_normal" ) ),

View File

@ -205,7 +205,7 @@ else if( b.getWorld() == world )
int queued = 0;
for( ServerComputer computer : computers )
{
if( computer.getFamily() == ComputerFamily.Command && computer.isOn() )
if( computer.getFamily() == ComputerFamily.COMMAND && computer.isOn() )
{
computer.queueEvent( "computer_command", rest );
queued++;

View File

@ -32,7 +32,7 @@ public class TileCommandComputer extends TileComputer
{
public static final NamedTileEntityType<TileCommandComputer> FACTORY = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "command_computer" ),
f -> new TileCommandComputer( ComputerFamily.Command, f )
f -> new TileCommandComputer( ComputerFamily.COMMAND, f )
);
public class CommandReceiver implements ICommandSource

View File

@ -27,12 +27,12 @@ public class TileComputer extends TileComputerBase
{
public static final NamedTileEntityType<TileComputer> FACTORY_NORMAL = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "computer_normal" ),
f -> new TileComputer( ComputerFamily.Normal, f )
f -> new TileComputer( ComputerFamily.NORMAL, f )
);
public static final NamedTileEntityType<TileComputer> FACTORY_ADVANCED = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "computer_advanced" ),
f -> new TileComputer( ComputerFamily.Advanced, f )
f -> new TileComputer( ComputerFamily.ADVANCED, f )
);
private ComputerProxy m_proxy;

View File

@ -7,7 +7,7 @@
public enum ComputerFamily
{
Normal,
Advanced,
Command
NORMAL,
ADVANCED,
COMMAND
}

View File

@ -50,7 +50,7 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput
public ServerComputer( World world, int computerID, String label, int instanceID, ComputerFamily family, int terminalWidth, int terminalHeight )
{
super( family != ComputerFamily.Normal, terminalWidth, terminalHeight );
super( family != ComputerFamily.NORMAL, terminalWidth, terminalHeight );
m_instanceID = instanceID;
m_world = world;

View File

@ -48,7 +48,7 @@ private static boolean canInteractWith( @Nonnull ServerComputer computer, @Nonnu
}
// If we're a command computer then ensure we're in creative
if( computer.getFamily() == ComputerFamily.Command )
if( computer.getFamily() == ComputerFamily.COMMAND )
{
MinecraftServer server = player.getServer();
if( server == null || !server.isCommandBlockEnabled() )

View File

@ -29,11 +29,11 @@ public static ItemStack create( int id, String label, ComputerFamily family )
{
switch( family )
{
case Normal:
case NORMAL:
return ComputerCraft.Items.computerNormal.create( id, label );
case Advanced:
case ADVANCED:
return ComputerCraft.Items.computerAdvanced.create( id, label );
case Command:
case COMMAND:
return ComputerCraft.Items.computerCommand.create( id, label );
default:
return ItemStack.EMPTY;

View File

@ -80,7 +80,7 @@ public boolean setLabel( @Nonnull ItemStack stack, String label )
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{
ComputerFamily family = getFamily();
if( family != ComputerFamily.Command )
if( family != ComputerFamily.COMMAND )
{
int id = getComputerID( stack );
if( id >= 0 )

View File

@ -116,8 +116,8 @@ public void onRuntimeAvailable( IJeiRuntime runtime )
StringBuilder name = new StringBuilder();
// Add left and right upgrades to the identifier
ITurtleUpgrade left = turtle.getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade right = turtle.getUpgrade( stack, TurtleSide.Right );
ITurtleUpgrade left = turtle.getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = turtle.getUpgrade( stack, TurtleSide.RIGHT );
if( left != null ) name.append( left.getUpgradeID() );
if( left != null && right != null ) name.append( '|' );
if( right != null ) name.append( right.getUpgradeID() );

View File

@ -37,7 +37,7 @@
class RecipeResolver implements IRecipeManagerPlugin
{
static final ComputerFamily[] MAIN_FAMILIES = new ComputerFamily[] { ComputerFamily.Normal, ComputerFamily.Advanced };
static final ComputerFamily[] MAIN_FAMILIES = new ComputerFamily[] { ComputerFamily.NORMAL, ComputerFamily.ADVANCED };
private final Map<Item, List<UpgradeInfo>> upgradeItemLookup = new HashMap<>();
private final List<UpgradeInfo> pocketUpgrades = new ArrayList<>();
@ -150,8 +150,8 @@ private List<Shaped> findRecipesWithInput( @Nonnull ItemStack stack )
{
// Suggest possible upgrades which can be applied to this turtle
ITurtleItem item = (ITurtleItem) stack.getItem();
ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.Right );
ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.RIGHT );
if( left != null && right != null ) return Collections.emptyList();
List<Shaped> recipes = new ArrayList<>();
@ -231,8 +231,8 @@ private static List<Shaped> findRecipesWithOutput( @Nonnull ItemStack stack )
ITurtleItem item = (ITurtleItem) stack.getItem();
List<Shaped> recipes = new ArrayList<>( 0 );
ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.Right );
ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.RIGHT );
// The turtle is facing towards us, so upgrades on the left are actually crafted on the right.
if( left != null )

View File

@ -126,6 +126,6 @@ private static void setDiskID( @Nonnull ItemStack stack, int id )
public int getColour( @Nonnull ItemStack stack )
{
int colour = IColouredItem.getColourBasic( stack );
return colour == -1 ? Colour.White.getHex() : colour;
return colour == -1 ? Colour.WHITE.getHex() : colour;
}
}

View File

@ -134,6 +134,6 @@ private static String getSubPath( @Nonnull ItemStack stack )
public static int getColour( @Nonnull ItemStack stack )
{
CompoundNBT nbt = stack.getTag();
return nbt != null && nbt.contains( NBT_COLOUR ) ? nbt.getInt( NBT_COLOUR ) : Colour.Blue.getHex();
return nbt != null && nbt.contains( NBT_COLOUR ) ? nbt.getInt( NBT_COLOUR ) : Colour.BLUE.getHex();
}
}

View File

@ -87,7 +87,7 @@ public ItemStack getCraftingResult( @Nonnull CraftingInventory inv )
}
}
return ItemDisk.createFromIDAndColour( -1, null, tracker.hasColour() ? tracker.getColour() : Colour.Blue.getHex() );
return ItemDisk.createFromIDAndColour( -1, null, tracker.hasColour() ? tracker.getColour() : Colour.BLUE.getHex() );
}
@Override
@ -100,7 +100,7 @@ public boolean canFit( int x, int y )
@Override
public ItemStack getRecipeOutput()
{
return ItemDisk.createFromIDAndColour( -1, null, Colour.Blue.getHex() );
return ItemDisk.createFromIDAndColour( -1, null, Colour.BLUE.getHex() );
}
@Nonnull

View File

@ -21,9 +21,9 @@ public static ItemStack create( int id, String label, int colour, ComputerFamily
{
switch( family )
{
case Normal:
case NORMAL:
return ComputerCraft.Items.pocketComputerNormal.create( id, label, colour, upgrade );
case Advanced:
case ADVANCED:
return ComputerCraft.Items.pocketComputerAdvanced.create( id, label, colour, upgrade );
default:
return ItemStack.EMPTY;

View File

@ -37,7 +37,7 @@ public boolean canFit( int x, int y )
@Override
public ItemStack getRecipeOutput()
{
return PocketComputerItemFactory.create( -1, null, -1, ComputerFamily.Normal, null );
return PocketComputerItemFactory.create( -1, null, -1, ComputerFamily.NORMAL, null );
}
@Override

View File

@ -133,11 +133,11 @@ private static TurtleSide parseSide( Object[] arguments, int index ) throws LuaE
}
else if( side.equalsIgnoreCase( "left" ) )
{
return TurtleSide.Left;
return TurtleSide.LEFT;
}
else if( side.equalsIgnoreCase( "right" ) )
{
return TurtleSide.Right;
return TurtleSide.RIGHT;
}
else
{
@ -152,58 +152,58 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
{
case 0: // forward
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.Forward ) );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.FORWARD ) );
case 1: // back
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.Back ) );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.BACK ) );
case 2: // up
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.Up ) );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.UP ) );
case 3: // down
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.Down ) );
return tryCommand( context, new TurtleMoveCommand( MoveDirection.DOWN ) );
case 4: // turnLeft
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleTurnCommand( TurnDirection.Left ) );
return tryCommand( context, new TurtleTurnCommand( TurnDirection.LEFT ) );
case 5: // turnRight
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleTurnCommand( TurnDirection.Right ) );
return tryCommand( context, new TurtleTurnCommand( TurnDirection.RIGHT ) );
case 6:
{
// dig
TurtleSide side = parseSide( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, TurtleToolCommand.dig( InteractDirection.Forward, side ) );
return tryCommand( context, TurtleToolCommand.dig( InteractDirection.FORWARD, side ) );
}
case 7:
{
// digUp
TurtleSide side = parseSide( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, TurtleToolCommand.dig( InteractDirection.Up, side ) );
return tryCommand( context, TurtleToolCommand.dig( InteractDirection.UP, side ) );
}
case 8:
{
// digDown
TurtleSide side = parseSide( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, TurtleToolCommand.dig( InteractDirection.Down, side ) );
return tryCommand( context, TurtleToolCommand.dig( InteractDirection.DOWN, side ) );
}
case 9: // place
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtlePlaceCommand( InteractDirection.Forward, args ) );
return tryCommand( context, new TurtlePlaceCommand( InteractDirection.FORWARD, args ) );
case 10: // placeUp
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtlePlaceCommand( InteractDirection.Up, args ) );
return tryCommand( context, new TurtlePlaceCommand( InteractDirection.UP, args ) );
case 11: // placeDown
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtlePlaceCommand( InteractDirection.Down, args ) );
return tryCommand( context, new TurtlePlaceCommand( InteractDirection.DOWN, args ) );
case 12:
{
// drop
int count = parseCount( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleDropCommand( InteractDirection.Forward, count ) );
return tryCommand( context, new TurtleDropCommand( InteractDirection.FORWARD, count ) );
}
case 13:
{
@ -229,72 +229,72 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
return new Object[] { stack.isEmpty() ? 64 : Math.min( stack.getMaxStackSize(), 64 ) - stack.getCount() };
}
case 16: // detect
return tryCommand( context, new TurtleDetectCommand( InteractDirection.Forward ) );
return tryCommand( context, new TurtleDetectCommand( InteractDirection.FORWARD ) );
case 17: // detectUp
return tryCommand( context, new TurtleDetectCommand( InteractDirection.Up ) );
return tryCommand( context, new TurtleDetectCommand( InteractDirection.UP ) );
case 18: // detectDown
return tryCommand( context, new TurtleDetectCommand( InteractDirection.Down ) );
return tryCommand( context, new TurtleDetectCommand( InteractDirection.DOWN ) );
case 19: // compare
return tryCommand( context, new TurtleCompareCommand( InteractDirection.Forward ) );
return tryCommand( context, new TurtleCompareCommand( InteractDirection.FORWARD ) );
case 20: // compareUp
return tryCommand( context, new TurtleCompareCommand( InteractDirection.Up ) );
return tryCommand( context, new TurtleCompareCommand( InteractDirection.UP ) );
case 21: // compareDown
return tryCommand( context, new TurtleCompareCommand( InteractDirection.Down ) );
return tryCommand( context, new TurtleCompareCommand( InteractDirection.DOWN ) );
case 22:
{
// attack
TurtleSide side = parseSide( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, TurtleToolCommand.attack( InteractDirection.Forward, side ) );
return tryCommand( context, TurtleToolCommand.attack( InteractDirection.FORWARD, side ) );
}
case 23:
{
// attackUp
TurtleSide side = parseSide( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, TurtleToolCommand.attack( InteractDirection.Up, side ) );
return tryCommand( context, TurtleToolCommand.attack( InteractDirection.UP, side ) );
}
case 24:
{
// attackDown
TurtleSide side = parseSide( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, TurtleToolCommand.attack( InteractDirection.Down, side ) );
return tryCommand( context, TurtleToolCommand.attack( InteractDirection.DOWN, side ) );
}
case 25:
{
// dropUp
int count = parseCount( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleDropCommand( InteractDirection.Up, count ) );
return tryCommand( context, new TurtleDropCommand( InteractDirection.UP, count ) );
}
case 26:
{
// dropDown
int count = parseCount( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleDropCommand( InteractDirection.Down, count ) );
return tryCommand( context, new TurtleDropCommand( InteractDirection.DOWN, count ) );
}
case 27:
{
// suck
int count = parseCount( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleSuckCommand( InteractDirection.Forward, count ) );
return tryCommand( context, new TurtleSuckCommand( InteractDirection.FORWARD, count ) );
}
case 28:
{
// suckUp
int count = parseCount( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleSuckCommand( InteractDirection.Up, count ) );
return tryCommand( context, new TurtleSuckCommand( InteractDirection.UP, count ) );
}
case 29:
{
// suckDown
int count = parseCount( args, 0 );
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleSuckCommand( InteractDirection.Down, count ) );
return tryCommand( context, new TurtleSuckCommand( InteractDirection.DOWN, count ) );
}
case 30: // getFuelLevel
return new Object[] { m_turtle.isFuelNeeded() ? m_turtle.getFuelLevel() : "unlimited" };
@ -324,16 +324,16 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
return new Object[] { m_turtle.isFuelNeeded() ? m_turtle.getFuelLimit() : "unlimited" };
case 36: // equipLeft
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleEquipCommand( TurtleSide.Left ) );
return tryCommand( context, new TurtleEquipCommand( TurtleSide.LEFT ) );
case 37: // equipRight
m_environment.addTrackingChange( TrackingField.TURTLE_OPS );
return tryCommand( context, new TurtleEquipCommand( TurtleSide.Right ) );
return tryCommand( context, new TurtleEquipCommand( TurtleSide.RIGHT ) );
case 38: // inspect
return tryCommand( context, new TurtleInspectCommand( InteractDirection.Forward ) );
return tryCommand( context, new TurtleInspectCommand( InteractDirection.FORWARD ) );
case 39: // inspectUp
return tryCommand( context, new TurtleInspectCommand( InteractDirection.Up ) );
return tryCommand( context, new TurtleInspectCommand( InteractDirection.UP ) );
case 40: // inspectDown
return tryCommand( context, new TurtleInspectCommand( InteractDirection.Down ) );
return tryCommand( context, new TurtleInspectCommand( InteractDirection.DOWN ) );
case 41: // getItemDetail
{
// FIXME: There's a race condition here if the stack is being modified (mutating NBT, etc...)

View File

@ -152,7 +152,7 @@ public void onBlockPlacedBy( World world, BlockPos pos, BlockState state, @Nulla
@Override
public float getExplosionResistance( BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion )
{
if( getFamily() == ComputerFamily.Advanced || exploder instanceof LivingEntity || exploder instanceof DamagingProjectileEntity )
if( getFamily() == ComputerFamily.ADVANCED || exploder instanceof LivingEntity || exploder instanceof DamagingProjectileEntity )
{
return 2000;
}

View File

@ -57,12 +57,12 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
public static final NamedTileEntityType<TileTurtle> FACTORY_NORMAL = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "turtle_normal" ),
type -> new TileTurtle( type, ComputerFamily.Normal )
type -> new TileTurtle( type, ComputerFamily.NORMAL )
);
public static final NamedTileEntityType<TileTurtle> FACTORY_ADVANCED = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "turtle_advanced" ),
type -> new TileTurtle( type, ComputerFamily.Advanced )
type -> new TileTurtle( type, ComputerFamily.ADVANCED )
);
enum MoveState
@ -526,10 +526,10 @@ private boolean hasPeripheralUpgradeOnSide( ComputerSide side )
switch( side )
{
case RIGHT:
upgrade = getUpgrade( TurtleSide.Right );
upgrade = getUpgrade( TurtleSide.RIGHT );
break;
case LEFT:
upgrade = getUpgrade( TurtleSide.Left );
upgrade = getUpgrade( TurtleSide.LEFT );
break;
default:
return false;

View File

@ -10,20 +10,20 @@
public enum InteractDirection
{
Forward,
Up,
Down;
FORWARD,
UP,
DOWN;
public Direction toWorldDir( ITurtleAccess turtle )
{
switch( this )
{
case Forward:
case FORWARD:
default:
return turtle.getDirection();
case Up:
case UP:
return Direction.UP;
case Down:
case DOWN:
return Direction.DOWN;
}
}

View File

@ -10,23 +10,23 @@
public enum MoveDirection
{
Forward,
Back,
Up,
Down;
FORWARD,
BACK,
UP,
DOWN;
public Direction toWorldDir( ITurtleAccess turtle )
{
switch( this )
{
case Forward:
case FORWARD:
default:
return turtle.getDirection();
case Back:
case BACK:
return turtle.getDirection().getOpposite();
case Up:
case UP:
return Direction.UP;
case Down:
case DOWN:
return Direction.DOWN;
}
}

View File

@ -7,6 +7,6 @@
public enum TurnDirection
{
Left,
Right,
LEFT,
RIGHT,
}

View File

@ -84,7 +84,7 @@ public class TurtleBrain implements ITurtleAccess
private int m_colourHex = -1;
private ResourceLocation m_overlay = null;
private TurtleAnimation m_animation = TurtleAnimation.None;
private TurtleAnimation m_animation = TurtleAnimation.NONE;
private int m_animationProgress = 0;
private int m_lastAnimationProgress = 0;
@ -166,18 +166,18 @@ private void readCommon( CompoundNBT nbt )
m_overlay = nbt.contains( NBT_OVERLAY ) ? new ResourceLocation( nbt.getString( NBT_OVERLAY ) ) : null;
// Read upgrades
setUpgrade( TurtleSide.Left, nbt.contains( NBT_LEFT_UPGRADE ) ? TurtleUpgrades.get( nbt.getString( NBT_LEFT_UPGRADE ) ) : null );
setUpgrade( TurtleSide.Right, nbt.contains( NBT_RIGHT_UPGRADE ) ? TurtleUpgrades.get( nbt.getString( NBT_RIGHT_UPGRADE ) ) : null );
setUpgrade( TurtleSide.LEFT, nbt.contains( NBT_LEFT_UPGRADE ) ? TurtleUpgrades.get( nbt.getString( NBT_LEFT_UPGRADE ) ) : null );
setUpgrade( TurtleSide.RIGHT, nbt.contains( NBT_RIGHT_UPGRADE ) ? TurtleUpgrades.get( nbt.getString( NBT_RIGHT_UPGRADE ) ) : null );
// NBT
m_upgradeNBTData.clear();
if( nbt.contains( NBT_LEFT_UPGRADE_DATA ) )
{
m_upgradeNBTData.put( TurtleSide.Left, nbt.getCompound( NBT_LEFT_UPGRADE_DATA ).copy() );
m_upgradeNBTData.put( TurtleSide.LEFT, nbt.getCompound( NBT_LEFT_UPGRADE_DATA ).copy() );
}
if( nbt.contains( NBT_RIGHT_UPGRADE_DATA ) )
{
m_upgradeNBTData.put( TurtleSide.Right, nbt.getCompound( NBT_RIGHT_UPGRADE_DATA ).copy() );
m_upgradeNBTData.put( TurtleSide.RIGHT, nbt.getCompound( NBT_RIGHT_UPGRADE_DATA ).copy() );
}
}
@ -188,19 +188,19 @@ private void writeCommon( CompoundNBT nbt )
if( m_overlay != null ) nbt.putString( NBT_OVERLAY, m_overlay.toString() );
// Write upgrades
String leftUpgradeId = getUpgradeId( getUpgrade( TurtleSide.Left ) );
String leftUpgradeId = getUpgradeId( getUpgrade( TurtleSide.LEFT ) );
if( leftUpgradeId != null ) nbt.putString( NBT_LEFT_UPGRADE, leftUpgradeId );
String rightUpgradeId = getUpgradeId( getUpgrade( TurtleSide.Right ) );
String rightUpgradeId = getUpgradeId( getUpgrade( TurtleSide.RIGHT ) );
if( rightUpgradeId != null ) nbt.putString( NBT_RIGHT_UPGRADE, rightUpgradeId );
// Write upgrade NBT
if( m_upgradeNBTData.containsKey( TurtleSide.Left ) )
if( m_upgradeNBTData.containsKey( TurtleSide.LEFT ) )
{
nbt.put( NBT_LEFT_UPGRADE_DATA, getUpgradeNBTData( TurtleSide.Left ).copy() );
nbt.put( NBT_LEFT_UPGRADE_DATA, getUpgradeNBTData( TurtleSide.LEFT ).copy() );
}
if( m_upgradeNBTData.containsKey( TurtleSide.Right ) )
if( m_upgradeNBTData.containsKey( TurtleSide.RIGHT ) )
{
nbt.put( NBT_RIGHT_UPGRADE_DATA, getUpgradeNBTData( TurtleSide.Right ).copy() );
nbt.put( NBT_RIGHT_UPGRADE_DATA, getUpgradeNBTData( TurtleSide.RIGHT ).copy() );
}
}
@ -259,9 +259,9 @@ public void readDescription( CompoundNBT nbt )
// Animation
TurtleAnimation anim = TurtleAnimation.values()[nbt.getInt( "Animation" )];
if( anim != m_animation &&
anim != TurtleAnimation.Wait &&
anim != TurtleAnimation.ShortWait &&
anim != TurtleAnimation.None )
anim != TurtleAnimation.WAIT &&
anim != TurtleAnimation.SHORT_WAIT &&
anim != TurtleAnimation.NONE )
{
m_animation = anim;
m_animationProgress = 0;
@ -385,7 +385,7 @@ public float getVisualYaw( float f )
float yaw = getDirection().getHorizontalAngle();
switch( m_animation )
{
case TurnLeft:
case TURN_LEFT:
{
yaw += 90.0f * (1.0f - getAnimationFraction( f ));
if( yaw >= 360.0f )
@ -394,7 +394,7 @@ public float getVisualYaw( float f )
}
break;
}
case TurnRight:
case TURN_RIGHT:
{
yaw += -90.0f * (1.0f - getAnimationFraction( f ));
if( yaw < 0.0f )
@ -474,7 +474,7 @@ public void setFuelLevel( int level )
@Override
public int getFuelLimit()
{
if( m_owner.getFamily() == ComputerFamily.Advanced )
if( m_owner.getFamily() == ComputerFamily.ADVANCED )
{
return ComputerCraft.advancedTurtleFuelLimit;
}
@ -546,7 +546,7 @@ public void playAnimation( @Nonnull TurtleAnimation animation )
if( getWorld().isRemote ) throw new UnsupportedOperationException( "Cannot play animations on the client" );
m_animation = animation;
if( m_animation == TurtleAnimation.ShortWait )
if( m_animation == TurtleAnimation.SHORT_WAIT )
{
m_animationProgress = ANIM_DURATION / 2;
m_lastAnimationProgress = ANIM_DURATION / 2;
@ -688,26 +688,26 @@ public Vec3d getRenderOffset( float f )
{
switch( m_animation )
{
case MoveForward:
case MoveBack:
case MoveUp:
case MoveDown:
case MOVE_FORWARD:
case MOVE_BACK:
case MOVE_UP:
case MOVE_DOWN:
{
// Get direction
Direction dir;
switch( m_animation )
{
case MoveForward:
case MOVE_FORWARD:
default:
dir = getDirection();
break;
case MoveBack:
case MOVE_BACK:
dir = getDirection().getOpposite();
break;
case MoveUp:
case MOVE_UP:
dir = Direction.UP;
break;
case MoveDown:
case MOVE_DOWN:
dir = Direction.DOWN;
break;
}
@ -728,8 +728,8 @@ public Vec3d getRenderOffset( float f )
public float getToolRenderAngle( TurtleSide side, float f )
{
return (side == TurtleSide.Left && m_animation == TurtleAnimation.SwingLeftTool) ||
(side == TurtleSide.Right && m_animation == TurtleAnimation.SwingRightTool)
return (side == TurtleSide.LEFT && m_animation == TurtleAnimation.SWING_LEFT_TOOL) ||
(side == TurtleSide.RIGHT && m_animation == TurtleAnimation.SWING_RIGHT_TOOL)
? 45.0f * (float) Math.sin( getAnimationFraction( f ) * Math.PI )
: 0.0f;
}
@ -738,9 +738,9 @@ private static ComputerSide toDirection( TurtleSide side )
{
switch( side )
{
case Left:
case LEFT:
return ComputerSide.LEFT;
case Right:
case RIGHT:
default:
return ComputerSide.RIGHT;
}
@ -779,7 +779,7 @@ private void updatePeripherals( ServerComputer serverComputer )
private void updateCommands()
{
if( m_animation != TurtleAnimation.None || m_commandQueue.isEmpty() ) return;
if( m_animation != TurtleAnimation.NONE || m_commandQueue.isEmpty() ) return;
// If we've got a computer, ensure that we're allowed to perform work.
ServerComputer computer = m_owner.getServerComputer();
@ -828,33 +828,33 @@ private void updateCommands()
private void updateAnimation()
{
if( m_animation != TurtleAnimation.None )
if( m_animation != TurtleAnimation.NONE )
{
World world = getWorld();
if( ComputerCraft.turtlesCanPush )
{
// Advance entity pushing
if( m_animation == TurtleAnimation.MoveForward ||
m_animation == TurtleAnimation.MoveBack ||
m_animation == TurtleAnimation.MoveUp ||
m_animation == TurtleAnimation.MoveDown )
if( m_animation == TurtleAnimation.MOVE_FORWARD ||
m_animation == TurtleAnimation.MOVE_BACK ||
m_animation == TurtleAnimation.MOVE_UP ||
m_animation == TurtleAnimation.MOVE_DOWN )
{
BlockPos pos = getPosition();
Direction moveDir;
switch( m_animation )
{
case MoveForward:
case MOVE_FORWARD:
default:
moveDir = getDirection();
break;
case MoveBack:
case MOVE_BACK:
moveDir = getDirection().getOpposite();
break;
case MoveUp:
case MOVE_UP:
moveDir = Direction.UP;
break;
case MoveDown:
case MOVE_DOWN:
moveDir = Direction.DOWN;
break;
}
@ -912,11 +912,11 @@ private void updateAnimation()
}
// Advance valentines day easter egg
if( world.isRemote && m_animation == TurtleAnimation.MoveForward && m_animationProgress == 4 )
if( world.isRemote && m_animation == TurtleAnimation.MOVE_FORWARD && m_animationProgress == 4 )
{
// Spawn love pfx if valentines day
Holiday currentHoliday = HolidayUtil.getCurrentHoliday();
if( currentHoliday == Holiday.Valentines )
if( currentHoliday == Holiday.VALENTINES )
{
Vec3d position = getVisualPosition( 1.0f );
if( position != null )
@ -938,7 +938,7 @@ private void updateAnimation()
m_lastAnimationProgress = m_animationProgress;
if( ++m_animationProgress >= ANIM_DURATION )
{
m_animation = TurtleAnimation.None;
m_animation = TurtleAnimation.NONE;
m_animationProgress = 0;
m_lastAnimationProgress = 0;
}

View File

@ -45,7 +45,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
}
}
if( !results.isEmpty() ) turtle.playAnimation( TurtleAnimation.Wait );
if( !results.isEmpty() ) turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
}

View File

@ -39,7 +39,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Dropping nothing is easy
if( m_quantity == 0 )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
@ -83,7 +83,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Return true if we stored anything
if( remainder != stack )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
else
@ -96,7 +96,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Drop the item into the world
WorldUtil.dropItemStack( stack, world, oldPosition, direction );
world.playBroadcastSound( 1000, newPosition, 0 );
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
}

View File

@ -92,7 +92,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Animate
if( newUpgrade != null || oldUpgrade != null )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
}
return TurtleCommandResult.success();

View File

@ -72,7 +72,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
if( !oldWorld.checkNoEntityCollision( null, collision ) )
{
if( !ComputerCraft.turtlesCanPush || m_direction == MoveDirection.Up || m_direction == MoveDirection.Down )
if( !ComputerCraft.turtlesCanPush || m_direction == MoveDirection.UP || m_direction == MoveDirection.DOWN )
{
return TurtleCommandResult.failure( "Movement obstructed" );
}
@ -114,18 +114,18 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Animate
switch( m_direction )
{
case Forward:
case FORWARD:
default:
turtle.playAnimation( TurtleAnimation.MoveForward );
turtle.playAnimation( TurtleAnimation.MOVE_FORWARD );
break;
case Back:
turtle.playAnimation( TurtleAnimation.MoveBack );
case BACK:
turtle.playAnimation( TurtleAnimation.MOVE_BACK );
break;
case Up:
turtle.playAnimation( TurtleAnimation.MoveUp );
case UP:
turtle.playAnimation( TurtleAnimation.MOVE_UP );
break;
case Down:
turtle.playAnimation( TurtleAnimation.MoveDown );
case DOWN:
turtle.playAnimation( TurtleAnimation.MOVE_DOWN );
break;
}
return TurtleCommandResult.success();

View File

@ -86,7 +86,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
turtle.getInventory().markDirty();
// Animate and return success
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
else

View File

@ -39,7 +39,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
if( limit != 0 )
{
turtle.addFuel( event.getHandler().refuel( turtle, stack, slot, limit ) );
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
}
return TurtleCommandResult.success();

View File

@ -42,7 +42,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Sucking nothing is easy
if( m_quantity == 0 )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
@ -82,7 +82,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Return true if we consumed anything
if( remainder != stack )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
else
@ -142,7 +142,7 @@ else if( leaveStack.isEmpty() )
// Play fx
world.playBroadcastSound( 1000, turtlePosition, 0 ); // BLOCK_DISPENSER_DISPENSE
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
}

View File

@ -41,14 +41,14 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
{
switch( side )
{
case Left:
turtle.playAnimation( TurtleAnimation.SwingLeftTool );
case LEFT:
turtle.playAnimation( TurtleAnimation.SWING_LEFT_TOOL );
break;
case Right:
turtle.playAnimation( TurtleAnimation.SwingRightTool );
case RIGHT:
turtle.playAnimation( TurtleAnimation.SWING_RIGHT_TOOL );
break;
default:
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
break;
}
return result;
@ -64,11 +64,11 @@ else if( firstFailure == null )
public static TurtleToolCommand attack( InteractDirection direction, @Nullable TurtleSide side )
{
return new TurtleToolCommand( TurtleVerb.Attack, direction, side );
return new TurtleToolCommand( TurtleVerb.ATTACK, direction, side );
}
public static TurtleToolCommand dig( InteractDirection direction, @Nullable TurtleSide side )
{
return new TurtleToolCommand( TurtleVerb.Dig, direction, side );
return new TurtleToolCommand( TurtleVerb.DIG, direction, side );
}
}

View File

@ -33,7 +33,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
ItemStack stack = InventoryUtil.takeItems( m_quantity, turtle.getItemHandler(), turtle.getSelectedSlot(), 1, turtle.getSelectedSlot() );
if( stack.isEmpty() )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
@ -48,7 +48,7 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
// Return true if we moved anything
if( remainder != stack )
{
turtle.playAnimation( TurtleAnimation.Wait );
turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success();
}
else

View File

@ -36,16 +36,16 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
switch( m_direction )
{
case Left:
case LEFT:
{
turtle.setDirection( turtle.getDirection().rotateYCCW() );
turtle.playAnimation( TurtleAnimation.TurnLeft );
turtle.playAnimation( TurtleAnimation.TURN_LEFT );
return TurtleCommandResult.success();
}
case Right:
case RIGHT:
{
turtle.setDirection( turtle.getDirection().rotateY() );
turtle.playAnimation( TurtleAnimation.TurnRight );
turtle.playAnimation( TurtleAnimation.TURN_RIGHT );
return TurtleCommandResult.success();
}
default:

View File

@ -76,8 +76,8 @@ public void fillItemGroup( @Nonnull ItemGroup group, @Nonnull NonNullList<ItemSt
public ITextComponent getDisplayName( @Nonnull ItemStack stack )
{
String baseString = getTranslationKey( stack );
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade right = getUpgrade( stack, TurtleSide.Right );
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = getUpgrade( stack, TurtleSide.RIGHT );
if( left != null && right != null )
{
return new TranslationTextComponent( baseString + ".upgraded_twice",
@ -110,14 +110,14 @@ public String getCreatorModId( ItemStack stack )
// Determine our "creator mod" from the upgrades. We attempt to find the first non-vanilla/non-CC
// upgrade (starting from the left).
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.Left );
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.LEFT );
if( left != null )
{
String mod = TurtleUpgrades.getOwner( left );
if( mod != null && !mod.equals( ComputerCraft.MOD_ID ) ) return mod;
}
ITurtleUpgrade right = getUpgrade( stack, TurtleSide.Right );
ITurtleUpgrade right = getUpgrade( stack, TurtleSide.RIGHT );
if( right != null )
{
String mod = TurtleUpgrades.getOwner( right );
@ -133,7 +133,7 @@ public ItemStack withFamily( @Nonnull ItemStack stack, @Nonnull ComputerFamily f
return TurtleItemFactory.create(
getComputerID( stack ), getLabel( stack ),
getColour( stack ), family,
getUpgrade( stack, TurtleSide.Left ), getUpgrade( stack, TurtleSide.Right ),
getUpgrade( stack, TurtleSide.LEFT ), getUpgrade( stack, TurtleSide.RIGHT ),
getFuelLevel( stack ), getOverlay( stack )
);
}
@ -144,7 +144,7 @@ public ITurtleUpgrade getUpgrade( @Nonnull ItemStack stack, @Nonnull TurtleSide
CompoundNBT tag = stack.getTag();
if( tag == null ) return null;
String key = side == TurtleSide.Left ? NBT_LEFT_UPGRADE : NBT_RIGHT_UPGRADE;
String key = side == TurtleSide.LEFT ? NBT_LEFT_UPGRADE : NBT_RIGHT_UPGRADE;
return tag.contains( key ) ? TurtleUpgrades.get( tag.getString( key ) ) : null;
}

View File

@ -22,8 +22,8 @@ private TurtleItemFactory() {}
@Nonnull
public static ItemStack create( ITurtleTile turtle )
{
ITurtleUpgrade leftUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Left );
ITurtleUpgrade rightUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Right );
ITurtleUpgrade leftUpgrade = turtle.getAccess().getUpgrade( TurtleSide.LEFT );
ITurtleUpgrade rightUpgrade = turtle.getAccess().getUpgrade( TurtleSide.RIGHT );
String label = turtle.getLabel();
if( label == null )
@ -41,9 +41,9 @@ public static ItemStack create( int id, String label, int colour, ComputerFamily
{
switch( family )
{
case Normal:
case NORMAL:
return ComputerCraft.Items.turtleNormal.create( id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay );
case Advanced:
case ADVANCED:
return ComputerCraft.Items.turtleAdvanced.create( id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay );
default:
return ItemStack.EMPTY;

View File

@ -38,7 +38,7 @@ public boolean canFit( int x, int y )
@Override
public ItemStack getRecipeOutput()
{
return TurtleItemFactory.create( -1, null, -1, ComputerFamily.Normal, null, null, 0, null );
return TurtleItemFactory.create( -1, null, -1, ComputerFamily.NORMAL, null, null, 0, null );
}
@Override
@ -142,8 +142,8 @@ else if( !turtle.isEmpty() && rightItem.isEmpty() )
ITurtleItem itemTurtle = (ITurtleItem) turtle.getItem();
ComputerFamily family = itemTurtle.getFamily();
ITurtleUpgrade[] upgrades = new ITurtleUpgrade[] {
itemTurtle.getUpgrade( turtle, TurtleSide.Left ),
itemTurtle.getUpgrade( turtle, TurtleSide.Right ),
itemTurtle.getUpgrade( turtle, TurtleSide.LEFT ),
itemTurtle.getUpgrade( turtle, TurtleSide.RIGHT ),
};
// Get the upgrades for the new items

View File

@ -29,7 +29,7 @@ public class TurtleCraftingTable extends AbstractTurtleUpgrade
public TurtleCraftingTable( ResourceLocation id )
{
super( id, TurtleUpgradeType.Peripheral, Blocks.CRAFTING_TABLE );
super( id, TurtleUpgradeType.PERIPHERAL, Blocks.CRAFTING_TABLE );
}
@Override
@ -54,6 +54,6 @@ private void loadModelLocations()
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
{
loadModelLocations();
return TransformedModel.of( side == TurtleSide.Left ? m_leftModel : m_rightModel );
return TransformedModel.of( side == TurtleSide.LEFT ? m_leftModel : m_rightModel );
}
}

View File

@ -57,7 +57,7 @@ protected boolean canBreakBlock( BlockState state, World world, BlockPos pos, Tu
@Override
public TurtleCommandResult useTool( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side, @Nonnull TurtleVerb verb, @Nonnull Direction direction )
{
if( verb == TurtleVerb.Dig )
if( verb == TurtleVerb.DIG )
{
ItemStack hoe = item.copy();
ItemStack remainder = TurtlePlaceCommand.deploy( hoe, turtle, direction, null, null );

View File

@ -78,7 +78,7 @@ public boolean equals( IPeripheral other )
public TurtleModem( boolean advanced, ResourceLocation id )
{
super(
id, TurtleUpgradeType.Peripheral,
id, TurtleUpgradeType.PERIPHERAL,
advanced
? ComputerCraft.Blocks.wirelessModemAdvanced
: ComputerCraft.Blocks.wirelessModemNormal
@ -135,7 +135,7 @@ public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side
active = turtleNBT.contains( "active" ) && turtleNBT.getBoolean( "active" );
}
return side == TurtleSide.Left
return side == TurtleSide.LEFT
? TransformedModel.of( active ? m_leftOnModel : m_leftOffModel )
: TransformedModel.of( active ? m_rightOnModel : m_rightOffModel );
}

View File

@ -61,7 +61,7 @@ protected boolean canBreakBlock( BlockState state, World world, BlockPos pos, Tu
@Override
public TurtleCommandResult useTool( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side, @Nonnull TurtleVerb verb, @Nonnull Direction direction )
{
if( verb == TurtleVerb.Dig )
if( verb == TurtleVerb.DIG )
{
ItemStack shovel = item.copy();
ItemStack remainder = TurtlePlaceCommand.deploy( shovel, turtle, direction, null, null );

View File

@ -63,7 +63,7 @@ public boolean equals( IPeripheral other )
public TurtleSpeaker( ResourceLocation id )
{
super( id, TurtleUpgradeType.Peripheral, ComputerCraft.Blocks.speaker );
super( id, TurtleUpgradeType.PERIPHERAL, ComputerCraft.Blocks.speaker );
}
@Override
@ -88,7 +88,7 @@ private void loadModelLocations()
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
{
loadModelLocations();
return TransformedModel.of( side == TurtleSide.Left ? m_leftModel : m_rightModel );
return TransformedModel.of( side == TurtleSide.LEFT ? m_leftModel : m_rightModel );
}
@Override

View File

@ -51,19 +51,19 @@ public class TurtleTool extends AbstractTurtleUpgrade
public TurtleTool( ResourceLocation id, String adjective, Item item )
{
super( id, TurtleUpgradeType.Tool, adjective, item );
super( id, TurtleUpgradeType.TOOL, adjective, item );
this.item = new ItemStack( item );
}
public TurtleTool( ResourceLocation id, Item item )
{
super( id, TurtleUpgradeType.Tool, item );
super( id, TurtleUpgradeType.TOOL, item );
this.item = new ItemStack( item );
}
public TurtleTool( ResourceLocation id, ItemStack craftItem, ItemStack toolItem )
{
super( id, TurtleUpgradeType.Tool, craftItem );
super( id, TurtleUpgradeType.TOOL, craftItem );
this.item = toolItem;
}
@ -72,7 +72,7 @@ public TurtleTool( ResourceLocation id, ItemStack craftItem, ItemStack toolItem
@OnlyIn( Dist.CLIENT )
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
{
float xOffset = side == TurtleSide.Left ? -0.40625f : 0.40625f;
float xOffset = side == TurtleSide.LEFT ? -0.40625f : 0.40625f;
Matrix4f transform = new Matrix4f( new float[] {
0.0f, 0.0f, -1.0f, 1.0f + xOffset,
1.0f, 0.0f, 0.0f, 0.0f,
@ -88,9 +88,9 @@ public TurtleCommandResult useTool( @Nonnull ITurtleAccess turtle, @Nonnull Turt
{
switch( verb )
{
case Attack:
case ATTACK:
return attack( turtle, direction, side );
case Dig:
case DIG:
return dig( turtle, direction, side );
default:
return TurtleCommandResult.failure( "Unsupported action" );

View File

@ -7,22 +7,22 @@
public enum Colour
{
Black( 0x111111 ),
Red( 0xcc4c4c ),
Green( 0x57A64E ),
Brown( 0x7f664c ),
Blue( 0x3366cc ),
Purple( 0xb266e5 ),
Cyan( 0x4c99b2 ),
LightGrey( 0x999999 ),
Grey( 0x4c4c4c ),
Pink( 0xf2b2cc ),
Lime( 0x7fcc19 ),
Yellow( 0xdede6c ),
LightBlue( 0x99b2f2 ),
Magenta( 0xe57fd8 ),
Orange( 0xf2b233 ),
White( 0xf0f0f0 );
BLACK( 0x111111 ),
RED( 0xcc4c4c ),
GREEN( 0x57A64E ),
BROWN( 0x7f664c ),
BLUE( 0x3366cc ),
PURPLE( 0xb266e5 ),
CYAN( 0x4c99b2 ),
LIGHT_GREY( 0x999999 ),
GREY( 0x4c4c4c ),
PINK( 0xf2b2cc ),
LIME( 0x7fcc19 ),
YELLOW( 0xdede6c ),
LIGHT_BLUE( 0x99b2f2 ),
MAGENTA( 0xe57fd8 ),
ORANGE( 0xf2b233 ),
WHITE( 0xf0f0f0 );
public static final Colour[] VALUES = values();

View File

@ -7,9 +7,9 @@
public enum Holiday
{
None,
Valentines,
AprilFoolsDay,
Halloween,
Christmas,
NONE,
VALENTINES,
APRIL_FOOLS_DAY,
HALLOWEEN,
CHRISTMAS,
}

View File

@ -20,10 +20,10 @@ private static Holiday getHoliday( Calendar calendar )
{
int month = calendar.get( Calendar.MONTH );
int day = calendar.get( Calendar.DAY_OF_MONTH );
if( month == Calendar.FEBRUARY && day == 14 ) return Holiday.Valentines;
if( month == Calendar.APRIL && day == 1 ) return Holiday.AprilFoolsDay;
if( month == Calendar.OCTOBER && day == 31 ) return Holiday.Halloween;
if( month == Calendar.DECEMBER && day >= 24 && day <= 30 ) return Holiday.Christmas;
return Holiday.None;
if( month == Calendar.FEBRUARY && day == 14 ) return Holiday.VALENTINES;
if( month == Calendar.APRIL && day == 1 ) return Holiday.APRIL_FOOLS_DAY;
if( month == Calendar.OCTOBER && day == 31 ) return Holiday.HALLOWEEN;
if( month == Calendar.DECEMBER && day >= 24 && day <= 30 ) return Holiday.CHRISTMAS;
return Holiday.NONE;
}
}