Added the start of the craneManager

this will be used to control and assist in the movement of the crane.
Will still have to create something seperate to do commands but this
will be used to move the crane.
This commit is contained in:
Rseifert 2013-02-06 14:56:14 -05:00
parent 2fd1bdb688
commit 69affcca09

View file

@ -0,0 +1,51 @@
package assemblyline.common.machine.crane;
import assemblyline.common.AssemblyLine;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
/**
* Manager of crane movement, mapping, setup, but not AI
* @author Rseifert
*
*/
public class CraneManager
{
protected int ticks = 0;
/** Limits of how far the crane can move on a 2D plane */
public int maxLimitX, minLimitY,maxLimitZ, minLimitZ;
public World world;
public CraneManager()
{
}
/**
* maps out the rail system that the crane will use for movement
*/
public void mapRails()
{
//TODO figure out what i'm going to use as the center point of this mapping first
}
/**
* finds if the rail at this location is a rail and lines up with the current direction of the rails
*
* @return true if the rail is good to use
*/
public boolean isValidRail(World world, Vector3 loc, ForgeDirection dir)
{
int id = world.getBlockId(loc.intX(), loc.intY(), loc.intZ());
int meta = world.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
ForgeDirection facing = ForgeDirection.getOrientation(meta);
if (id == AssemblyLine.blockCraneParts.blockID && (dir == facing || dir == facing.getOpposite()))
{
return true;
}
else
{
return false;
}
}
}