001package net.minecraft.client.renderer.entity; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import net.minecraft.client.model.ModelVillager; 006import net.minecraft.entity.Entity; 007import net.minecraft.entity.EntityLiving; 008import net.minecraft.entity.passive.EntityVillager; 009import org.lwjgl.opengl.GL11; 010 011@SideOnly(Side.CLIENT) 012public class RenderVillager extends RenderLiving 013{ 014 /** Model of the villager. */ 015 protected ModelVillager villagerModel; 016 017 public RenderVillager() 018 { 019 super(new ModelVillager(0.0F), 0.5F); 020 this.villagerModel = (ModelVillager)this.mainModel; 021 } 022 023 /** 024 * Determines wether Villager Render pass or not. 025 */ 026 protected int shouldVillagerRenderPass(EntityVillager par1EntityVillager, int par2, float par3) 027 { 028 return -1; 029 } 030 031 public void renderVillager(EntityVillager par1EntityVillager, double par2, double par4, double par6, float par8, float par9) 032 { 033 super.doRenderLiving(par1EntityVillager, par2, par4, par6, par8, par9); 034 } 035 036 protected void renderVillagerEquipedItems(EntityVillager par1EntityVillager, float par2) 037 { 038 super.renderEquippedItems(par1EntityVillager, par2); 039 } 040 041 protected void preRenderVillager(EntityVillager par1EntityVillager, float par2) 042 { 043 float f1 = 0.9375F; 044 045 if (par1EntityVillager.getGrowingAge() < 0) 046 { 047 f1 = (float)((double)f1 * 0.5D); 048 this.shadowSize = 0.25F; 049 } 050 else 051 { 052 this.shadowSize = 0.5F; 053 } 054 055 GL11.glScalef(f1, f1, f1); 056 } 057 058 /** 059 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: 060 * entityLiving, partialTickTime 061 */ 062 protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) 063 { 064 this.preRenderVillager((EntityVillager)par1EntityLiving, par2); 065 } 066 067 /** 068 * Queries whether should render the specified pass or not. 069 */ 070 protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3) 071 { 072 return this.shouldVillagerRenderPass((EntityVillager)par1EntityLiving, par2, par3); 073 } 074 075 protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2) 076 { 077 this.renderVillagerEquipedItems((EntityVillager)par1EntityLiving, par2); 078 } 079 080 public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) 081 { 082 this.renderVillager((EntityVillager)par1EntityLiving, par2, par4, par6, par8, par9); 083 } 084 085 /** 086 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then 087 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic 088 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, 089 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. 090 */ 091 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) 092 { 093 this.renderVillager((EntityVillager)par1Entity, par2, par4, par6, par8, par9); 094 } 095}