// Date: 30-6-2015 15:38:53
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package pneumaticCraft.client.model.entity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
import pneumaticCraft.client.util.RenderUtils;
import pneumaticCraft.common.entity.living.EntityDrone;
import pneumaticCraft.common.minigun.Minigun;
import pneumaticCraft.lib.Textures;
public class ModelDroneMinigun extends ModelBase{
//fields
ModelRenderer barrel;
ModelRenderer support1;
ModelRenderer support2;
ModelRenderer support3;
ModelRenderer support4;
ModelRenderer support5;
ModelRenderer main;
ModelRenderer magazine;
ModelRenderer mount;
ModelRenderer magazineColor;
public ModelDroneMinigun(){
textureWidth = 64;
textureHeight = 32;
barrel = new ModelRenderer(this, 30, 15);
barrel.addBox(-0.5F, 1.5F, 0F, 1, 1, 16);
barrel.setRotationPoint(0F, 20.96667F, -8F);
barrel.setTextureSize(64, 32);
barrel.mirror = true;
setRotation(barrel, 0F, 0F, 0F);
support1 = new ModelRenderer(this, 0, 0);
support1.addBox(-1.5F, -1.5F, 0F, 3, 3, 1);
support1.setRotationPoint(0F, 21F, -6F);
support1.setTextureSize(64, 32);
support1.mirror = true;
setRotation(support1, 0F, 0F, 0F);
support2 = new ModelRenderer(this, 0, 4);
support2.addBox(-1F, 1.5F, 0F, 2, 1, 1);
support2.setRotationPoint(0F, 21F, -6F);
support2.setTextureSize(64, 32);
support2.mirror = true;
setRotation(support2, 0F, 0F, 0F);
support3 = new ModelRenderer(this, 0, 6);
support3.addBox(-1F, -2.5F, 0F, 2, 1, 1);
support3.setRotationPoint(0F, 21F, -6F);
support3.setTextureSize(64, 32);
support3.mirror = true;
setRotation(support3, 0F, 0F, 0F);
support4 = new ModelRenderer(this, 0, 8);
support4.addBox(1.5F, -1F, 0F, 1, 2, 1);
support4.setRotationPoint(0F, 21F, -6F);
support4.setTextureSize(64, 32);
support4.mirror = true;
setRotation(support4, 0F, 0F, 0F);
support5 = new ModelRenderer(this, 0, 11);
support5.addBox(-2.5F, -1F, 0F, 1, 2, 1);
support5.setRotationPoint(0F, 21F, -6F);
support5.setTextureSize(64, 32);
support5.mirror = true;
setRotation(support5, 0F, 0F, 0F);
main = new ModelRenderer(this, 36, 0);
main.addBox(0F, 0F, 0F, 6, 6, 8);
main.setRotationPoint(-3F, 18F, 8F);
main.setTextureSize(64, 32);
main.mirror = true;
setRotation(main, 0F, 0F, 0F);
magazine = new ModelRenderer(this, 0, 14);
magazine.addBox(0F, 0F, 0F, 2, 3, 6);
magazine.setRotationPoint(3F, 22F, 9F);
magazine.setTextureSize(64, 32);
magazine.mirror = true;
setRotation(magazine, 0F, 0F, 0F);
mount = new ModelRenderer(this, 0, 23);
mount.addBox(0F, 0F, 0F, 2, 4, 2);
mount.setRotationPoint(-1F, 15F, 11F);
mount.setTextureSize(64, 32);
mount.mirror = true;
setRotation(mount, 0F, 0F, 0F);
magazineColor = new ModelRenderer(this, 8, 0);
magazineColor.addBox(0F, 0F, 0F, 1, 2, 4);
magazineColor.setRotationPoint(4.3F, 22.5F, 10F);
magazineColor.setTextureSize(64, 32);
magazineColor.mirror = true;
setRotation(magazineColor, 0F, 0F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
EntityDrone drone = (EntityDrone)entity;
renderMinigun(drone != null ? drone.getMinigun() : null, f5, 0, true);
}
public void renderMinigun(Minigun minigun, float size, float partialTick, boolean renderMount){
Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.MODEL_DRONE_MINIGUN);
GL11.glColor4d(1, 1, 1, 1);
GL11.glPushMatrix();
if(renderMount) {
GL11.glTranslated(0, 5 / 16D, -12 / 16D);
mount.render(size);
GL11.glTranslated(0, -5 / 16D, 12 / 16D);
}
float barrelRotation = 0;
if(minigun != null) {
barrelRotation = (float)(minigun.getOldMinigunRotation() + partialTick * (minigun.getMinigunRotation() - minigun.getOldMinigunRotation()));
double yaw = minigun.oldMinigunYaw + partialTick * (minigun.minigunYaw - minigun.oldMinigunYaw);
double pitch = minigun.oldMinigunPitch + partialTick * (minigun.minigunPitch - minigun.oldMinigunPitch);
GL11.glTranslated(0, 23 / 16D, 0);
GL11.glRotated(yaw, 0, 1, 0);
GL11.glRotated(pitch, 1, 0, 0);
GL11.glTranslated(0, -18 / 16D, -12 / 16D);
}
barrel.rotateAngleY = 0;
barrel.rotateAngleX = 0;
for(int i = 0; i < 6; i++) {
barrel.rotateAngleZ = (float)(Math.PI / 3 * i) + barrelRotation;
barrel.render(size);
}
support1.rotateAngleZ = barrelRotation;
support2.rotateAngleZ = barrelRotation;
support3.rotateAngleZ = barrelRotation;
support4.rotateAngleZ = barrelRotation;
support5.rotateAngleZ = barrelRotation;
support1.render(size);
support2.render(size);
support3.render(size);
support4.render(size);
support5.render(size);
magazine.render(size);
main.render(size);
GL11.glDisable(GL11.GL_TEXTURE_2D);
RenderUtils.glColorHex(minigun != null ? 0xFF000000 | minigun.getAmmoColor() : 0xFF313131);
magazineColor.render(size);
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
private void setRotation(ModelRenderer model, float x, float y, float z){
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}