Spinning stuff!

This commit is contained in:
Aidan C. Brady 2014-02-01 14:19:47 -05:00
parent 214be2bbba
commit 228e550baa
3 changed files with 28 additions and 1 deletions

View file

@ -305,6 +305,19 @@ public class ModelChemicalCrystalizer extends ModelBase
MekanismRenderer.blendOff();
}
public void renderWithRotation(float size, float rotate)
{
rotate *= Math.PI;
Spin.rotateAngleY = rotate;
Vial1.rotateAngleY = rotate;
Vial2.rotateAngleY = rotate;
Vial3.rotateAngleY = rotate;
Vial4.rotateAngleY = rotate;
render(size);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;

View file

@ -36,9 +36,19 @@ public class RenderChemicalCrystalizer extends TileEntitySpecialRenderer
case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
}
if(tileEntity.isActive)
{
tileEntity.spinSpeed = Math.min(1, tileEntity.spinSpeed+0.01F);
}
else {
tileEntity.spinSpeed = Math.max(0, tileEntity.spinSpeed-0.02F);
}
tileEntity.spin = (tileEntity.spin + (tileEntity.spinSpeed*0.1F)) % 1;
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F);
model.renderWithRotation(0.0625F, tileEntity.spin);
GL11.glPopMatrix();
}
}

View file

@ -60,6 +60,10 @@ public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock imple
public double prevEnergy;
public float spinSpeed;
public float spin;
public final double ENERGY_USAGE = Mekanism.chemicalCrystalizerUsage;
/** This machine's current RedstoneControl type. */