Cleaned up gear packages moving a few things around
This commit is contained in:
parent
00b5f8b559
commit
6c42ba4342
10 changed files with 4 additions and 124 deletions
|
@ -2,7 +2,7 @@ package resonantinduction.mechanical;
|
||||||
|
|
||||||
import resonantinduction.mechanical.fluid.pipe.PartPipe;
|
import resonantinduction.mechanical.fluid.pipe.PartPipe;
|
||||||
import resonantinduction.mechanical.gear.PartGear;
|
import resonantinduction.mechanical.gear.PartGear;
|
||||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
import resonantinduction.mechanical.gearshaft.PartGearShaft;
|
||||||
import codechicken.multipart.MultiPartRegistry;
|
import codechicken.multipart.MultiPartRegistry;
|
||||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||||
import codechicken.multipart.MultipartGenerator;
|
import codechicken.multipart.MultipartGenerator;
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
package resonantinduction.mechanical.gear;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import resonant.lib.utility.WorldUtility;
|
|
||||||
import universalelectricity.api.vector.Vector3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for testing. NO-OP
|
|
||||||
*
|
|
||||||
* @author Calclavia
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public abstract class ConnectionLogic
|
|
||||||
{
|
|
||||||
protected final Vector3 self;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Relative coordinates of connections allowed.
|
|
||||||
*/
|
|
||||||
protected HashMap<Vector3, ForgeDirection> connections = new HashMap<Vector3, ForgeDirection>();
|
|
||||||
|
|
||||||
public ConnectionLogic(Vector3 self)
|
|
||||||
{
|
|
||||||
this.self = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param rotation
|
|
||||||
* @param other
|
|
||||||
* @param from - Incoming direction
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean canConnect(ForgeDirection rotation, Vector3 other, ForgeDirection from)
|
|
||||||
{
|
|
||||||
Vector3 relative = other.clone().subtract(self);
|
|
||||||
Vector3 rotated = relative.clone();
|
|
||||||
WorldUtility.rotateVectorFromDirection(rotated, rotation);
|
|
||||||
rotated = rotated.round();
|
|
||||||
|
|
||||||
Vector3 fromDir = new Vector3(from);
|
|
||||||
WorldUtility.rotateVectorFromDirection(fromDir, rotation);
|
|
||||||
fromDir = fromDir.round();
|
|
||||||
|
|
||||||
return connections.get(rotated) == fromDir.toForgeDirection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* By default, gears are facing UP, on the DOWN face.
|
|
||||||
*/
|
|
||||||
public static class ConnectionGearSmall extends ConnectionLogic
|
|
||||||
{
|
|
||||||
public ConnectionGearSmall(Vector3 self)
|
|
||||||
{
|
|
||||||
super(self);
|
|
||||||
|
|
||||||
// Flat connection
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
|
||||||
{
|
|
||||||
if (dir != ForgeDirection.UP)
|
|
||||||
{
|
|
||||||
connections.put(new Vector3(dir), dir);
|
|
||||||
connections.put(new Vector3(), dir.getOpposite());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ConnectionGearLarge extends ConnectionLogic
|
|
||||||
{
|
|
||||||
public ConnectionGearLarge(Vector3 self)
|
|
||||||
{
|
|
||||||
super(self);
|
|
||||||
|
|
||||||
// Flat connection and side connections
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
|
||||||
{
|
|
||||||
if (dir != ForgeDirection.UP)
|
|
||||||
connections.put(new Vector3(dir), dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonant.api.grid.INodeProvider;
|
import resonant.api.grid.INodeProvider;
|
||||||
import resonantinduction.core.interfaces.IMechanicalNode;
|
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||||
|
import resonantinduction.mechanical.gearshaft.PartGearShaft;
|
||||||
import codechicken.lib.vec.Rotation;
|
import codechicken.lib.vec.Rotation;
|
||||||
import codechicken.multipart.TMultiPart;
|
import codechicken.multipart.TMultiPart;
|
||||||
import codechicken.multipart.TileMultipart;
|
import codechicken.multipart.TileMultipart;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.core.prefab.part.IHighlight;
|
import resonantinduction.core.prefab.part.IHighlight;
|
||||||
|
import resonantinduction.mechanical.gearshaft.PartGearShaft;
|
||||||
import codechicken.lib.vec.BlockCoord;
|
import codechicken.lib.vec.BlockCoord;
|
||||||
import codechicken.lib.vec.Vector3;
|
import codechicken.lib.vec.Vector3;
|
||||||
import codechicken.microblock.FacePlacementGrid$;
|
import codechicken.microblock.FacePlacementGrid$;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import resonant.api.grid.INodeProvider;
|
||||||
import resonantinduction.core.interfaces.IMechanicalNode;
|
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||||
import resonantinduction.mechanical.gear.PartGear;
|
import resonantinduction.mechanical.gear.PartGear;
|
||||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
|
||||||
|
|
||||||
public class GearShaftNode extends MechanicalNode
|
public class GearShaftNode extends MechanicalNode
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.core.prefab.part.IHighlight;
|
import resonantinduction.core.prefab.part.IHighlight;
|
||||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
|
||||||
import codechicken.lib.vec.BlockCoord;
|
import codechicken.lib.vec.BlockCoord;
|
||||||
import codechicken.lib.vec.Vector3;
|
import codechicken.lib.vec.Vector3;
|
||||||
import codechicken.multipart.JItemMultiPart;
|
import codechicken.multipart.JItemMultiPart;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package resonantinduction.mechanical.gear;
|
package resonantinduction.mechanical.gearshaft;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -8,8 +8,6 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.mechanical.Mechanical;
|
import resonantinduction.mechanical.Mechanical;
|
||||||
import resonantinduction.mechanical.energy.grid.PartMechanical;
|
import resonantinduction.mechanical.energy.grid.PartMechanical;
|
||||||
import resonantinduction.mechanical.gearshaft.GearShaftNode;
|
|
||||||
import resonantinduction.mechanical.gearshaft.RenderGearShaft;
|
|
||||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||||
import codechicken.lib.vec.Cuboid6;
|
import codechicken.lib.vec.Cuboid6;
|
||||||
import codechicken.lib.vec.Vector3;
|
import codechicken.lib.vec.Vector3;
|
|
@ -11,7 +11,6 @@ import org.lwjgl.opengl.GL11;
|
||||||
import resonant.api.items.ISimpleItemRenderer;
|
import resonant.api.items.ISimpleItemRenderer;
|
||||||
import resonant.lib.render.RenderUtility;
|
import resonant.lib.render.RenderUtility;
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package resonantinduction.mechanical.gearshaft;
|
|
||||||
|
|
||||||
import resonant.lib.grid.NodeGrid;
|
|
||||||
|
|
||||||
public class ShaftGrid extends NodeGrid<ShaftSubNode>
|
|
||||||
{
|
|
||||||
public ShaftGrid(ShaftSubNode node)
|
|
||||||
{
|
|
||||||
super(ShaftSubNode.class);
|
|
||||||
add(node);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package resonantinduction.mechanical.gearshaft;
|
|
||||||
|
|
||||||
import resonant.api.grid.INodeProvider;
|
|
||||||
import resonant.lib.grid.Node;
|
|
||||||
import resonantinduction.mechanical.gear.PartGearShaft;
|
|
||||||
|
|
||||||
public class ShaftSubNode extends Node<INodeProvider, ShaftGrid, ShaftSubNode>
|
|
||||||
{
|
|
||||||
public ShaftSubNode(PartGearShaft parent)
|
|
||||||
{
|
|
||||||
super(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ShaftGrid newGrid()
|
|
||||||
{
|
|
||||||
return new ShaftGrid(this);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue