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) if (node != null)
{ {
node.update(0.05f); node.update(0.05f);
if (!isInversed) if (!isInversed)
{ {
receiveMechanical(); receiveMechanical();

View file

@ -32,7 +32,8 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISim
RenderUtility.rotateBlockBasedOnDirectionUp(tile.getDirection()); 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); GL11.glRotatef((float) Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
render(tile.tier, tile.multiBlockRadius, tile.getMultiBlock().isConstructed()); render(tile.tier, tile.multiBlockRadius, tile.getMultiBlock().isConstructed());

View file

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

View file

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