Add @Nullable and @NonNull annotations

This commit is contained in:
SquidDev 2017-05-07 00:07:42 +01:00
parent 9d1872c948
commit dc5517303f
128 changed files with 818 additions and 381 deletions

View File

@ -722,7 +722,7 @@ public static IWritableMount createSaveDirMount( World world, String subPath, lo
}
}
public static IMount createResourceMount( Class modClass, String domain, String subPath )
public static IMount createResourceMount( Class<?> modClass, String domain, String subPath )
{
// Start building list of mounts
List<IMount> mounts = new ArrayList<IMount>();
@ -806,7 +806,7 @@ else if( mounts.size() == 1 )
}
}
private static File getContainingJar( Class modClass )
private static File getContainingJar( Class<?> modClass )
{
String path = modClass.getProtectionDomain().getCodeSource().getLocation().getPath();
int bangIndex = path.indexOf( "!" );
@ -831,7 +831,7 @@ private static File getContainingJar( Class modClass )
return file;
}
private static File getDebugCodeDir( Class modClass )
private static File getDebugCodeDir( Class<?> modClass )
{
String path = modClass.getProtectionDomain().getCodeSource().getLocation().getPath();
int bangIndex = path.indexOf("!");

View File

@ -21,6 +21,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.reflect.Method;
/**
@ -36,6 +38,7 @@ public static boolean isInstalled()
return computerCraft != null;
}
@Nonnull
public static String getInstalledVersion()
{
findCC();
@ -50,6 +53,7 @@ public static String getInstalledVersion()
return "";
}
@Nonnull
public static String getAPIVersion()
{
return "${version}";
@ -68,7 +72,7 @@ public static String getAPIVersion()
* available for writing.
* @see #createSaveDirMount(World, String, long)
*/
public static int createUniqueNumberedSaveDir( World world, String parentSubPath )
public static int createUniqueNumberedSaveDir( @Nonnull World world, @Nonnull String parentSubPath )
{
findCC();
if( computerCraft_createUniqueNumberedSaveDir != null )
@ -100,7 +104,8 @@ public static int createUniqueNumberedSaveDir( World world, String parentSubPath
* @see IMount
* @see IWritableMount
*/
public static IWritableMount createSaveDirMount( World world, String subPath, long capacity )
@Nullable
public static IWritableMount createSaveDirMount( @Nonnull World world, @Nonnull String subPath, long capacity )
{
findCC();
if( computerCraft_createSaveDirMount != null )
@ -132,7 +137,8 @@ public static IWritableMount createSaveDirMount( World world, String subPath, lo
* @see IComputerAccess#mountWritable(String, IWritableMount)
* @see IMount
*/
public static IMount createResourceMount( Class modClass, String domain, String subPath )
@Nullable
public static IMount createResourceMount( @Nonnull Class<?> modClass, @Nonnull String domain, @Nonnull String subPath )
{
findCC();
if( computerCraft_createResourceMount != null )
@ -153,7 +159,7 @@ public static IMount createResourceMount( Class modClass, String domain, String
* @see dan200.computercraft.api.peripheral.IPeripheral
* @see dan200.computercraft.api.peripheral.IPeripheralProvider
*/
public static void registerPeripheralProvider( IPeripheralProvider handler )
public static void registerPeripheralProvider( @Nonnull IPeripheralProvider handler )
{
findCC();
if ( computerCraft_registerPeripheralProvider != null)
@ -174,7 +180,7 @@ public static void registerPeripheralProvider( IPeripheralProvider handler )
* @param upgrade The turtle upgrade to register.
* @see dan200.computercraft.api.turtle.ITurtleUpgrade
*/
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
public static void registerTurtleUpgrade( @Nonnull ITurtleUpgrade upgrade )
{
if( upgrade != null )
{
@ -196,7 +202,7 @@ public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
* @param handler The bundled redstone provider to register.
* @see dan200.computercraft.api.redstone.IBundledRedstoneProvider
*/
public static void registerBundledRedstoneProvider( IBundledRedstoneProvider handler )
public static void registerBundledRedstoneProvider( @Nonnull IBundledRedstoneProvider handler )
{
findCC();
if( computerCraft_registerBundledRedstoneProvider != null )
@ -219,7 +225,7 @@ public static void registerBundledRedstoneProvider( IBundledRedstoneProvider han
* If there is no block capable of emitting bundled redstone at the location, -1 will be returned.
* @see dan200.computercraft.api.redstone.IBundledRedstoneProvider
*/
public static int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacing side )
public static int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side )
{
findCC();
if( computerCraft_getDefaultBundledRedstoneOutput != null )
@ -239,7 +245,7 @@ public static int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacin
* @param handler The media provider to register.
* @see dan200.computercraft.api.media.IMediaProvider
*/
public static void registerMediaProvider( IMediaProvider handler )
public static void registerMediaProvider( @Nonnull IMediaProvider handler )
{
findCC();
if( computerCraft_registerMediaProvider != null )
@ -258,7 +264,7 @@ public static void registerMediaProvider( IMediaProvider handler )
* @param handler The turtle permission provider to register.
* @see dan200.computercraft.api.permissions.ITurtlePermissionProvider
*/
public static void registerPermissionProvider( ITurtlePermissionProvider handler )
public static void registerPermissionProvider( @Nonnull ITurtlePermissionProvider handler )
{
findCC();
if( computerCraft_registerPermissionProvider != null )
@ -271,7 +277,8 @@ public static void registerPermissionProvider( ITurtlePermissionProvider handler
}
}
public static void registerPocketUpgrade(IPocketUpgrade upgrade) {
public static void registerPocketUpgrade( @Nonnull IPocketUpgrade upgrade )
{
findCC();
if(computerCraft_registerPocketUpgrade != null) {
try {
@ -331,7 +338,7 @@ private static void findCC()
}
}
private static Method findCCMethod( String name, Class[] args )
private static Method findCCMethod( String name, Class<?>[] args )
{
try {
if( computerCraft != null )

View File

@ -10,6 +10,7 @@
import dan200.computercraft.api.peripheral.IComputerAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@ -36,7 +37,7 @@ public interface IMount
* @return If the file exists.
* @throws IOException If an error occurs when checking the existence of the file.
*/
public boolean exists( String path ) throws IOException;
boolean exists( @Nonnull String path ) throws IOException;
/**
* Returns whether a file with a given path is a directory or not.
@ -45,7 +46,7 @@ public interface IMount
* @return If the file exists and is a directory
* @throws IOException If an error occurs when checking whether the file is a directory.
*/
public boolean isDirectory( String path ) throws IOException;
boolean isDirectory( @Nonnull String path ) throws IOException;
/**
* Returns the file names of all the files in a directory.
@ -54,7 +55,7 @@ public interface IMount
* @param contents A list of strings. Add all the file names to this list.
* @throws IOException If the file was not a directory, or could not be listed.
*/
public void list( String path, List<String> contents ) throws IOException;
void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException;
/**
* Returns the size of a file with a given path, in bytes
@ -63,7 +64,7 @@ public interface IMount
* @return The size of the file, in bytes.
* @throws IOException If the file does not exist, or its size could not be determined.
*/
public long getSize( String path ) throws IOException;
long getSize( @Nonnull String path ) throws IOException;
/**
* Opens a file with a given path, and returns an {@link InputStream} representing its contents.
@ -72,5 +73,6 @@ public interface IMount
* @return A stream representing the contents of the file.
* @throws IOException If the file does not exist, or could not be opened.
*/
public InputStream openForRead( String path ) throws IOException;
@Nonnull
InputStream openForRead( @Nonnull String path ) throws IOException;
}

View File

@ -10,6 +10,7 @@
import dan200.computercraft.api.peripheral.IComputerAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.OutputStream;
@ -33,7 +34,7 @@ public interface IWritableMount extends IMount
* @param path A file path in normalised format, relative to the mount location. ie: "programs/mynewprograms".
* @throws IOException If the directory already exists or could not be created.
*/
public void makeDirectory( String path ) throws IOException;
void makeDirectory( @Nonnull String path ) throws IOException;
/**
* Deletes a directory at a given path inside the virtual file system.
@ -41,7 +42,7 @@ public interface IWritableMount extends IMount
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myoldprograms".
* @throws IOException If the file does not exist or could not be deleted.
*/
public void delete( String path ) throws IOException;
void delete( @Nonnull String path ) throws IOException;
/**
* Opens a file with a given path, and returns an {@link OutputStream} for writing to it.
@ -50,7 +51,8 @@ public interface IWritableMount extends IMount
* @return A stream for writing to
* @throws IOException If the file could not be opened for writing.
*/
public OutputStream openForWrite( String path ) throws IOException;
@Nonnull
OutputStream openForWrite( @Nonnull String path ) throws IOException;
/**
* Opens a file with a given path, and returns an {@link OutputStream} for appending to it.
@ -59,7 +61,8 @@ public interface IWritableMount extends IMount
* @return A stream for writing to.
* @throws IOException If the file could not be opened for writing.
*/
public OutputStream openForAppend( String path ) throws IOException;
@Nonnull
OutputStream openForAppend( @Nonnull String path ) throws IOException;
/**
* Get the amount of free space on the mount, in bytes. You should decrease this value as the user writes to the
@ -68,5 +71,5 @@ public interface IWritableMount extends IMount
* @return The amount of free space, in bytes.
* @throws IOException If the remaining space could not be computed.
*/
public long getRemainingSpace() throws IOException;
long getRemainingSpace() throws IOException;
}

View File

@ -6,6 +6,9 @@
package dan200.computercraft.api.lua;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* An interface passed to peripherals and {@link ILuaObject}s by computers or turtles, providing methods
* that allow the peripheral call to wait for events before returning, just like in lua. This is very useful if you need
@ -28,7 +31,8 @@ public interface ILuaContext
* event, InterruptedException will be thrown. This exception must not be caught or
* intercepted, or the computer will leak memory and end up in a broken state.
*/
public Object[] pullEvent( String filter ) throws LuaException, InterruptedException;
@Nonnull
Object[] pullEvent( @Nullable String filter ) throws LuaException, InterruptedException;
/**
* The same as {@link #pullEvent(String)}, except "terminated" events are ignored. Only use this if you want to
@ -42,7 +46,8 @@ public interface ILuaContext
* intercepted, or the computer will leak memory and end up in a broken state.
* @see #pullEvent(String)
*/
public Object[] pullEventRaw( String filter ) throws InterruptedException;
@Nonnull
Object[] pullEventRaw( @Nullable String filter ) throws InterruptedException;
/**
* Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to
@ -55,7 +60,8 @@ public interface ILuaContext
* intercepted, or the computer will leak memory and end up in a broken state.
* @see #pullEvent(String)
*/
public Object[] yield( Object[] arguments ) throws InterruptedException;
@Nonnull
Object[] yield( @Nullable Object[] arguments ) throws InterruptedException;
/**
* Queue a task to be executed on the main server thread at the beginning of next tick, waiting for it to complete.
@ -71,7 +77,8 @@ public interface ILuaContext
* InterruptedException will be thrown. This exception must not be caught or
* intercepted, or the computer will leak memory and end up in a broken state.
*/
public Object[] executeMainThreadTask( ILuaTask task ) throws LuaException, InterruptedException;
@Nullable
Object[] executeMainThreadTask( @Nonnull ILuaTask task ) throws LuaException, InterruptedException;
/**
* Queue a task to be executed on the main server thread at the beginning of next tick, but do not wait for it to
@ -86,5 +93,5 @@ public interface ILuaContext
* @return The "id" of the task. This will be the first argument to the {@code task_completed} event.
* @throws LuaException If the task could not be queued.
*/
public long issueMainThreadTask( ILuaTask task ) throws LuaException;
long issueMainThreadTask( @Nonnull ILuaTask task ) throws LuaException;
}

View File

@ -9,6 +9,9 @@
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* An interface for representing custom objects returned by {@link IPeripheral#callMethod(IComputerAccess, ILuaContext, int, Object[])}
* calls.
@ -24,7 +27,8 @@ public interface ILuaObject
* @return The method names this object provides.
* @see IPeripheral#getMethodNames()
*/
public String[] getMethodNames();
@Nonnull
String[] getMethodNames();
/**
* Called when a user calls one of the methods that this object implements. This works the same as
@ -47,5 +51,6 @@ public interface ILuaObject
* intercepted, or the computer will leak memory and end up in a broken state.w
* @see IPeripheral#callMethod(IComputerAccess, ILuaContext, int, Object[])
*/
public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException;
@Nullable
Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException;
}

View File

@ -6,6 +6,8 @@
package dan200.computercraft.api.lua;
import javax.annotation.Nullable;
/**
* A task which can be executed via {@link ILuaContext#executeMainThreadTask(ILuaTask)} or
* {@link ILuaContext#issueMainThreadTask(ILuaTask)}. This will be run on the main thread, at the beginning of the
@ -25,5 +27,6 @@ public interface ILuaTask
* same message as your exception. Use this to throw appropriate errors if the wrong
* arguments are supplied to your method.
*/
public Object[] execute() throws LuaException;
@Nullable
Object[] execute() throws LuaException;
}

View File

@ -6,6 +6,8 @@
package dan200.computercraft.api.lua;
import javax.annotation.Nullable;
/**
* An exception representing an error in Lua, like that raised by the {@code error()} function.
*/
@ -19,12 +21,12 @@ public LuaException()
this( "error", 1 );
}
public LuaException( String message )
public LuaException( @Nullable String message )
{
this( message, 1 );
}
public LuaException( String message, int level )
public LuaException( @Nullable String message, int level )
{
super( message );
m_level = level;

View File

@ -11,6 +11,9 @@
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Represents an item that can be placed in a disk drive and used by a Computer.
* Implement this interface on your Item class to allow it to be used in the drive.
@ -23,7 +26,8 @@ public interface IMedia
* @param stack The itemstack to inspect.
* @return The label. ie: "Dan's Programs".
*/
public String getLabel( ItemStack stack );
@Nullable
String getLabel( @Nonnull ItemStack stack );
/**
* Set a string representing the label of this item. Will be called vi {@code disk.setLabel()} in lua.
@ -32,7 +36,7 @@ public interface IMedia
* @param label The string to set the label to.
* @return true if the label was updated, false if the label may not be modified.
*/
public boolean setLabel( ItemStack stack, String label );
boolean setLabel( @Nonnull ItemStack stack, @Nullable String label );
/**
* If this disk represents an item with audio (like a record), get the readable name of the audio track. ie:
@ -41,7 +45,8 @@ public interface IMedia
* @param stack The itemstack to inspect.
* @return The name, or null if this item does not represent an item with audio.
*/
public String getAudioTitle( ItemStack stack );
@Nullable
String getAudioTitle( @Nonnull ItemStack stack );
/**
* If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
@ -49,7 +54,8 @@ public interface IMedia
* @param stack The itemstack to inspect.
* @return The name, or null if this item does not represent an item with audio.
*/
public SoundEvent getAudio( ItemStack stack );
@Nullable
SoundEvent getAudio( @Nonnull ItemStack stack );
/**
* If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will
@ -64,5 +70,6 @@ public interface IMedia
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String, long)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
*/
public IMount createDataMount( ItemStack stack, World world );
@Nullable
IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world );
}

View File

@ -8,6 +8,9 @@
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* This interface is used to provide {@link IMedia} implementations for {@link ItemStack}.
*
@ -22,5 +25,6 @@ public interface IMediaProvider
* @return An IMedia implementation, or null if the item is not something you wish to handle
* @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider)
*/
public IMedia getMedia( ItemStack stack );
@Nullable
IMedia getMedia( @Nonnull ItemStack stack );
}

View File

@ -11,6 +11,9 @@
import dan200.computercraft.api.filesystem.IWritableMount;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* The interface passed to peripherals by computers or turtles, providing methods
* that they can call. This should not be implemented by your classes. Do not interact
@ -33,7 +36,8 @@ public interface IComputerAccess
* @see #unmount(String)
* @see IMount
*/
public String mount( String desiredLocation, IMount mount );
@Nullable
String mount( @Nonnull String desiredLocation, @Nonnull IMount mount );
/**
* Mount a mount onto the computer's file system in a read only mode.
@ -51,7 +55,8 @@ public interface IComputerAccess
* @see #unmount(String)
* @see IMount
*/
public String mount( String desiredLocation, IMount mount, String driveName );
@Nullable
String mount( @Nonnull String desiredLocation, @Nonnull IMount mount, @Nonnull String driveName );
/**
* Mount a mount onto the computer's file system in a writable mode.
@ -67,7 +72,8 @@ public interface IComputerAccess
* @see #unmount(String)
* @see IMount
*/
public String mountWritable( String desiredLocation, IWritableMount mount );
@Nullable
String mountWritable( @Nonnull String desiredLocation, @Nonnull IWritableMount mount );
/**
* Mount a mount onto the computer's file system in a writable mode.
@ -84,7 +90,7 @@ public interface IComputerAccess
* @see #unmount(String)
* @see IMount
*/
public String mountWritable( String desiredLocation, IWritableMount mount, String driveName );
String mountWritable( @Nonnull String desiredLocation, @Nonnull IWritableMount mount, @Nonnull String driveName );
/**
* Unmounts a directory previously mounted onto the computers file system by {@link #mount(String, IMount)}
@ -104,7 +110,7 @@ public interface IComputerAccess
* @see #mount(String, IMount)
* @see #mountWritable(String, IWritableMount)
*/
public void unmount( String location );
void unmount( @Nullable String location );
/**
* Returns the numerical ID of this computer.
@ -114,7 +120,7 @@ public interface IComputerAccess
*
* @return The identifier.
*/
public int getID();
int getID();
/**
* Causes an event to be raised on this computer, which the computer can respond to by calling
@ -134,7 +140,7 @@ public interface IComputerAccess
* @throws RuntimeException If the peripheral has been detached.
* @see dan200.computercraft.api.peripheral.IPeripheral#callMethod
*/
public void queueEvent( String event, Object[] arguments );
void queueEvent( @Nonnull String event, @Nullable Object[] arguments );
/**
* Get a string, unique to the computer, by which the computer refers to this peripheral.
@ -146,5 +152,6 @@ public interface IComputerAccess
* @return A string unique to the computer, but not globally.
* @throws RuntimeException If the peripheral has been detached.
*/
public String getAttachmentName();
@Nonnull
String getAttachmentName();
}

View File

@ -9,6 +9,9 @@
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* The interface that defines a peripheral. See {@link IPeripheralProvider} for how to associate blocks with peripherals.
*/
@ -20,7 +23,8 @@ public interface IPeripheral
*
* @return A string identifying the type of peripheral.
*/
public String getType();
@Nonnull
String getType();
/**
* Should return an array of strings that identify the methods that this
@ -30,7 +34,8 @@ public interface IPeripheral
* @return An array of strings representing method names.
* @see #callMethod
*/
public String[] getMethodNames();
@Nonnull
String[] getMethodNames();
/**
* This is called when a lua program on an attached computer calls {@code peripheral.call()} with
@ -66,7 +71,8 @@ public interface IPeripheral
* intercepted, or the computer will leak memory and end up in a broken state.
* @see #getMethodNames
*/
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException;
@Nullable
Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException;
/**
* Is called when canAttachToSide has returned true, and a computer is attaching to the peripheral.
@ -85,7 +91,7 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
public void attach( IComputerAccess computer );
void attach( @Nonnull IComputerAccess computer );
/**
* Is called when a computer is detaching from the peripheral.
@ -102,7 +108,7 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
public void detach( IComputerAccess computer );
void detach( @Nonnull IComputerAccess computer );
/**
* Determine whether this peripheral is equivalent to another one.
@ -113,5 +119,5 @@ public interface IPeripheral
* @param other The peripheral to compare against. This may be {@code null}.
* @return Whether these peripherals are equivalent.
*/
public boolean equals( IPeripheral other );
boolean equals( @Nullable IPeripheral other );
}

View File

@ -10,6 +10,9 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* This interface is used to create peripheral implementations for blocks.
*
@ -26,5 +29,6 @@ public interface IPeripheralProvider
* @return A peripheral, or {@code null} if there is not a peripheral here you'd like to handle.
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
*/
public IPeripheral getPeripheral( World world, BlockPos pos, EnumFacing side );
@Nullable
IPeripheral getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side );
}

View File

@ -9,6 +9,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
/**
* This interface is used to restrict where turtles can move or build.
*
@ -25,7 +27,7 @@ public interface ITurtlePermissionProvider
* @param pos The location of the block.
* @return Whether the turtle can move into this block.
*/
public boolean isBlockEnterable( World world, BlockPos pos );
boolean isBlockEnterable( @Nonnull World world, @Nonnull BlockPos pos );
/**
* Determine whether a block can be modified by a turtle.
@ -36,5 +38,5 @@ public interface ITurtlePermissionProvider
* @param pos The location of the block.
* @return Whether the turtle can modify this block.
*/
public boolean isBlockEditable( World world, BlockPos pos );
boolean isBlockEditable( @Nonnull World world, @Nonnull BlockPos pos );
}

View File

@ -10,6 +10,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
/**
* This interface is used to provide bundled redstone output for blocks.
*
@ -27,5 +29,5 @@ public interface IBundledRedstoneProvider
* handle this block.
* @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider)
*/
public int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacing side );
int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side );
}

View File

@ -16,6 +16,9 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* The interface passed to turtle by turtles, providing methods that they can call.
*
@ -29,14 +32,16 @@ public interface ITurtleAccess
*
* @return the world in which the turtle resides.
*/
public World getWorld();
@Nonnull
World getWorld();
/**
* Returns a vector containing the integer co-ordinates at which the turtle resides.
*
* @return a vector containing the integer co-ordinates at which the turtle resides.
*/
public BlockPos getPosition();
@Nonnull
BlockPos getPosition();
/**
* Attempt to move this turtle to a new position.
@ -51,7 +56,7 @@ public interface ITurtleAccess
* {@link dan200.computercraft.api.permissions.ITurtlePermissionProvider#isBlockEnterable(World, BlockPos)}.
* @throws UnsupportedOperationException When attempting to teleport on the client side.
*/
public boolean teleportTo( World world, BlockPos pos );
boolean teleportTo( @Nonnull World world, @Nonnull BlockPos pos );
/**
* Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
@ -61,7 +66,8 @@ public interface ITurtleAccess
* @return A vector containing the floating point co-ordinates at which the turtle resides.
* @see #getVisualYaw(float)
*/
public Vec3d getVisualPosition( float f );
@Nonnull
Vec3d getVisualPosition( float f );
/**
* Returns the yaw the turtle is facing when it is rendered.
@ -70,7 +76,7 @@ public interface ITurtleAccess
* @return The yaw the turtle is facing.
* @see #getVisualPosition(float)
*/
public float getVisualYaw( float f );
float getVisualYaw( float f );
/**
* Returns the world direction the turtle is currently facing.
@ -78,7 +84,8 @@ public interface ITurtleAccess
* @return The world direction the turtle is currently facing.
* @see #setDirection(EnumFacing)
*/
public EnumFacing getDirection();
@Nonnull
EnumFacing getDirection();
/**
* Set the direction the turtle is facing. Note that this will not play a rotation animation, you will also need to
@ -87,7 +94,7 @@ public interface ITurtleAccess
* @param dir The new direction to set. This should be on either the x or z axis (so north, south, east or west).
* @see #getDirection()
*/
public void setDirection( EnumFacing dir );
void setDirection( @Nonnull EnumFacing dir );
/**
* Get the currently selected slot in the turtle's inventory.
@ -96,7 +103,7 @@ public interface ITurtleAccess
* @see #getInventory()
* @see #setSelectedSlot(int)
*/
public int getSelectedSlot();
int getSelectedSlot();
/**
* Set the currently selected slot in the turtle's inventory.
@ -107,7 +114,7 @@ public interface ITurtleAccess
* @see #getInventory()
* @see #getSelectedSlot()
*/
public void setSelectedSlot( int slot );
void setSelectedSlot( int slot );
/**
* Sets the colour of the turtle, as if the player had dyed it with a dye item.
@ -116,7 +123,7 @@ public interface ITurtleAccess
* the dye from the turtle.
* @see #getDyeColour()
*/
public void setDyeColour( int dyeColour );
void setDyeColour( int dyeColour );
/**
* Gets the colour the turtle has been dyed.
@ -125,14 +132,15 @@ public interface ITurtleAccess
* is clean.
* @see #getDyeColour()
*/
public int getDyeColour();
int getDyeColour();
/**
* Get the inventory of this turtle
*
* @return This turtle's inventory
*/
public IInventory getInventory();
@Nonnull
IInventory getInventory();
/**
* Determine whether this turtle will require fuel when performing actions.
@ -141,7 +149,7 @@ public interface ITurtleAccess
* @see #getFuelLevel()
* @see #setFuelLevel(int)
*/
public boolean isFuelNeeded();
boolean isFuelNeeded();
/**
* Get the current fuel level of this turtle.
@ -150,7 +158,7 @@ public interface ITurtleAccess
* @see #isFuelNeeded()
* @see #setFuelLevel(int)
*/
public int getFuelLevel();
int getFuelLevel();
/**
* Set the fuel level to a new value. It is generally preferred to use {@link #consumeFuel(int)}} or {@link #addFuel(int)}
@ -162,14 +170,14 @@ public interface ITurtleAccess
* @see #addFuel(int)
* @see #consumeFuel(int)
*/
public void setFuelLevel( int fuel );
void setFuelLevel( int fuel );
/**
* Get the maximum amount of fuel a turtle can hold.
*
* @return The turtle's fuel limit.
*/
public int getFuelLimit();
int getFuelLimit();
/**
* Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle.
@ -179,7 +187,7 @@ public interface ITurtleAccess
* greater than the current fuel level of the turtle. No fuel will be consumed if {@code false} is returned.
* @throws UnsupportedOperationException When attempting to consume fuel on the client side.
*/
public boolean consumeFuel( int fuel );
boolean consumeFuel( int fuel );
/**
* Increase the turtle's fuel level by the given amount.
@ -187,7 +195,7 @@ public interface ITurtleAccess
* @param fuel The amount to refuel with.
* @throws UnsupportedOperationException When attempting to refuel on the client side.
*/
public void addFuel( int fuel );
void addFuel( int fuel );
/**
* Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed
@ -209,7 +217,8 @@ public interface ITurtleAccess
* @see ITurtleCommand
* @see ILuaContext#pullEvent(String)
*/
public Object[] executeCommand( ILuaContext context, ITurtleCommand command ) throws LuaException, InterruptedException;
@Nonnull
Object[] executeCommand( @Nonnull ILuaContext context, @Nonnull ITurtleCommand command ) throws LuaException, InterruptedException;
/**
* Start playing a specific animation. This will prevent other turtle commands from executing until
@ -219,7 +228,7 @@ public interface ITurtleAccess
* @throws UnsupportedOperationException When attempting to execute play an animation on the client side.
* @see TurtleAnimation
*/
public void playAnimation( TurtleAnimation animation );
void playAnimation( @Nonnull TurtleAnimation animation );
/**
* Returns the turtle on the specified side of the turtle, if there is one.
@ -228,7 +237,8 @@ public interface ITurtleAccess
* @return The upgrade on the specified side of the turtle, if there is one.
* @see #setUpgrade(TurtleSide, ITurtleUpgrade)
*/
public ITurtleUpgrade getUpgrade( TurtleSide side );
@Nullable
ITurtleUpgrade getUpgrade( @Nonnull TurtleSide side );
/**
* Set the upgrade for a given side, resetting peripherals and clearing upgrade specific data.
@ -237,7 +247,7 @@ public interface ITurtleAccess
* @param upgrade The upgrade to set, may be {@code null} to clear.
* @see #getUpgrade(TurtleSide)
*/
public void setUpgrade( TurtleSide side, ITurtleUpgrade upgrade );
void setUpgrade( @Nonnull TurtleSide side, @Nullable ITurtleUpgrade upgrade );
/**
* Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.
@ -245,7 +255,8 @@ public interface ITurtleAccess
* @param side The side to get the peripheral from.
* @return The peripheral created by the upgrade on the specified side of the turtle, {@code null} if none exists.
*/
public IPeripheral getPeripheral( TurtleSide side );
@Nullable
IPeripheral getPeripheral( @Nonnull TurtleSide side );
/**
* Get an upgrade-specific NBT compound, which can be used to store arbitrary data.
@ -257,7 +268,8 @@ public interface ITurtleAccess
* @return The upgrade-specific data.
* @see #updateUpgradeNBTData(TurtleSide)
*/
public NBTTagCompound getUpgradeNBTData( TurtleSide side );
@Nonnull
NBTTagCompound getUpgradeNBTData( @Nullable TurtleSide side );
/**
* Mark the upgrade-specific data as dirty on a specific side. This is required for the data to be synced to the
@ -266,5 +278,5 @@ public interface ITurtleAccess
* @param side The side to mark dirty.
* @see #updateUpgradeNBTData(TurtleSide)
*/
public void updateUpgradeNBTData( TurtleSide side );
void updateUpgradeNBTData( @Nonnull TurtleSide side );
}

View File

@ -8,6 +8,8 @@
import dan200.computercraft.api.lua.ILuaContext;
import javax.annotation.Nonnull;
/**
* An interface for objects executing custom turtle commands, used with {@link ITurtleAccess#executeCommand(ILuaContext, ITurtleCommand)}.
*
@ -28,5 +30,6 @@ public interface ITurtleCommand
* @see TurtleCommandResult#failure(String)
* @see TurtleCommandResult
*/
public TurtleCommandResult execute( ITurtleAccess turtle );
@Nonnull
TurtleCommandResult execute( @Nonnull ITurtleAccess turtle );
}

View File

@ -17,6 +17,8 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@ -36,7 +38,8 @@ public interface ITurtleUpgrade
* @return The unique ID for this upgrade.
* @see ComputerCraftAPI#registerTurtleUpgrade(ITurtleUpgrade)
*/
public ResourceLocation getUpgradeID();
@Nonnull
ResourceLocation getUpgradeID();
/**
* Gets a numerical identifier representing this type of turtle upgrade,
@ -47,7 +50,7 @@ public interface ITurtleUpgrade
* @return The legacy ID, or -1 if is needed.
* @see ComputerCraftAPI#registerTurtleUpgrade(ITurtleUpgrade)
*/
public int getLegacyUpgradeID();
int getLegacyUpgradeID();
/**
* Return an unlocalised string to describe this type of turtle in turtle item names.
@ -56,7 +59,8 @@ public interface ITurtleUpgrade
*
* @return The localisation key for this upgrade's adjective.
*/
public String getUnlocalisedAdjective();
@Nonnull
String getUnlocalisedAdjective();
/**
* Return whether this turtle adds a tool or a peripheral to the turtle.
@ -64,7 +68,8 @@ public interface ITurtleUpgrade
* @return The type of upgrade this is.
* @see TurtleUpgradeType for the differences between them.
*/
public TurtleUpgradeType getType();
@Nonnull
TurtleUpgradeType getType();
/**
* Return an item stack representing the type of item that a turtle must be crafted
@ -73,7 +78,8 @@ public interface ITurtleUpgrade
*
* @return The item stack to craft with, or {@code null} if it cannot be crafted.
*/
public ItemStack getCraftingItem();
@Nullable
ItemStack getCraftingItem();
/**
* Will only be called for peripheral upgrades. Creates a peripheral for a turtle being placed using this upgrade.
@ -87,7 +93,8 @@ public interface ITurtleUpgrade
* @return The newly created peripheral. You may return {@code null} if this upgrade is a Tool
* and this method is not expected to be called.
*/
public IPeripheral createPeripheral( ITurtleAccess turtle, TurtleSide side );
@Nullable
IPeripheral createPeripheral( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side );
/**
* Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called
@ -104,7 +111,8 @@ public interface ITurtleUpgrade
* a swinging animation. You may return {@code null} if this turtle is a Peripheral and this method is not expected
* to be called.
*/
public TurtleCommandResult useTool( ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, EnumFacing direction );
@Nonnull
TurtleCommandResult useTool( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side, @Nonnull TurtleVerb verb, @Nonnull EnumFacing direction );
/**
* Called to obtain the model to be used when rendering a turtle peripheral.
@ -119,7 +127,8 @@ public interface ITurtleUpgrade
* a transformation of {@code null} has the same effect as the identify matrix.
*/
@SideOnly(Side.CLIENT)
public Pair<IBakedModel, Matrix4f> getModel( ITurtleAccess turtle, TurtleSide side );
@Nonnull
Pair<IBakedModel, Matrix4f> getModel( @Nullable ITurtleAccess turtle, @Nonnull TurtleSide side );
/**
* Called once per tick for each turtle which has the upgrade equipped.
@ -127,5 +136,5 @@ public interface ITurtleUpgrade
* @param turtle Access to the turtle that the upgrade resides on.
* @param side Which side of the turtle (left or right) the upgrade resides on.
*/
public void update( ITurtleAccess turtle, TurtleSide side );
void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side );
}

View File

@ -8,6 +8,9 @@
import net.minecraft.util.EnumFacing;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Used to indicate the result of executing a turtle command.
*
@ -24,6 +27,7 @@ public final class TurtleCommandResult
*
* @return A successful command result with no values.
*/
@Nonnull
public static TurtleCommandResult success()
{
return success( null );
@ -35,7 +39,8 @@ public static TurtleCommandResult success()
* @param results The results of executing this command.
* @return A successful command result with the given values.
*/
public static TurtleCommandResult success( Object[] results )
@Nonnull
public static TurtleCommandResult success( @Nullable Object[] results )
{
if( results == null || results.length == 0 )
{
@ -52,6 +57,7 @@ public static TurtleCommandResult success( Object[] results )
*
* @return A failed command result with no message.
*/
@Nonnull
public static TurtleCommandResult failure()
{
return failure( null );
@ -63,7 +69,8 @@ public static TurtleCommandResult failure()
* @param errorMessage The error message to provide.
* @return A failed command result with a message.
*/
public static TurtleCommandResult failure( String errorMessage )
@Nonnull
public static TurtleCommandResult failure( @Nullable String errorMessage )
{
if( errorMessage == null )
{
@ -101,6 +108,7 @@ public boolean isSuccess()
*
* @return The command's error message, or {@code null} if it was a success.
*/
@Nullable
public String getErrorMessage()
{
return m_errorMessage;
@ -111,6 +119,7 @@ public String getErrorMessage()
*
* @return The command's result, or {@code null} if it was a failure.
*/
@Nullable
public Object[] getResults()
{
return m_results;

View File

@ -38,6 +38,8 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import javax.annotation.Nonnull;
public class CCTurtleProxyClient extends CCTurtleProxyCommon
{
public CCTurtleProxyClient()
@ -56,8 +58,9 @@ public void init()
{
private ModelResourceLocation turtle_dynamic = new ModelResourceLocation( "computercraft:turtle_dynamic", "inventory" );
@Nonnull
@Override
public ModelResourceLocation getModelLocation( ItemStack stack )
public ModelResourceLocation getModelLocation( @Nonnull ItemStack stack )
{
return turtle_dynamic;
}
@ -188,7 +191,7 @@ private void loadSmartModel( ModelBakeEvent event, String name, IBakedModel smar
private static class TurtleItemColour implements IItemColor
{
@Override
public int getColorFromItemstack( ItemStack stack, int tintIndex )
public int getColorFromItemstack( @Nonnull ItemStack stack, int tintIndex )
{
if( tintIndex == 0 )
{

View File

@ -55,6 +55,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@ -88,8 +89,9 @@ public void init()
private ModelResourceLocation computer = new ModelResourceLocation( "computercraft:CC-Computer", "inventory" );
private ModelResourceLocation advanced_computer = new ModelResourceLocation( "computercraft:advanced_computer", "inventory" );
@Nonnull
@Override
public ModelResourceLocation getModelLocation( ItemStack stack )
public ModelResourceLocation getModelLocation( @Nonnull ItemStack stack )
{
ItemComputer itemComputer = (ItemComputer) stack.getItem();
ComputerFamily family = itemComputer.getFamily( stack.getItemDamage() );
@ -121,8 +123,9 @@ public ModelResourceLocation getModelLocation( ItemStack stack )
private ModelResourceLocation advanced_pocket_computer_on = new ModelResourceLocation( "computercraft:advanced_pocket_computer_on", "inventory" );
private ModelResourceLocation advanced_pocket_computer_blinking = new ModelResourceLocation( "computercraft:advanced_pocket_computer_blinking", "inventory" );
@Nonnull
@Override
public ModelResourceLocation getModelLocation( ItemStack stack )
public ModelResourceLocation getModelLocation( @Nonnull ItemStack stack )
{
ItemPocketComputer itemPocketComputer = (ItemPocketComputer)stack.getItem();
switch( itemPocketComputer.getFamily( stack ) )
@ -180,7 +183,7 @@ public ModelResourceLocation getModelLocation( ItemStack stack )
mc.getItemColors().registerItemColorHandler( new IItemColor()
{
@Override
public int getColorFromItemstack( ItemStack stack, int layout )
public int getColorFromItemstack( @Nonnull ItemStack stack, int layout )
{
if( layout != 1 ) return 0xFFFFFF;
@ -219,8 +222,9 @@ private void registerItemModel( Item item, String name )
ModelBakery.registerItemVariants( item, new ResourceLocation( "computercraft", name ) );
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, new ItemMeshDefinition()
{
@Nonnull
@Override
public ModelResourceLocation getModelLocation( ItemStack stack )
public ModelResourceLocation getModelLocation( @Nonnull ItemStack stack )
{
return res;
}
@ -519,7 +523,7 @@ private DiskColorHandler(ItemDiskLegacy disk)
}
@Override
public int getColorFromItemstack(ItemStack stack, int layer)
public int getColorFromItemstack( @Nonnull ItemStack stack, int layer)
{
return layer == 0 ? 0xFFFFFF : disk.getColor(stack);
}

View File

@ -24,6 +24,8 @@
import net.minecraft.util.math.BlockPos;
import org.lwjgl.opengl.GL11;
import javax.annotation.Nonnull;
public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMonitor>
{
public TileEntityMonitorRenderer()
@ -31,7 +33,7 @@ public TileEntityMonitorRenderer()
}
@Override
public void renderTileEntityAt( TileMonitor tileEntity, double posX, double posY, double posZ, float f, int i )
public void renderTileEntityAt( @Nonnull TileMonitor tileEntity, double posX, double posY, double posZ, float f, int i )
{
if( tileEntity != null )
{

View File

@ -41,6 +41,7 @@
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
import javax.annotation.Nonnull;
import javax.vecmath.Matrix4f;
import java.util.List;
@ -75,7 +76,7 @@ public TileEntityTurtleRenderer()
}
@Override
public void renderTileEntityAt( TileTurtle tileEntity, double posX, double posY, double posZ, float f, int i )
public void renderTileEntityAt( @Nonnull TileTurtle tileEntity, double posX, double posY, double posZ, float f, int i )
{
if( tileEntity != null )
{

View File

@ -10,6 +10,7 @@
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import javax.annotation.Nonnull;
import javax.vecmath.Matrix4f;
import javax.vecmath.Point3f;
import java.util.ArrayList;
@ -39,6 +40,7 @@ public TurtleMultiModel( IBakedModel baseModel, IBakedModel overlayModel, IBaked
m_faceQuads = new List[6];
}
@Nonnull
@Override
public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
{
@ -107,18 +109,21 @@ public boolean isBuiltInRenderer()
return m_baseModel.isBuiltInRenderer();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture()
{
return m_baseModel.getParticleTexture();
}
@Nonnull
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return m_baseModel.getItemCameraTransforms();
}
@Nonnull
@Override
public ItemOverrideList getOverrides()
{

View File

@ -30,6 +30,7 @@
import net.minecraftforge.client.model.ISmartVariant;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.vecmath.Matrix4f;
import java.util.ArrayList;
import java.util.HashMap;
@ -102,8 +103,9 @@ public TurtleSmartItemModel()
m_cachedModels = new HashMap<TurtleModelCombination, IBakedModel>();
m_overrides = new ItemOverrideList( new ArrayList<ItemOverride>() )
{
@Nonnull
@Override
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
public IBakedModel handleItemState( @Nonnull IBakedModel originalModel, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity)
{
ItemTurtleBase turtle = (ItemTurtleBase) stack.getItem();
ComputerFamily family = turtle.getFamily( stack );
@ -127,6 +129,7 @@ public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, W
};
}
@Nonnull
@Override
public ItemOverrideList getOverrides()
{
@ -134,7 +137,7 @@ public ItemOverrideList getOverrides()
}
@Override
public void onResourceManagerReload( IResourceManager resourceManager )
public void onResourceManagerReload( @Nonnull IResourceManager resourceManager )
{
m_cachedModels.clear();
}
@ -173,6 +176,7 @@ else if( overlayModel != null )
// These should not be called:
@Nonnull
@Override
public List<BakedQuad> getQuads( IBlockState state, EnumFacing facing, long rand )
{
@ -197,12 +201,14 @@ public boolean isBuiltInRenderer()
return getDefaultModel().isBuiltInRenderer();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture()
{
return getDefaultModel().getParticleTexture();
}
@Nonnull
@Override
public ItemCameraTransforms getItemCameraTransforms()
{

View File

@ -9,6 +9,8 @@
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import javax.annotation.Nonnull;
// Contributed by Nia
// Based on LuaBit (http://luaforge.net/projects/bit)
@ -68,6 +70,7 @@ public void shutdown( )
{
}
@Nonnull
@Override
public String[] getMethodNames() {
return new String[] {
@ -77,7 +80,7 @@ public String[] getMethodNames() {
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
Object a = args.length>0?args[0]:null;
Object b = args.length>1?args[1]:null;

View File

@ -11,6 +11,8 @@
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.core.terminal.TextBuffer;
import javax.annotation.Nonnull;
public class BufferAPI implements ILuaAPI
{
private static class BufferLuaObject implements ILuaObject
@ -22,6 +24,7 @@ public BufferLuaObject( TextBuffer buffer )
m_buffer = buffer;
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -35,7 +38,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException
{
switch( method )
{
@ -165,6 +168,7 @@ public void shutdown()
{
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -174,7 +178,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException
{
switch( method )
{

View File

@ -14,6 +14,7 @@
import dan200.computercraft.core.filesystem.IMountedFileBinary;
import dan200.computercraft.core.filesystem.IMountedFileNormal;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -54,6 +55,7 @@ public void shutdown( )
m_fileSystem = null;
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -78,7 +80,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{
@ -370,6 +372,7 @@ public Object[] callMethod( ILuaContext context, int method, Object[] args ) thr
private static Object[] wrapBufferedReader( final IMountedFileNormal reader )
{
return new Object[] { new ILuaObject() {
@Nonnull
@Override
public String[] getMethodNames()
{
@ -381,7 +384,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{
@ -439,6 +442,7 @@ public Object[] callMethod( ILuaContext context, int method, Object[] args ) thr
private static Object[] wrapBufferedWriter( final IMountedFileNormal writer )
{
return new Object[] { new ILuaObject() {
@Nonnull
@Override
public String[] getMethodNames()
{
@ -451,7 +455,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{
@ -521,6 +525,7 @@ private static Object[] wrapInputStream( final IMountedFileBinary reader )
return new Object[] { new ILuaObject() {
@Nonnull
@Override
public String[] getMethodNames() {
return new String[] {
@ -530,7 +535,7 @@ public String[] getMethodNames() {
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args) throws LuaException {
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args) throws LuaException {
switch( method )
{
case 0:
@ -572,6 +577,7 @@ private static Object[] wrapOutputStream( final IMountedFileBinary writer )
return new Object[] { new ILuaObject() {
@Nonnull
@Override
public String[] getMethodNames() {
return new String[] {
@ -582,7 +588,7 @@ public String[] getMethodNames() {
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args) throws LuaException {
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args) throws LuaException {
switch( method )
{
case 0:

View File

@ -10,6 +10,7 @@
import dan200.computercraft.api.lua.ILuaObject;
import dan200.computercraft.api.lua.LuaException;
import javax.annotation.Nonnull;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.*;
@ -72,6 +73,7 @@ public void advance( double _dt )
private static ILuaObject wrapBufferedReader( final BufferedReader reader, final int responseCode, final Map<String, String> responseHeaders )
{
return new ILuaObject() {
@Nonnull
@Override
public String[] getMethodNames()
{
@ -85,7 +87,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{
@ -164,6 +166,7 @@ public void shutdown( )
}
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -174,7 +177,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{

View File

@ -10,6 +10,7 @@
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.shared.util.StringUtil;
import javax.annotation.Nonnull;
import java.util.*;
public class OSAPI implements ILuaAPI
@ -47,7 +48,7 @@ public Alarm( double time, int day )
}
@Override
public int compareTo( Alarm o )
public int compareTo( @Nonnull Alarm o )
{
double t = (double)m_day * 24.0 + m_time;
double ot = (double)m_day * 24.0 + m_time;
@ -166,6 +167,7 @@ public void shutdown( )
}
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -216,7 +218,7 @@ private long getEpochForCalendar(Calendar c)
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{

View File

@ -18,6 +18,7 @@
import dan200.computercraft.core.filesystem.FileSystem;
import dan200.computercraft.core.filesystem.FileSystemException;
import javax.annotation.Nonnull;
import java.util.*;
public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChangeListener
@ -118,13 +119,13 @@ public Object[] call( ILuaContext context, String methodName, Object[] arguments
// IComputerAccess implementation
@Override
public String mount( String desiredLoc, IMount mount )
public String mount( @Nonnull String desiredLoc, @Nonnull IMount mount )
{
return mount( desiredLoc, mount, m_side );
}
@Override
public synchronized String mount( String desiredLoc, IMount mount, String driveName )
public synchronized String mount( @Nonnull String desiredLoc, @Nonnull IMount mount, @Nonnull String driveName )
{
if( !m_attached )
{
@ -153,13 +154,13 @@ public synchronized String mount( String desiredLoc, IMount mount, String driveN
}
@Override
public String mountWritable( String desiredLoc, IWritableMount mount )
public String mountWritable( @Nonnull String desiredLoc, @Nonnull IWritableMount mount )
{
return mountWritable( desiredLoc, mount, m_side );
}
@Override
public synchronized String mountWritable( String desiredLoc, IWritableMount mount, String driveName )
public synchronized String mountWritable( @Nonnull String desiredLoc, @Nonnull IWritableMount mount, @Nonnull String driveName )
{
if( !m_attached )
{
@ -215,7 +216,7 @@ public synchronized int getID()
}
@Override
public synchronized void queueEvent( final String event, final Object[] arguments )
public synchronized void queueEvent( @Nonnull final String event, final Object[] arguments )
{
if( !m_attached ) {
throw new RuntimeException( "You are not attached to this Computer" );
@ -223,6 +224,7 @@ public synchronized void queueEvent( final String event, final Object[] argument
m_environment.queueEvent( event, arguments );
}
@Nonnull
@Override
public synchronized String getAttachmentName()
{
@ -372,6 +374,7 @@ public void shutdown( )
}
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -384,7 +387,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException, InterruptedException
{
switch( method )
{

View File

@ -10,6 +10,7 @@
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.core.computer.Computer;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Map;
@ -45,6 +46,7 @@ public void shutdown( )
{
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -67,7 +69,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{

View File

@ -11,6 +11,8 @@
import dan200.computercraft.core.computer.IComputerEnvironment;
import dan200.computercraft.core.terminal.Terminal;
import javax.annotation.Nonnull;
public class TermAPI implements ILuaAPI
{
private Terminal m_terminal;
@ -45,6 +47,7 @@ public void shutdown( )
{
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -102,7 +105,7 @@ public static Object[] encodeColour( int colour ) throws LuaException
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{

View File

@ -8,6 +8,7 @@
import dan200.computercraft.api.filesystem.IMount;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@ -27,7 +28,7 @@ public ComboMount( IMount[] parts )
// IMount implementation
@Override
public boolean exists( String path ) throws IOException
public boolean exists( @Nonnull String path ) throws IOException
{
for( int i=m_parts.length-1; i>=0; --i )
{
@ -41,7 +42,7 @@ public boolean exists( String path ) throws IOException
}
@Override
public boolean isDirectory( String path ) throws IOException
public boolean isDirectory( @Nonnull String path ) throws IOException
{
for( int i=m_parts.length-1; i>=0; --i )
{
@ -55,7 +56,7 @@ public boolean isDirectory( String path ) throws IOException
}
@Override
public void list( String path, List<String> contents ) throws IOException
public void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException
{
// Combine the lists from all the mounts
List<String> foundFiles = null;
@ -99,7 +100,7 @@ else if( foundDirs > 1 )
}
@Override
public long getSize( String path ) throws IOException
public long getSize( @Nonnull String path ) throws IOException
{
for( int i=m_parts.length-1; i>=0; --i )
{
@ -112,8 +113,9 @@ public long getSize( String path ) throws IOException
throw new IOException( "No such file" );
}
@Nonnull
@Override
public InputStream openForRead( String path ) throws IOException
public InputStream openForRead( @Nonnull String path ) throws IOException
{
for( int i=m_parts.length-1; i>=0; --i )
{

View File

@ -8,6 +8,7 @@
import dan200.computercraft.api.filesystem.IMount;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@ -21,30 +22,31 @@ public EmptyMount()
// IMount implementation
@Override
public boolean exists( String path ) throws IOException
public boolean exists( @Nonnull String path ) throws IOException
{
return path.isEmpty();
}
@Override
public boolean isDirectory( String path ) throws IOException
public boolean isDirectory( @Nonnull String path ) throws IOException
{
return path.isEmpty();
}
@Override
public void list( String path, List<String> contents ) throws IOException
public void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException
{
}
@Override
public long getSize( String path ) throws IOException
public long getSize( @Nonnull String path ) throws IOException
{
return 0;
}
@Nonnull
@Override
public InputStream openForRead( String path ) throws IOException
public InputStream openForRead( @Nonnull String path ) throws IOException
{
return null;
}

View File

@ -8,6 +8,7 @@
import dan200.computercraft.api.filesystem.IWritableMount;
import javax.annotation.Nonnull;
import java.io.*;
import java.util.List;
@ -39,14 +40,14 @@ public void flush() throws IOException
}
@Override
public void write( byte[] b ) throws IOException
public void write( @Nonnull byte[] b ) throws IOException
{
count( b.length );
m_innerStream.write( b );
}
@Override
public void write( byte[] b, int off, int len ) throws IOException
public void write( @Nonnull byte[] b, int off, int len ) throws IOException
{
count( len );
m_innerStream.write( b, off, len );
@ -94,7 +95,7 @@ public FileMount( File rootPath, long capacity )
// IMount implementation
@Override
public boolean exists( String path ) throws IOException
public boolean exists( @Nonnull String path ) throws IOException
{
if( !created() )
{
@ -108,7 +109,7 @@ public boolean exists( String path ) throws IOException
}
@Override
public boolean isDirectory( String path ) throws IOException
public boolean isDirectory( @Nonnull String path ) throws IOException
{
if( !created() )
{
@ -122,7 +123,7 @@ public boolean isDirectory( String path ) throws IOException
}
@Override
public void list( String path, List<String> contents ) throws IOException
public void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException
{
if( !created() )
{
@ -153,7 +154,7 @@ public void list( String path, List<String> contents ) throws IOException
}
@Override
public long getSize( String path ) throws IOException
public long getSize( @Nonnull String path ) throws IOException
{
if( !created() )
{
@ -180,8 +181,9 @@ public long getSize( String path ) throws IOException
throw new IOException( "No such file" );
}
@Nonnull
@Override
public InputStream openForRead( String path ) throws IOException
public InputStream openForRead( @Nonnull String path ) throws IOException
{
if( created() )
{
@ -197,7 +199,7 @@ public InputStream openForRead( String path ) throws IOException
// IWritableMount implementation
@Override
public void makeDirectory( String path ) throws IOException
public void makeDirectory( @Nonnull String path ) throws IOException
{
create();
File file = getRealPath( path );
@ -236,7 +238,7 @@ public void makeDirectory( String path ) throws IOException
}
@Override
public void delete( String path ) throws IOException
public void delete( @Nonnull String path ) throws IOException
{
if( path.length() == 0 )
{
@ -278,8 +280,9 @@ private void deleteRecursively( File file ) throws IOException
}
}
@Nonnull
@Override
public OutputStream openForWrite( String path ) throws IOException
public OutputStream openForWrite( @Nonnull String path ) throws IOException
{
create();
File file = getRealPath( path );
@ -309,8 +312,9 @@ public OutputStream openForWrite( String path ) throws IOException
}
}
@Nonnull
@Override
public OutputStream openForAppend( String path ) throws IOException
public OutputStream openForAppend( @Nonnull String path ) throws IOException
{
if( created() )
{

View File

@ -8,6 +8,7 @@
import dan200.computercraft.api.filesystem.IMount;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@ -178,14 +179,14 @@ public JarMount( File jarFile, String subPath ) throws IOException
// IMount implementation
@Override
public boolean exists( String path ) throws IOException
public boolean exists( @Nonnull String path ) throws IOException
{
FileInZip file = m_root.getFile( path );
return file != null;
}
@Override
public boolean isDirectory( String path ) throws IOException
public boolean isDirectory( @Nonnull String path ) throws IOException
{
FileInZip file = m_root.getFile( path );
if( file != null )
@ -196,7 +197,7 @@ public boolean isDirectory( String path ) throws IOException
}
@Override
public void list( String path, List<String> contents ) throws IOException
public void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException
{
FileInZip file = m_root.getFile( path );
if( file != null && file.isDirectory() )
@ -210,7 +211,7 @@ public void list( String path, List<String> contents ) throws IOException
}
@Override
public long getSize( String path ) throws IOException
public long getSize( @Nonnull String path ) throws IOException
{
FileInZip file = m_root.getFile( path );
if( file != null )
@ -220,8 +221,9 @@ public long getSize( String path ) throws IOException
throw new IOException( "No such file" );
}
@Nonnull
@Override
public InputStream openForRead( String path ) throws IOException
public InputStream openForRead( @Nonnull String path ) throws IOException
{
FileInZip file = m_root.getFile( path );
if( file != null && !file.isDirectory() )

View File

@ -8,6 +8,7 @@
import dan200.computercraft.api.filesystem.IMount;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@ -26,31 +27,32 @@ public SubMount( IMount parent, String subPath )
// IMount implementation
@Override
public boolean exists( String path ) throws IOException
public boolean exists( @Nonnull String path ) throws IOException
{
return m_parent.exists( getFullPath( path ) );
}
@Override
public boolean isDirectory( String path ) throws IOException
public boolean isDirectory( @Nonnull String path ) throws IOException
{
return m_parent.isDirectory( getFullPath( path ) );
}
@Override
public void list( String path, List<String> contents ) throws IOException
public void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException
{
m_parent.list( getFullPath( path ), contents );
}
@Override
public long getSize( String path ) throws IOException
public long getSize( @Nonnull String path ) throws IOException
{
return m_parent.getSize( getFullPath( path ) );
}
@Nonnull
@Override
public InputStream openForRead( String path ) throws IOException
public InputStream openForRead( @Nonnull String path ) throws IOException
{
return m_parent.openForRead( getFullPath( path ) );
}

View File

@ -21,6 +21,7 @@
import org.luaj.vm2.lib.ZeroArgFunction;
import org.luaj.vm2.lib.jse.JsePlatform;
import javax.annotation.Nonnull;
import java.io.*;
import java.util.HashMap;
import java.util.IdentityHashMap;
@ -339,6 +340,7 @@ public Varargs invoke( Varargs _args )
try
{
results = apiObject.callMethod( new ILuaContext() {
@Nonnull
@Override
public Object[] pullEvent( String filter ) throws LuaException, InterruptedException
{
@ -350,12 +352,14 @@ public Object[] pullEvent( String filter ) throws LuaException, InterruptedExcep
return results;
}
@Nonnull
@Override
public Object[] pullEventRaw( String filter ) throws InterruptedException
{
return yield( new Object[] { filter } );
}
@Nonnull
@Override
public Object[] yield( Object[] yieldArgs ) throws InterruptedException
{
@ -372,7 +376,7 @@ public Object[] yield( Object[] yieldArgs ) throws InterruptedException
}
@Override
public long issueMainThreadTask( final ILuaTask task ) throws LuaException
public long issueMainThreadTask( @Nonnull final ILuaTask task ) throws LuaException
{
// Issue command
final long taskID = MainThread.getUniqueTaskID();
@ -431,7 +435,7 @@ public void execute()
}
@Override
public Object[] executeMainThreadTask( final ILuaTask task ) throws LuaException, InterruptedException
public Object[] executeMainThreadTask( @Nonnull final ILuaTask task ) throws LuaException, InterruptedException
{
// Issue task
final long taskID = issueMainThreadTask( task );

View File

@ -25,6 +25,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -43,12 +44,13 @@ protected BlockGeneric( Material material )
protected abstract TileGeneric createTile( int damage );
@Override
public final void dropBlockAsItemWithChance( World world, BlockPos pos, IBlockState state, float chance, int fortune )
public final void dropBlockAsItemWithChance( World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, float chance, int fortune )
{
}
@Nonnull
@Override
public final List<ItemStack> getDrops( IBlockAccess world, BlockPos pos, IBlockState state, int fortune )
public final List<ItemStack> getDrops( IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune )
{
ArrayList<ItemStack> drops = new ArrayList<ItemStack>( 1 );
TileEntity tile = world.getTileEntity( pos );
@ -60,6 +62,7 @@ public final List<ItemStack> getDrops( IBlockAccess world, BlockPos pos, IBlockS
return drops;
}
@Nonnull
@Override
public final IBlockState onBlockPlaced( World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int damage, EntityLivingBase placer )
{
@ -67,7 +70,7 @@ public final IBlockState onBlockPlaced( World world, BlockPos pos, EnumFacing si
}
@Override
public final boolean removedByPlayer( IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest )
public final boolean removedByPlayer( @Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest )
{
if( !world.isRemote )
{
@ -109,7 +112,7 @@ public final void dropItem( World world, BlockPos pos, ItemStack stack )
}
@Override
public final void breakBlock( World world, BlockPos pos, IBlockState newState )
public final void breakBlock( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState newState )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileGeneric )
@ -121,8 +124,9 @@ public final void breakBlock( World world, BlockPos pos, IBlockState newState )
world.removeTileEntity( pos );
}
@Nonnull
@Override
public final ItemStack getPickBlock( IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player )
public final ItemStack getPickBlock( @Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileGeneric )
@ -134,7 +138,7 @@ public final ItemStack getPickBlock( IBlockState state, RayTraceResult target, W
}
@Override
protected final ItemStack createStackedBlock( IBlockState state )
protected final ItemStack createStackedBlock( @Nonnull IBlockState state )
{
return null;
}
@ -174,7 +178,7 @@ public final void onNeighborChange( IBlockAccess world, BlockPos pos, BlockPos n
}
@Override
public final boolean isSideSolid( IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side )
public final boolean isSideSolid( IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileGeneric )
@ -192,7 +196,7 @@ public final boolean canBeReplacedByLeaves( IBlockState state, IBlockAccess worl
}
@Override
public float getExplosionResistance( World world, BlockPos pos, Entity exploder, Explosion explosion )
public float getExplosionResistance( World world, BlockPos pos, @Nonnull Entity exploder, Explosion explosion )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileGeneric && tile.hasWorldObj() )
@ -206,6 +210,7 @@ public float getExplosionResistance( World world, BlockPos pos, Entity exploder,
return super.getExplosionResistance( exploder );
}
@Nonnull
@Override
public final AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess world, BlockPos pos )
{
@ -218,14 +223,15 @@ public final AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess world
return FULL_BLOCK_AABB;
}
@Nonnull
@Override
public AxisAlignedBB getSelectedBoundingBox( IBlockState state, World worldIn, BlockPos pos )
public final AxisAlignedBB getSelectedBoundingBox( IBlockState state, @Nonnull World world, @Nonnull BlockPos pos )
{
return getBoundingBox( state, worldIn, pos ).offset( pos );
return getBoundingBox( state, world, pos ).offset( pos );
}
@Override
public final AxisAlignedBB getCollisionBoundingBox( IBlockState state, World world, BlockPos pos )
public final AxisAlignedBB getCollisionBoundingBox( IBlockState state, @Nonnull World world, @Nonnull BlockPos pos )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileGeneric && tile.hasWorldObj() )
@ -252,7 +258,7 @@ public final AxisAlignedBB getCollisionBoundingBox( IBlockState state, World wor
}
@Override
public final void addCollisionBoxToList( IBlockState state, World world, BlockPos pos, AxisAlignedBB bigBox, List<AxisAlignedBB> list, Entity entity )
public final void addCollisionBoxToList( IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB bigBox, @Nonnull List<AxisAlignedBB> list, Entity entity )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileGeneric && tile.hasWorldObj() )
@ -349,14 +355,16 @@ public boolean eventReceived( IBlockState state, World world, BlockPos pos, int
return true;
}
@Nonnull
@Override
public final TileEntity createTileEntity( World world, IBlockState state )
public final TileEntity createTileEntity( @Nonnull World world, @Nonnull IBlockState state )
{
return createTile( state );
}
@Nonnull
@Override
public final TileEntity createNewTileEntity( World world, int damage )
public final TileEntity createNewTileEntity( @Nonnull World world, int damage )
{
return createTile( damage );
}

View File

@ -12,6 +12,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class DefaultBundledRedstoneProvider implements IBundledRedstoneProvider
{
public DefaultBundledRedstoneProvider()
@ -19,7 +21,7 @@ public DefaultBundledRedstoneProvider()
}
@Override
public int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacing side )
public int getBundledRedstoneOutput( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side )
{
return getDefaultBundledRedstoneOutput( world, pos, side );
}

View File

@ -23,6 +23,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public abstract class TileGeneric extends TileEntity
@ -48,6 +50,7 @@ public void destroy()
{
}
@Nullable
public BlockGeneric getBlock()
{
Block block = worldObj.getBlockState( getPos() ).getBlock();
@ -77,7 +80,7 @@ protected final void setBlockState( IBlockState newState )
worldObj.setBlockState( getPos(), newState, 3 );
}
public void getDroppedItems( List<ItemStack> drops, boolean creative )
public void getDroppedItems( @Nonnull List<ItemStack> drops, boolean creative )
{
}
@ -95,7 +98,7 @@ public void onNeighbourChange()
{
}
public void onNeighbourTileEntityChange( BlockPos neighbour )
public void onNeighbourTileEntityChange( @Nonnull BlockPos neighbour )
{
}
@ -109,12 +112,13 @@ public boolean isImmuneToExplosion( Entity exploder )
return false;
}
@Nonnull
public AxisAlignedBB getBounds()
{
return new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 );
}
public void getCollisionBounds( List<AxisAlignedBB> bounds )
public void getCollisionBounds( @Nonnull List<AxisAlignedBB> bounds )
{
bounds.add( getBounds() );
}
@ -129,12 +133,12 @@ public int getRedstoneOutput( EnumFacing side )
return 0;
}
public boolean getBundledRedstoneConnectivity( EnumFacing side )
public boolean getBundledRedstoneConnectivity( @Nonnull EnumFacing side )
{
return false;
}
public int getBundledRedstoneOutput( EnumFacing side )
public int getBundledRedstoneOutput( @Nonnull EnumFacing side )
{
return 0;
}
@ -163,11 +167,11 @@ public boolean isUsable( EntityPlayer player, boolean ignoreRange )
return false;
}
protected void writeDescription( NBTTagCompound nbttagcompound )
protected void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
{
}
protected void readDescription( NBTTagCompound nbttagcompound )
protected void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
}
@ -186,7 +190,7 @@ public void onBlockEvent( int eventID, int eventParameter )
}
@Override
public boolean shouldRefresh( World world, BlockPos pos, IBlockState oldState, IBlockState newState )
public boolean shouldRefresh( World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState )
{
return newState.getBlock() != oldState.getBlock();
}
@ -215,6 +219,7 @@ public final void onDataPacket( NetworkManager net, SPacketUpdateTileEntity pack
}
}
@Nonnull
@Override
public NBTTagCompound getUpdateTag ()
{
@ -224,7 +229,7 @@ public NBTTagCompound getUpdateTag ()
}
@Override
public void handleUpdateTag (NBTTagCompound tag)
public void handleUpdateTag ( @Nonnull NBTTagCompound tag)
{
super.handleUpdateTag(tag);
readDescription( tag );

View File

@ -24,6 +24,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Map;
@ -61,6 +62,7 @@ public void shutdown()
{
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -139,7 +141,7 @@ private Object getBlockInfo( World world, BlockPos pos )
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException
{
switch( method )
{

View File

@ -25,6 +25,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockCommandComputer extends BlockComputerBase
{
// Statics
@ -50,6 +52,7 @@ public BlockCommandComputer()
);
}
@Nonnull
@Override
protected BlockStateContainer createBlockState()
{
@ -59,6 +62,7 @@ protected BlockStateContainer createBlockState()
});
}
@Nonnull
@Override
public IBlockState getStateFromMeta( int meta )
{
@ -76,8 +80,9 @@ public int getMetaFromState( IBlockState state )
return ((EnumFacing)state.getValue( Properties.FACING )).getIndex();
}
@Nonnull
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
public IBlockState getActualState( @Nonnull IBlockState state, IBlockAccess world, BlockPos pos )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof IComputerTile )

View File

@ -27,6 +27,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockComputer extends BlockComputerBase
{
// Statics
@ -52,6 +54,7 @@ public BlockComputer()
);
}
@Nonnull
@Override
protected BlockStateContainer createBlockState()
{
@ -62,6 +65,7 @@ protected BlockStateContainer createBlockState()
});
}
@Nonnull
@Override
public IBlockState getStateFromMeta( int meta )
{
@ -117,8 +121,9 @@ protected IBlockState getDefaultBlockState( ComputerFamily family, EnumFacing pl
}
}
@Nonnull
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
public IBlockState getActualState( @Nonnull IBlockState state, IBlockAccess world, BlockPos pos )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof IComputerTile )

View File

@ -12,6 +12,8 @@
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.shared.computer.core.ServerComputer;
import javax.annotation.Nonnull;
public class ComputerPeripheral
implements IPeripheral
{
@ -26,12 +28,14 @@ public ComputerPeripheral( String type, ServerComputer computer )
// IPeripheral implementation
@Nonnull
@Override
public String getType()
{
return m_type;
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -45,7 +49,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException
{
switch( method )
{
@ -87,12 +91,12 @@ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int m
}
@Override
public void attach( IComputerAccess computer )
public void attach( @Nonnull IComputerAccess computer )
{
}
@Override
public void detach( IComputerAccess computer )
public void detach( @Nonnull IComputerAccess computer )
{
}

View File

@ -8,6 +8,8 @@
import net.minecraft.util.IStringSerializable;
import javax.annotation.Nonnull;
public enum ComputerState implements IStringSerializable
{
Off( "off" ),
@ -21,6 +23,7 @@ private ComputerState( String name )
m_name = name;
}
@Nonnull
@Override
public String getName()
{

View File

@ -21,6 +21,7 @@
import net.minecraft.util.*;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
@ -53,6 +54,7 @@ public Map<Integer, String> copyOutput()
// ICommandSender
@Nonnull
@Override
public ITextComponent getDisplayName()
{
@ -69,7 +71,7 @@ public ITextComponent getDisplayName()
}
@Override
public void addChatMessage( ITextComponent chatComponent )
public void addChatMessage( @Nonnull ITextComponent chatComponent )
{
m_outputTable.put( m_outputTable.size() + 1, chatComponent.getUnformattedText() );
}
@ -80,12 +82,14 @@ public boolean canCommandSenderUseCommand( int level, String command )
return level <= 2;
}
@Nonnull
@Override
public BlockPos getPosition()
{
return TileCommandComputer.this.getPos();
}
@Nonnull
@Override
public Vec3d getPositionVector()
{
@ -93,6 +97,7 @@ public Vec3d getPositionVector()
return new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 );
}
@Nonnull
@Override
public World getEntityWorld()
{
@ -126,7 +131,7 @@ public int getCommandBlockType()
}
@Override
public void fillInInfo( ByteBuf buf )
public void fillInInfo( @Nonnull ByteBuf buf )
{
}
}

View File

@ -17,6 +17,7 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import javax.annotation.Nonnull;
import java.util.List;
public class TileComputer extends TileComputerBase
@ -47,7 +48,7 @@ protected ServerComputer createComputer( int instanceID, int id )
}
@Override
public void getDroppedItems( List<ItemStack> drops, boolean creative )
public void getDroppedItems( @Nonnull List<ItemStack> drops, boolean creative )
{
IComputer computer = getComputer();
if( !creative || (computer != null && computer.getLabel() != null) )
@ -69,7 +70,7 @@ public void openGUI( EntityPlayer player )
}
@Override
public final void readDescription( NBTTagCompound nbttagcompound )
public final void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
updateBlock();

View File

@ -27,6 +27,8 @@
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nonnull;
public abstract class TileComputerBase extends TileGeneric
implements IComputerTile, IDirectionalTile, ITickable
{
@ -167,14 +169,14 @@ public int getRedstoneOutput( EnumFacing side )
}
@Override
public boolean getBundledRedstoneConnectivity( EnumFacing side )
public boolean getBundledRedstoneConnectivity( @Nonnull EnumFacing side )
{
int localDir = remapLocalSide( DirectionUtil.toLocal( this, side ) );
return !isRedstoneBlockedOnSide( localDir );
}
@Override
public int getBundledRedstoneOutput( EnumFacing side )
public int getBundledRedstoneOutput( @Nonnull EnumFacing side )
{
int localDir = remapLocalSide( DirectionUtil.toLocal( this, side ) );
if( !isRedstoneBlockedOnSide( localDir ) )
@ -198,7 +200,7 @@ public void onNeighbourChange()
}
@Override
public void onNeighbourTileEntityChange( BlockPos neighbour )
public void onNeighbourTileEntityChange( @Nonnull BlockPos neighbour )
{
updateInput( neighbour );
}
@ -239,6 +241,7 @@ public void update()
}
}
@Nonnull
@Override
public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
{
@ -517,14 +520,14 @@ public ClientComputer getClientComputer()
// Networking stuff
@Override
public void writeDescription( NBTTagCompound nbttagcompound )
public void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.writeDescription( nbttagcompound );
nbttagcompound.setInteger( "instanceID", createServerComputer().getInstanceID() );
}
@Override
public void readDescription( NBTTagCompound nbttagcompound )
public void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
m_instanceID = nbttagcompound.getInteger( "instanceID" );

View File

@ -12,6 +12,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ContainerComputer extends Container
@ -25,7 +26,7 @@ public ContainerComputer( TileComputer computer )
}
@Override
public boolean canInteractWith( EntityPlayer player )
public boolean canInteractWith( @Nonnull EntityPlayer player )
{
return m_computer.isUseableByPlayer( player );
}

View File

@ -14,6 +14,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemCommandComputer extends ItemComputer
@ -51,7 +52,7 @@ public ItemStack create( int id, String label, ComputerFamily family )
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
{
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Command ) );
}

View File

@ -21,6 +21,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemComputer extends ItemComputerBase
@ -71,14 +72,14 @@ public ItemStack create( int id, String label, ComputerFamily family )
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
{
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Normal ) );
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Advanced ) );
}
@Override
public boolean placeBlockAt( ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState )
public boolean placeBlockAt( @Nonnull ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull IBlockState newState )
{
if( super.placeBlockAt( stack, player, world, pos, side, hitX, hitY, hitZ, newState ) )
{
@ -110,6 +111,7 @@ private void setupComputerAfterPlacement( ItemStack stack, IComputerTile compute
}
}
@Nonnull
@Override
public String getUnlocalizedName( ItemStack stack )
{

View File

@ -18,6 +18,7 @@
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.List;
public abstract class ItemComputerBase extends ItemBlock implements IComputerItem, IMedia
@ -36,7 +37,7 @@ public final int getMetadata( int damage )
}
@Override
public void addInformation( ItemStack stack, EntityPlayer player, List list, boolean debug )
public void addInformation( @Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull List list, boolean debug )
{
if( debug )
{
@ -54,7 +55,7 @@ public void addInformation( ItemStack stack, EntityPlayer player, List list, boo
public abstract int getComputerID( ItemStack stack );
@Override
public String getLabel( ItemStack stack )
public String getLabel( @Nonnull ItemStack stack )
{
if( stack.hasDisplayName() )
{
@ -73,7 +74,7 @@ public final ComputerFamily getFamily( ItemStack stack )
// IMedia implementation
@Override
public boolean setLabel( ItemStack stack, String label )
public boolean setLabel( @Nonnull ItemStack stack, String label )
{
if( label != null )
{
@ -87,19 +88,19 @@ public boolean setLabel( ItemStack stack, String label )
}
@Override
public String getAudioTitle( ItemStack stack )
public String getAudioTitle( @Nonnull ItemStack stack )
{
return null;
}
@Override
public SoundEvent getAudio( ItemStack stack )
public SoundEvent getAudio( @Nonnull ItemStack stack )
{
return null;
}
@Override
public IMount createDataMount( ItemStack stack, World world )
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{
ComputerFamily family = getFamily( stack );
if( family != ComputerFamily.Command )

View File

@ -7,6 +7,8 @@
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class DefaultMediaProvider implements IMediaProvider
{
public DefaultMediaProvider()
@ -14,7 +16,7 @@ public DefaultMediaProvider()
}
@Override
public IMedia getMedia( ItemStack stack )
public IMedia getMedia( @Nonnull ItemStack stack )
{
Item item = stack.getItem();
if( item instanceof IMedia )

View File

@ -12,6 +12,8 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import javax.annotation.Nonnull;
public class ContainerHeldItem extends Container
{
private final ItemStack m_stack;
@ -29,7 +31,7 @@ public ItemStack getStack()
}
@Override
public boolean canInteractWith( EntityPlayer player )
public boolean canInteractWith( @Nonnull EntityPlayer player )
{
if( player != null && player.isEntityAlive() )
{

View File

@ -20,6 +20,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemDiskLegacy extends Item
@ -34,7 +35,7 @@ public ItemDiskLegacy()
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
{
for( int colour=0; colour<16; ++colour )
{
@ -94,7 +95,7 @@ public void addInformation( ItemStack stack, EntityPlayer player, List list, boo
// IMedia implementation
@Override
public String getLabel( ItemStack stack )
public String getLabel( @Nonnull ItemStack stack )
{
if( stack.hasDisplayName() )
{
@ -104,7 +105,7 @@ public String getLabel( ItemStack stack )
}
@Override
public boolean setLabel( ItemStack stack, String label )
public boolean setLabel( @Nonnull ItemStack stack, String label )
{
if( label != null )
{
@ -118,19 +119,19 @@ public boolean setLabel( ItemStack stack, String label )
}
@Override
public String getAudioTitle( ItemStack stack )
public String getAudioTitle( @Nonnull ItemStack stack )
{
return null;
}
@Override
public SoundEvent getAudio( ItemStack stack )
public SoundEvent getAudio( @Nonnull ItemStack stack )
{
return null;
}
@Override
public IMount createDataMount( ItemStack stack, World world )
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{
int diskID = getDiskID( stack );
if( diskID < 0 )

View File

@ -17,6 +17,7 @@
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemPrintout extends Item
@ -41,7 +42,7 @@ public ItemPrintout()
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
{
list.add( createSingleFromTitleAndText( null, new String[ LINES_PER_PAGE ], new String[ LINES_PER_PAGE ] ) );
list.add( createMultipleFromTitleAndText( null, new String[ 2*LINES_PER_PAGE ], new String[ 2*LINES_PER_PAGE ] ) );
@ -58,6 +59,7 @@ public void addInformation( ItemStack itemstack, EntityPlayer par2EntityPlayer,
}
}
@Nonnull
@Override
public String getUnlocalizedName( ItemStack stack )
{
@ -80,8 +82,9 @@ public String getUnlocalizedName( ItemStack stack )
}
}
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick( ItemStack stack, World world, EntityPlayer player, EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( @Nonnull ItemStack stack, World world, EntityPlayer player, EnumHand hand )
{
if( !world.isRemote )
{

View File

@ -21,6 +21,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@ -38,7 +39,7 @@ public ItemTreasureDisk()
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
{
}
@ -61,31 +62,31 @@ public boolean doesSneakBypassUse( ItemStack stack, IBlockAccess world, BlockPos
// IMedia implementation
@Override
public String getLabel( ItemStack stack )
public String getLabel( @Nonnull ItemStack stack )
{
return getTitle( stack );
}
@Override
public boolean setLabel( ItemStack stack, String label )
public boolean setLabel( @Nonnull ItemStack stack, String label )
{
return false;
}
@Override
public String getAudioTitle( ItemStack stack )
public String getAudioTitle( @Nonnull ItemStack stack )
{
return null;
}
@Override
public SoundEvent getAudio( ItemStack stack )
public SoundEvent getAudio( @Nonnull ItemStack stack )
{
return null;
}
@Override
public IMount createDataMount( ItemStack stack, World world )
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{
IMount rootTreasure = getTreasureMount();
String subPath = getSubPath( stack );

View File

@ -15,6 +15,8 @@
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import javax.annotation.Nonnull;
// An implementation of IMedia for ItemRecord's
public class RecordMedia implements IMedia
{
@ -23,32 +25,32 @@ public RecordMedia()
}
@Override
public String getLabel( ItemStack stack )
public String getLabel( @Nonnull ItemStack stack )
{
return getAudioTitle( stack );
}
@Override
public boolean setLabel( ItemStack stack, String label )
public boolean setLabel( @Nonnull ItemStack stack, String label )
{
return false;
}
@Override
public String getAudioTitle( ItemStack stack )
public String getAudioTitle( @Nonnull ItemStack stack )
{
return ComputerCraft.getRecordInfo( stack );
}
@Override
public SoundEvent getAudio( ItemStack stack )
public SoundEvent getAudio( @Nonnull ItemStack stack )
{
ItemRecord itemRecord = (ItemRecord)stack.getItem();
return ObfuscationReflectionHelper.getPrivateValue(ItemRecord.class, itemRecord, "field_185076_b");
}
@Override
public IMount createDataMount( ItemStack stack, World world )
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{
return null;
}

View File

@ -14,6 +14,8 @@
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class DiskRecipe implements IRecipe
{
public DiskRecipe()
@ -21,7 +23,7 @@ public DiskRecipe()
}
@Override
public boolean matches( InventoryCrafting inventory, World world )
public boolean matches( @Nonnull InventoryCrafting inventory, @Nonnull World world )
{
boolean diskFound = false;
boolean paperFound = false;
@ -75,7 +77,7 @@ else if (var6.getItem() == Items.REDSTONE)
}
@Override
public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting)
public ItemStack getCraftingResult( @Nonnull InventoryCrafting par1InventoryCrafting)
{
int diskID = -1;
String diskLabel = null;
@ -153,8 +155,9 @@ public ItemStack getRecipeOutput()
return ItemDiskLegacy.createFromIDAndColour( -1, null, Colour.Blue.getHex() );
}
@Nonnull
@Override
public ItemStack[] getRemainingItems( InventoryCrafting inventoryCrafting )
public ItemStack[] getRemainingItems( @Nonnull InventoryCrafting inventoryCrafting )
{
ItemStack[] results = new ItemStack[ inventoryCrafting.getSizeInventory() ];
for (int i = 0; i < results.length; ++i)

View File

@ -14,6 +14,8 @@
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class PrintoutRecipe implements IRecipe
{
public PrintoutRecipe( )
@ -33,13 +35,13 @@ public ItemStack getRecipeOutput()
}
@Override
public boolean matches( InventoryCrafting _inventory, World world )
public boolean matches( @Nonnull InventoryCrafting _inventory, @Nonnull World world )
{
return (getCraftingResult( _inventory ) != null);
}
@Override
public ItemStack getCraftingResult( InventoryCrafting inventory )
public ItemStack getCraftingResult( @Nonnull InventoryCrafting inventory )
{
// See if we match the recipe, and extract the input disk ID and dye colour
int numPages = 0;
@ -146,8 +148,9 @@ else if( item == Items.LEATHER && !leatherFound )
return null;
}
@Nonnull
@Override
public ItemStack[] getRemainingItems( InventoryCrafting inventoryCrafting )
public ItemStack[] getRemainingItems( @Nonnull InventoryCrafting inventoryCrafting )
{
ItemStack[] results = new ItemStack[ inventoryCrafting.getSizeInventory() ];
for (int i = 0; i < results.length; ++i)

View File

@ -8,6 +8,8 @@
import net.minecraft.util.IStringSerializable;
import javax.annotation.Nonnull;
public enum PeripheralType implements IStringSerializable
{
DiskDrive( "disk_drive" ),
@ -27,6 +29,7 @@ private PeripheralType( String name )
m_name = name;
}
@Nonnull
@Override
public String getName()
{

View File

@ -14,6 +14,8 @@
import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nonnull;
public class CommandBlockPeripheral implements IPeripheral
{
private final TileEntityCommandBlock m_commandBlock;
@ -25,12 +27,14 @@ public CommandBlockPeripheral( TileEntityCommandBlock commandBlock )
// IPeripheral methods
@Nonnull
@Override
public String getType()
{
return "command";
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -42,7 +46,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, final Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull final Object[] arguments ) throws LuaException, InterruptedException
{
switch (method)
{
@ -108,12 +112,12 @@ public Object[] execute() throws LuaException
}
@Override
public void attach( IComputerAccess computer )
public void attach( @Nonnull IComputerAccess computer )
{
}
@Override
public void detach( IComputerAccess computer )
public void detach( @Nonnull IComputerAccess computer )
{
}

View File

@ -14,10 +14,12 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class CommandBlockPeripheralProvider implements IPeripheralProvider
{
@Override
public IPeripheral getPeripheral( World world, BlockPos pos, EnumFacing side )
public IPeripheral getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null && tile instanceof TileEntityCommandBlock )

View File

@ -21,6 +21,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import javax.annotation.Nonnull;
public class BlockCable extends BlockPeripheralBase
{
// Statics
@ -73,6 +75,7 @@ public BlockCable()
);
}
@Nonnull
@Override
protected BlockStateContainer createBlockState()
{
@ -88,6 +91,7 @@ protected BlockStateContainer createBlockState()
});
}
@Nonnull
@Override
public IBlockState getStateFromMeta( int meta )
{
@ -174,8 +178,9 @@ else if( ((BlockCableModemVariant)state.getValue( Properties.MODEM )).getFacing(
}
}
@Nonnull
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
public IBlockState getActualState( @Nonnull IBlockState state, IBlockAccess world, BlockPos pos )
{
state = state.withProperty( Properties.NORTH, doesConnect( state, world, pos, EnumFacing.NORTH ) );
state = state.withProperty( Properties.SOUTH, doesConnect( state, world, pos, EnumFacing.SOUTH ) );
@ -209,7 +214,7 @@ public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockP
}
@Override
public boolean shouldSideBeRendered( IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side )
public boolean shouldSideBeRendered( IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side )
{
return true;
}

View File

@ -9,6 +9,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import javax.annotation.Nonnull;
public enum BlockCableModemVariant implements IStringSerializable
{
None( "none", null ),
@ -60,6 +62,7 @@ private BlockCableModemVariant( String name, EnumFacing facing )
m_facing = facing;
}
@Nonnull
@Override
public String getName()
{

View File

@ -30,6 +30,8 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockPeripheral extends BlockPeripheralBase
{
public static class Properties
@ -49,12 +51,14 @@ public BlockPeripheral()
);
}
@Nonnull
@SideOnly( Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Nonnull
@Override
protected BlockStateContainer createBlockState()
{
@ -64,6 +68,7 @@ protected BlockStateContainer createBlockState()
});
}
@Nonnull
@Override
public IBlockState getStateFromMeta( int meta )
{
@ -166,8 +171,9 @@ public int getMetaFromState( IBlockState state )
return meta;
}
@Nonnull
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
public IBlockState getActualState( @Nonnull IBlockState state, IBlockAccess world, BlockPos pos )
{
int anim;
EnumFacing dir;

View File

@ -17,6 +17,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public abstract class BlockPeripheralBase extends BlockDirectional
{
public BlockPeripheralBase()
@ -42,7 +44,7 @@ public final boolean isFullCube( IBlockState state )
}
@Override
public final boolean canPlaceBlockOnSide( World world, BlockPos pos, EnumFacing side )
public final boolean canPlaceBlockOnSide( @Nonnull World world, @Nonnull BlockPos pos, EnumFacing side )
{
return true; // ItemPeripheralBase handles this
}

View File

@ -9,6 +9,8 @@
import dan200.computercraft.shared.peripheral.PeripheralType;
import net.minecraft.util.IStringSerializable;
import javax.annotation.Nonnull;
public enum BlockPeripheralVariant implements IStringSerializable
{
DiskDriveEmpty( "disk_drive_empty", PeripheralType.DiskDrive ),
@ -130,6 +132,7 @@ private BlockPeripheralVariant( String name, PeripheralType peripheralType )
m_peripheralType = peripheralType;
}
@Nonnull
@Override
public String getName()
{

View File

@ -16,6 +16,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class DefaultPeripheralProvider implements IPeripheralProvider
{
public DefaultPeripheralProvider()
@ -23,7 +25,7 @@ public DefaultPeripheralProvider()
}
@Override
public IPeripheral getPeripheral( World world, BlockPos pos, EnumFacing side )
public IPeripheral getPeripheral( @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side )
{
TileEntity tile = world.getTileEntity( pos );
if( tile != null )

View File

@ -13,6 +13,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemAdvancedModem extends ItemPeripheralBase
@ -48,7 +49,7 @@ public ItemStack create( PeripheralType type, String label, int quantity )
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
{
list.add( PeripheralItemFactory.create( PeripheralType.AdvancedModem, null, 1 ) );
}

View File

@ -24,6 +24,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemCable extends ItemPeripheralBase
@ -63,14 +64,15 @@ public ItemStack create( PeripheralType type, String label, int quantity )
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
{
list.add( PeripheralItemFactory.create( PeripheralType.WiredModem, null, 1 ) );
list.add( PeripheralItemFactory.create( PeripheralType.Cable, null, 1 ) );
}
@Nonnull
@Override
public EnumActionResult onItemUse( ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float fx, float fy, float fz )
public EnumActionResult onItemUse( ItemStack stack, @Nonnull EntityPlayer player, World world, @Nonnull BlockPos pos, EnumHand hand, @Nonnull EnumFacing side, float fx, float fy, float fz )
{
if( !canPlaceBlockOnSide( world, pos, side, player, stack ) )
{

View File

@ -13,6 +13,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemPeripheral extends ItemPeripheralBase
@ -68,7 +69,7 @@ public ItemStack create( PeripheralType type, String label, int quantity )
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
{
list.add( PeripheralItemFactory.create( PeripheralType.DiskDrive, null, 1 ) );
list.add( PeripheralItemFactory.create( PeripheralType.Printer, null, 1 ) );

View File

@ -15,6 +15,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public abstract class ItemPeripheralBase extends ItemBlock implements IPeripheralItem
{
protected ItemPeripheralBase( Block block )
@ -33,7 +35,7 @@ public final int getMetadata( int damage )
}
@Override
public boolean canPlaceBlockOnSide( World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack ) // canPlaceItemBlockOnSide
public boolean canPlaceBlockOnSide( World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, EntityPlayer player, @Nonnull ItemStack stack ) // canPlaceItemBlockOnSide
{
PeripheralType type = getPeripheralType( stack );
switch( type )
@ -55,6 +57,7 @@ public boolean canPlaceBlockOnSide( World world, BlockPos pos, EnumFacing side,
}
}
@Nonnull
@Override
public String getUnlocalizedName( ItemStack stack )
{

View File

@ -15,6 +15,7 @@
import net.minecraft.util.ITickable;
import net.minecraft.util.EnumFacing;
import javax.annotation.Nonnull;
import java.util.List;
public abstract class TilePeripheralBase extends TileGeneric
@ -45,7 +46,7 @@ public BlockPeripheralBase getBlock()
}
@Override
public void getDroppedItems( List<ItemStack> drops, boolean creative )
public void getDroppedItems( @Nonnull List<ItemStack> drops, boolean creative )
{
if( !creative )
{
@ -149,7 +150,8 @@ public void readFromNBT( NBTTagCompound nbttagcompound )
}
}
@Override
@Nonnull
@Override
public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
{
// Write properties
@ -164,7 +166,7 @@ public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
}
@Override
public void readDescription( NBTTagCompound nbttagcompound )
public void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
m_dir = EnumFacing.getFront( nbttagcompound.getInteger( "dir" ) );
@ -180,7 +182,7 @@ public void readDescription( NBTTagCompound nbttagcompound )
}
@Override
public void writeDescription( NBTTagCompound nbttagcompound )
public void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.writeDescription( nbttagcompound );
nbttagcompound.setInteger( "dir", m_dir.getIndex() );

View File

@ -12,6 +12,8 @@
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerDiskDrive extends Container
{
private final TileDiskDrive m_diskDrive;
@ -36,7 +38,7 @@ public ContainerDiskDrive( IInventory playerInventory, TileDiskDrive diskDrive )
}
@Override
public boolean canInteractWith( EntityPlayer player )
public boolean canInteractWith( @Nonnull EntityPlayer player )
{
return m_diskDrive.isUseableByPlayer( player );
}

View File

@ -16,6 +16,8 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class DiskDrivePeripheral implements IPeripheral
{
private final TileDiskDrive m_diskDrive;
@ -25,12 +27,14 @@ public DiskDrivePeripheral( TileDiskDrive diskDrive )
m_diskDrive = diskDrive;
}
@Nonnull
@Override
public String getType()
{
return "drive";
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -50,7 +54,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException
{
switch( method )
{
@ -174,13 +178,13 @@ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int m
}
@Override
public void attach( IComputerAccess computer )
public void attach( @Nonnull IComputerAccess computer )
{
m_diskDrive.mount( computer );
}
@Override
public void detach( IComputerAccess computer )
public void detach( @Nonnull IComputerAccess computer )
{
m_diskDrive.unmount( computer );
}

View File

@ -29,6 +29,7 @@
import net.minecraft.util.text.*;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ -145,6 +146,7 @@ public void readFromNBT(NBTTagCompound nbttagcompound)
}
}
@Nonnull
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
{
@ -320,6 +322,7 @@ public boolean hasCustomName()
return getLabel() != null;
}
@Nonnull
@Override
public String getName()
{
@ -334,6 +337,7 @@ public String getName()
}
}
@Nonnull
@Override
public ITextComponent getDisplayName()
{
@ -354,23 +358,23 @@ public int getInventoryStackLimit()
}
@Override
public void openInventory( EntityPlayer player )
public void openInventory( @Nonnull EntityPlayer player )
{
}
@Override
public void closeInventory( EntityPlayer player )
public void closeInventory( @Nonnull EntityPlayer player )
{
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
public boolean isItemValidForSlot( int i, @Nonnull ItemStack itemstack)
{
return true;
}
@Override
public boolean isUseableByPlayer( EntityPlayer player )
public boolean isUseableByPlayer( @Nonnull EntityPlayer player )
{
return isUsable( player, false );
}
@ -613,7 +617,7 @@ private synchronized void ejectContents( boolean destroyed )
}
@Override
public final void readDescription( NBTTagCompound nbttagcompound )
public final void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
if( nbttagcompound.hasKey( "item" ) )
@ -628,7 +632,7 @@ public final void readDescription( NBTTagCompound nbttagcompound )
}
@Override
public void writeDescription( NBTTagCompound nbttagcompound )
public void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.writeDescription( nbttagcompound );
if( m_diskStack != null )
@ -659,7 +663,7 @@ public void onBlockEvent( int eventID, int eventParameter )
}
@Override
public boolean shouldRefresh( World world, BlockPos pos, IBlockState oldState, IBlockState newState )
public boolean shouldRefresh( World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState )
{
return super.shouldRefresh( world, pos, oldState, newState ) || ComputerCraft.Blocks.peripheral.getPeripheralType( newState ) != PeripheralType.DiskDrive;
}

View File

@ -23,6 +23,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockAdvancedModem extends BlockPeripheralBase
{
public static class Properties
@ -42,6 +44,7 @@ public BlockAdvancedModem()
);
}
@Nonnull
@Override
protected BlockStateContainer createBlockState()
{
@ -51,6 +54,7 @@ protected BlockStateContainer createBlockState()
});
}
@Nonnull
@Override
public IBlockState getStateFromMeta( int meta )
{
@ -63,12 +67,13 @@ public IBlockState getStateFromMeta( int meta )
@Override
public int getMetaFromState( IBlockState state )
{
EnumFacing dir = (EnumFacing) state.getValue( Properties.FACING );
EnumFacing dir = state.getValue( Properties.FACING );
return dir.getIndex();
}
@Nonnull
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
public IBlockState getActualState( @Nonnull IBlockState state, IBlockAccess world, BlockPos pos )
{
int anim;
EnumFacing dir;

View File

@ -13,6 +13,7 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ -203,12 +204,14 @@ public void receiveDifferentDimension( int channel, int replyChannel, Object pay
// IPeripheral implementation
@Nonnull
@Override
public String getType()
{
return "modem";
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -237,7 +240,7 @@ private static int parseChannel( Object[] arguments, int index ) throws LuaExcep
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException
{
switch( method )
{
@ -366,7 +369,7 @@ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int m
}
@Override
public synchronized void attach( IComputerAccess computer )
public synchronized void attach( @Nonnull IComputerAccess computer )
{
m_computer = computer;
setNetwork( getNetwork() );
@ -374,7 +377,7 @@ public synchronized void attach( IComputerAccess computer )
}
@Override
public synchronized void detach( IComputerAccess computer )
public synchronized void detach( @Nonnull IComputerAccess computer )
{
if( m_network != null )
{

View File

@ -31,6 +31,7 @@
import net.minecraft.util.text.*;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.io.File;
import java.util.*;
@ -93,6 +94,7 @@ protected Vec3d getPosition()
return new Vec3d( (double)pos.getX() + 0.5, (double)pos.getY() + 0.5, (double)pos.getZ() + 0.5 );
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -117,7 +119,7 @@ private String parseString( Object[] arguments, int index ) throws LuaException
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException
{
String[] methods = super.getMethodNames();
switch( method - methods.length )
@ -186,7 +188,7 @@ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int m
}
@Override
public void attach( IComputerAccess computer )
public void attach( @Nonnull IComputerAccess computer )
{
super.attach( computer );
synchronized( m_entity.m_peripheralsByName )
@ -205,7 +207,7 @@ public void attach( IComputerAccess computer )
}
@Override
public synchronized void detach( IComputerAccess computer )
public synchronized void detach( @Nonnull IComputerAccess computer )
{
synchronized( m_entity.m_peripheralsByName )
{
@ -302,7 +304,7 @@ public void setDirection( EnumFacing dir )
}
@Override
public void getDroppedItems( List<ItemStack> drops, boolean creative )
public void getDroppedItems( @Nonnull List<ItemStack> drops, boolean creative )
{
if( !creative )
{
@ -409,6 +411,7 @@ public AxisAlignedBB getCableBounds()
return new AxisAlignedBB( xMin, yMin, zMin, xMax, yMax, zMax );
}
@Nonnull
@Override
public AxisAlignedBB getBounds()
{
@ -434,7 +437,7 @@ public AxisAlignedBB getBounds()
}
@Override
public void getCollisionBounds( List<AxisAlignedBB> bounds )
public void getCollisionBounds( @Nonnull List<AxisAlignedBB> bounds )
{
PeripheralType type = getPeripheralType();
if( type == PeripheralType.WiredModem || type == PeripheralType.WiredModemWithCable )
@ -503,7 +506,8 @@ public void readFromNBT(NBTTagCompound nbttagcompound)
m_attachedPeripheralID = nbttagcompound.getInteger( "peripheralID" );
}
@Override
@Nonnull
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
{
// Write properties
@ -828,25 +832,25 @@ public Object[] callMethod( ILuaContext context, String methodName, Object[] arg
// IComputerAccess implementation
@Override
public String mount( String desiredLocation, IMount mount )
public String mount( @Nonnull String desiredLocation, @Nonnull IMount mount )
{
return m_computer.mount( desiredLocation, mount, m_name );
}
@Override
public String mount( String desiredLocation, IMount mount, String driveName )
public String mount( @Nonnull String desiredLocation, @Nonnull IMount mount, @Nonnull String driveName )
{
return m_computer.mount( desiredLocation, mount, driveName );
}
@Override
public String mountWritable( String desiredLocation, IWritableMount mount )
public String mountWritable( @Nonnull String desiredLocation, @Nonnull IWritableMount mount )
{
return m_computer.mountWritable( desiredLocation, mount, m_name );
}
@Override
public String mountWritable( String desiredLocation, IWritableMount mount, String driveName )
public String mountWritable( @Nonnull String desiredLocation, @Nonnull IWritableMount mount, @Nonnull String driveName )
{
return m_computer.mountWritable( desiredLocation, mount, driveName );
}
@ -864,11 +868,12 @@ public int getID()
}
@Override
public void queueEvent( String event, Object[] arguments )
public void queueEvent( @Nonnull String event, Object[] arguments )
{
m_computer.queueEvent( event, arguments );
}
@Nonnull
@Override
public String getAttachmentName()
{

View File

@ -14,6 +14,8 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import javax.annotation.Nonnull;
public abstract class TileModemBase extends TilePeripheralBase
{
private static final AxisAlignedBB[] BOXES = new AxisAlignedBB[] {
@ -65,6 +67,7 @@ public void onNeighbourChange()
}
}
@Nonnull
@Override
public AxisAlignedBB getBounds()
{
@ -95,7 +98,7 @@ protected void updateAnim()
}
@Override
public final void readDescription( NBTTagCompound nbttagcompound )
public final void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
updateBlock();

View File

@ -17,6 +17,8 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class TileWirelessModem extends TileModemBase
{
// Statics
@ -120,7 +122,7 @@ protected ModemPeripheral createPeripheral()
}
@Override
public boolean shouldRefresh( World world, BlockPos pos, IBlockState oldState, IBlockState newState )
public boolean shouldRefresh( World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState )
{
return super.shouldRefresh( world, pos, oldState, newState ) || ComputerCraft.Blocks.peripheral.getPeripheralType( newState ) != PeripheralType.WirelessModem;
}

View File

@ -12,6 +12,8 @@
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.core.terminal.Terminal;
import javax.annotation.Nonnull;
public class MonitorPeripheral implements IPeripheral
{
private final TileMonitor m_monitor;
@ -23,12 +25,14 @@ public MonitorPeripheral( TileMonitor monitor )
// IPeripheral implementation
@Nonnull
@Override
public String getType()
{
return "monitor";
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -57,7 +61,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object args[] ) throws LuaException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object args[] ) throws LuaException
{
switch( method )
{
@ -223,13 +227,13 @@ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int m
}
@Override
public void attach( IComputerAccess computer )
public void attach( @Nonnull IComputerAccess computer )
{
m_monitor.addComputer( computer );
}
@Override
public void detach( IComputerAccess computer )
public void detach( @Nonnull IComputerAccess computer )
{
m_monitor.removeComputer( computer );
}

View File

@ -25,6 +25,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.HashSet;
import java.util.Set;
@ -111,6 +112,7 @@ public boolean onActivate( EntityPlayer player, EnumFacing side, float hitX, flo
return false;
}
@Nonnull
@Override
public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
{
@ -206,7 +208,7 @@ public void setTextScale( int scale )
// Networking stuff
@Override
public void writeDescription( NBTTagCompound nbttagcompound )
public void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.writeDescription( nbttagcompound );
nbttagcompound.setInteger( "xIndex", m_xIndex );
@ -219,7 +221,7 @@ public void writeDescription( NBTTagCompound nbttagcompound )
}
@Override
public final void readDescription( NBTTagCompound nbttagcompound )
public final void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
@ -815,6 +817,7 @@ private XYPair( float x, float y )
}
}
@Nonnull
@Override
public AxisAlignedBB getRenderBoundingBox()
{
@ -840,7 +843,7 @@ public AxisAlignedBB getRenderBoundingBox()
}
@Override
public boolean shouldRefresh( World world, BlockPos pos, IBlockState oldState, IBlockState newState )
public boolean shouldRefresh( World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState )
{
if( super.shouldRefresh( world, pos, oldState, newState ) )
{

View File

@ -14,6 +14,8 @@
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class ContainerPrinter extends Container
{
private TilePrinter m_printer;
@ -97,7 +99,7 @@ public void updateProgressBar(int i, int j)
}
@Override
public boolean canInteractWith( EntityPlayer player )
public boolean canInteractWith( @Nonnull EntityPlayer player )
{
return m_printer.isUseableByPlayer( player );
}

View File

@ -12,6 +12,8 @@
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.core.terminal.Terminal;
import javax.annotation.Nonnull;
public class PrinterPeripheral implements IPeripheral
{
private final TilePrinter m_printer;
@ -21,12 +23,14 @@ public PrinterPeripheral( TilePrinter printer )
m_printer = printer;
}
@Nonnull
@Override
public String getType()
{
return "printer";
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -44,7 +48,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] args ) throws LuaException
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
{
switch( method )
{
@ -139,12 +143,12 @@ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int m
}
@Override
public void attach( IComputerAccess computer )
public void attach( @Nonnull IComputerAccess computer )
{
}
@Override
public void detach( IComputerAccess computer )
public void detach( @Nonnull IComputerAccess computer )
{
}

View File

@ -29,6 +29,8 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import javax.annotation.Nonnull;
public class TilePrinter extends TilePeripheralBase
implements IInventory, ISidedInventory
{
@ -102,7 +104,8 @@ public void readFromNBT(NBTTagCompound nbttagcompound)
}
}
@Override
@Nonnull
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound = super.writeToNBT(nbttagcompound);
@ -136,14 +139,14 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
}
@Override
public final void readDescription( NBTTagCompound nbttagcompound )
public final void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
updateBlock();
}
@Override
public boolean shouldRefresh( World world, BlockPos pos, IBlockState oldState, IBlockState newState )
public boolean shouldRefresh( World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState )
{
return super.shouldRefresh( world, pos, oldState, newState ) || ComputerCraft.Blocks.peripheral.getPeripheralType( newState ) != PeripheralType.Printer;
}
@ -243,6 +246,7 @@ public boolean hasCustomName()
return getLabel() != null;
}
@Nonnull
@Override
public String getName()
{
@ -257,6 +261,7 @@ public String getName()
}
}
@Nonnull
@Override
public ITextComponent getDisplayName()
{
@ -277,23 +282,23 @@ public int getInventoryStackLimit()
}
@Override
public void openInventory( EntityPlayer player )
public void openInventory( @Nonnull EntityPlayer player )
{
}
@Override
public void closeInventory( EntityPlayer player )
public void closeInventory( @Nonnull EntityPlayer player )
{
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack itemstack )
public boolean isItemValidForSlot( int slot, @Nonnull ItemStack itemstack )
{
return true;
}
@Override
public boolean isUseableByPlayer( EntityPlayer player )
public boolean isUseableByPlayer( @Nonnull EntityPlayer player )
{
return isUsable( player, false );
}
@ -317,8 +322,9 @@ public void setField(int id, int value)
// ISidedInventory implementation
@Override
public int[] getSlotsForFace( EnumFacing side )
@Nonnull
@Override
public int[] getSlotsForFace( @Nonnull EnumFacing side )
{
switch( side )
{
@ -329,13 +335,13 @@ public int[] getSlotsForFace( EnumFacing side )
}
@Override
public boolean canInsertItem( int slot, ItemStack itemstack, EnumFacing face )
public boolean canInsertItem( int slot, @Nonnull ItemStack itemstack, @Nonnull EnumFacing face )
{
return isItemValidForSlot( slot, itemstack );
}
@Override
public boolean canExtractItem( int slot, ItemStack itemstack, EnumFacing face )
public boolean canExtractItem( int slot, @Nonnull ItemStack itemstack, @Nonnull EnumFacing face )
{
return true;
}

View File

@ -19,6 +19,8 @@
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class PocketAPI implements ILuaAPI
{
private final PocketServerComputer m_computer;
@ -51,6 +53,7 @@ public void shutdown()
{
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -61,7 +64,7 @@ public String[] getMethodNames()
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException, InterruptedException
{
switch( method )
{

View File

@ -35,6 +35,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.List;
public class ItemPocketComputer extends Item implements IComputerItem, IMedia
@ -79,7 +80,7 @@ public ItemStack create( int id, String label, ComputerFamily family, IPocketUpg
}
@Override
public void getSubItems( Item itemID, CreativeTabs tabs, List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
{
getSubItems( list, ComputerFamily.Normal );
getSubItems( list, ComputerFamily.Advanced );
@ -151,8 +152,9 @@ public void onUpdate( ItemStack stack, World world, Entity entity, int slotNum,
}
}
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick( ItemStack stack, World world, EntityPlayer player, EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( @Nonnull ItemStack stack, World world, EntityPlayer player, EnumHand hand )
{
if( !world.isRemote )
{
@ -176,6 +178,7 @@ public ActionResult<ItemStack> onItemRightClick( ItemStack stack, World world, E
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, stack );
}
@Nonnull
@Override
public String getUnlocalizedName( ItemStack stack )
{
@ -193,8 +196,9 @@ public String getUnlocalizedName( ItemStack stack )
}
}
@Nonnull
@Override
public String getItemStackDisplayName( ItemStack stack )
public String getItemStackDisplayName( @Nonnull ItemStack stack )
{
String baseString = getUnlocalizedName( stack );
IPocketUpgrade upgrade = getUpgrade( stack );
@ -331,7 +335,7 @@ private void setComputerID( ItemStack stack, int computerID )
}
@Override
public String getLabel( ItemStack stack )
public String getLabel( @Nonnull ItemStack stack )
{
if( stack.hasDisplayName() )
{
@ -361,7 +365,7 @@ public ComputerFamily getFamily( ItemStack stack )
// IMedia
@Override
public boolean setLabel( ItemStack stack, String label )
public boolean setLabel( @Nonnull ItemStack stack, String label )
{
if( label != null )
{
@ -375,19 +379,19 @@ public boolean setLabel( ItemStack stack, String label )
}
@Override
public String getAudioTitle( ItemStack stack )
public String getAudioTitle( @Nonnull ItemStack stack )
{
return null;
}
@Override
public SoundEvent getAudio( ItemStack stack )
public SoundEvent getAudio( @Nonnull ItemStack stack )
{
return null;
}
@Override
public IMount createDataMount( ItemStack stack, World world )
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
{
ServerComputer computer = createServerComputer( world, null, null, stack );
if( computer != null )

View File

@ -16,6 +16,8 @@
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class PocketComputerUpgradeRecipe implements IRecipe
{
public PocketComputerUpgradeRecipe()
@ -35,13 +37,13 @@ public ItemStack getRecipeOutput()
}
@Override
public boolean matches( InventoryCrafting inventory, World world )
public boolean matches( @Nonnull InventoryCrafting inventory, @Nonnull World world )
{
return (getCraftingResult( inventory ) != null);
}
@Override
public ItemStack getCraftingResult( InventoryCrafting inventory )
public ItemStack getCraftingResult( @Nonnull InventoryCrafting inventory )
{
// Scan the grid for a pocket computer
ItemStack computer = null;
@ -112,8 +114,9 @@ else if( item != null )
return PocketComputerItemFactory.create( computerID, label, family, upgrade );
}
@Nonnull
@Override
public ItemStack[] getRemainingItems( InventoryCrafting inventoryCrafting )
public ItemStack[] getRemainingItems( @Nonnull InventoryCrafting inventoryCrafting )
{
ItemStack[] results = new ItemStack[ inventoryCrafting.getSizeInventory() ];
for (int i = 0; i < results.length; ++i)

View File

@ -19,6 +19,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.Map;
@ -58,6 +59,7 @@ public void shutdown( )
{
}
@Nonnull
@Override
public String[] getMethodNames()
{
@ -181,7 +183,7 @@ else if( arguments[ index ].equals( "right" ) )
}
@Override
public Object[] callMethod( ILuaContext context, int method, Object[] args ) throws LuaException, InterruptedException
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException, InterruptedException
{
switch( method )
{

View File

@ -27,6 +27,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockTurtle extends BlockComputerBase
{
// Statics
@ -54,6 +56,7 @@ public BlockTurtle()
);
}
@Nonnull
@Override
public EnumBlockRenderType getRenderType( IBlockState state )
{
@ -72,12 +75,14 @@ public boolean isFullCube( IBlockState state )
return false;
}
@Nonnull
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, Properties.FACING );
}
@Nonnull
@Override
public IBlockState getStateFromMeta( int meta )
{
@ -90,8 +95,9 @@ public int getMetaFromState( IBlockState state )
return 0;
}
@Nonnull
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
public IBlockState getActualState( @Nonnull IBlockState state, IBlockAccess world, BlockPos pos )
{
return state.withProperty( Properties.FACING, getDirection( world, pos ) );
}

View File

@ -34,6 +34,7 @@
import net.minecraft.util.text.*;
import net.minecraftforge.common.util.Constants;
import javax.annotation.Nonnull;
import java.util.List;
public class TileTurtle extends TileComputerBase
@ -144,7 +145,7 @@ protected void unload()
}
@Override
public void getDroppedItems( List<ItemStack> drops, boolean creative )
public void getDroppedItems( @Nonnull List<ItemStack> drops, boolean creative )
{
IComputer computer = getComputer();
if( !creative || (computer != null && computer.getLabel() != null) )
@ -243,6 +244,7 @@ public boolean isImmuneToExplosion( Entity exploder )
}
}
@Nonnull
@Override
public AxisAlignedBB getBounds()
{
@ -293,7 +295,7 @@ public void onNeighbourChange()
}
@Override
public void onNeighbourTileEntityChange(BlockPos neighbour)
public void onNeighbourTileEntityChange( @Nonnull BlockPos neighbour)
{
if ( m_moveState == MoveState.NOT_MOVED )
{
@ -342,6 +344,7 @@ public void readFromNBT( NBTTagCompound nbttagcompound )
m_brain.readFromNBT( nbttagcompound );
}
@Nonnull
@Override
public NBTTagCompound writeToNBT( NBTTagCompound nbttagcompound )
{
@ -539,6 +542,7 @@ public void clear()
}
}
@Nonnull
@Override
public String getName()
{
@ -569,6 +573,7 @@ public boolean hasCustomName()
return false;
}
@Nonnull
@Override
public ITextComponent getDisplayName()
{
@ -589,17 +594,17 @@ public int getInventoryStackLimit()
}
@Override
public void openInventory( EntityPlayer player )
public void openInventory( @Nonnull EntityPlayer player )
{
}
@Override
public void closeInventory( EntityPlayer player )
public void closeInventory( @Nonnull EntityPlayer player )
{
}
@Override
public boolean isItemValidForSlot( int slot, ItemStack stack )
public boolean isItemValidForSlot( int slot, @Nonnull ItemStack stack )
{
return true;
}
@ -625,7 +630,7 @@ public void markDirty()
}
@Override
public boolean isUseableByPlayer( EntityPlayer player )
public boolean isUseableByPlayer( @Nonnull EntityPlayer player )
{
return isUsable( player, false );
}
@ -666,14 +671,14 @@ public void onTileEntityChange()
// Networking stuff
@Override
public void writeDescription( NBTTagCompound nbttagcompound )
public void writeDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.writeDescription( nbttagcompound );
m_brain.writeDescription( nbttagcompound );
}
@Override
public void readDescription( NBTTagCompound nbttagcompound )
public void readDescription( @Nonnull NBTTagCompound nbttagcompound )
{
super.readDescription( nbttagcompound );
m_brain.readDescription( nbttagcompound );

View File

@ -32,6 +32,7 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import javax.annotation.Nonnull;
import java.lang.ref.WeakReference;
import java.util.*;
@ -473,12 +474,14 @@ public void readDescription( NBTTagCompound nbttagcompound )
m_fuelLevel = nbttagcompound.getInteger( "fuelLevel" );
}
@Nonnull
@Override
public World getWorld()
{
return m_owner.getWorld();
}
@Nonnull
@Override
public BlockPos getPosition()
{
@ -486,7 +489,7 @@ public BlockPos getPosition()
}
@Override
public boolean teleportTo( World world, BlockPos pos )
public boolean teleportTo( @Nonnull World world, @Nonnull BlockPos pos )
{
if( world.isRemote || getWorld().isRemote )
{
@ -555,6 +558,7 @@ public boolean teleportTo( World world, BlockPos pos )
return false;
}
@Nonnull
@Override
public Vec3d getVisualPosition( float f )
{
@ -596,6 +600,7 @@ public float getVisualYaw( float f )
return yaw;
}
@Nonnull
@Override
public EnumFacing getDirection()
{
@ -603,7 +608,7 @@ public EnumFacing getDirection()
}
@Override
public void setDirection( EnumFacing dir )
public void setDirection( @Nonnull EnumFacing dir )
{
if( dir.getAxis() == EnumFacing.Axis.Y )
{
@ -635,6 +640,7 @@ public void setSelectedSlot( int slot )
}
}
@Nonnull
@Override
public IInventory getInventory()
{
@ -711,8 +717,9 @@ private int issueCommand( ITurtleCommand command )
return m_commandsIssued;
}
@Nonnull
@Override
public Object[] executeCommand( ILuaContext context, ITurtleCommand command ) throws LuaException, InterruptedException
public Object[] executeCommand( @Nonnull ILuaContext context, @Nonnull ITurtleCommand command ) throws LuaException, InterruptedException
{
if( getWorld().isRemote )
{
@ -742,7 +749,7 @@ public Object[] executeCommand( ILuaContext context, ITurtleCommand command ) th
}
@Override
public void playAnimation( TurtleAnimation animation )
public void playAnimation( @Nonnull TurtleAnimation animation )
{
if( getWorld().isRemote )
{
@ -798,7 +805,7 @@ public void setDyeColour( int dyeColour )
}
@Override
public ITurtleUpgrade getUpgrade( TurtleSide side )
public ITurtleUpgrade getUpgrade( @Nonnull TurtleSide side )
{
if( m_upgrades.containsKey( side ) )
{
@ -808,7 +815,7 @@ public ITurtleUpgrade getUpgrade( TurtleSide side )
}
@Override
public void setUpgrade( TurtleSide side, ITurtleUpgrade upgrade )
public void setUpgrade( @Nonnull TurtleSide side, ITurtleUpgrade upgrade )
{
// Remove old upgrade
if( m_upgrades.containsKey( side ) )
@ -846,7 +853,7 @@ public void setUpgrade( TurtleSide side, ITurtleUpgrade upgrade )
}
@Override
public IPeripheral getPeripheral( TurtleSide side )
public IPeripheral getPeripheral( @Nonnull TurtleSide side )
{
if( m_peripherals.containsKey( side ) )
{
@ -855,6 +862,7 @@ public IPeripheral getPeripheral( TurtleSide side )
return null;
}
@Nonnull
@Override
public NBTTagCompound getUpgradeNBTData( TurtleSide side )
{
@ -866,7 +874,7 @@ public NBTTagCompound getUpgradeNBTData( TurtleSide side )
}
@Override
public void updateUpgradeNBTData( TurtleSide side )
public void updateUpgradeNBTData( @Nonnull TurtleSide side )
{
m_owner.updateBlock();
}

View File

@ -11,6 +11,8 @@
import dan200.computercraft.api.turtle.TurtleCommandResult;
import dan200.computercraft.core.apis.IAPIEnvironment;
import javax.annotation.Nonnull;
public class TurtleCheckRedstoneCommand implements ITurtleCommand
{
private final IAPIEnvironment m_environment;
@ -22,8 +24,9 @@ public TurtleCheckRedstoneCommand( IAPIEnvironment environment, InteractDirectio
m_direction = direction;
}
@Nonnull
@Override
public TurtleCommandResult execute( ITurtleAccess turtle )
public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
{
// Do the checking
int redstoneSide;

View File

@ -19,6 +19,7 @@
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import javax.annotation.Nonnull;
import java.lang.reflect.Method;
import java.util.Iterator;
@ -31,8 +32,9 @@ public TurtleCompareCommand( InteractDirection direction )
m_direction = direction;
}
@Nonnull
@Override
public TurtleCommandResult execute( ITurtleAccess turtle )
public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
{
// Get world direction from direction
EnumFacing direction = m_direction.toWorldDir( turtle );

View File

@ -12,6 +12,8 @@
import dan200.computercraft.shared.util.InventoryUtil;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class TurtleCompareToCommand implements ITurtleCommand
{
private final int m_slot;
@ -21,8 +23,9 @@ public TurtleCompareToCommand( int slot )
m_slot = slot;
}
@Nonnull
@Override
public TurtleCommandResult execute( ITurtleAccess turtle )
public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
{
ItemStack selectedStack = turtle.getInventory().getStackInSlot( turtle.getSelectedSlot() );
ItemStack stack = turtle.getInventory().getStackInSlot( m_slot );

View File

@ -16,6 +16,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nonnull;
import java.util.ArrayList;
public class TurtleCraftCommand implements ITurtleCommand
@ -27,8 +28,9 @@ public TurtleCraftCommand( int limit )
m_limit = limit;
}
@Nonnull
@Override
public TurtleCommandResult execute( ITurtleAccess turtle )
public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
{
// Craft the item
TurtleInventoryCrafting crafting = new TurtleInventoryCrafting( turtle );

Some files were not shown because too many files have changed in this diff Show More