Fixed turbine's mech node not updating
This commit is contained in:
parent
72b268611a
commit
63918f16b3
1 changed files with 79 additions and 122 deletions
|
@ -1,14 +1,12 @@
|
|||
package resonantinduction.mechanical.energy.turbine;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INode;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonant.lib.network.Synced;
|
||||
import resonant.lib.network.Synced.SyncedInput;
|
||||
import resonant.lib.network.Synced.SyncedOutput;
|
||||
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
|
||||
//TODO: MC 1.7, merge turbines in.
|
||||
|
@ -21,46 +19,6 @@ public class TileMechanicalTurbine extends TileTurbineBase implements INodeProvi
|
|||
|
||||
protected double prevAngularVelocity;
|
||||
|
||||
protected class TurbineNode extends MechanicalNode
|
||||
{
|
||||
public TurbineNode(INodeProvider parent)
|
||||
{
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
{
|
||||
if (source instanceof MechanicalNode && !(source instanceof TileMechanicalTurbine))
|
||||
{
|
||||
/**
|
||||
* Face to face stick connection.
|
||||
*/
|
||||
TileEntity sourceTile = position().translate(from).getTileEntity(getWorld());
|
||||
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = (MechanicalNode) ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
return sourceInstance == source && from == getDirection().getOpposite();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
|
||||
{
|
||||
return dir == getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRatio(ForgeDirection dir, IMechanicalNode with)
|
||||
{
|
||||
return getMultiBlock().isConstructed() ? multiBlockRadius - 0.5f : 0.5f;
|
||||
}
|
||||
};
|
||||
|
||||
public TileMechanicalTurbine()
|
||||
{
|
||||
super();
|
||||
|
@ -84,6 +42,7 @@ public class TileMechanicalTurbine extends TileTurbineBase implements INodeProvi
|
|||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
mechanicalNode.update(0.05f);
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
renderAngularVelocity = (double) mechanicalNode.angularVelocity;
|
||||
|
@ -137,9 +96,7 @@ public class TileMechanicalTurbine extends TileTurbineBase implements INodeProvi
|
|||
mechanicalNode.load(nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
/** Writes a tile entity to NBT. */
|
||||
@Override
|
||||
@SyncedOutput
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
|
|
Loading…
Reference in a new issue