OSDN Git Service

いろいろした
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / render / RenderAtomsGrenade.java
1 package pcc.chemicraft.base.render;
2
3 import net.minecraft.client.renderer.Tessellator;
4 import net.minecraft.client.renderer.entity.Render;
5 import net.minecraft.entity.Entity;
6
7 import org.lwjgl.opengl.GL11;
8 import org.lwjgl.opengl.GL12;
9
10 import pcc.chemicraft.base.entity.EntityAtomsGrenade;
11 import pcc.chemicraft.core.ChemiCraftCore;
12 import cpw.mods.fml.relauncher.Side;
13 import cpw.mods.fml.relauncher.SideOnly;
14
15 /**
16  * 手榴弾のRenderクラスです
17  * @author mozipi
18  */
19 @SideOnly(Side.CLIENT)
20 public class RenderAtomsGrenade extends Render {
21
22         private float field_77002_a;
23
24         public RenderAtomsGrenade(float par1) {
25                 this.field_77002_a = par1;
26         }
27
28         public void doRenderAtomsGrenade(EntityAtomsGrenade par1AtomGrenade, double par2, double par4, double par6, float par8, float par9) {
29                 GL11.glPushMatrix();
30                 GL11.glTranslatef((float)par2, (float)par4, (float)par6);
31                 GL11.glEnable(GL12.GL_RESCALE_NORMAL);
32                 float var10 = this.field_77002_a;
33                 GL11.glScalef(var10 / 1.0F, var10 / 1.0F, var10 / 1.0F);
34                 byte var11 = 1;
35                 this.loadTexture(ChemiCraftCore.instance.ITEM_TEXTURE);
36                 Tessellator var12 = Tessellator.instance;
37                 float var13 = (float)(var11 % 16 * 16 + 0) / 256.0F;
38                 float var14 = (float)(var11 % 16 * 16 + 16) / 256.0F;
39                 float var15 = (float)(var11 / 16 * 16 + 0) / 256.0F;
40                 float var16 = (float)(var11 / 16 * 16 + 16) / 256.0F;
41                 float var17 = 1.0F;
42                 float var18 = 0.5F;
43                 float var19 = 0.25F;
44                 GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
45                 GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
46                 var12.startDrawingQuads();
47                 var12.setNormal(0.0F, 1.0F, 0.0F);
48                 var12.addVertexWithUV((double)(0.0F - var18), (double)(0.0F - var19), 0.0D, (double)var13, (double)var16);
49                 var12.addVertexWithUV((double)(var17 - var18), (double)(0.0F - var19), 0.0D, (double)var14, (double)var16);
50                 var12.addVertexWithUV((double)(var17 - var18), (double)(1.0F - var19), 0.0D, (double)var14, (double)var15);
51                 var12.addVertexWithUV((double)(0.0F - var18), (double)(1.0F - var19), 0.0D, (double)var13, (double)var15);
52                 var12.draw();
53                 GL11.glDisable(GL12.GL_RESCALE_NORMAL);
54                 GL11.glPopMatrix();
55         }
56
57         @Override
58         public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
59                 this.doRenderAtomsGrenade((EntityAtomsGrenade)par1Entity, par2, par4, par6, par8, par9);
60         }
61 }