Fixed setVelocity null point exception
This commit is contained in:
parent
84f2a90c02
commit
a0ec8a83c0
3 changed files with 9 additions and 7 deletions
|
@ -93,7 +93,7 @@ public class PartGearShaft extends PartMechanical
|
||||||
{
|
{
|
||||||
IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(checkDir.getOpposite());
|
IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(checkDir.getOpposite());
|
||||||
|
|
||||||
// Only connet to shafts outside of this block space.
|
// Only connect to shafts outside of this block space.
|
||||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && instance instanceof PartGearShaft)
|
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && instance instanceof PartGearShaft)
|
||||||
{
|
{
|
||||||
connections[checkDir.ordinal()] = instance;
|
connections[checkDir.ordinal()] = instance;
|
||||||
|
|
|
@ -62,8 +62,8 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
System.out.println(this + ":" + getNetwork());
|
System.out.println(this + ":" + getNetwork());
|
||||||
for(Object obj : connections)
|
for (Object obj : connections)
|
||||||
System.out.println(obj);
|
System.out.println(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -263,7 +263,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
@Override
|
@Override
|
||||||
public void setAngularVelocity(float velocity)
|
public void setAngularVelocity(float velocity)
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
if (world() != null && !world().isRemote)
|
||||||
this.angularVelocity = velocity;
|
this.angularVelocity = velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
@Override
|
@Override
|
||||||
public void setTorque(long torque)
|
public void setTorque(long torque)
|
||||||
{
|
{
|
||||||
if (!world().isRemote)
|
if (world() != null && !world().isRemote)
|
||||||
this.torque = torque;
|
this.torque = torque;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package resonantinduction.mechanical.network;
|
package resonantinduction.mechanical.network;
|
||||||
|
|
||||||
|
import resonantinduction.mechanical.gear.PartGearShaft;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
@ -46,7 +47,7 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
||||||
|
|
||||||
protected float getLoad()
|
protected float getLoad()
|
||||||
{
|
{
|
||||||
return 0.9f;
|
return 0.95f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,7 +70,8 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
||||||
{
|
{
|
||||||
IMechanical mech = ((IMechanical) tile).getInstance(dir.getOpposite());
|
IMechanical mech = ((IMechanical) tile).getInstance(dir.getOpposite());
|
||||||
|
|
||||||
if (mech != null && canConnect(dir, this) && mech.canConnect(dir.getOpposite(), this))
|
// Don't connect with shafts
|
||||||
|
if (mech != null && !(mech instanceof PartGearShaft) && canConnect(dir, this) && mech.canConnect(dir.getOpposite(), this))
|
||||||
{
|
{
|
||||||
connections[dir.ordinal()] = mech;
|
connections[dir.ordinal()] = mech;
|
||||||
getNetwork().merge(mech.getNetwork());
|
getNetwork().merge(mech.getNetwork());
|
||||||
|
|
Loading…
Reference in a new issue