From a2d955d6a3f0cfa9843f3f23e787522384a37f5c Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Sun, 4 Aug 2013 18:02:07 -0400 Subject: [PATCH] Fixed contractor spinning --- src/resonantinduction/model/ModelEMContractor.java | 11 +++++++---- .../render/BlockRenderingHandler.java | 4 +--- src/resonantinduction/render/RenderEMContractor.java | 11 +++++++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/resonantinduction/model/ModelEMContractor.java b/src/resonantinduction/model/ModelEMContractor.java index c2b7cd33..8c183f45 100644 --- a/src/resonantinduction/model/ModelEMContractor.java +++ b/src/resonantinduction/model/ModelEMContractor.java @@ -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); diff --git a/src/resonantinduction/render/BlockRenderingHandler.java b/src/resonantinduction/render/BlockRenderingHandler.java index 49e36e8f..91abc95a 100644 --- a/src/resonantinduction/render/BlockRenderingHandler.java +++ b/src/resonantinduction/render/BlockRenderingHandler.java @@ -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) diff --git a/src/resonantinduction/render/RenderEMContractor.java b/src/resonantinduction/render/RenderEMContractor.java index ae2f0980..778d804f 100644 --- a/src/resonantinduction/render/RenderEMContractor.java +++ b/src/resonantinduction/render/RenderEMContractor.java @@ -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(); }