Fixed NPE in Return Command

This commit is contained in:
Henry Mao 2013-01-26 22:04:56 +08:00
parent 2059523e28
commit 4761d8d826
2 changed files with 10 additions and 16 deletions

View file

@ -8,7 +8,6 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import universalelectricity.prefab.tile.TileEntityAdvanced;

View file

@ -2,10 +2,10 @@ package assemblyline.common.machine.command;
public class CommandReturn extends Command
{
public static final float IDLE_ROTATION_PITCH = 0;
public static final float IDLE_ROTATION_YAW = 0;
public static final float IDLE_ROTATION_PITCH = 0;
public static final float IDLE_ROTATION_YAW = 0;
private CommandRotateTo rotateToCommand;
private CommandRotateTo rotateToCommand;
@Override
public void onTaskStart()
@ -13,29 +13,24 @@ public class CommandReturn extends Command
this.rotateToCommand = (CommandRotateTo) this.commandManager.getNewCommand(this.tileEntity, CommandRotateTo.class, new String[] { "0", "0" });
this.rotateToCommand.onTaskStart();
}
@Override
protected boolean doTask()
{
if (this.rotateToCommand == null)
{
this.onTaskStart();
}
return this.rotateToCommand.doTask();
}
@Override
public void onTaskEnd()
{
this.rotateToCommand.onTaskEnd();
}
/*
* @Override protected boolean doTask() { /** Move the arm rotation to idle position if the machine is not idling
*
* if (Math.abs(this.tileEntity.rotationPitch - IDLE_ROTATION_PITCH) > 0.01 || Math.abs(this.tileEntity.rotationYaw - IDLE_ROTATION_YAW) > 0.01) { if (Math.abs(IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) > 0.125) this.tileEntity.rotationPitch += (IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) * 0.05; else this.tileEntity.rotationPitch += Math.signum(IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) * (0.125 * 0.05); if (Math.abs(this.tileEntity.rotationPitch - IDLE_ROTATION_PITCH) < 0.0125) this.tileEntity.rotationPitch = IDLE_ROTATION_PITCH;
*
* if (Math.abs(IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) > 0.125) this.tileEntity.rotationYaw += (IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) * 0.05; else this.tileEntity.rotationYaw += Math.signum(IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) * (0.125 * 0.05); if (Math.abs(this.tileEntity.rotationYaw - IDLE_ROTATION_YAW) < 0.0125) this.tileEntity.rotationYaw = IDLE_ROTATION_YAW; return true; }
*
* return false; }
*/
@Override
public String toString()
{