| |
| package mrplaigon.invictusserver.invictus.client.renderer.entity.mob; |
| |
| import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; |
| import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; |
| |
| import java.util.Random; |
| |
| import org.lwjgl.opengl.GL11; |
| |
| import mrplaigon.invictusserver.invictus.client.model.entity.mob.ModelCyclopBoss; |
| import mrplaigon.invictusserver.invictus.common.InvictusMod; |
| import mrplaigon.invictusserver.invictus.entity.EntityBossCyclop; |
| import mrplaigon.invictusserver.invictus.entity.EntityScorpion; |
| import mrplaigon.invictusserver.invictus.handler.ItemHandler; |
| import net.minecraft.block.Block; |
| import net.minecraft.client.model.ModelBase; |
| import net.minecraft.client.model.ModelBiped; |
| import net.minecraft.client.renderer.RenderBlocks; |
| import net.minecraft.client.renderer.RenderHelper; |
| import net.minecraft.client.renderer.Tessellator; |
| import net.minecraft.client.renderer.entity.RenderBiped; |
| import net.minecraft.client.renderer.entity.RenderLiving; |
| import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; |
| import net.minecraft.entity.Entity; |
| import net.minecraft.entity.EntityLiving; |
| import net.minecraft.entity.EntityLivingBase; |
| import net.minecraft.entity.boss.BossStatus; |
| import net.minecraft.entity.boss.EntityDragon; |
| import net.minecraft.entity.monster.EntityGiantZombie; |
| import net.minecraft.init.Items; |
| import net.minecraft.item.Item; |
| import net.minecraft.item.ItemBlock; |
| import net.minecraft.item.ItemStack; |
| import net.minecraft.util.ResourceLocation; |
| import net.minecraftforge.client.IItemRenderer; |
| import net.minecraftforge.client.MinecraftForgeClient; |
| |
| public class RenderCyclopBoss |
| extends RenderLiving |
| { |
| public final ResourceLocation texturePhase1 = new ResourceLocation(InvictusMod.MODID, "textures/entity/cyclopBossPhase1.png"); |
| public final ResourceLocation texturePhase2 = new ResourceLocation(InvictusMod.MODID, "textures/entity/cyclopBossPhase2.png"); |
| public final ResourceLocation textureExploding = new ResourceLocation(InvictusMod.MODID, "textures/entity/cyclopBossExploding.png"); |
| |
| public ModelCyclopBoss modelcyclop; |
| |
| public RenderCyclopBoss(ModelCyclopBoss modelcyclop, float shadow) |
| { |
| super(modelcyclop, shadow); |
| this.modelcyclop = modelcyclop; |
| } |
| |
| protected void preRenderCallback(EntityBossCyclop cyclop, float f) |
| { |
| GL11.glScalef(2, 2, 2); |
| } |
| |
| protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) |
| { |
| this.preRenderCallback((EntityBossCyclop)par1EntityLivingBase, par2); |
| } |
| |
| @Override |
| protected void renderEquippedItems(EntityLivingBase livingbase, float par2) |
| { |
| this.renderCyclopEquippedItems((EntityBossCyclop)livingbase, par2); |
| } |
| |
| protected void renderCyclopEquippedItems(EntityBossCyclop cyclopBoss, float par2) |
| { |
| float f = 1.0F; |
| GL11.glColor3f(f, f, f); |
| super.renderEquippedItems(cyclopBoss, par2); |
| ItemStack itemstack = cyclopBoss.getHeldItem(); |
| float f0; |
| Tessellator tessellator = Tessellator.instance; |
| |
| if(itemstack != null) |
| { |
| GL11.glPushMatrix(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); |
| |
| IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); |
| boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); |
| |
| if(itemstack.getItem().equals(ItemHandler.gourdin)) |
| { |
| GL11.glRotatef(120F, 0.0F, 1.0F, 0.0F); |
| GL11.glRotatef(160F, 1.0F, 0.0F, 0.0F); |
| GL11.glRotatef(-60F, 0.0F, 0.0F, 1.0F); |
| GL11.glTranslatef(0.5F, 0.01F, 0.09F); |
| } |
| else if(itemstack.getItem().isFull3D()) |
| { |
| f0 = 0.625F; |
| |
| if(itemstack.getItem().shouldRotateAroundWhenRendering()) |
| { |
| GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); |
| GL11.glTranslatef(0.0F, -0.125F, 0.0F); |
| } |
| |
| GL11.glTranslatef(0.0F, 0.1875F, 0.0F); |
| GL11.glScalef(f0, -f0, f0); |
| GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); |
| GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); |
| } |
| else |
| { |
| f0 = 0.375F; |
| GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); |
| GL11.glScalef(f0, f0, f0); |
| GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); |
| GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); |
| GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); |
| } |
| |
| this.renderManager.itemRenderer.renderItem(cyclopBoss, itemstack, 0); |
| |
| if(itemstack.getItem().requiresMultipleRenderPasses()) |
| { |
| for(int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) |
| { |
| this.renderManager.itemRenderer.renderItem(cyclopBoss, itemstack, x); |
| } |
| } |
| |
| if (cyclopBoss.deathTicks > 0) |
| { |
| RenderHelper.disableStandardItemLighting(); |
| float f1 = ((float)cyclopBoss.deathTicks + par2) / 200.0F; |
| float f2 = 0.0F; |
| |
| if (f1 > 0.8F) |
| { |
| f2 = (f1 - 0.8F) / 0.2F; |
| } |
| |
| Random random = new Random(432L); |
| GL11.glDisable(GL11.GL_TEXTURE_2D); |
| GL11.glShadeModel(GL11.GL_SMOOTH); |
| GL11.glEnable(GL11.GL_BLEND); |
| GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); |
| GL11.glDisable(GL11.GL_ALPHA_TEST); |
| GL11.glEnable(GL11.GL_CULL_FACE); |
| GL11.glDepthMask(false); |
| GL11.glPushMatrix(); |
| GL11.glTranslatef(0.0F, -1.0F, -2.0F); |
| |
| for (int i = 0; (float)i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) |
| { |
| GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); |
| GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); |
| GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); |
| GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); |
| GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); |
| GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F); |
| tessellator.startDrawing(6); |
| float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F; |
| float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F; |
| tessellator.setColorRGBA_I(19311935, (int)(255.0F * (1.0F - f2))); |
| tessellator.addVertex(0.0D, 0.0D, 0.0D); |
| tessellator.setColorRGBA_I(16311935, 0); |
| tessellator.addVertexWithUV(cyclopBoss.motionX + 50.0D, cyclopBoss.posY + 10, cyclopBoss.motionZ +10, 1, 1); |
| tessellator.addVertex(-0.866D * (double)f4, (double)f3, (double)(-0.5F * f4)); |
| tessellator.addVertex(0.866D * (double)f4, (double)f3, (double)(-0.5F * f4)); |
| tessellator.addVertex(0.0D, (double)f3, (double)(1.0F * f4)); |
| tessellator.addVertex(-0.866D * (double)f4, (double)f3, (double)(-0.5F * f4)); |
| tessellator.draw(); |
| } |
| GL11.glPopMatrix(); |
| GL11.glDepthMask(true); |
| GL11.glDisable(GL11.GL_CULL_FACE); |
| GL11.glDisable(GL11.GL_BLEND); |
| GL11.glShadeModel(GL11.GL_FLAT); |
| GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); |
| GL11.glEnable(GL11.GL_TEXTURE_2D); |
| GL11.glEnable(GL11.GL_ALPHA_TEST); |
| RenderHelper.enableStandardItemLighting(); |
| } |
| |
| GL11.glPopMatrix(); |
| } |
| } |
| |
| |
| |
| |
| protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7) |
| { |
| this.renderModel((EntityBossCyclop)par1EntityLivingBase, par2, par3, par4, par5, par6, par7); |
| } |
| |
| |
| |
| |
| protected void renderModel(EntityBossCyclop bossCyclop, float par2, float par3, float par4, float par5, float par6, float par7) |
| { |
| if (bossCyclop.deathTicks > 0) |
| { |
| float f6 = (float)bossCyclop.deathTicks / 200.0F; |
| GL11.glDepthFunc(GL11.GL_LEQUAL); |
| GL11.glEnable(GL11.GL_ALPHA_TEST); |
| GL11.glAlphaFunc(GL11.GL_GREATER, f6); |
| this.bindTexture(textureExploding); |
| this.mainModel.render(bossCyclop, par2, par3, par4, par5, par6, par7); |
| GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); |
| GL11.glDepthFunc(GL11.GL_EQUAL); |
| } |
| |
| this.bindEntityTexture(bossCyclop); |
| this.mainModel.render(bossCyclop, par2, par3, par4, par5, par6, par7); |
| } |
| |
| protected ResourceLocation getEntityTexture(Entity entity) |
| { |
| return getMobTutorielTexture((EntityBossCyclop)entity); |
| } |
| |
| private ResourceLocation getMobTutorielTexture(EntityBossCyclop cyclop) |
| { |
| if (cyclop.getHealth() < 10) |
| { |
| return texturePhase2; |
| } |
| return this.texturePhase1; |
| } |
| } |