Fixed gears interacting with shafts on wrong axis

This commit is contained in:
Calclavia 2014-02-21 20:47:07 +08:00
parent efd7eab534
commit 15ff0bfc6a
2 changed files with 10 additions and 1 deletions

View file

@ -448,7 +448,8 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
{
if (source instanceof PartGearShaft)
{
return ((PartGearShaft) source).tile().partMap(from.getOpposite().ordinal()) == this;
PartGearShaft shaft = (PartGearShaft) source;
return shaft.tile().partMap(from.getOpposite().ordinal()) == this && Math.abs(shaft.placementSide.offsetX) == Math.abs(placementSide.offsetX) && Math.abs(shaft.placementSide.offsetY) == Math.abs(placementSide.offsetY) && Math.abs(shaft.placementSide.offsetZ) == Math.abs(placementSide.offsetZ);
}
else if (source instanceof PartGear)
{

View file

@ -136,6 +136,14 @@ public class PartGearShaft extends PartMechanical
@Override
public boolean canConnect(ForgeDirection from, Object source)
{
if (source instanceof PartGear)
{
PartGear gear = (PartGear) source;
if (!(Math.abs(gear.placementSide.offsetX) == Math.abs(placementSide.offsetX) && Math.abs(gear.placementSide.offsetY) == Math.abs(placementSide.offsetY) && Math.abs(gear.placementSide.offsetZ) == Math.abs(placementSide.offsetZ)))
return false;
}
return from == placementSide || from == placementSide.getOpposite();
}