Package com.flansmod.client.model

Source Code of com.flansmod.client.model.RenderBullet

package com.flansmod.client.model;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

import com.flansmod.client.FlansModResourceHandler;
import com.flansmod.common.guns.EntityBullet;

public class RenderBullet extends Render
{
  public RenderBullet()
  {
    shadowSize = 0.5F;
  }

  public void render(EntityBullet bullet, double d, double d1, double d2, float f, float f1)
  {
    if(bullet.owner == Minecraft.getMinecraft().thePlayer && bullet.ticksExisted < 1)
      return;
    bindEntityTexture(bullet);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glRotatef(f, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(90F -bullet.prevRotationPitch - (bullet.rotationPitch - bullet.prevRotationPitch) * f1, 1.0F, 0.0F, 0.0F);
    ModelBase model = (ModelBase) bullet.type.model;
    if(model != null)
      model.render(bullet, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
  }

  @Override
  public void doRender(Entity entity, double d, double d1, double d2, float f, float f1)
  {
    render((EntityBullet) entity, d, d1, d2, f, f1);
  }
 
  @Override
  protected ResourceLocation getEntityTexture(Entity entity)
  {
    return FlansModResourceHandler.getTexture(((EntityBullet)entity).type);
  }
}
TOP

Related Classes of com.flansmod.client.model.RenderBullet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.