diff --git a/.gitignore b/.gitignore
index 2dda7460..7295eceb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,8 @@ remotebuild.py
/build
/eclipse
/gradlew.bat
+/libs
+
## ForgeGradle
/run
diff --git a/remake.sh b/remake.sh
new file mode 100755
index 00000000..580c2654
--- /dev/null
+++ b/remake.sh
@@ -0,0 +1,4 @@
+gradle clean cleanCache --refresh-dependencies
+gradle setupDecompWorkspace
+gradle idea --assetIndex
+gradle genIntellijRuns
diff --git a/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java b/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java
index 891800b0..9b8833d2 100644
--- a/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java
+++ b/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java
@@ -30,7 +30,7 @@ public final class ComputerCraftAPI
* @param parentSubPath The folder path within the save directory where the new directory should be created. eg: "computercraft/disk"
* @return The numerical value of the name of the new folder, or -1 if the folder could not be created for some reason.
* eg: if createUniqueNumberedSaveDir( world, "computer/disk" ) was called returns 42, then "computer/disk/42" is now available for writing.
- * @see #createSaveDirMount(net.minecraft.world.World, String, long)
+ * @see #createSaveDirMount(World, String, long)
*/
public static int createUniqueNumberedSaveDir( World world, String parentSubPath )
{
@@ -56,11 +56,11 @@ public final class ComputerCraftAPI
* @param capacity The ammount of data that can be stored in the directory before it fills up, in bytes.
* @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable()
* to mount this on a Computers' file system.
- * @see #createUniqueNumberedSaveDir(net.minecraft.world.World, String)
+ * @see #createUniqueNumberedSaveDir(World, String)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount)
* @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
* @see dan200.computercraft.api.filesystem.IMount
- * @see dan200.computercraft.api.filesystem.IWritableMount
+ * @see IWritableMount
*/
public static IWritableMount createSaveDirMount( World world, String subPath, long capacity )
{
@@ -86,7 +86,7 @@ public final class ComputerCraftAPI
* @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable()
* to mount this on a Computers' file system.
* @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount)
- * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
+ * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, IWritableMount)
* @see dan200.computercraft.api.filesystem.IMount
*/
public static IMount createResourceMount( Class modClass, String domain, String subPath )
@@ -154,7 +154,7 @@ public final class ComputerCraftAPI
{
try {
computerCraft_registerBundledRedstoneProvider.invoke( null, handler );
- } catch (Exception e){
+ } catch (Exception e) {
// It failed
}
}
@@ -241,7 +241,11 @@ public final class ComputerCraftAPI
private static Method findCCMethod( String name, Class[] args )
{
try {
- return computerCraft.getMethod( name, args );
+ if( computerCraft != null )
+ {
+ return computerCraft.getMethod( name, args );
+ }
+ return null;
} catch( NoSuchMethodException e ) {
System.out.println( "ComputerCraftAPI: ComputerCraft method " + name + " not found." );
return null;
diff --git a/src/api/java/dan200/computercraft/api/filesystem/IMount.java b/src/api/java/dan200/computercraft/api/filesystem/IMount.java
index c9a438ee..e340496b 100644
--- a/src/api/java/dan200/computercraft/api/filesystem/IMount.java
+++ b/src/api/java/dan200/computercraft/api/filesystem/IMount.java
@@ -15,7 +15,7 @@ import java.util.List;
* Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount() or ComputerCraftAPI.createResourceMount(), or you're free to implement it yourselves!
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
- * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount)
+ * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, IMount)
* @see IWritableMount
*/
public interface IMount
@@ -25,33 +25,33 @@ public interface IMount
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return true if the file exists, false otherwise
*/
- public boolean exists(String path) throws IOException;
+ public boolean exists( String path ) throws IOException;
/**
* Returns whether a file with a given path is a directory or not.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms"
* @return true if the file exists and is a directory, false otherwise
*/
- public boolean isDirectory(String path) throws IOException;
+ public boolean isDirectory( String path ) throws IOException;
/**
* Returns the file names of all the files in a directory.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms"
* @param contents A list of strings. Add all the file names to this list
*/
- public void list(String path, List contents) throws IOException;
+ public void list( String path, List contents ) throws IOException;
/**
* Returns the size of a file with a given path, in bytes
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return the size of the file, in bytes
*/
- public long getSize(String path) throws IOException;
+ public long getSize( String path ) throws IOException;
/**
* Opens a file with a given path, and returns an inputstream representing it's contents.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return a stream representing the contents of the file
*/
- public InputStream openForRead(String path) throws IOException;
+ public InputStream openForRead( String path ) throws IOException;
}
diff --git a/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java b/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java
index 9a50ce26..9c3bb43d 100644
--- a/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java
+++ b/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java
@@ -13,8 +13,8 @@ import java.io.OutputStream;
* Represents a part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount() or IComputerAccess.mountWritable(), that can also be written to.
* Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount(), or you're free to implement it yourselves!
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
- * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, IMount)
- * @see IMount
+ * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IMount)
+ * @see dan200.computercraft.api.filesystem.IMount
*/
public interface IWritableMount extends IMount
{
@@ -22,27 +22,27 @@ public interface IWritableMount extends IMount
* Creates a directory at a given path inside the virtual file system.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/mynewprograms"
*/
- public void makeDirectory(String path) throws IOException;
+ public void makeDirectory( String path ) throws IOException;
/**
* Deletes a directory at a given path inside the virtual file system.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myoldprograms"
*/
- public void delete(String path) throws IOException;
+ public void delete( String path ) throws IOException;
/**
* Opens a file with a given path, and returns an outputstream for writing to it.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return a stream for writing to
*/
- public OutputStream openForWrite(String path) throws IOException;
+ public OutputStream openForWrite( String path ) throws IOException;
/**
* Opens a file with a given path, and returns an outputstream for appending to it.
* @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram"
* @return a stream for writing to
*/
- public OutputStream openForAppend(String path) throws IOException;
+ public OutputStream openForAppend( String path ) throws IOException;
/**
* Get the ammount of free space on the mount, in bytes. You should decrease this value as the user writes to the mount, and write operations should fail once it reaches zero.
diff --git a/src/api/java/dan200/computercraft/api/filesystem/package-info.java b/src/api/java/dan200/computercraft/api/filesystem/package-info.java
new file mode 100644
index 00000000..02bb7ea6
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/filesystem/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+@API( owner="ComputerCraft", provides="ComputerCraft|API|FileSystem", apiVersion="1.65" )
+package dan200.computercraft.api.filesystem;
+
+import cpw.mods.fml.common.API;
\ No newline at end of file
diff --git a/src/api/java/dan200/computercraft/api/lua/ILuaContext.java b/src/api/java/dan200/computercraft/api/lua/ILuaContext.java
index 8b6c7235..787a93d4 100644
--- a/src/api/java/dan200/computercraft/api/lua/ILuaContext.java
+++ b/src/api/java/dan200/computercraft/api/lua/ILuaContext.java
@@ -22,7 +22,7 @@ public interface ILuaContext
* Do not attempt to common this exception, unless you wish to prevent termination, which is not recommended.
* @throws InterruptedException If the user shuts down or reboots the computercraft while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
*/
- public Object[] pullEvent(String filter) throws Exception, InterruptedException;
+ public Object[] pullEvent( String filter ) throws LuaException, InterruptedException;
/**
* The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua.
@@ -31,8 +31,7 @@ public interface ILuaContext
* @throws InterruptedException If the user shuts down or reboots the computercraft while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
* @see #pullEvent(String)
*/
- public Object[] pullEventRaw(String filter) throws InterruptedException;
-
+ public Object[] pullEventRaw( String filter ) throws InterruptedException;
/**
* Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events.
@@ -41,5 +40,5 @@ public interface ILuaContext
* @throws InterruptedException If the user shuts down or reboots the computercraft the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state.
* @see #pullEvent(String)
*/
- public Object[] yield(Object[] arguments) throws InterruptedException;
+ public Object[] yield( Object[] arguments ) throws InterruptedException;
}
diff --git a/src/api/java/dan200/computercraft/api/lua/ILuaObject.java b/src/api/java/dan200/computercraft/api/lua/ILuaObject.java
index e78f837d..4005bbf8 100644
--- a/src/api/java/dan200/computercraft/api/lua/ILuaObject.java
+++ b/src/api/java/dan200/computercraft/api/lua/ILuaObject.java
@@ -22,5 +22,5 @@ public interface ILuaObject
* Called when a user calls one of the methods that this object implements. This works the same as IPeripheral.callMethod(). See that method for detailed documentation.
* @see dan200.computercraft.api.peripheral.IPeripheral#callMethod(dan200.computercraft.api.peripheral.IComputerAccess, ILuaContext, int, Object[])
*/
- public Object[] callMethod(ILuaContext context, int method, Object[] arguments) throws Exception;
+ public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException;
}
diff --git a/src/api/java/dan200/computercraft/api/lua/LuaException.java b/src/api/java/dan200/computercraft/api/lua/LuaException.java
new file mode 100644
index 00000000..29874bdc
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/lua/LuaException.java
@@ -0,0 +1,31 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+package dan200.computercraft.api.lua;
+
+/**
+ * An exception representing an error in Lua, like that raised by the error() function
+ */
+public class LuaException extends Exception
+{
+ private final int m_level;
+
+ public LuaException( String message )
+ {
+ this( message, 1 );
+ }
+
+ public LuaException( String message, int level )
+ {
+ super( message );
+ m_level = level;
+ }
+
+ public int getLevel()
+ {
+ return m_level;
+ }
+}
diff --git a/src/api/java/dan200/computercraft/api/lua/package-info.java b/src/api/java/dan200/computercraft/api/lua/package-info.java
new file mode 100644
index 00000000..9ea59b6f
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/lua/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+@API( owner="ComputerCraft", provides="ComputerCraft|API|Lua", apiVersion="1.65" )
+package dan200.computercraft.api.lua;
+
+import cpw.mods.fml.common.API;
diff --git a/src/api/java/dan200/computercraft/api/media/IMedia.java b/src/api/java/dan200/computercraft/api/media/IMedia.java
index 8ae3109c..637a2970 100644
--- a/src/api/java/dan200/computercraft/api/media/IMedia.java
+++ b/src/api/java/dan200/computercraft/api/media/IMedia.java
@@ -21,7 +21,7 @@ public interface IMedia
* @param stack The itemstack to inspect
* @return The label. ie: "Dan's Programs"
*/
- public String getLabel(ItemStack stack);
+ public String getLabel( ItemStack stack );
/**
* Set a string representing the label of this item. Will be called vi disk.setLabel() in lua.
@@ -29,21 +29,21 @@ 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);
+ public boolean setLabel( ItemStack stack, String label );
/**
* If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathon Coulton - Still Alive"
* @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);
+ public String getAudioTitle( ItemStack stack );
/**
* If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
* @param stack The itemstack to inspect.
* @return The name, or null if this item does not represent an item with audio.
*/
- public String getAudioRecordName(ItemStack stack);
+ public String getAudioRecordName( ItemStack stack );
/**
* If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will be mounted onto the filesystem of the computercraft while the media is in the disk drive.
@@ -52,8 +52,8 @@ public interface IMedia
* @return The mount, or null if this item does not represent an item with data. If the IMount returned also implements IWritableMount, it will mounted using mountWritable()
* @see dan200.computercraft.api.filesystem.IMount
* @see dan200.computercraft.api.filesystem.IWritableMount
- * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(net.minecraft.world.World, String, long)
+ * @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);
+ public IMount createDataMount( ItemStack stack, World world );
}
diff --git a/src/api/java/dan200/computercraft/api/media/IMediaProvider.java b/src/api/java/dan200/computercraft/api/media/IMediaProvider.java
index b6f214fe..33e53ed4 100644
--- a/src/api/java/dan200/computercraft/api/media/IMediaProvider.java
+++ b/src/api/java/dan200/computercraft/api/media/IMediaProvider.java
@@ -10,14 +10,14 @@ import net.minecraft.item.ItemStack;
/**
* This interface is used to provide IMedia implementations for ItemStack
- * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(dan200.computercraft.api.media.IMediaProvider)
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider)
*/
public interface IMediaProvider
{
/**
* Produce an IMedia implementation from an ItemStack.
- * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(dan200.computercraft.api.media.IMediaProvider)
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider)
* @return an IMedia implementation, or null if the item is not something you wish to handle
*/
- public IMedia getMedia(ItemStack stack);
+ public IMedia getMedia( ItemStack stack );
}
diff --git a/src/api/java/dan200/computercraft/api/media/package-info.java b/src/api/java/dan200/computercraft/api/media/package-info.java
new file mode 100644
index 00000000..ec0695fb
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/media/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+@API( owner="ComputerCraft", provides="ComputerCraft|API|Media", apiVersion="1.65" )
+package dan200.computercraft.api.media;
+
+import cpw.mods.fml.common.API;
diff --git a/src/api/java/dan200/computercraft/api/package-info.java b/src/api/java/dan200/computercraft/api/package-info.java
new file mode 100644
index 00000000..5c16faf4
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+@API( owner="ComputerCraft", provides="ComputerCraft|API", apiVersion="1.65" )
+package dan200.computercraft.api;
+
+import cpw.mods.fml.common.API;
\ No newline at end of file
diff --git a/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java b/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java
index 919669d4..1c9327d2 100644
--- a/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java
+++ b/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java
@@ -27,8 +27,13 @@ public interface IComputerAccess
* @see #unmount(String)
* @see dan200.computercraft.api.filesystem.IMount
*/
- public String mount(String desiredLocation, IMount mount);
-
+ public String mount( String desiredLocation, IMount mount );
+
+ /**
+ * TODO: Document me
+ */
+ public String mount( String desiredLocation, IMount mount, String driveName );
+
/**
* Mount a mount onto the computers' file system in a writable mode.
* @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted.
@@ -36,12 +41,17 @@ public interface IComputerAccess
* @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later.
* @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String)
* @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String)
- * @see #mount(String, dan200.computercraft.api.filesystem.IMount)
+ * @see #mount(String, IMount)
* @see #unmount(String)
- * @see dan200.computercraft.api.filesystem.IMount
+ * @see IMount
*/
- public String mountWritable(String desiredLocation, IWritableMount mount);
-
+ public String mountWritable( String desiredLocation, IWritableMount mount );
+
+ /**
+ * TODO: Document me
+ */
+ public String mountWritable( String desiredLocation, IWritableMount mount, String driveName );
+
/**
* Unmounts a directory previously mounted onto the computers file system by mount() or mountWritable().
* When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to
@@ -50,10 +60,10 @@ public interface IComputerAccess
* @param location The desired location in the computers file system of the directory to unmount.
* This must be the location of a directory previously mounted by mount() or mountWritable(), as
* indicated by their return value.
- * @see #mount(String, dan200.computercraft.api.filesystem.IMount)
- * @see #mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount)
+ * @see #mount(String, IMount)
+ * @see #mountWritable(String, IWritableMount)
*/
- public void unmount(String location);
+ public void unmount( String location );
/**
* Returns the numerical ID of this computercraft.
@@ -76,9 +86,9 @@ public interface IComputerAccess
* be supplied as extra return values to os.pullEvent(). Objects in the array will be converted
* to lua data types in the same fashion as the return values of IPeripheral.callMethod().
* You may supply null to indicate that no arguments are to be supplied.
- * @see IPeripheral#callMethod
+ * @see dan200.computercraft.api.peripheral.IPeripheral#callMethod
*/
- public void queueEvent(String event, Object[] arguments);
+ public void queueEvent( String event, Object[] arguments );
/**
* Get a string, unique to the computercraft, by which the computercraft refers to this peripheral.
diff --git a/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java b/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java
index 7eb47359..99396dd9 100644
--- a/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java
+++ b/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java
@@ -7,6 +7,7 @@
package dan200.computercraft.api.peripheral;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
/**
* The interface that defines a peripheral. This should be implemented by the
@@ -59,7 +60,7 @@ public interface IPeripheral
* arguments are supplied to your method.
* @see #getMethodNames
*/
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception;
+ public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException;
/**
* Is called when canAttachToSide has returned true, and a computercraft is attaching to the peripheral.
@@ -75,7 +76,7 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
- public void attach(IComputerAccess computer);
+ public void attach( IComputerAccess computer );
/**
* Is called when a computercraft is detaching from the peripheral.
@@ -90,10 +91,10 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
- public void detach(IComputerAccess computer);
+ public void detach( IComputerAccess computer );
/**
* TODO: Document me
*/
- public boolean equals(IPeripheral other);
+ public boolean equals( IPeripheral other );
}
diff --git a/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java b/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java
index 3dd4cdaa..aeb354f3 100644
--- a/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java
+++ b/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java
@@ -10,14 +10,14 @@ import net.minecraft.world.World;
/**
* This interface is used to create peripheral implementations for blocks
- * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(dan200.computercraft.api.peripheral.IPeripheralProvider)
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
*/
public interface IPeripheralProvider
{
/**
* Produce an peripheral implementation from a block location.
- * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(dan200.computercraft.api.peripheral.IPeripheralProvider)
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
* @return a peripheral, or null if there is not a peripheral here you'd like to handle.
*/
- public IPeripheral getPeripheral(World world, int x, int y, int z, int side);
+ public IPeripheral getPeripheral( World world, int x, int y, int z, int side );
}
diff --git a/src/api/java/dan200/computercraft/api/peripheral/package-info.java b/src/api/java/dan200/computercraft/api/peripheral/package-info.java
new file mode 100644
index 00000000..c3ee6484
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/peripheral/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+@API( owner="ComputerCraft", provides="ComputerCraft|API|Peripheral", apiVersion="1.65" )
+package dan200.computercraft.api.peripheral;
+
+import cpw.mods.fml.common.API;
diff --git a/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java b/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java
index 44f909e4..6d5d400d 100644
--- a/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java
+++ b/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java
@@ -10,14 +10,14 @@ import net.minecraft.world.World;
/**
* This interface is used to provide bundled redstone output for blocks
- * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(dan200.computercraft.api.redstone.IBundledRedstoneProvider)
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider)
*/
public interface IBundledRedstoneProvider
{
/**
* Produce an bundled redstone output from a block location.
- * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(dan200.computercraft.api.redstone.IBundledRedstoneProvider)
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider)
* @return a number in the range 0-65535 to indicate this block is providing output, or -1 if you do not wish to handle this block
*/
- public int getBundledRedstoneOutput(World world, int x, int y, int z, int side);
+ public int getBundledRedstoneOutput( World world, int x, int y, int z, int side );
}
diff --git a/src/api/java/dan200/computercraft/api/redstone/package-info.java b/src/api/java/dan200/computercraft/api/redstone/package-info.java
new file mode 100644
index 00000000..fa59ad32
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/redstone/package-info.java
@@ -0,0 +1,10 @@
+/**
+ * This file is part of the public ComputerCraft API - http://www.computercraft.info
+ * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only.
+ * For help using the API, and posting your mods, visit the forums at computercraft.info.
+ */
+
+@API( owner="ComputerCraft", provides="ComputerCraft|API|Redstone", apiVersion="1.65" )
+package dan200.computercraft.api.redstone;
+
+import cpw.mods.fml.common.API;
diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java
index 29bec143..e7e96810 100644
--- a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java
+++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java
@@ -7,6 +7,7 @@
package dan200.computercraft.api.turtle;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
@@ -35,7 +36,7 @@ public interface ITurtleAccess
/**
* TODO: Document me
*/
- public boolean teleportTo(World world, int x, int y, int z);
+ public boolean teleportTo( World world, int x, int y, int z );
/**
* Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
@@ -43,12 +44,12 @@ public interface ITurtleAccess
* @param f The subframe fraction
* @return a vector containing the floating point co-ordinates at which the turtle resides.
*/
- public Vec3 getVisualPosition(float f);
+ public Vec3 getVisualPosition( float f );
/**
* TODO: Document me
*/
- public float getVisualYaw(float f);
+ public float getVisualYaw( float f );
/**
* Returns the world direction the turtle is currently facing.
@@ -59,7 +60,7 @@ public interface ITurtleAccess
/**
* TODO: Document me
*/
- public void setDirection(int dir);
+ public void setDirection( int dir );
/**
* TODO: Document me
@@ -69,7 +70,7 @@ public interface ITurtleAccess
/**
* TODO: Document me
*/
- public void setSelectedSlot(int slot);
+ public void setSelectedSlot( int slot );
/**
* TODO: Document me
@@ -89,7 +90,7 @@ public interface ITurtleAccess
/**
* TODO: Document me
*/
- public void setFuelLevel(int fuel);
+ public void setFuelLevel( int fuel );
/**
* TODO: Document me
@@ -101,12 +102,12 @@ public interface ITurtleAccess
* @return Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number
* greater than the current fuel level of the turtle.
*/
- public boolean consumeFuel(int fuel);
+ public boolean consumeFuel( int fuel );
/**
* TODO: Document me
*/
- public void addFuel(int fuel);
+ public void addFuel( int fuel );
/**
* Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed
@@ -119,37 +120,37 @@ public interface ITurtleAccess
* unchanged if called from a peripheral method.
* @see ITurtleCommand
*/
- public Object[] executeCommand(ILuaContext context, ITurtleCommand command) throws Exception;
+ public Object[] executeCommand( ILuaContext context, ITurtleCommand command ) throws LuaException, InterruptedException;
/**
* TODO: Document me
*/
- public void playAnimation(TurtleAnimation animation);
+ public void playAnimation( TurtleAnimation animation );
/**
* Returns the turtle on the specified side of the turtle, if there is one.
* @return the turtle on the specified side of the turtle, if there is one.
*/
- public ITurtleUpgrade getUpgrade(TurtleSide side);
+ public ITurtleUpgrade getUpgrade( TurtleSide side );
/**
* TODO: Document me
*/
- public void setUpgrade(TurtleSide side, ITurtleUpgrade upgrade);
+ public void setUpgrade( TurtleSide side, ITurtleUpgrade upgrade );
/**
* Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.
* @return the peripheral created by the upgrade on the specified side of the turtle, if there is one.
*/
- public IPeripheral getPeripheral(TurtleSide side);
+ public IPeripheral getPeripheral( TurtleSide side );
/**
* TODO: Document me
*/
- public NBTTagCompound getUpgradeNBTData(TurtleSide side);
+ public NBTTagCompound getUpgradeNBTData( TurtleSide side );
/**
* TODO: Document me
*/
- public void updateUpgradeNBTData(TurtleSide side);
+ public void updateUpgradeNBTData( TurtleSide side );
}
diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java
index b6595767..a551b649 100644
--- a/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java
+++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java
@@ -8,7 +8,7 @@ package dan200.computercraft.api.turtle;
/**
* An interface for objects executing custom turtle commands, used with ITurtleAccess.issueCommand
- * @see dan200.computercraft.api.turtle.ITurtleAccess#issueCommand(dan200.computercraft.api.turtle.ITurtleCommand)
+ * @see ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext,ITurtleCommand)
*/
public interface ITurtleCommand
{
@@ -18,8 +18,8 @@ public interface ITurtleCommand
* failure with an error message to indicate the command cannot be executed at this time.
* @param turtle access to the turtle for whom the command was issued
* @return TurtleCommandResult.success() or TurtleCommandResult.failure( errorMessage )
- * @see dan200.computercraft.api.turtle.ITurtleAccess#issueCommand(dan200.computercraft.api.turtle.ITurtleCommand)
+ * @see ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext,ITurtleCommand)
* @see dan200.computercraft.api.turtle.TurtleCommandResult
*/
- public TurtleCommandResult execute(ITurtleAccess turtle);
+ public TurtleCommandResult execute( ITurtleAccess turtle );
}
diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java
index 9171da38..461d6e2b 100644
--- a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java
+++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java
@@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
/**
* The primary interface for defining an turtle for Turtles. A turtle turtle
* can either be a new tool, or a new peripheral.
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( dan200.computercraft.api.turtle.ITurtleUpgrade )
*/
public interface ITurtleUpgrade
{
@@ -23,13 +24,15 @@ public interface ITurtleUpgrade
* The ID must be in the range 64 to 255, as the ID is stored as an 8-bit value,
* and 0-64 is reserved for future use by ComputerCraft. The turtle will
* fail registration if an already used ID is specified.
+ * @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( dan200.computercraft.api.turtle.ITurtleUpgrade )
+ */
public int getUpgradeID();
/**
* Return a String to describe this type of turtle in turtle item names.
* Examples of built-in adjectives are "Wireless", "Mining" and "Crafty".
*/
- public String getAdjective();
+ public String getUnlocalisedAdjective();
/**
* Return whether this turtle adds a tool or a peripheral to the turtle.
@@ -56,7 +59,7 @@ public interface ITurtleUpgrade
* @return The newly created peripheral. You may return null if this turtle is a Tool
* and this method is not expected to be called.
*/
- public IPeripheral createPeripheral(ITurtleAccess turtle, TurtleSide side);
+ public IPeripheral createPeripheral( ITurtleAccess turtle, TurtleSide side );
/**
* Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called
@@ -72,20 +75,20 @@ public interface ITurtleUpgrade
* a swinging animation. You may return 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, int direction);
+ public TurtleCommandResult useTool( ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction );
/**
- * Called to obtain the Icon to be used when rendering a turtle peripheral. Needs to be a "common"
- * type Icon for now, as there is no way to determine which texture sheet an Icon is from by the
- * Icon itself.
+ * Called to obtain the IIcon to be used when rendering a turtle peripheral. Needs to be a "common"
+ * type IIcon for now, as there is no way to determine which texture sheet an IIcon is from by the
+ * IIcon itself.
* @param turtle Access to the turtle that the peripheral resides on.
* @param side Which side of the turtle (left or right) the peripheral resides on.
- * @return The Icon that you wish to be used to render your turtle peripheral.
+ * @return The IIcon that you wish to be used to render your turtle peripheral.
*/
- public IIcon getIcon(ITurtleAccess turtle, TurtleSide side);
+ public IIcon getIcon( ITurtleAccess turtle, TurtleSide side );
/**
* TODO: Document me
*/
- public void update(ITurtleAccess turtle, TurtleSide side);
+ public void update( ITurtleAccess turtle, TurtleSide side );
}
diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java b/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java
index 7a94ae6f..f0f26fd0 100644
--- a/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java
+++ b/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java
@@ -8,12 +8,24 @@ package dan200.computercraft.api.turtle;
public final class TurtleCommandResult
{
- private static final TurtleCommandResult s_success = new TurtleCommandResult( true, null );
- private static final TurtleCommandResult s_emptyFailure = new TurtleCommandResult( false, null );
+ private static final TurtleCommandResult s_success = new TurtleCommandResult( true, null, null );
+ private static final TurtleCommandResult s_emptyFailure = new TurtleCommandResult( false, null, null );
public static TurtleCommandResult success()
{
- return s_success;
+ return success( null );
+ }
+
+ public static TurtleCommandResult success( Object[] results )
+ {
+ if( results == null || results.length == 0 )
+ {
+ return s_success;
+ }
+ else
+ {
+ return new TurtleCommandResult( true, null, results );
+ }
}
public static TurtleCommandResult failure()
@@ -23,23 +35,25 @@ public final class TurtleCommandResult
public static TurtleCommandResult failure( String errorMessage )
{
- if( errorMessage != null )
+ if( errorMessage == null )
{
- return new TurtleCommandResult( false, errorMessage );
+ return s_emptyFailure;
}
else
{
- return s_emptyFailure;
+ return new TurtleCommandResult( false, errorMessage, null );
}
}
private final boolean m_success;
private final String m_errorMessage;
+ private final Object[] m_results;
- private TurtleCommandResult( boolean success, String errorMessage )
+ private TurtleCommandResult( boolean success, String errorMessage, Object[] results )
{
m_success = success;
m_errorMessage = errorMessage;
+ m_results = results;
}
public boolean isSuccess()
@@ -51,4 +65,9 @@ public final class TurtleCommandResult
{
return m_errorMessage;
}
+
+ public Object[] getResults()
+ {
+ return m_results;
+ }
}
diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java b/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java
index d0a34710..ef84ee9b 100644
--- a/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java
+++ b/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java
@@ -9,7 +9,7 @@ package dan200.computercraft.api.turtle;
/**
* An enum representing the two different types of turtle that an ITurtleUpgrade
* implementation can add to a turtle.
- * @see dan200.computercraft.api.turtle.ITurtleUpgrade
+ * @see ITurtleUpgrade
*/
public enum TurtleUpgradeType
{
diff --git a/src/api/java/dan200/computercraft/api/turtle/package-info.java b/src/api/java/dan200/computercraft/api/turtle/package-info.java
new file mode 100644
index 00000000..13a832fc
--- /dev/null
+++ b/src/api/java/dan200/computercraft/api/turtle/package-info.java
@@ -0,0 +1,4 @@
+@API( owner="ComputerCraft", provides="ComputerCraft|API|Turtle", apiVersion="1.65" )
+package dan200.computercraft.api.turtle;
+
+import cpw.mods.fml.common.API;
diff --git a/src/main/java/thaumic/tinkerer/common/block/tile/TileAspectAnalyzer.java b/src/main/java/thaumic/tinkerer/common/block/tile/TileAspectAnalyzer.java
index d14f2a4d..1a2d5e00 100644
--- a/src/main/java/thaumic/tinkerer/common/block/tile/TileAspectAnalyzer.java
+++ b/src/main/java/thaumic/tinkerer/common/block/tile/TileAspectAnalyzer.java
@@ -169,7 +169,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
@Override
@Optional.Method(modid = "ComputerCraft")
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments){
switch (method) {
case 0:
return hasItemMethod();
diff --git a/src/main/java/thaumic/tinkerer/common/block/tile/TileGolemConnector.java b/src/main/java/thaumic/tinkerer/common/block/tile/TileGolemConnector.java
index 026554b6..48190e9b 100644
--- a/src/main/java/thaumic/tinkerer/common/block/tile/TileGolemConnector.java
+++ b/src/main/java/thaumic/tinkerer/common/block/tile/TileGolemConnector.java
@@ -2,6 +2,7 @@ package thaumic.tinkerer.common.block.tile;
import cpw.mods.fml.common.Optional;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import li.cil.oc.api.network.Arguments;
@@ -58,14 +59,14 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
return "tt_golemconnector";
}
- public Object[] getGolemDecorationsImplementation() throws Exception {
+ public Object[] getGolemDecorationsImplementation() throws LuaException {
if (golem == null || golem.decoration == null || golem.decoration.length() == 0)
return new String[]{ };
HashMap decorations = new HashMap();
for (int i = 0; i < golem.decoration.length(); i++) {
EnumGolemDecorations golemDec = EnumGolemDecorations.getFromChar(golem.decoration.charAt(i));
if (golemDec == null)
- throw new Exception("Golem is wearing unknown accessory: " + golem.decoration.charAt(i));
+ throw new LuaException("Golem is wearing unknown accessory: " + golem.decoration.charAt(i));
decorations.put((double) i, StatCollector.translateToLocal(golemDec.getName()));
}
@@ -73,7 +74,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
- public String[] getGolemCoreImplementation() throws Exception {
+ public String[] getGolemCoreImplementation() throws LuaException {
if (golem == null)
return new String[]{ };
if (golem.getCore() == -1)
@@ -81,7 +82,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
String[] decorations = new String[1];
EnumGolemCores golemCore = EnumGolemCores.getFromByte(golem.getCore());
if (golemCore == null)
- throw new Exception("Golem has Unknown core: " + golem.getCore());
+ throw new LuaException("Golem has Unknown core: " + golem.getCore());
decorations[0] = StatCollector.translateToLocal(golemCore.getName());
return decorations;
@@ -132,7 +133,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@Override
@Optional.Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
- int method, Object[] arguments) throws Exception {
+ int method, Object[] arguments) throws LuaException{
switch (method) {
case 0:
return getGolemDecorationsImplementation();
@@ -152,7 +153,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
return getHomeImplementation();
case 6:
if (arguments.length != 4)
- throw new Exception("Invalid arguments");
+ throw new LuaException("Invalid arguments");
double x = (Double) arguments[0];
double y = (Double) arguments[0];
double z = (Double) arguments[0];
@@ -162,25 +163,25 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
return getMarkersImplementation();
case 8:
if (arguments.length != 1)
- throw new Exception("setMarkers takes 1 argument");
+ throw new LuaException("setMarkers takes 1 argument");
return setMarkersImplementation((HashMap>) arguments[0]);
case 9:
return newMarkerImplementation();
case 10:
if (arguments.length != 1)
- throw new Exception("addMarker must have 1 argument");
+ throw new LuaException("addMarker must have 1 argument");
return addMarkerImplementation((Map) arguments[0]);
case 11:
if (arguments.length != 2)
- throw new Exception("saveMarker must have 2 arguments");
+ throw new LuaException("saveMarker must have 2 arguments");
return saveMarkerImplementation((Double) arguments[0], (Map) arguments[1]);
case 12:
if (arguments.length != 1)
- throw new Exception("deleteMarker must have 1 argument");
+ throw new LuaException("deleteMarker must have 1 argument");
return deleteMarkerImplementation((Double) arguments[0]);
case 13:
if (arguments.length != 1)
- throw new Exception("getMarker must have 1 argument");
+ throw new LuaException("getMarker must have 1 argument");
return getMarkerImplementation((Double) arguments[0]);
case 14:
return getMarkerCountImplementation();
@@ -197,34 +198,34 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
return new Object[]{ (double) markers.size() };
}
- private Object[] getMarkerImplementation(Double arguments) throws Exception {
+ private Object[] getMarkerImplementation(Double arguments) throws LuaException {
if (golem == null)
return new String[]{ };
ArrayList markers = golem.getMarkers();
if (markers == null || markers.size() <= arguments)
- throw new Exception("marker " + (int) (double) arguments + " does not exist");
+ throw new LuaException("marker " + (int) (double) arguments + " does not exist");
Marker mark = markers.get((int) (double) arguments);
return new Object[]{ fromMarkerImplementation(mark) };
}
- private Object[] deleteMarkerImplementation(double arguments) throws Exception {
+ private Object[] deleteMarkerImplementation(double arguments) throws LuaException {
if (golem == null)
return new String[]{ };
ArrayList markers = golem.getMarkers();
if (markers == null || markers.size() <= arguments)
- throw new Exception("marker " + (int) (double) arguments + " does not exist");
+ throw new LuaException("marker " + (int) (double) arguments + " does not exist");
markers.remove((int) (double) arguments);
golem.setMarkers(markers);
return new String[]{ };
}
- private Object[] saveMarkerImplementation(double markerNum, Map markerArg) throws Exception {
+ private Object[] saveMarkerImplementation(double markerNum, Map markerArg) throws LuaException {
if (golem == null)
return new String[]{ };
ArrayList markers = golem.getMarkers();
if (markers == null || markers.size() <= markerNum)
- throw new Exception("marker " + (int) (double) markerNum + " does not exist");
+ throw new LuaException("marker " + (int) (double) markerNum + " does not exist");
Marker mark = toMarkerImplementation(markerArg);
markers.set((int) (double) markerNum, mark);
golem.setMarkers(markers);
@@ -232,7 +233,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
@SuppressWarnings("unchecked")
- private Object[] addMarkerImplementation(Map arguments) throws Exception {
+ private Object[] addMarkerImplementation(Map arguments) throws LuaException {
if (golem == null)
return new String[]{ };
ArrayList markers = golem.getMarkers();
@@ -256,7 +257,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
@SuppressWarnings("unchecked")
- private Object[] setMarkersImplementation(Map arguments) throws Exception {
+ private Object[] setMarkersImplementation(Map arguments) throws LuaException {
if (golem == null)
return new String[]{ };
@@ -315,7 +316,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
return luaMarker;
}
- private Object[] setHomeImplementation(double x, double y, double z, double facing) throws Exception {
+ private Object[] setHomeImplementation(double x, double y, double z, double facing) throws LuaException {
if (golem == null)
return new String[]{ };
@@ -331,7 +332,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
return new Integer[]{ home.posX, home.posY, home.posZ, golem.homeFacing };
}
- private String[] getGolemTypeImplementation() throws Exception {
+ private String[] getGolemTypeImplementation() throws LuaException {
if (golem == null)
return new String[]{ };
switch (golem.getGolemType()) {
@@ -352,7 +353,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
case WOOD:
return new String[]{ "Wood" };
default:
- throw new Exception("Unknown Golem Type: " + golem.getGolemType());
+ throw new LuaException("Unknown Golem Type: " + golem.getGolemType());
}
}
@@ -384,7 +385,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@Callback(doc = "function():table -- Returns table of current decorations on golem")
@Optional.Method(modid = "OpenComputers")
- public Object[] getDecorations(Context context, Arguments args) throws Exception {
+ public Object[] getDecorations(Context context, Arguments args) throws LuaException {
return getGolemDecorationsImplementation();
}
@@ -396,79 +397,79 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@Callback(doc = "function():string -- Returns The golems type")
@Optional.Method(modid = "OpenComputers")
- public Object[] getType(Context context, Arguments args) throws Exception {
+ public Object[] getType(Context context, Arguments args) throws LuaException {
return getGolemTypeImplementation();
}
@Callback(doc = "function():number -- Returns The golems health")
@Optional.Method(modid = "OpenComputers")
- public Object[] getHealth(Context context, Arguments args) throws Exception {
+ public Object[] getHealth(Context context, Arguments args) throws LuaException {
return new Float[]{ golem.getHealth() };
}
@Callback(doc = "function():string -- Returns The golems core")
@Optional.Method(modid = "OpenComputers")
- public Object[] getCore(Context context, Arguments args) throws Exception {
+ public Object[] getCore(Context context, Arguments args) throws LuaException {
return getGolemCoreImplementation();
}
@Callback(doc = "function():x:number,y:number,z:number,facing:number -- Returns The golems home position")
@Optional.Method(modid = "OpenComputers")
- public Object[] getHome(Context context, Arguments args) throws Exception {
+ public Object[] getHome(Context context, Arguments args) throws LuaException {
return getHomeImplementation();
}
@Callback(doc = "function(x:number,y:number,z:number,facing:number):nill -- Sets The golems home position")
@Optional.Method(modid = "OpenComputers")
- public Object[] setHome(Context context, Arguments args) throws Exception {
+ public Object[] setHome(Context context, Arguments args) throws LuaException {
return setHomeImplementation(args.checkDouble(0), args.checkDouble(1), args.checkDouble(2), args.checkDouble(3));
}
@Callback(doc = "function():table -- Gets list of markers")
@Optional.Method(modid = "OpenComputers")
- public Object[] getMarkers(Context context, Arguments args) throws Exception {
+ public Object[] getMarkers(Context context, Arguments args) throws LuaException {
return getMarkersImplementation();
}
@Callback(doc = "function(list:table):table -- Sets list of markers")
@Optional.Method(modid = "OpenComputers")
- public Object[] setMarkers(Context context, Arguments args) throws Exception {
+ public Object[] setMarkers(Context context, Arguments args) throws LuaException {
return setMarkersImplementation(args.checkTable(0));
}
@Callback(doc = "function():table -- Returns a blank marker with sensible defaults")
@Optional.Method(modid = "OpenComputers")
- public Object[] newMarker(Context context, Arguments args) throws Exception {
+ public Object[] newMarker(Context context, Arguments args) throws LuaException {
return newMarkerImplementation();
}
@Callback(doc = "function(marker:table):table -- Adds the marker to the end of the marker list")
@Optional.Method(modid = "OpenComputers")
- public Object[] addMarker(Context context, Arguments args) throws Exception {
+ public Object[] addMarker(Context context, Arguments args) throws LuaException {
return addMarkerImplementation(args.checkTable(0));
}
@Callback(doc = "function(markerNum:number,marker:table):table -- saves current marker")
@Optional.Method(modid = "OpenComputers")
- public Object[] saveMarker(Context context, Arguments args) throws Exception {
+ public Object[] saveMarker(Context context, Arguments args) throws LuaException {
return saveMarkerImplementation((double) args.checkInteger(0), args.checkTable(0));
}
@Callback(doc = "function(markerNum:number):table -- Deletes marker number")
@Optional.Method(modid = "OpenComputers")
- public Object[] deleteMarker(Context context, Arguments args) throws Exception {
+ public Object[] deleteMarker(Context context, Arguments args) throws LuaException {
return deleteMarkerImplementation((double) args.checkInteger(0));
}
@Callback(doc = "function(markerNum:number):table -- gets a specific marker")
@Optional.Method(modid = "OpenComputers")
- public Object[] getMarker(Context context, Arguments args) throws Exception {
+ public Object[] getMarker(Context context, Arguments args) throws LuaException {
return getMarkerImplementation((double) args.checkInteger(0));
}
@Callback(doc = "function():number -- Returns number of markers")
@Optional.Method(modid = "OpenComputers")
- public Object[] getMarkerCount(Context context, Arguments args) throws Exception {
+ public Object[] getMarkerCount(Context context, Arguments args) throws LuaException {
return getMarkerCountImplementation();
}
diff --git a/src/main/java/thaumic/tinkerer/common/block/tile/TileMagnet.java b/src/main/java/thaumic/tinkerer/common/block/tile/TileMagnet.java
index 54e6bd4e..49de2fca 100644
--- a/src/main/java/thaumic/tinkerer/common/block/tile/TileMagnet.java
+++ b/src/main/java/thaumic/tinkerer/common/block/tile/TileMagnet.java
@@ -98,7 +98,7 @@ public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile,
@Override
@Optional.Method(modid = "ComputerCraft")
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
switch (method) {
case 0:
return new Object[]{ (getBlockMetadata() & 1) == 0 };
diff --git a/src/main/java/thaumic/tinkerer/common/block/tile/TileMobMagnet.java b/src/main/java/thaumic/tinkerer/common/block/tile/TileMobMagnet.java
index c8dd65fc..63c7c16b 100644
--- a/src/main/java/thaumic/tinkerer/common/block/tile/TileMobMagnet.java
+++ b/src/main/java/thaumic/tinkerer/common/block/tile/TileMobMagnet.java
@@ -17,6 +17,7 @@ package thaumic.tinkerer.common.block.tile;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Optional;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import li.cil.oc.api.network.Arguments;
import li.cil.oc.api.network.Callback;
@@ -204,7 +205,7 @@ public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTil
@Override
@Optional.Method(modid = "ComputerCraft")
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments){
switch (method) {
case 3:
return new Object[]{ adult };
diff --git a/src/main/java/thaumic/tinkerer/common/block/tile/tablet/TileAnimationTablet.java b/src/main/java/thaumic/tinkerer/common/block/tile/tablet/TileAnimationTablet.java
index 06dc10b8..c3a82aad 100644
--- a/src/main/java/thaumic/tinkerer/common/block/tile/tablet/TileAnimationTablet.java
+++ b/src/main/java/thaumic/tinkerer/common/block/tile/tablet/TileAnimationTablet.java
@@ -18,6 +18,7 @@ import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.Event;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import li.cil.oc.api.network.Arguments;
@@ -539,7 +540,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IMova
@Override
@Optional.Method(modid = "ComputerCraft")
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException{
switch (method) {
case 0:
return new Object[]{ redstone };
@@ -572,11 +573,11 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IMova
return new Object[]{ true };
}
- private Object[] setRotationImplementation(Double argument) throws Exception {
+ private Object[] setRotationImplementation(Double argument) throws LuaException {
int rotation = (int) argument.doubleValue();
if (rotation > 3)
- throw new Exception("Invalid value: " + rotation + ".");
+ throw new LuaException("Invalid value: " + rotation + ".");
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, rotation + 2, 1 | 2);
return null;
diff --git a/src/main/java/thaumic/tinkerer/common/block/tile/transvector/TileTransvectorInterface.java b/src/main/java/thaumic/tinkerer/common/block/tile/transvector/TileTransvectorInterface.java
index a3d0f6e6..92a6c7de 100644
--- a/src/main/java/thaumic/tinkerer/common/block/tile/transvector/TileTransvectorInterface.java
+++ b/src/main/java/thaumic/tinkerer/common/block/tile/transvector/TileTransvectorInterface.java
@@ -22,6 +22,7 @@ import cofh.api.energy.IEnergyHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import ic2.api.energy.tile.IEnergyAcceptor;
@@ -453,7 +454,7 @@ public class TileTransvectorInterface extends TileTransvector implements ISidedI
@Override
@Optional.Method(modid = "ComputerCraft")
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
return getTile() instanceof IPeripheral ? ((IPeripheral) getTile()).callMethod(computer, context, method, arguments) : new Object[0];
}
diff --git a/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java b/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java
index bbbdc839..8efb6449 100644
--- a/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java
+++ b/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java
@@ -23,6 +23,8 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
+import dan200.computercraft.api.ComputerCraftAPI;
+import dan200.computercraft.api.turtle.TurtleUpgradeType;
import li.cil.oc.api.Driver;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
@@ -30,12 +32,16 @@ import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-import net.minecraftforge.client.EnumHelperClient;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
+import thaumcraft.api.aspects.IEssentiaTransport;
import thaumcraft.api.wands.WandCap;
import thaumcraft.api.wands.WandRod;
+import thaumcraft.common.tiles.*;
import thaumic.tinkerer.common.ThaumicTinkerer;
+import thaumic.tinkerer.common.block.tile.TileFunnel;
+import thaumic.tinkerer.common.block.tile.TileRepairer;
+import thaumic.tinkerer.common.block.tile.transvector.TileTransvectorInterface;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.core.handler.kami.DimensionalShardDropHandler;
@@ -58,6 +64,7 @@ import thaumic.tinkerer.common.network.packet.kami.PacketToggleArmor;
import thaumic.tinkerer.common.network.packet.kami.PacketWarpGateButton;
import thaumic.tinkerer.common.network.packet.kami.PacketWarpGateTeleport;
import thaumic.tinkerer.common.peripheral.OpenComputers.*;
+import thaumic.tinkerer.common.peripheral.PeripheralHandler;
import thaumic.tinkerer.common.potion.ModPotions;
import thaumic.tinkerer.common.research.ResearchHelper;
@@ -147,7 +154,7 @@ public class TTCommonProxy {
}
protected void initCCPeripherals() {
- /*IPeripheralHandler handler = new PeripheralHandler();
+ PeripheralHandler handler = new PeripheralHandler();
Class[] peripheralClasses = new Class[] {
TileAlembic.class, TileCentrifuge.class, TileCrucible.class, TileFunnel.class,
@@ -156,10 +163,9 @@ public class TTCommonProxy {
TileDeconstructionTable.class, TileJarBrain.class, TileSensor.class, TileArcaneBore.class,IEssentiaTransport.class
};
// DUMMY CHANGE
- for(Class clazz : peripheralClasses)
- ComputerCraftAPI.registerExternalPeripheral(clazz, handler);
+ ComputerCraftAPI.registerPeripheralProvider(handler);
- TurtleAPI.registerUpgrade(new FumeTool());*/
+ //ComputerCraftAPI.registerTurtleUpgrade(new FumeTool());
}
@Optional.Method(modid = "OpenComputers")
diff --git a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneBore.java b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneBore.java
index 67ab178f..ea4c0aba 100644
--- a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneBore.java
+++ b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneBore.java
@@ -43,7 +43,7 @@ public class PeripheralArcaneBore implements IPeripheral {
}
@Override
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments){
ItemStack pickaxe = bore.getStackInSlot(1);
boolean nearBroken = pickaxe != null && pickaxe.getItemDamage() + 1 == pickaxe.getMaxDamage();
diff --git a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneEar.java b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneEar.java
index afb4cc85..6e8015f1 100644
--- a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneEar.java
+++ b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralArcaneEar.java
@@ -39,7 +39,7 @@ public class PeripheralArcaneEar implements IPeripheral {
}
@Override
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
if (method == 0) {
return new Object[]{ ear.note };
} else {
diff --git a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralAspectContainer.java b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralAspectContainer.java
index bdc20e0f..48a0eccb 100644
--- a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralAspectContainer.java
+++ b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralAspectContainer.java
@@ -42,7 +42,7 @@ public class PeripheralAspectContainer implements IPeripheral {
@Override
@Optional.Method(modid = "ComputerCraft")
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
switch (method) {
case 0: {
return IAspectContainerImplementation.getAspects(container);
diff --git a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralBrainInAJar.java b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralBrainInAJar.java
index 1216be65..0ca2d5af 100644
--- a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralBrainInAJar.java
+++ b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralBrainInAJar.java
@@ -39,7 +39,7 @@ public class PeripheralBrainInAJar implements IPeripheral {
}
@Override
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
return new Object[]{ jar.xp };
}
diff --git a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralDeconstructor.java b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralDeconstructor.java
index dfc8892b..21f7f6f3 100644
--- a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralDeconstructor.java
+++ b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralDeconstructor.java
@@ -39,7 +39,7 @@ public class PeripheralDeconstructor implements IPeripheral {
}
@Override
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
switch (method) {
case 0:
return new Object[]{ deconstructor.aspect != null };
diff --git a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralEssentiaTransport.java b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralEssentiaTransport.java
index 69b1b7f1..760f5acb 100644
--- a/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralEssentiaTransport.java
+++ b/src/main/java/thaumic/tinkerer/common/peripheral/PeripheralEssentiaTransport.java
@@ -2,6 +2,7 @@
package thaumic.tinkerer.common.peripheral;
import dan200.computercraft.api.lua.ILuaContext;
+import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraftforge.common.util.ForgeDirection;
@@ -35,7 +36,7 @@ public class PeripheralEssentiaTransport implements IPeripheral {
}
@Override
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
+ public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException {
switch (method) {
case 0:
return new Object[]{ pipe.isConnectable(ForgeDirection.getOrientation(GetDirection(arguments[0]))) };