1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-07 16:00:31 +00:00

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. * An animation which does nothing. This takes no time to complete.
* *
* @see #Wait * @see #WAIT
* @see #ShortWait * @see #SHORT_WAIT
*/ */
None, NONE,
/** /**
* Make the turtle move forward. Note that the animation starts from the block <em>behind</em> it, and * Make the turtle move forward. Note that the animation starts from the block <em>behind</em> it, and
* moves into this one. * 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 * Make the turtle move backwards. Note that the animation starts from the block <em>in front</em> it, and
* moves into this one. * 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 * Make the turtle move backwards. Note that the animation starts from the block <em>above</em> it, and
* moves into this one. * 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 * Make the turtle move backwards. Note that the animation starts from the block <em>below</em> it, and
* moves into this one. * 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 * 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. * 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 * 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. * the turtle turns to face in the current direction.
*/ */
TurnRight, TURN_RIGHT,
/** /**
* Swing the tool on the left. * Swing the tool on the left.
*/ */
SwingLeftTool, SWING_LEFT_TOOL,
/** /**
* Swing the tool on the right. * Swing the tool on the right.
*/ */
SwingRightTool, SWING_RIGHT_TOOL,
/** /**
* Wait until the animation has finished, performing no movement. * Wait until the animation has finished, performing no movement.
* *
* @see #ShortWait * @see #SHORT_WAIT
* @see #None * @see #NONE
*/ */
Wait, WAIT,
/** /**
* Wait until the animation has finished, performing no movement. This takes 4 ticks to complete. * Wait until the animation has finished, performing no movement. This takes 4 ticks to complete.
* *
* @see #Wait * @see #WAIT
* @see #None * @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). * 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). * 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()} * 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). * 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, * 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). * 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 * 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 * your upgrade to also provide methods. For example, a pickaxe could provide methods
* determining whether it can break the given block or not. * determining whether it can break the given block or not.
*/ */
Both; BOTH;
public boolean isTool() public boolean isTool()
{ {
return this == Tool || this == Both; return this == TOOL || this == BOTH;
} }
public boolean isPeripheral() 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()}. * 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()}. * The turtle called {@code turtle.attack()}, {@code turtle.attackUp()} or {@code turtle.attackDown()}.
*/ */
Attack, ATTACK,
} }

View File

@ -130,7 +130,7 @@ public final class ClientRegistry
case 2: // Light colour case 2: // Light colour
{ {
int light = ItemPocketComputer.getLightState( stack ); 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 ); }, ComputerCraft.Items.pocketComputerNormal, ComputerCraft.Items.pocketComputerAdvanced );

View File

@ -270,7 +270,7 @@ public final class FixedWidthFontRenderer
public static void drawEmptyTerminal( @Nonnull Matrix4f transform, @Nonnull IRenderTypeBuffer renderer, float x, float y, float width, float height ) 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() ); drawQuad( transform, renderer.getBuffer( TYPE ), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
} }
@ -286,7 +286,7 @@ public final class FixedWidthFontRenderer
public static void drawBlocker( @Nonnull Matrix4f transform, @Nonnull IRenderTypeBuffer renderer, float x, float y, float width, float height ) 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() ); drawQuad( transform, renderer.getBuffer( Type.BLOCKER ), x, y, width, height, colour.getR(), colour.getG(), colour.getB() );
} }

View File

@ -137,14 +137,14 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f ); RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
switch( m_family ) switch( m_family )
{ {
case Normal: case NORMAL:
default: default:
minecraft.getTextureManager().bindTexture( BACKGROUND_NORMAL ); minecraft.getTextureManager().bindTexture( BACKGROUND_NORMAL );
break; break;
case Advanced: case ADVANCED:
minecraft.getTextureManager().bindTexture( BACKGROUND_ADVANCED ); minecraft.getTextureManager().bindTexture( BACKGROUND_ADVANCED );
break; break;
case Command: case COMMAND:
minecraft.getTextureManager().bindTexture( BACKGROUND_COMMAND ); minecraft.getTextureManager().bindTexture( BACKGROUND_COMMAND );
break; break;
} }

View File

@ -110,7 +110,7 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY ) protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
{ {
// Draw term // Draw term
boolean advanced = m_family == ComputerFamily.Advanced; boolean advanced = m_family == ComputerFamily.ADVANCED;
terminal.draw( terminalWrapper.getX(), terminalWrapper.getY() ); terminal.draw( terminalWrapper.getX(), terminalWrapper.getY() );
// Draw border/inventory // Draw border/inventory

View File

@ -56,10 +56,10 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
{ {
switch( family ) switch( family )
{ {
case Normal: case NORMAL:
default: default:
return coloured ? COLOUR_TURTLE_MODEL : NORMAL_TURTLE_MODEL; return coloured ? COLOUR_TURTLE_MODEL : NORMAL_TURTLE_MODEL;
case Advanced: case ADVANCED:
return coloured ? COLOUR_TURTLE_MODEL : ADVANCED_TURTLE_MODEL; return coloured ? COLOUR_TURTLE_MODEL : ADVANCED_TURTLE_MODEL;
} }
} }
@ -121,15 +121,15 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
renderModel( transform, buffer, lightmapCoord, overlayLight, getTurtleModel( family, colour != -1 ), colour == -1 ? null : new int[] { colour } ); renderModel( transform, buffer, lightmapCoord, overlayLight, getTurtleModel( family, colour != -1 ), colour == -1 ? null : new int[] { colour } );
// Render the overlay // Render the overlay
ModelResourceLocation overlayModel = getTurtleOverlayModel( overlay, HolidayUtil.getCurrentHoliday() == Holiday.Christmas ); ModelResourceLocation overlayModel = getTurtleOverlayModel( overlay, HolidayUtil.getCurrentHoliday() == Holiday.CHRISTMAS );
if( overlayModel != null ) if( overlayModel != null )
{ {
renderModel( transform, buffer, lightmapCoord, overlayLight, overlayModel, null ); renderModel( transform, buffer, lightmapCoord, overlayLight, overlayModel, null );
} }
// Render the upgrades // Render the upgrades
renderUpgrade( transform, buffer, lightmapCoord, overlayLight, turtle, TurtleSide.Left, partialTicks ); 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.RIGHT, partialTicks );
transform.pop(); transform.pop();
} }

View File

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

View File

@ -609,7 +609,7 @@ final class ComputerExecutor
terminal.reset(); terminal.reset();
// Display our primary error message // Display our primary error message
if( colour ) terminal.setTextColour( 15 - Colour.Red.ordinal() ); if( colour ) terminal.setTextColour( 15 - Colour.RED.ordinal() );
terminal.write( message ); terminal.write( message );
if( extra != null ) if( extra != null )
@ -622,7 +622,7 @@ final class ComputerExecutor
// And display our generic "CC may be installed incorrectly" message. // And display our generic "CC may be installed incorrectly" message.
terminal.setCursorPos( 0, terminal.getCursorY() + 1 ); 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" ); terminal.write( "ComputerCraft may be installed incorrectly" );
} }

View File

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

View File

@ -205,7 +205,7 @@ public final class CommandComputerCraft
int queued = 0; int queued = 0;
for( ServerComputer computer : computers ) for( ServerComputer computer : computers )
{ {
if( computer.getFamily() == ComputerFamily.Command && computer.isOn() ) if( computer.getFamily() == ComputerFamily.COMMAND && computer.isOn() )
{ {
computer.queueEvent( "computer_command", rest ); computer.queueEvent( "computer_command", rest );
queued++; queued++;

View File

@ -32,7 +32,7 @@ public class TileCommandComputer extends TileComputer
{ {
public static final NamedTileEntityType<TileCommandComputer> FACTORY = NamedTileEntityType.create( public static final NamedTileEntityType<TileCommandComputer> FACTORY = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "command_computer" ), new ResourceLocation( ComputerCraft.MOD_ID, "command_computer" ),
f -> new TileCommandComputer( ComputerFamily.Command, f ) f -> new TileCommandComputer( ComputerFamily.COMMAND, f )
); );
public class CommandReceiver implements ICommandSource 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( public static final NamedTileEntityType<TileComputer> FACTORY_NORMAL = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "computer_normal" ), 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( public static final NamedTileEntityType<TileComputer> FACTORY_ADVANCED = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "computer_advanced" ), new ResourceLocation( ComputerCraft.MOD_ID, "computer_advanced" ),
f -> new TileComputer( ComputerFamily.Advanced, f ) f -> new TileComputer( ComputerFamily.ADVANCED, f )
); );
private ComputerProxy m_proxy; private ComputerProxy m_proxy;

View File

@ -7,7 +7,7 @@ package dan200.computercraft.shared.computer.core;
public enum ComputerFamily public enum ComputerFamily
{ {
Normal, NORMAL,
Advanced, ADVANCED,
Command 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 ) 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_instanceID = instanceID;
m_world = world; m_world = world;

View File

@ -48,7 +48,7 @@ public class ContainerViewComputer extends ContainerComputerBase implements ICon
} }
// If we're a command computer then ensure we're in creative // 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(); MinecraftServer server = player.getServer();
if( server == null || !server.isCommandBlockEnabled() ) if( server == null || !server.isCommandBlockEnabled() )

View File

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

View File

@ -80,7 +80,7 @@ public abstract class ItemComputerBase extends BlockItem implements IComputerIte
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world ) public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{ {
ComputerFamily family = getFamily(); ComputerFamily family = getFamily();
if( family != ComputerFamily.Command ) if( family != ComputerFamily.COMMAND )
{ {
int id = getComputerID( stack ); int id = getComputerID( stack );
if( id >= 0 ) if( id >= 0 )

View File

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

View File

@ -37,7 +37,7 @@ import static net.minecraft.util.NonNullList.from;
class RecipeResolver implements IRecipeManagerPlugin 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 Map<Item, List<UpgradeInfo>> upgradeItemLookup = new HashMap<>();
private final List<UpgradeInfo> pocketUpgrades = new ArrayList<>(); private final List<UpgradeInfo> pocketUpgrades = new ArrayList<>();
@ -150,8 +150,8 @@ class RecipeResolver implements IRecipeManagerPlugin
{ {
// Suggest possible upgrades which can be applied to this turtle // Suggest possible upgrades which can be applied to this turtle
ITurtleItem item = (ITurtleItem) stack.getItem(); ITurtleItem item = (ITurtleItem) stack.getItem();
ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.Left ); ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.Right ); ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.RIGHT );
if( left != null && right != null ) return Collections.emptyList(); if( left != null && right != null ) return Collections.emptyList();
List<Shaped> recipes = new ArrayList<>(); List<Shaped> recipes = new ArrayList<>();
@ -231,8 +231,8 @@ class RecipeResolver implements IRecipeManagerPlugin
ITurtleItem item = (ITurtleItem) stack.getItem(); ITurtleItem item = (ITurtleItem) stack.getItem();
List<Shaped> recipes = new ArrayList<>( 0 ); List<Shaped> recipes = new ArrayList<>( 0 );
ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.Left ); ITurtleUpgrade left = item.getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.Right ); ITurtleUpgrade right = item.getUpgrade( stack, TurtleSide.RIGHT );
// The turtle is facing towards us, so upgrades on the left are actually crafted on the right. // The turtle is facing towards us, so upgrades on the left are actually crafted on the right.
if( left != null ) if( left != null )

View File

@ -126,6 +126,6 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
public int getColour( @Nonnull ItemStack stack ) public int getColour( @Nonnull ItemStack stack )
{ {
int colour = IColouredItem.getColourBasic( 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 @@ public class ItemTreasureDisk extends Item implements IMedia
public static int getColour( @Nonnull ItemStack stack ) public static int getColour( @Nonnull ItemStack stack )
{ {
CompoundNBT nbt = stack.getTag(); 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 class DiskRecipe extends SpecialRecipe
} }
} }
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 @Override
@ -100,7 +100,7 @@ public class DiskRecipe extends SpecialRecipe
@Override @Override
public ItemStack getRecipeOutput() public ItemStack getRecipeOutput()
{ {
return ItemDisk.createFromIDAndColour( -1, null, Colour.Blue.getHex() ); return ItemDisk.createFromIDAndColour( -1, null, Colour.BLUE.getHex() );
} }
@Nonnull @Nonnull

View File

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

View File

@ -37,7 +37,7 @@ public final class PocketComputerUpgradeRecipe extends SpecialRecipe
@Override @Override
public ItemStack getRecipeOutput() public ItemStack getRecipeOutput()
{ {
return PocketComputerItemFactory.create( -1, null, -1, ComputerFamily.Normal, null ); return PocketComputerItemFactory.create( -1, null, -1, ComputerFamily.NORMAL, null );
} }
@Override @Override

View File

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

View File

@ -152,7 +152,7 @@ public class BlockTurtle extends BlockComputerBase<TileTurtle> implements IWater
@Override @Override
public float getExplosionResistance( BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion ) 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; 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( public static final NamedTileEntityType<TileTurtle> FACTORY_NORMAL = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "turtle_normal" ), 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( public static final NamedTileEntityType<TileTurtle> FACTORY_ADVANCED = NamedTileEntityType.create(
new ResourceLocation( ComputerCraft.MOD_ID, "turtle_advanced" ), new ResourceLocation( ComputerCraft.MOD_ID, "turtle_advanced" ),
type -> new TileTurtle( type, ComputerFamily.Advanced ) type -> new TileTurtle( type, ComputerFamily.ADVANCED )
); );
enum MoveState enum MoveState
@ -526,10 +526,10 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
switch( side ) switch( side )
{ {
case RIGHT: case RIGHT:
upgrade = getUpgrade( TurtleSide.Right ); upgrade = getUpgrade( TurtleSide.RIGHT );
break; break;
case LEFT: case LEFT:
upgrade = getUpgrade( TurtleSide.Left ); upgrade = getUpgrade( TurtleSide.LEFT );
break; break;
default: default:
return false; return false;

View File

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

View File

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

View File

@ -7,6 +7,6 @@ package dan200.computercraft.shared.turtle.core;
public enum TurnDirection public enum TurnDirection
{ {
Left, LEFT,
Right, RIGHT,
} }

View File

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

View File

@ -45,7 +45,7 @@ public class TurtleCraftCommand implements ITurtleCommand
} }
} }
if( !results.isEmpty() ) turtle.playAnimation( TurtleAnimation.Wait ); if( !results.isEmpty() ) turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success(); return TurtleCommandResult.success();
} }
} }

View File

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

View File

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

View File

@ -72,7 +72,7 @@ public class TurtleMoveCommand implements ITurtleCommand
if( !oldWorld.checkNoEntityCollision( null, collision ) ) 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" ); return TurtleCommandResult.failure( "Movement obstructed" );
} }
@ -114,18 +114,18 @@ public class TurtleMoveCommand implements ITurtleCommand
// Animate // Animate
switch( m_direction ) switch( m_direction )
{ {
case Forward: case FORWARD:
default: default:
turtle.playAnimation( TurtleAnimation.MoveForward ); turtle.playAnimation( TurtleAnimation.MOVE_FORWARD );
break; break;
case Back: case BACK:
turtle.playAnimation( TurtleAnimation.MoveBack ); turtle.playAnimation( TurtleAnimation.MOVE_BACK );
break; break;
case Up: case UP:
turtle.playAnimation( TurtleAnimation.MoveUp ); turtle.playAnimation( TurtleAnimation.MOVE_UP );
break; break;
case Down: case DOWN:
turtle.playAnimation( TurtleAnimation.MoveDown ); turtle.playAnimation( TurtleAnimation.MOVE_DOWN );
break; break;
} }
return TurtleCommandResult.success(); return TurtleCommandResult.success();

View File

@ -86,7 +86,7 @@ public class TurtlePlaceCommand implements ITurtleCommand
turtle.getInventory().markDirty(); turtle.getInventory().markDirty();
// Animate and return success // Animate and return success
turtle.playAnimation( TurtleAnimation.Wait ); turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success(); return TurtleCommandResult.success();
} }
else else

View File

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

View File

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

View File

@ -41,14 +41,14 @@ public class TurtleToolCommand implements ITurtleCommand
{ {
switch( side ) switch( side )
{ {
case Left: case LEFT:
turtle.playAnimation( TurtleAnimation.SwingLeftTool ); turtle.playAnimation( TurtleAnimation.SWING_LEFT_TOOL );
break; break;
case Right: case RIGHT:
turtle.playAnimation( TurtleAnimation.SwingRightTool ); turtle.playAnimation( TurtleAnimation.SWING_RIGHT_TOOL );
break; break;
default: default:
turtle.playAnimation( TurtleAnimation.Wait ); turtle.playAnimation( TurtleAnimation.WAIT );
break; break;
} }
return result; return result;
@ -64,11 +64,11 @@ public class TurtleToolCommand implements ITurtleCommand
public static TurtleToolCommand attack( InteractDirection direction, @Nullable TurtleSide side ) 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 ) 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 class TurtleTransferToCommand implements ITurtleCommand
ItemStack stack = InventoryUtil.takeItems( m_quantity, turtle.getItemHandler(), turtle.getSelectedSlot(), 1, turtle.getSelectedSlot() ); ItemStack stack = InventoryUtil.takeItems( m_quantity, turtle.getItemHandler(), turtle.getSelectedSlot(), 1, turtle.getSelectedSlot() );
if( stack.isEmpty() ) if( stack.isEmpty() )
{ {
turtle.playAnimation( TurtleAnimation.Wait ); turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success(); return TurtleCommandResult.success();
} }
@ -48,7 +48,7 @@ public class TurtleTransferToCommand implements ITurtleCommand
// Return true if we moved anything // Return true if we moved anything
if( remainder != stack ) if( remainder != stack )
{ {
turtle.playAnimation( TurtleAnimation.Wait ); turtle.playAnimation( TurtleAnimation.WAIT );
return TurtleCommandResult.success(); return TurtleCommandResult.success();
} }
else else

View File

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

View File

@ -76,8 +76,8 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem
public ITextComponent getDisplayName( @Nonnull ItemStack stack ) public ITextComponent getDisplayName( @Nonnull ItemStack stack )
{ {
String baseString = getTranslationKey( stack ); String baseString = getTranslationKey( stack );
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.Left ); ITurtleUpgrade left = getUpgrade( stack, TurtleSide.LEFT );
ITurtleUpgrade right = getUpgrade( stack, TurtleSide.Right ); ITurtleUpgrade right = getUpgrade( stack, TurtleSide.RIGHT );
if( left != null && right != null ) if( left != null && right != null )
{ {
return new TranslationTextComponent( baseString + ".upgraded_twice", return new TranslationTextComponent( baseString + ".upgraded_twice",
@ -110,14 +110,14 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem
// Determine our "creator mod" from the upgrades. We attempt to find the first non-vanilla/non-CC // Determine our "creator mod" from the upgrades. We attempt to find the first non-vanilla/non-CC
// upgrade (starting from the left). // upgrade (starting from the left).
ITurtleUpgrade left = getUpgrade( stack, TurtleSide.Left ); ITurtleUpgrade left = getUpgrade( stack, TurtleSide.LEFT );
if( left != null ) if( left != null )
{ {
String mod = TurtleUpgrades.getOwner( left ); String mod = TurtleUpgrades.getOwner( left );
if( mod != null && !mod.equals( ComputerCraft.MOD_ID ) ) return mod; 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 ) if( right != null )
{ {
String mod = TurtleUpgrades.getOwner( right ); String mod = TurtleUpgrades.getOwner( right );
@ -133,7 +133,7 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem
return TurtleItemFactory.create( return TurtleItemFactory.create(
getComputerID( stack ), getLabel( stack ), getComputerID( stack ), getLabel( stack ),
getColour( stack ), family, getColour( stack ), family,
getUpgrade( stack, TurtleSide.Left ), getUpgrade( stack, TurtleSide.Right ), getUpgrade( stack, TurtleSide.LEFT ), getUpgrade( stack, TurtleSide.RIGHT ),
getFuelLevel( stack ), getOverlay( stack ) getFuelLevel( stack ), getOverlay( stack )
); );
} }
@ -144,7 +144,7 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem
CompoundNBT tag = stack.getTag(); CompoundNBT tag = stack.getTag();
if( tag == null ) return null; 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; return tag.contains( key ) ? TurtleUpgrades.get( tag.getString( key ) ) : null;
} }

View File

@ -22,8 +22,8 @@ public final class TurtleItemFactory
@Nonnull @Nonnull
public static ItemStack create( ITurtleTile turtle ) public static ItemStack create( ITurtleTile turtle )
{ {
ITurtleUpgrade leftUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Left ); ITurtleUpgrade leftUpgrade = turtle.getAccess().getUpgrade( TurtleSide.LEFT );
ITurtleUpgrade rightUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Right ); ITurtleUpgrade rightUpgrade = turtle.getAccess().getUpgrade( TurtleSide.RIGHT );
String label = turtle.getLabel(); String label = turtle.getLabel();
if( label == null ) if( label == null )
@ -41,9 +41,9 @@ public final class TurtleItemFactory
{ {
switch( family ) switch( family )
{ {
case Normal: case NORMAL:
return ComputerCraft.Items.turtleNormal.create( id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay ); 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 ); return ComputerCraft.Items.turtleAdvanced.create( id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay );
default: default:
return ItemStack.EMPTY; return ItemStack.EMPTY;

View File

@ -38,7 +38,7 @@ public final class TurtleUpgradeRecipe extends SpecialRecipe
@Override @Override
public ItemStack getRecipeOutput() 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 @Override
@ -142,8 +142,8 @@ public final class TurtleUpgradeRecipe extends SpecialRecipe
ITurtleItem itemTurtle = (ITurtleItem) turtle.getItem(); ITurtleItem itemTurtle = (ITurtleItem) turtle.getItem();
ComputerFamily family = itemTurtle.getFamily(); ComputerFamily family = itemTurtle.getFamily();
ITurtleUpgrade[] upgrades = new ITurtleUpgrade[] { ITurtleUpgrade[] upgrades = new ITurtleUpgrade[] {
itemTurtle.getUpgrade( turtle, TurtleSide.Left ), itemTurtle.getUpgrade( turtle, TurtleSide.LEFT ),
itemTurtle.getUpgrade( turtle, TurtleSide.Right ), itemTurtle.getUpgrade( turtle, TurtleSide.RIGHT ),
}; };
// Get the upgrades for the new items // Get the upgrades for the new items

View File

@ -29,7 +29,7 @@ public class TurtleCraftingTable extends AbstractTurtleUpgrade
public TurtleCraftingTable( ResourceLocation id ) public TurtleCraftingTable( ResourceLocation id )
{ {
super( id, TurtleUpgradeType.Peripheral, Blocks.CRAFTING_TABLE ); super( id, TurtleUpgradeType.PERIPHERAL, Blocks.CRAFTING_TABLE );
} }
@Override @Override
@ -54,6 +54,6 @@ public class TurtleCraftingTable extends AbstractTurtleUpgrade
public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side ) public TransformedModel getModel( ITurtleAccess turtle, @Nonnull TurtleSide side )
{ {
loadModelLocations(); 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 @@ public class TurtleHoe extends TurtleTool
@Override @Override
public TurtleCommandResult useTool( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side, @Nonnull TurtleVerb verb, @Nonnull Direction direction ) 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 hoe = item.copy();
ItemStack remainder = TurtlePlaceCommand.deploy( hoe, turtle, direction, null, null ); ItemStack remainder = TurtlePlaceCommand.deploy( hoe, turtle, direction, null, null );

View File

@ -78,7 +78,7 @@ public class TurtleModem extends AbstractTurtleUpgrade
public TurtleModem( boolean advanced, ResourceLocation id ) public TurtleModem( boolean advanced, ResourceLocation id )
{ {
super( super(
id, TurtleUpgradeType.Peripheral, id, TurtleUpgradeType.PERIPHERAL,
advanced advanced
? ComputerCraft.Blocks.wirelessModemAdvanced ? ComputerCraft.Blocks.wirelessModemAdvanced
: ComputerCraft.Blocks.wirelessModemNormal : ComputerCraft.Blocks.wirelessModemNormal
@ -135,7 +135,7 @@ public class TurtleModem extends AbstractTurtleUpgrade
active = turtleNBT.contains( "active" ) && turtleNBT.getBoolean( "active" ); 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_leftOnModel : m_leftOffModel )
: TransformedModel.of( active ? m_rightOnModel : m_rightOffModel ); : TransformedModel.of( active ? m_rightOnModel : m_rightOffModel );
} }

View File

@ -61,7 +61,7 @@ public class TurtleShovel extends TurtleTool
@Override @Override
public TurtleCommandResult useTool( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side, @Nonnull TurtleVerb verb, @Nonnull Direction direction ) 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 shovel = item.copy();
ItemStack remainder = TurtlePlaceCommand.deploy( shovel, turtle, direction, null, null ); ItemStack remainder = TurtlePlaceCommand.deploy( shovel, turtle, direction, null, null );

View File

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

View File

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

View File

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

View File

@ -7,9 +7,9 @@ package dan200.computercraft.shared.util;
public enum Holiday public enum Holiday
{ {
None, NONE,
Valentines, VALENTINES,
AprilFoolsDay, APRIL_FOOLS_DAY,
Halloween, HALLOWEEN,
Christmas, CHRISTMAS,
} }

View File

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