Fixed contractor spinning

This commit is contained in:
Aidan Brady 2013-08-04 18:02:07 -04:00
parent 7c9bc8bb8d
commit a2d955d6a3
3 changed files with 17 additions and 9 deletions

View file

@ -5,7 +5,8 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelEMContractor extends ModelBase
{
// fields
public boolean doSpin;
ModelRenderer frame1;
ModelRenderer frame2;
ModelRenderer frame3;
@ -37,8 +38,10 @@ public class ModelEMContractor extends ModelBase
ModelRenderer poletop4;
ModelRenderer nase_depth2;
public ModelEMContractor()
public ModelEMContractor(boolean spin)
{
doSpin = spin;
textureWidth = 128;
textureHeight = 128;
@ -224,9 +227,9 @@ public class ModelEMContractor extends ModelBase
setRotation(nase_depth2, 0F, 0F, 0F);
}
public void render(float f5, boolean rotate)
public void render(float f5)
{
if (rotate)
if (doSpin)
{
Coil1.rotateAngleY = (float) Math.toRadians(Math.toDegrees(Coil1.rotateAngleY) + 3 < 360 ? Math.toDegrees(Coil1.rotateAngleY) + 3 : 0);
coil2.rotateAngleY = (float) Math.toRadians(Math.toDegrees(coil2.rotateAngleY) + 3 < 360 ? Math.toDegrees(coil2.rotateAngleY) + 3 : 0);

View file

@ -11,7 +11,6 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.battery.BlockBattery;
import resonantinduction.contractor.BlockEMContractor;
import resonantinduction.model.ModelEMContractor;
import resonantinduction.tesla.BlockTesla;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@ -27,7 +26,6 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
{
public static final BlockRenderingHandler INSTANCE = new BlockRenderingHandler();
public static final ModelEMContractor MODEL_CONTRACTOR = new ModelEMContractor();
private static final int ID = RenderingRegistry.getNextAvailableRenderId();
@Override
@ -48,7 +46,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
GL11.glTranslated(0.5, 1.5, 0.5);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(RenderEMContractor.TEXTURE);
MODEL_CONTRACTOR.render(0.0625f, false);
RenderEMContractor.MODEL.render(0.0625f);
GL11.glPopMatrix();
}
else if (block instanceof BlockBattery)

View file

@ -12,7 +12,8 @@ import resonantinduction.model.ModelEMContractor;
public class RenderEMContractor extends TileEntitySpecialRenderer
{
public ModelEMContractor MODEL = new ModelEMContractor();
public static final ModelEMContractor MODEL = new ModelEMContractor(false);
public static final ModelEMContractor MODEL_SPIN = new ModelEMContractor(true);
public static final ResourceLocation TEXTURE = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "em_contractor.png");
public static final ResourceLocation TEXTURE_PUSH = new ResourceLocation(ResonantInduction.DOMAIN, ResonantInduction.MODEL_TEXTURE_DIRECTORY + "em_contractor_push.png");
@ -59,7 +60,13 @@ public class RenderEMContractor extends TileEntitySpecialRenderer
this.func_110628_a(TEXTURE_PUSH);
}
MODEL.render(0.0625f, ((TileEntityEMContractor)t).canFunction() && ResonantInduction.proxy.isPaused());
if(((TileEntityEMContractor)t).canFunction() && !ResonantInduction.proxy.isPaused())
{
MODEL_SPIN.render(0.0625f);
}
else {
MODEL.render(0.0625f);
}
GL11.glPopMatrix();
}