Posted 13 March 2012 - 10:57 PM
Well, I'm just buggy with a "challange" that Casper gave me: make a directory be accessible in the whole world with a peripheral. I'm trying to do that, and, I need some help. I want to make it so, the user input the desiredLocation, and the path. If you want to check out the code, take a look:
I'd appreciate any help and, you will be credited when I release my peripheral.
package rockymc.network;
import net.minecraft.src.TileEntity;
import dan200.computer.api.*;
public class TileEntityNetwork extends TileEntity implements IPeripheral
{
public IComputerAccess Computer;
boolean writeOnly = false;
String desiredLocation;
String path;
public synchronized void detach(IComputerAccess icomputeraccess) // tried sync and without
{
Computer.queueEvent("network_detach");
}
public void attach(IComputerAccess icomputeraccess, String s)
{
Computer.queueEvent("network_attach");
}
public String getType() {
return "Mounts the specified directory in ComputerCraft.";
}
public String[] getMethodNames()
{
return (new String[] { "mountDir" });
}
public Object[] callMethod(IComputerAccess icomputeraccess, int i, Object aobj[])
throws Exception
{
if (i == 0)
{
return (new Object[] {Computer.mountFixedDir(desiredLocation, path, writeOnly)});
}
return null;
}
public boolean canAttachToSide(int i)
{
return true;
}
}
I'd appreciate any help and, you will be credited when I release my peripheral.