Как сделать рендер от лица 3 лица? Что надо написать, изменить в коде?
P.S Это рендер акм74
Код:
package net.STALMINE.Weapons;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import com.f3rullo14.fgm3.client.models.ModelHands;
import com.f3rullo14.fgm3.client.models.ModelSmoke;
import com.f3rullo14.fgm3.common.GunAttachment;
import com.f3rullo14.fgm3.common.items.ItemGun;
import com.f3rullo14.fgm3.common.items.ItemHandler;
import com.f3rullo14.fgm3.common.player.PlayerData;
import com.f3rullo14.fgm3.common.player.PlayerHandler;
import cpw.mods.fml.client.FMLClientHandler;
public class RenderAKM74 implements IItemRenderer {
public static final float PI = 3.1415927F;
private static ResourceLocation tex = new ResourceLocation("fgmassets:textures/models/texakm74.png");
private static ResourceLocation texsmoke = new ResourceLocation("fgmassets:textures/models/smoke.png");
private IModelCustom model = AdvancedModelLoader.loadModel("/assets/stalmine_05/obj/wpnakm74.obj");
private ModelHands hands = new ModelHands();
private ModelSmoke smoke = new ModelSmoke();
private Random random = new Random();
private static Minecraft mc = Minecraft.getMinecraft();
private PlayerData playerData;
private int ticks = 0;
public static float muzzle_flash = 0.0F;
public static float muzzle_flash2 = 0.0F;
float animspeed = 0.6F;
float posX = 0.0F;
float posY = 0.0F;
float posZ = 0.0F;
float rotX = 0.0F;
float rotY = 0.0F;
float rotZ = 0.0F;
float animPX = 0.0F;
float animPY = 0.0F;
float animPZ = 0.0F;
float animPRX = 0.0F;
float animPRY = 0.0F;
float animPRZ = 0.0F;
float animRX = 0.0F;
float animRY = 0.0F;
float animRZ = 0.0F;
float animRRX = 0.0F;
float animRRY = 0.0F;
float animRRZ = 0.0F;
float animERX = 0.0F;
float animERY = 0.0F;
float animERZ = 0.0F;
float shootAnimX = 0.0F;
float shootAnimY = 0.0F;
float shootAnimZ = 0.0F;
boolean reloading = false;
int ammo = 0;
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(RenderAKM74.NamelessClass1092296439.$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[type.ordinal()]) {
case 1:
return false;
case 2:
return true;
case 3:
return true;
default:
return false;
}
}
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return false;
}
public void renderMag(ItemStack item) {
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("sproject:textures/models/aks74u/ASR_AK74_Mag_30_01_D.png"));
GL11.glDisable(2884);
this.model.renderPart("AKS74UMag");
GL11.glEnable(2884);
}
public void renderAcog3RD(ItemStack item) {
Item VALitem = item.getItem();
if(mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().itemID == ItemHandler.akm74.itemID && VALitem instanceof ItemGun && ((ItemGun)VALitem).hasAttachment(GunAttachment.scope, item)) {
GL11.glPushMatrix();
mc.renderEngine.bindTexture(new ResourceLocation("fgmassets:textures/models/PSO.png"));
GL11.glTranslatef(1.1F, 0.32F, 0.0F);
GL11.glScalef(2.0F, 2.0F, 2.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-28.0F, 1.0F, 0.0F, 0.0F);
GL11.glPopMatrix();
}
}
public void renderAcog1RD(ItemStack item) {
Item VALitem = item.getItem();
if(mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().itemID == ItemHandler.akm74.itemID && VALitem instanceof ItemGun && ((ItemGun)VALitem).hasAttachment(GunAttachment.scope, item)) {
GL11.glPushMatrix();
mc.renderEngine.bindTexture(new ResourceLocation("fgmassets:textures/models/PSO.png"));
GL11.glTranslatef(0.01F, -0.01F, -0.05F);
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glRotatef(5.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);
GL11.glPopMatrix();
/*if(Mouse.isButtonDown(1) && mc.currentScreen == null && !mc.thePlayer.isSprinting()) {
GL11.glTranslatef(-5000.0F, -5000.0F, -5000.0F);
}*/
}
}
public void renderAcogERD(ItemStack item) {
Item VALitem = item.getItem();
if(VALitem instanceof ItemGun && ((ItemGun)VALitem).hasAttachment(GunAttachment.scope, item)) {
GL11.glPushMatrix();
mc.renderEngine.bindTexture(new ResourceLocation("fgmassets:textures/models/PSO.png"));
GL11.glTranslatef(-0.05F, 0.04F, 0.05F);
GL11.glScalef(2.5F, 2.5F, 2.5F);
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
GL11.glPopMatrix();
}
}
public void renderItem(ItemRenderType type, ItemStack item, Object ... data) {
this.playerData = PlayerHandler.getPlayerData((EntityPlayer)mc.thePlayer);
Item VALitem = item.getItem();
if(mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().itemID == ItemHandler.akm74.itemID && VALitem instanceof ItemGun) {
this.reloading = ((ItemGun)VALitem).isGunReloading();
this.ammo = ((ItemGun)VALitem).getAmmo(item);
}
if (Mouse.isButtonDown(1))
{
Minecraft.getMinecraft().gameSettings.smoothCamera = false;
Minecraft.getMinecraft().gameSettings.fovSetting = -0.3F;
}
if (!Mouse.isButtonDown(1))
{
Minecraft.getMinecraft().gameSettings.smoothCamera = false;
Minecraft.getMinecraft().gameSettings.fovSetting = 0.0F;
}
switch(RenderAKM74.NamelessClass1092296439.$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[type.ordinal()]) {
case 1:
this.renderAcogERD(item);
GL11.glPushMatrix();
mc.renderEngine.bindTexture(tex);
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
GL11.glScalef(3.0F, 3.0F, 3.0F);
this.model.renderAll();
GL11.glPopMatrix();
break;
case 2:
this.renderAcog3RD(item);
GL11.glPushMatrix();
//От 3-его лица
GL11.glRotatef(84.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
GL11.glScalef(1.5F, 1.5F, 1.4F);
GL11.glTranslatef(0.06F, -0.06F, 0.65F);
//От 3-его лица
mc.renderEngine.bindTexture(tex);
this.model.renderAll();
GL11.glPopMatrix();
if(Mouse.isButtonDown(0) && mc.currentScreen == null) {
//this.renderMuzzleFlashThirdPerson();
}
break;
case 3:
GL11.glPushMatrix();
GL11.glTranslatef(-this.shootAnimX, -this.shootAnimY, -this.shootAnimZ);
GL11.glTranslatef(-this.animPX - 0.33F, -this.animPY - 0.04F, -this.animPZ - 0.01F);
GL11.glTranslatef(-this.animPRX, -this.animPRY + 0.1F, -this.animPRZ);
GL11.glRotatef(this.animRX, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(this.animRY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.animRZ - 1.0F, 0.0F, 0.0F, 1.0F);
GL11.glScalef(2.0F, 2.0F, 2.0F);
GL11.glRotatef(-this.animRRX, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(this.animRRY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.animRRZ, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-this.animERX, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(this.animERY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.animERZ, 0.0F, 0.0F, 1.0F);
GL11.glPushMatrix();
//Моделька
mc.renderEngine.bindTexture(tex);
GL11.glRotatef(this.rotX + 79.0F, -1.0F, 0.0F, 0.0F);
GL11.glRotatef(this.rotY + 63.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.rotZ + 79.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(this.posX + 0.07F, this.posY + -0.1F, this.posZ + 1.4F);
GL11.glScalef(3.4F, 3.4F, 3.4F);
//Моделька
RenderHelper.disableStandardItemLighting();
this.model.renderAll();
this.renderAcog1RD(item);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
GL11.glPushMatrix();
//Руки
GL11.glScaled(1.0D, 1.0D, 1.0D);
GL11.glTranslatef(0.4F, -0.08F, -0.5F);
GL11.glRotatef(105.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-60.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-75.0F, 0.0F, 0.0F, 1.0F);
this.hands.render(mc.thePlayer, 1.0F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScaled(0.8D, 1.0D, 1.0D);
GL11.glTranslatef(1.0F,-0.5F, -0.9F);
GL11.glRotatef(147.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(57.0F, 0.0F, 0.0F, 1.0F);
this.hands.render(mc.thePlayer, 2.9F);
//Руки
GL11.glPopMatrix();
GL11.glPopMatrix();
//Прицел
if(Mouse.isButtonDown(1) && mc.currentScreen == null && !mc.thePlayer.isSprinting()) {
this.animRX = 0.0F;
this.animRY = 0.0F;
this.animRZ = 0.5F;
if(this.animPZ < 0.9F) {
this.animPZ += 0.009F / (this.animspeed / 2.0F);
}
if(this.animPZ < 0.0F) {
this.animPZ = 0.0F;
}
if(this.animPY < 0.0F) {
this.animPY += 0.009F / (this.animspeed / 2.0F);
}
if(this.animPY < 0.0F) {
this.animPY = 0.0F;
}
if(this.animPX < 0.0F) {
this.animPX += 0.009F / (this.animspeed / 2.0F);
}
if(this.animPX < 0.0F) {
this.animPX = 0.0F;
}
}
else
{
this.animRX = 0.0F;
this.animRY = 0.0F;
this.animRZ = 0.0F;
if(this.animPZ > 0.0F) {
this.animPZ -= 0.009F / (this.animspeed / 3.0F);
}
if(this.animPZ < 0.0F) {
this.animPZ = 0.0F;
}
if(this.animPY > 0.0F) {
this.animPY -= 0.009F / (this.animspeed / 3.0F);
}
if(this.animPY < 0.0F) {
this.animPY = 0.0F;
}
if(this.animPX > 0.0F) {
this.animPX -= 0.009F / (this.animspeed / 3.0F);
}
if(this.animPX < 0.0F) {
this.animPX = 0.0F;
}
}
//Прицел
if(Mouse.isButtonDown(0) && this.ammo > 0 && !this.reloading && mc.currentScreen == null) {
this.renderMuzzleFlash();
this.renderMuzzleFlash();
this.renderMuzzleFlash();
/*if(this.shootAnimX < 0.2F) {
this.shootAnimX += 0.009F / (this.animspeed / 1.0F);
this.shootAnimY += 0.009F / (this.animspeed / 1.0F);
}
if(this.shootAnimX < 0.0F) {
this.shootAnimX = 0.0F;
}
if(this.shootAnimY < 0.1F) {
this.shootAnimY += 0.009F / (this.animspeed / 1.0F);
}
if(this.shootAnimY < 0.0F) {
this.shootAnimY = 0.0F;
}
} else {
if(this.shootAnimX > 0.0F) {
this.shootAnimX -= 0.009F / (this.animspeed / 1.0F);
}
if(this.shootAnimX < 0.0F) {
this.shootAnimX = 0.0F;
}
if(this.shootAnimY > 0.0F) {
this.shootAnimY -= 0.009F / (this.animspeed / 1.0F);
}
if(this.shootAnimY < 0.0F) {
this.shootAnimY = 0.0F;
}*/
}
if(mc.thePlayer.isSprinting() && !Mouse.isButtonDown(0)) {
if(this.animRRX < 10.0F) {
this.animRRX += 0.2F / (this.animspeed / 5.0F);
}
if(this.animRRX < 0.0F) {
this.animRRX = 0.0F;
}
if(this.animRRZ < 10.0F) {
this.animRRZ += 0.2F / (this.animspeed / 5.0F);
}
if(this.animRRZ < 0.0F) {
this.animRRZ = 0.0F;
}
if(this.animRRY < 45.0F) {
this.animRRY += 0.2F / (this.animspeed / 5.0F);
}
if(this.animRRY < 0.0F) {
this.animRRY = 0.0F;
}
if(this.animPRY < 1.0F) {
this.animPRY += 0.01F / (this.animspeed / 5.0F);
}
if(this.animPRY < 0.0F) {
this.animPRY = 0.0F;
}
if(this.animPRZ < 0.0F) {
this.animPRZ += 0.01F / (this.animspeed / 5.0F);
}
if(this.animPRZ < 0.0F) {
this.animPRZ = 0.0F;
}
}
else
{
if(this.animPRZ > 0.0F) {
this.animPRZ -= 0.01F / (this.animspeed / 3.0F);
}
if(this.animPRZ < 0.0F) {
this.animPRZ = 0.0F;
}
if(this.animPRY > 0.0F) {
this.animPRY -= 0.01F / (this.animspeed / 3.0F);
}
if(this.animPRY < 0.0F) {
this.animPRY = 0.0F;
}
if(this.animRRX > 0.0F) {
this.animRRX -= 0.2F / (this.animspeed / 3.0F);
}
if(this.animRRX < 0.0F) {
this.animRRX = 0.0F;
}
if(this.animRRZ > 0.0F) {
this.animRRZ -= 0.2F / (this.animspeed / 3.0F);
}
if(this.animRRZ < 0.0F) {
this.animRRZ = 0.0F;
}
if(this.animRRY > 0.0F) {
this.animRRY -= 0.2F / (this.animspeed / 3.0F);
}
if(this.animRRY < 0.0F) {
this.animRRY = 0.0F;
}
}
if(this.reloading && mc.currentScreen == null) {
if(this.animERZ < 40.0F) {
this.animERZ += 1.0F / (this.animspeed / 1.0F);
}
if(this.animERZ < 0.0F) {
this.animERZ = 0.0F;
}
} else {
if(this.animERZ > 0.0F) {
this.animERZ -= 1.0F / (this.animspeed / 1.0F);
}
if(this.animERZ < 0.0F) {
this.animERZ = 0.0F;
}
}
}
}
/*private void renderMuzzleFlashThirdPerson() {
if(muzzle_flash > 0.0F) {
muzzle_flash -= 0.009F;
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F,
1.0F);
GL11.glTranslatef(1.5F, 1.0F, 0.0F);
new Random();
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(6.0F / muzzle_flash, 0.0F, 0.0F, 1.0F);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texsmoke);
GL11.glColor4f(1.0F, 1.0F, 1.0F, muzzle_flash - 0.1F);
GL11.glRotatef(muzzle_flash2, 0.0F, 0.0F, 1.0F);
float scale1 = 0.005F;
GL11.glScalef(scale1 / muzzle_flash, scale1 / muzzle_flash, scale1);
GL11.glEnable(3042);
this.smoke.render(0.0625F);
GL11.glDisable(3042);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
} else {
muzzle_flash = 0.5F;
}
}*/
private void renderMuzzleFlash() {
if(muzzle_flash > 0.0F) {
muzzle_flash -= 0.003F;
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if(Mouse.isButtonDown(1)) {
GL11.glTranslatef(30.0F, 12.5F, 1.0F);
} else {
GL11.glTranslatef(18.0F, 7.5F, 3.5F);
}
new Random();
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F / muzzle_flash, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-2.0F, 4.0F, 10.0F);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texsmoke);
GL11.glColor4f(1.0F, 1.0F, 1.0F, muzzle_flash - 0.1F);
GL11.glRotatef(muzzle_flash2, 0.0F, 0.0F, 1.0F);
float scale1 = 0.05F;
GL11.glScalef(scale1 / muzzle_flash, scale1 / muzzle_flash, scale1);
GL11.glEnable(3042);
this.smoke.render(0.0625F);
GL11.glDisable(3042);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
} else {
muzzle_flash = 0.5F;
}
}
// $FF: synthetic class
static class NamelessClass1092296439 {
// $FF: synthetic field
static final int[] $SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType = new int[ItemRenderType.values().length];
static {
try {
$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[ItemRenderType.ENTITY.ordinal()] = 1;
} catch (NoSuchFieldError var3) {
;
}
try {
$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[ItemRenderType.EQUIPPED.ordinal()] = 2;
} catch (NoSuchFieldError var2) {
;
}
try {
$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[ItemRenderType.EQUIPPED_FIRST_PERSON.ordinal()] = 3;
} catch (NoSuchFieldError var1) {
;
}
}
}
}
P.S Это рендер акм74