Fixed gear shaft inverting rotation
This commit is contained in:
parent
ef4322338e
commit
84f2a90c02
6 changed files with 10 additions and 9 deletions
|
@ -461,8 +461,8 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inverseRotation(ForgeDirection dir)
|
public boolean inverseRotation(ForgeDirection dir, IMechanical with)
|
||||||
{
|
{
|
||||||
return dir != placementSide.getOpposite();
|
return !(with instanceof PartGearShaft);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -93,7 +93,8 @@ public class PartGearShaft extends PartMechanical
|
||||||
{
|
{
|
||||||
IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(checkDir.getOpposite());
|
IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(checkDir.getOpposite());
|
||||||
|
|
||||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this))
|
// Only connet to shafts outside of this block space.
|
||||||
|
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && instance instanceof PartGearShaft)
|
||||||
{
|
{
|
||||||
connections[checkDir.ordinal()] = instance;
|
connections[checkDir.ordinal()] = instance;
|
||||||
getNetwork().merge(instance.getNetwork());
|
getNetwork().merge(instance.getNetwork());
|
||||||
|
@ -155,9 +156,9 @@ public class PartGearShaft extends PartMechanical
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inverseRotation(ForgeDirection dir)
|
public boolean inverseRotation(ForgeDirection dir, IMechanical with)
|
||||||
{
|
{
|
||||||
return dir == placementSide;
|
return dir == placementSide.getOpposite() && !(with instanceof PartGearShaft);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@ public interface IMechanical extends IConnector<IMechanicalNetwork>
|
||||||
|
|
||||||
public float getRatio(ForgeDirection dir);
|
public float getRatio(ForgeDirection dir);
|
||||||
|
|
||||||
public boolean inverseRotation(ForgeDirection dir);
|
public boolean inverseRotation(ForgeDirection dir, IMechanical with);
|
||||||
|
|
||||||
public IMechanical getInstance(ForgeDirection dir);
|
public IMechanical getInstance(ForgeDirection dir);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
|
||||||
float ratio = adjacentMech.getRatio(dir) / mechanical.getRatio(dir.getOpposite());
|
float ratio = adjacentMech.getRatio(dir) / mechanical.getRatio(dir.getOpposite());
|
||||||
long torque = mechanical.getTorque();
|
long torque = mechanical.getTorque();
|
||||||
|
|
||||||
boolean inverseRotation = mechanical.inverseRotation(dir) && adjacentMech.inverseRotation(dir.getOpposite());
|
boolean inverseRotation = mechanical.inverseRotation(dir, adjacentMech)|| adjacentMech.inverseRotation(dir.getOpposite(), mechanical);
|
||||||
|
|
||||||
int inversion = inverseRotation ? -1 : 1;
|
int inversion = inverseRotation ? -1 : 1;
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inverseRotation(ForgeDirection dir)
|
public boolean inverseRotation(ForgeDirection dir, IMechanical with)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class TraitMechanical extends TileMultipart implements IMechanical
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inverseRotation(ForgeDirection dir)
|
public boolean inverseRotation(ForgeDirection dir, IMechanical with)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue