From 15ff0bfc6a3dcff259d5e78206eb288a00dbfabd Mon Sep 17 00:00:00 2001 From: Calclavia Date: Fri, 21 Feb 2014 20:47:07 +0800 Subject: [PATCH] Fixed gears interacting with shafts on wrong axis --- .../java/resonantinduction/mechanical/gear/PartGear.java | 3 ++- .../resonantinduction/mechanical/gear/PartGearShaft.java | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java b/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java index a31463504..b212b0584 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java @@ -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) { diff --git a/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java b/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java index 8af166321..8027ed35e 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java @@ -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(); }