From 69affcca0980dd2df62363ccaa153e90c5e325f4 Mon Sep 17 00:00:00 2001 From: Rseifert Date: Wed, 6 Feb 2013 14:56:14 -0500 Subject: [PATCH] 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. --- .../common/machine/crane/CraneManager.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/minecraft/assemblyline/common/machine/crane/CraneManager.java diff --git a/src/minecraft/assemblyline/common/machine/crane/CraneManager.java b/src/minecraft/assemblyline/common/machine/crane/CraneManager.java new file mode 100644 index 00000000..b6bb0941 --- /dev/null +++ b/src/minecraft/assemblyline/common/machine/crane/CraneManager.java @@ -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; + } + } +}