Tried fixing ArmBot again...
This commit is contained in:
parent
5c5f4395bb
commit
7a048652ac
2 changed files with 24 additions and 18 deletions
|
@ -59,7 +59,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
public double wattsReceived = 0;
|
public double wattsReceived = 0;
|
||||||
|
|
||||||
private int playerUsing = 0;
|
private int playerUsing = 0;
|
||||||
|
|
||||||
private int computersAttached = 0;
|
private int computersAttached = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,8 +119,6 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
|
|
||||||
if (this.disk == null && this.computersAttached == 0)
|
if (this.disk == null && this.computersAttached == 0)
|
||||||
{
|
{
|
||||||
this.commandManager.clear();
|
|
||||||
|
|
||||||
if (this.grabbedEntities.size() > 0)
|
if (this.grabbedEntities.size() > 0)
|
||||||
{
|
{
|
||||||
this.commandManager.addCommand(this, CommandDrop.class);
|
this.commandManager.addCommand(this, CommandDrop.class);
|
||||||
|
@ -128,8 +126,12 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!this.commandManager.hasTasks())
|
if (!this.commandManager.hasTasks())
|
||||||
|
{
|
||||||
if (Math.abs(this.rotationYaw - CommandReturn.IDLE_ROTATION_YAW) > 0.01)
|
if (Math.abs(this.rotationYaw - CommandReturn.IDLE_ROTATION_YAW) > 0.01)
|
||||||
|
{
|
||||||
this.commandManager.addCommand(this, CommandReturn.class);
|
this.commandManager.addCommand(this, CommandReturn.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.commandManager.setCurrentTask(0);
|
this.commandManager.setCurrentTask(0);
|
||||||
|
@ -457,6 +459,10 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.commandManager.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -500,7 +506,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
{
|
{
|
||||||
double angle = (Double) arguments[0];
|
double angle = (Double) arguments[0];
|
||||||
this.commandManager.addCommand(this, CommandRotate.class, new String[] { Double.toString(angle) });
|
this.commandManager.addCommand(this, CommandRotate.class, new String[] { Double.toString(angle) });
|
||||||
while(this.commandManager.hasTasks())
|
while (this.commandManager.hasTasks())
|
||||||
{
|
{
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
}
|
}
|
||||||
|
@ -526,10 +532,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
double angle = (Double) arguments[0];
|
double angle = (Double) arguments[0];
|
||||||
double diff = angle - this.rotationYaw;
|
double diff = angle - this.rotationYaw;
|
||||||
this.commandManager.addCommand(this, CommandRotate.class, new String[] { Double.toString(diff) });
|
this.commandManager.addCommand(this, CommandRotate.class, new String[] { Double.toString(diff) });
|
||||||
while(this.commandManager.hasTasks())
|
while (this.commandManager.hasTasks());
|
||||||
{
|
|
||||||
Thread.sleep(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -546,19 +549,11 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
||||||
case 2: // grab: grabs an item
|
case 2: // grab: grabs an item
|
||||||
{
|
{
|
||||||
this.commandManager.addCommand(this, CommandGrab.class);
|
this.commandManager.addCommand(this, CommandGrab.class);
|
||||||
while(this.commandManager.hasTasks())
|
|
||||||
{
|
|
||||||
Thread.sleep(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // drop: drops an item
|
case 3: // drop: drops an item
|
||||||
{
|
{
|
||||||
this.commandManager.addCommand(this, CommandDrop.class);
|
this.commandManager.addCommand(this, CommandDrop.class);
|
||||||
while(this.commandManager.hasTasks())
|
|
||||||
{
|
|
||||||
Thread.sleep(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: // reset: calls the RETURN command
|
case 4: // reset: calls the RETURN command
|
||||||
|
|
|
@ -3,6 +3,8 @@ package assemblyline.common.machine.command;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.nbt.NBTTagString;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||||
|
|
||||||
|
@ -121,7 +123,7 @@ public abstract class Command
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +132,15 @@ public abstract class Command
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound taskCompound)
|
public void writeToNBT(NBTTagCompound taskCompound)
|
||||||
{
|
{
|
||||||
|
NBTTagCompound tileEntityNBT = new NBTTagCompound();
|
||||||
|
this.tileEntity.writeToNBT(tileEntityNBT);
|
||||||
|
taskCompound.setCompoundTag("tileEntity", tileEntityNBT);
|
||||||
|
taskCompound.setInteger("ticks", this.ticks);
|
||||||
|
NBTTagList parList = new NBTTagList();
|
||||||
|
for (String parameter : this.parameters)
|
||||||
|
{
|
||||||
|
parList.appendTag(new NBTTagString(parameter));
|
||||||
|
}
|
||||||
|
taskCompound.setTag("parameters", parList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue