Fixed MechanicalNode using TMultiPart regardless of what the parent class type

This commit is contained in:
Robert S 2014-06-10 20:25:28 -04:00
parent 07e7170e82
commit 9c8fc0370e
2 changed files with 13 additions and 1 deletions

View file

@ -369,18 +369,30 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
@Override @Override
public double z() public double z()
{ {
if(this.getParent() instanceof TileEntity)
{
return ((TileEntity)this.getParent()).zCoord;
}
return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).z() : 0; return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).z() : 0;
} }
@Override @Override
public double x() public double x()
{ {
if(this.getParent() instanceof TileEntity)
{
return ((TileEntity)this.getParent()).xCoord;
}
return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).x() : 0; return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).x() : 0;
} }
@Override @Override
public double y() public double y()
{ {
if(this.getParent() instanceof TileEntity)
{
return ((TileEntity)this.getParent()).yCoord;
}
return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).y() : 0; return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).y() : 0;
} }
} }

View file

@ -55,7 +55,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
} }
//Make sure to update on both sides //Make sure to update on both sides
this.node.update(0.05f); this.node.update();
if (!world().isRemote) if (!world().isRemote)
{ {