mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-10-31 23:26:19 +00:00
Normalise enums to use SHOUTY_CASE
PascalCase is more .NET than Java
This commit is contained in:
parent
044d2b2b06
commit
f3a330e330
@ -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,
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public final class ClientRegistry
|
||||
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 );
|
||||
|
@ -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 )
|
||||
{
|
||||
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 final class FixedWidthFontRenderer
|
||||
|
||||
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() );
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,14 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
|
||||
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;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
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
|
||||
|
@ -56,10 +56,10 @@ public class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
{
|
||||
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 class TileEntityTurtleRenderer extends TileEntityRenderer<TileTurtle>
|
||||
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();
|
||||
}
|
||||
|
@ -114,10 +114,10 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
{
|
||||
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 @@ public class TurtleSmartItemModel implements IBakedModel
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ final class ComputerExecutor
|
||||
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 @@ final class ComputerExecutor
|
||||
|
||||
// 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" );
|
||||
}
|
||||
|
||||
|
@ -84,17 +84,17 @@ public final class Registry
|
||||
// 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 final class Registry
|
||||
// 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 final class Registry
|
||||
);
|
||||
|
||||
// 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" ) ),
|
||||
|
@ -205,7 +205,7 @@ public final class CommandComputerCraft
|
||||
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++;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.shared.computer.core;
|
||||
|
||||
public enum ComputerFamily
|
||||
{
|
||||
Normal,
|
||||
Advanced,
|
||||
Command
|
||||
NORMAL,
|
||||
ADVANCED,
|
||||
COMMAND
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -48,7 +48,7 @@ public class ContainerViewComputer extends ContainerComputerBase implements ICon
|
||||
}
|
||||
|
||||
// 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() )
|
||||
|
@ -29,11 +29,11 @@ public final class ComputerItemFactory
|
||||
{
|
||||
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;
|
||||
|
@ -80,7 +80,7 @@ public abstract class ItemComputerBase extends BlockItem implements IComputerIte
|
||||
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 )
|
||||
|
@ -116,8 +116,8 @@ public class JEIComputerCraft implements IModPlugin
|
||||
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() );
|
||||
|
@ -37,7 +37,7 @@ import static net.minecraft.util.NonNullList.from;
|
||||
|
||||
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 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
{
|
||||
// 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 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
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 )
|
||||
|
@ -126,6 +126,6 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +134,6 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -100,7 +100,7 @@ public class DiskRecipe extends SpecialRecipe
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return ItemDisk.createFromIDAndColour( -1, null, Colour.Blue.getHex() );
|
||||
return ItemDisk.createFromIDAndColour( -1, null, Colour.BLUE.getHex() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -21,9 +21,9 @@ public final class PocketComputerItemFactory
|
||||
{
|
||||
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;
|
||||
|
@ -37,7 +37,7 @@ public final class PocketComputerUpgradeRecipe extends SpecialRecipe
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return PocketComputerItemFactory.create( -1, null, -1, ComputerFamily.Normal, null );
|
||||
return PocketComputerItemFactory.create( -1, null, -1, ComputerFamily.NORMAL, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,11 +133,11 @@ public class TurtleAPI implements ILuaAPI
|
||||
}
|
||||
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 class TurtleAPI implements ILuaAPI
|
||||
{
|
||||
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 class TurtleAPI implements ILuaAPI
|
||||
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 class TurtleAPI implements ILuaAPI
|
||||
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...)
|
||||
|
@ -152,7 +152,7 @@ public class BlockTurtle extends BlockComputerBase<TileTurtle> implements IWater
|
||||
@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;
|
||||
}
|
||||
|
@ -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 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
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;
|
||||
|
@ -10,20 +10,20 @@ import net.minecraft.util.Direction;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -10,23 +10,23 @@ import net.minecraft.util.Direction;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ package dan200.computercraft.shared.turtle.core;
|
||||
|
||||
public enum TurnDirection
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
}
|
||||
|
@ -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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
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 class TurtleBrain implements ITurtleAccess
|
||||
// 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 class TurtleBrain implements ITurtleAccess
|
||||
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 class TurtleBrain implements ITurtleAccess
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TurnRight:
|
||||
case TURN_RIGHT:
|
||||
{
|
||||
yaw += -90.0f * (1.0f - getAnimationFraction( f ));
|
||||
if( yaw < 0.0f )
|
||||
@ -474,7 +474,7 @@ public class TurtleBrain implements ITurtleAccess
|
||||
@Override
|
||||
public int getFuelLimit()
|
||||
{
|
||||
if( m_owner.getFamily() == ComputerFamily.Advanced )
|
||||
if( m_owner.getFamily() == ComputerFamily.ADVANCED )
|
||||
{
|
||||
return ComputerCraft.advancedTurtleFuelLimit;
|
||||
}
|
||||
@ -546,7 +546,7 @@ public class TurtleBrain implements ITurtleAccess
|
||||
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 class TurtleBrain implements ITurtleAccess
|
||||
{
|
||||
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 class TurtleBrain implements ITurtleAccess
|
||||
|
||||
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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
{
|
||||
switch( side )
|
||||
{
|
||||
case Left:
|
||||
case LEFT:
|
||||
return ComputerSide.LEFT;
|
||||
case Right:
|
||||
case RIGHT:
|
||||
default:
|
||||
return ComputerSide.RIGHT;
|
||||
}
|
||||
@ -779,7 +779,7 @@ public class TurtleBrain implements ITurtleAccess
|
||||
|
||||
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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
|
||||
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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
}
|
||||
|
||||
// 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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
m_lastAnimationProgress = m_animationProgress;
|
||||
if( ++m_animationProgress >= ANIM_DURATION )
|
||||
{
|
||||
m_animation = TurtleAnimation.None;
|
||||
m_animation = TurtleAnimation.NONE;
|
||||
m_animationProgress = 0;
|
||||
m_lastAnimationProgress = 0;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class TurtleDropCommand implements ITurtleCommand
|
||||
// Dropping nothing is easy
|
||||
if( m_quantity == 0 )
|
||||
{
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
return TurtleCommandResult.success();
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class TurtleDropCommand implements ITurtleCommand
|
||||
// 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 class TurtleDropCommand implements ITurtleCommand
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class TurtleEquipCommand implements ITurtleCommand
|
||||
// Animate
|
||||
if( newUpgrade != null || oldUpgrade != null )
|
||||
{
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
}
|
||||
|
||||
return TurtleCommandResult.success();
|
||||
|
@ -72,7 +72,7 @@ public class TurtleMoveCommand implements ITurtleCommand
|
||||
|
||||
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 class TurtleMoveCommand implements ITurtleCommand
|
||||
// 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();
|
||||
|
@ -86,7 +86,7 @@ public class TurtlePlaceCommand implements ITurtleCommand
|
||||
turtle.getInventory().markDirty();
|
||||
|
||||
// Animate and return success
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
return TurtleCommandResult.success();
|
||||
}
|
||||
else
|
||||
|
@ -39,7 +39,7 @@ public class TurtleRefuelCommand implements ITurtleCommand
|
||||
if( limit != 0 )
|
||||
{
|
||||
turtle.addFuel( event.getHandler().refuel( turtle, stack, slot, limit ) );
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
}
|
||||
|
||||
return TurtleCommandResult.success();
|
||||
|
@ -42,7 +42,7 @@ public class TurtleSuckCommand implements ITurtleCommand
|
||||
// Sucking nothing is easy
|
||||
if( m_quantity == 0 )
|
||||
{
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
return TurtleCommandResult.success();
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class TurtleSuckCommand implements ITurtleCommand
|
||||
// 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 @@ public class TurtleSuckCommand implements ITurtleCommand
|
||||
|
||||
// Play fx
|
||||
world.playBroadcastSound( 1000, turtlePosition, 0 ); // BLOCK_DISPENSER_DISPENSE
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
return TurtleCommandResult.success();
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ public class TurtleToolCommand implements ITurtleCommand
|
||||
{
|
||||
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 @@ public class TurtleToolCommand implements ITurtleCommand
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class TurtleTransferToCommand implements ITurtleCommand
|
||||
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 class TurtleTransferToCommand implements ITurtleCommand
|
||||
// Return true if we moved anything
|
||||
if( remainder != stack )
|
||||
{
|
||||
turtle.playAnimation( TurtleAnimation.Wait );
|
||||
turtle.playAnimation( TurtleAnimation.WAIT );
|
||||
return TurtleCommandResult.success();
|
||||
}
|
||||
else
|
||||
|
@ -36,16 +36,16 @@ public class TurtleTurnCommand implements ITurtleCommand
|
||||
|
||||
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:
|
||||
|
@ -76,8 +76,8 @@ public class ItemTurtle extends ItemComputerBase implements ITurtleItem
|
||||
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 class ItemTurtle extends ItemComputerBase implements ITurtleItem
|
||||
// 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 class ItemTurtle extends ItemComputerBase implements ITurtleItem
|
||||
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 class ItemTurtle extends ItemComputerBase implements ITurtleItem
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ public final class 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 final class TurtleItemFactory
|
||||
{
|
||||
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;
|
||||
|
@ -38,7 +38,7 @@ public final class TurtleUpgradeRecipe extends SpecialRecipe
|
||||
@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 @@ public final class TurtleUpgradeRecipe extends SpecialRecipe
|
||||
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
|
||||
|
@ -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 @@ public class TurtleCraftingTable extends AbstractTurtleUpgrade
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class TurtleHoe extends TurtleTool
|
||||
@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 );
|
||||
|
@ -78,7 +78,7 @@ public class TurtleModem extends AbstractTurtleUpgrade
|
||||
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 class TurtleModem extends AbstractTurtleUpgrade
|
||||
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 );
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class TurtleShovel extends TurtleTool
|
||||
@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 );
|
||||
|
@ -63,7 +63,7 @@ public class TurtleSpeaker extends AbstractTurtleUpgrade
|
||||
|
||||
public TurtleSpeaker( ResourceLocation id )
|
||||
{
|
||||
super( id, TurtleUpgradeType.Peripheral, ComputerCraft.Blocks.speaker );
|
||||
super( id, TurtleUpgradeType.PERIPHERAL, ComputerCraft.Blocks.speaker );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +88,7 @@ public class TurtleSpeaker extends AbstractTurtleUpgrade
|
||||
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
|
||||
|
@ -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 class TurtleTool extends AbstractTurtleUpgrade
|
||||
@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 class TurtleTool extends AbstractTurtleUpgrade
|
||||
{
|
||||
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" );
|
||||
|
@ -7,22 +7,22 @@ package dan200.computercraft.shared.util;
|
||||
|
||||
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();
|
||||
|
||||
|
@ -7,9 +7,9 @@ package dan200.computercraft.shared.util;
|
||||
|
||||
public enum Holiday
|
||||
{
|
||||
None,
|
||||
Valentines,
|
||||
AprilFoolsDay,
|
||||
Halloween,
|
||||
Christmas,
|
||||
NONE,
|
||||
VALENTINES,
|
||||
APRIL_FOOLS_DAY,
|
||||
HALLOWEEN,
|
||||
CHRISTMAS,
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ public final class HolidayUtil
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user