Fixed turbine render and connection

This commit is contained in:
Calclavia 2014-06-20 17:27:50 -07:00
parent 0daba1a577
commit d595490009
4 changed files with 33 additions and 29 deletions

View file

@ -61,7 +61,8 @@ public class TileMotor extends TileElectrical implements IRotatable, INodeProvid
if (node != null)
{
node.update(0.05f);
node.update(0.05f);
if (!isInversed)
{
receiveMechanical();

View file

@ -32,7 +32,8 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISim
RenderUtility.rotateBlockBasedOnDirectionUp(tile.getDirection());
GL11.glTranslatef(0, -0.35f, 0);
GL11.glTranslatef(0, 0.35f, 0);
GL11.glRotatef(180, 1, 0, 0);
GL11.glRotatef((float) Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
render(tile.tier, tile.multiBlockRadius, tile.getMultiBlock().isConstructed());

View file

@ -22,7 +22,6 @@ public class TileWindTurbine extends TileTurbine
private float efficiency = 0;
private long windPower = 0;
@Override
public void updateEntity()

View file

@ -4,36 +4,39 @@ import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.interfaces.IMechanicalNode;
import resonantinduction.mechanical.energy.grid.MechanicalNode;
/** Turbine's Mechanical node
*
* @author Calclavia, Darkguardsman */
/**
* Turbine's Mechanical node
* Turbines always face forward and connect from behind.
*
* @author Calclavia, Darkguardsman
*/
public class TurbineNode extends MechanicalNode
{
public TurbineNode(TileTurbine tileTurbineBase)
{
super(tileTurbineBase);
}
public TurbineNode(TileTurbine tileTurbineBase)
{
super(tileTurbineBase);
}
public TileTurbine turbine()
{
return (TileTurbine) getParent();
}
public TileTurbine turbine()
{
return (TileTurbine) getParent();
}
@Override
public boolean canConnect(ForgeDirection from, Object source)
{
return turbine().getMultiBlock().isPrimary() && source instanceof MechanicalNode && !(source instanceof TurbineNode) && from == turbine().getDirection().getOpposite();
}
@Override
public boolean canConnect(ForgeDirection from, Object source)
{
return turbine().getMultiBlock().isPrimary() && source instanceof MechanicalNode && !(source instanceof TurbineNode) && from == turbine().getDirection().getOpposite();
}
@Override
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
{
return dir == turbine().getDirection().getOpposite();
}
@Override
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
{
return dir == turbine().getDirection().getOpposite();
}
@Override
public float getRatio(ForgeDirection dir, IMechanicalNode with)
{
return turbine().getMultiBlock().isConstructed() ? turbine().multiBlockRadius - 0.5f : 0.5f;
}
@Override
public float getRatio(ForgeDirection dir, IMechanicalNode with)
{
return turbine().getMultiBlock().isConstructed() ? turbine().multiBlockRadius - 0.5f : 0.5f;
}
}