package viruz.zeamateis.specialRender.mobs; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import viruz.zeamateis.mobs.monster.EntityZombieCrawler; import viruz.zeamateis.specialModels.mobs.ModelCrawler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderZombieCrawler extends RenderLiving { /** Scale of the model to use */ private float taille; private static final ResourceLocation zombieEyesTextures = new ResourceLocation("viruz:mob/zombies/zombie_eyes.png"); public RenderZombieCrawler(ModelBase par1ModelBase, float par2, float par3) { super(par1ModelBase, par2 * par3); this.taille = 1; this.setRenderPassModel(new ModelCrawler()); } /** * Applies the scale to the transform matrix */ protected void preRenderScale(EntityZombieCrawler par1EntityZombieCrawler, float par2) { GL11.glScalef(this.taille, this.taille, this.taille); } protected int setZombieEyeBrightness(EntityZombieCrawler par1EntityZombieCrawler, int par2, float par3) { if (par2 != 0) { return -1; } else { this.bindTexture(zombieEyesTextures); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); if (par1EntityZombieCrawler.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GL11.glColor4f(2F, 2F, 2F, 2F); GL11.glColor4f(2F, 2F, 2F, f1); return 1; } } /** * Queries whether should render the specified pass or not. */ protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) { return this.setZombieEyeBrightness((EntityZombieCrawler)par1EntityLivingBase, par2, par3); } protected ResourceLocation getZombieTexture(EntityZombieCrawler entity) { return new ResourceLocation("viruz:mob/zombies/zombie" + entity.texture + ".png"); } protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getZombieTexture((EntityZombieCrawler)par1Entity); } /** * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: * entityLiving, partialTickTime */ protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) { this.preRenderScale((EntityZombieCrawler)par1EntityLiving, par2); } }