mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
add some cape support, fully move item rendering into layers
This commit is contained in:
parent
72e45ad08b
commit
a49bae5b3b
8 changed files with 222 additions and 383 deletions
|
@ -1,27 +1,13 @@
|
|||
package com.minelittlepony.minelp.model;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
|
||||
import com.minelittlepony.minelp.PonyManager;
|
||||
import com.minelittlepony.minelp.renderer.AniParams;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class ModelPony extends ModelPlayer {
|
||||
|
@ -55,19 +41,11 @@ public abstract class ModelPony extends ModelPlayer {
|
|||
this.strech = strech;
|
||||
}
|
||||
|
||||
public final void init() {
|
||||
init(0);
|
||||
}
|
||||
public void init(float var1, float var2) {}
|
||||
|
||||
public final void init(float var1) {
|
||||
init(var1, 0);
|
||||
}
|
||||
public void animate(AniParams var1) {}
|
||||
|
||||
public abstract void init(float var1, float var2);
|
||||
|
||||
public void animate(AniParams var1) {};
|
||||
|
||||
public void render(AniParams var1) {};
|
||||
public void render(AniParams var1) {}
|
||||
|
||||
@Override
|
||||
public void render(Entity player, float Move, float Moveswing, float Loop, float Right, float Down, float Scale) {
|
||||
|
@ -122,96 +100,6 @@ public abstract class ModelPony extends ModelPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
public void renderDrop(RenderManager rendermanager, ItemRenderer itemrenderer, EntityLivingBase entity) {}
|
||||
|
||||
protected void renderDrop(ItemRenderer itemrenderer, EntityLivingBase entity, ModelRenderer box,
|
||||
float scalefactor, float posx, float posy, float posz) {
|
||||
ItemStack drop = entity.getHeldItem();
|
||||
if (drop != null) {
|
||||
pushMatrix();
|
||||
if (box != null) {
|
||||
box.postRender(scalefactor * 0.0625F);
|
||||
}
|
||||
|
||||
translate(posx, posy, posz);
|
||||
EnumAction playerAction = null;
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer is3D = (EntityPlayer) entity;
|
||||
if (is3D.fishEntity != null) {
|
||||
drop = new ItemStack(Items.stick);
|
||||
}
|
||||
|
||||
if (is3D.getItemInUseCount() > 0) {
|
||||
playerAction = drop.getItemUseAction();
|
||||
}
|
||||
}
|
||||
|
||||
if (drop.getItem() == Items.bow) {
|
||||
rotate(-20.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (drop.getItem().isFull3D()) {
|
||||
if (drop.getItem().shouldRotateAroundWhenRendering()) {
|
||||
rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
translate(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
|
||||
if (playerAction == EnumAction.BLOCK && entity instanceof EntityPlayer
|
||||
&& ((EntityPlayer) entity).getItemInUseCount() > 0) {
|
||||
translate(0.05F, 0.0F, -0.1F);
|
||||
rotate(-50.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(-10.0F, 1.0F, 0.0F, 0.0F);
|
||||
rotate(-60.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
float g;
|
||||
float b;
|
||||
int var20;
|
||||
|
||||
var20 = drop.getItem().getColorFromItemStack(drop, 0);
|
||||
float var19 = (var20 >> 16 & 255) / 255.0F;
|
||||
g = (var20 >> 8 & 255) / 255.0F;
|
||||
b = (var20 & 255) / 255.0F;
|
||||
color(var19, g, b, 1.0F);
|
||||
itemrenderer.renderItem(entity, drop, TransformType.THIRD_PERSON);
|
||||
|
||||
if (isUnicorn && glowColor != 0) {
|
||||
this.renderItemGlow(itemrenderer, entity, drop);
|
||||
}
|
||||
|
||||
popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItemGlow(ItemRenderer itemRenderer, EntityLivingBase entity, ItemStack drop) {
|
||||
// FIXME doesn't blend
|
||||
pushMatrix();
|
||||
GL11.glPushAttrib(24577);
|
||||
GL11.glDisable(2896);
|
||||
float red = (glowColor >> 16 & 255) / 255.0F;
|
||||
float green = (glowColor >> 8 & 255) / 255.0F;
|
||||
float blue = (glowColor & 255) / 255.0F;
|
||||
float alpha = 0.2F;
|
||||
enableBlend();
|
||||
GL11.glEnable(3042);
|
||||
GL14.glBlendColor(red, green, blue, alpha);
|
||||
blendFunc('\u8001', 1);
|
||||
color(red, green, blue, alpha);
|
||||
// translate(1.1F, 1.1F, 1.1F);
|
||||
if (!(drop.getItem() instanceof ItemBlock) || !drop.getItem().isFull3D()) {
|
||||
translate(0.02F, -0.06F, -0.02F);
|
||||
}
|
||||
// itemRenderer.renderItem(entity, drop, TransformType.THIRD_PERSON);
|
||||
popAttrib();
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
public void renderEars(EntityLivingBase entity, float par2) {}
|
||||
|
||||
public void renderCloak(EntityPlayer player, float par2) {}
|
||||
|
||||
public void renderStaticCloak(EntityLiving player, float par2) {}
|
||||
|
||||
protected boolean doCancelRender() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class PlayerModel {
|
|||
}
|
||||
|
||||
public void init() {
|
||||
model.init();
|
||||
model.init(0, 0);
|
||||
armor.modelArmorChestplate.init(0.0F, 1.0F);
|
||||
armor.modelArmor.init(0.0F, 0.5F);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,6 @@ import com.minelittlepony.minelp.renderer.AniParams;
|
|||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class pm_newPonyArmor extends pm_newPonyAdv {
|
||||
|
@ -290,11 +287,6 @@ public class pm_newPonyArmor extends pm_newPonyAdv {
|
|||
this.syncLegs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDrop(RenderManager rendermanager, ItemRenderer itemrenderer, EntityLivingBase entity) {
|
||||
this.renderDrop(itemrenderer, entity, this.bipedRightArm, 1.0F, -0.0625F, 0.8375F, 0.0625F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setModelVisibilities(AbstractClientPlayer clientPlayer) {}
|
||||
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
package com.minelittlepony.minelp.model.pony;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.minelp.model.ModelPony;
|
||||
import com.minelittlepony.minelp.renderer.AniParams;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class pm_Human extends ModelPony {
|
||||
|
||||
|
@ -22,130 +13,9 @@ public class pm_Human extends ModelPony {
|
|||
super(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yoffset, float stretch) {
|
||||
this.cloak = new ModelRenderer(this, 0, 0);
|
||||
this.cloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
|
||||
this.bipedEars = new ModelRenderer(this, 24, 0);
|
||||
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, stretch);
|
||||
this.bipedHead = new ModelRenderer(this, 0, 0);
|
||||
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, stretch);
|
||||
this.bipedHead.setRotationPoint(0.0F, 0.0F + yoffset, 0.0F);
|
||||
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
|
||||
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, stretch + 0.5F);
|
||||
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + yoffset, 0.0F);
|
||||
this.bipedBody = new ModelRenderer(this, 16, 16);
|
||||
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, stretch);
|
||||
this.bipedBody.setRotationPoint(0.0F, 0.0F + yoffset, 0.0F);
|
||||
this.bipedRightArm = new ModelRenderer(this, 40, 16);
|
||||
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, stretch);
|
||||
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + yoffset, 0.0F);
|
||||
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
|
||||
this.bipedLeftArm.mirror = true;
|
||||
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, stretch);
|
||||
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + yoffset, 0.0F);
|
||||
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
|
||||
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, stretch);
|
||||
this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + yoffset, 0.0F);
|
||||
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
|
||||
this.bipedLeftLeg.mirror = true;
|
||||
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, stretch);
|
||||
this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + yoffset, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animate(AniParams ani) {}
|
||||
|
||||
@Override
|
||||
public void render(AniParams ani) {}
|
||||
|
||||
@Override
|
||||
protected boolean doCancelRender() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDrop(RenderManager rendermanager, ItemRenderer itemrenderer, EntityLivingBase entity) {
|
||||
this.renderDrop(itemrenderer, entity, this.bipedRightArm, 1.0F, -0.0625F, 0.4375F, 0.0625F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEars(EntityLivingBase entity, float par2) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
float f1 = entity.renderYawOffset + (entity.prevRenderYawOffset - entity.renderYawOffset) * par2
|
||||
- (entity.prevRenderYawOffset + (entity.renderYawOffset - entity.prevRenderYawOffset) * par2);
|
||||
float f2 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par2;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.375F * (i * 2 - 1), 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.375F, 0.0F);
|
||||
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F);
|
||||
float f7 = 1.333333F;
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
this.bipedEars.rotateAngleY = this.bipedHead.rotateAngleY;
|
||||
this.bipedEars.rotateAngleX = this.bipedHead.rotateAngleX;
|
||||
this.bipedEars.rotationPointX = 0.0F;
|
||||
this.bipedEars.rotationPointY = 0.0F;
|
||||
this.bipedEars.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCloak(EntityPlayer player, float par2) {
|
||||
this.renderCape(par2);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 0.0F, 0.125F);
|
||||
double d = player.prevChasingPosX + (player.chasingPosX - player.prevChasingPosX) * par2
|
||||
- (player.prevPosX + (player.posX - player.prevPosX) * par2);
|
||||
double d1 = player.prevChasingPosY + (player.chasingPosY - player.prevChasingPosY) * par2
|
||||
- (player.prevPosY + (player.posY - player.prevPosY) * par2);
|
||||
double d2 = player.prevChasingPosZ + (player.chasingPosZ - player.prevChasingPosZ) * par2
|
||||
- (player.prevPosZ + (player.posZ - player.prevPosZ) * par2);
|
||||
float f10 = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * par2;
|
||||
double d3 = MathHelper.sin(f10 * 3.1415927F / 180.0F);
|
||||
double d4 = (-MathHelper.cos(f10 * 3.1415927F / 180.0F));
|
||||
float f12 = (float) d1 * 10.0F;
|
||||
if (f12 < -6.0F) {
|
||||
f12 = -6.0F;
|
||||
}
|
||||
|
||||
if (f12 > 32.0F) {
|
||||
f12 = 32.0F;
|
||||
}
|
||||
|
||||
float f13 = (float) (d * d3 + d2 * d4) * 100.0F;
|
||||
float f14 = (float) (d * d4 - d2 * d3) * 100.0F;
|
||||
if (f13 < 0.0F) {
|
||||
f13 = 0.0F;
|
||||
}
|
||||
|
||||
float f15 = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * par2;
|
||||
f12 += MathHelper.sin((player.prevDistanceWalkedModified
|
||||
+ (player.distanceWalkedModified - player.prevDistanceWalkedModified) * par2) * 6.0F) * 32.0F * f15;
|
||||
if (player.isSneaking()) {
|
||||
f12 += 25.0F;
|
||||
}
|
||||
|
||||
GL11.glRotatef(6.0F + f13 / 2.0F + f12, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(f14 / 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-f14 / 2.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.cloak.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderStaticCloak(EntityLiving player, float par2) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 0.0F, 0.125F);
|
||||
GL11.glRotatef(3.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(2.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.cloak.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,7 @@ import com.minelittlepony.minelp.renderer.HornGlowRenderer;
|
|||
import com.minelittlepony.minelp.renderer.PlaneRenderer;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class pm_newPonyAdv extends ModelPony {
|
||||
|
@ -1542,120 +1537,8 @@ public class pm_newPonyAdv extends ModelPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderDrop(RenderManager rendermanager, ItemRenderer itemrenderer, EntityLivingBase entity) {
|
||||
|
||||
if (!this.isSleeping) {
|
||||
if (this.isUnicorn && this.glowColor != 0) {
|
||||
if (this.aimedBow) {
|
||||
this.renderDrop(itemrenderer, entity, this.unicornarm, 1.0F, 0.15F, 0.9375F, 0.0625F);
|
||||
} else if (this.size == 0) {
|
||||
this.renderDrop(itemrenderer, entity, this.unicornarm, 1.0F, 0.35F, 0.5375F, -0.8F);
|
||||
} else {
|
||||
this.renderDrop(itemrenderer, entity, this.unicornarm, 1.0F, 0.35F, 0.5375F, -0.45F);
|
||||
}
|
||||
} else if (this.size == 0) {
|
||||
this.renderDrop(itemrenderer, entity, this.bipedRightArm, 1.0F, 0.08F, 0.8375F, 0.0625F);
|
||||
} else {
|
||||
this.renderDrop(itemrenderer, entity, this.bipedRightArm, 1.0F, -0.0625F, 0.8375F, 0.0625F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCloak(EntityPlayer player, float par2) {
|
||||
pushMatrix();
|
||||
translate(0.0F, 0.24F, 0.0F);
|
||||
if (this.size == 0) {
|
||||
translate(0.0F, 0.67F, -0.04F);
|
||||
scale(0.6F, 0.6F, 0.6F);
|
||||
} else if (this.size == 2) {
|
||||
translate(0.0F, -0.14F, -0.1F);
|
||||
scale(1.15F, 1.2F, 1.2F);
|
||||
if (this.issneak && !this.isFlying) {
|
||||
translate(0.0F, 0.03F, 0.0F);
|
||||
}
|
||||
} else if (this.size == 3) {
|
||||
translate(0.0F, -0.09F, 0.0F);
|
||||
scale(1.0F, 1.0F, 1.0F);
|
||||
if (this.issneak && !this.isFlying) {
|
||||
translate(0.0F, 0.03F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.issneak && !this.isFlying) {
|
||||
translate(0.0F, 0.4F, -0.12F);
|
||||
}
|
||||
double d = player.prevChasingPosX + (player.chasingPosX - player.prevChasingPosX) * par2
|
||||
- (player.prevPosX + (player.posX - player.prevPosX) * par2);
|
||||
double d1 = player.prevChasingPosY + (player.chasingPosY - player.prevChasingPosY) * par2
|
||||
- (player.prevPosY + (player.posY - player.prevPosY) * par2);
|
||||
double d2 = player.prevChasingPosZ + (player.chasingPosZ - player.prevChasingPosZ) * par2
|
||||
- (player.prevPosZ + (player.posZ - player.prevPosZ) * par2);
|
||||
float f10 = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * par2;
|
||||
double d3 = MathHelper.sin(f10 * 3.1415927F / 180.0F);
|
||||
double d4 = (-MathHelper.cos(f10 * 3.1415927F / 180.0F));
|
||||
float f12 = (float) d1 * 10.0F;
|
||||
if (f12 < -6.0F) {
|
||||
f12 = -6.0F;
|
||||
}
|
||||
|
||||
if (f12 > 32.0F) {
|
||||
f12 = 32.0F;
|
||||
}
|
||||
|
||||
float f13 = (float) (d * d3 + d2 * d4) * 100.0F;
|
||||
float f14 = (float) (d * d4 - d2 * d3) * 100.0F;
|
||||
if (f13 < 0.0F) {
|
||||
f13 = 0.0F;
|
||||
}
|
||||
|
||||
float f15 = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * par2;
|
||||
f12 += MathHelper.sin((player.prevDistanceWalkedModified
|
||||
+ (player.distanceWalkedModified - player.prevDistanceWalkedModified) * par2) * 6.0F) * 32.0F * f15;
|
||||
if (player.isSneaking()) {
|
||||
f12 += 25.0F;
|
||||
}
|
||||
|
||||
rotate(2.0F + f13 / 12.0F + f12, 1.0F, 0.0F, 0.0F);
|
||||
rotate(f14 / 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
rotate(-f14 / 2.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
this.bipedCape.render(0.0625F);
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderStaticCloak(EntityLiving player, float par2) {
|
||||
pushMatrix();
|
||||
translate(0.0F, 0.24F, 0.0F);
|
||||
if (this.size == 0) {
|
||||
translate(0.0F, 0.67F, -0.04F);
|
||||
scale(0.6F, 0.6F, 0.6F);
|
||||
} else if (this.size == 2) {
|
||||
translate(0.0F, -0.14F, -0.1F);
|
||||
scale(1.15F, 1.2F, 1.2F);
|
||||
if (this.issneak && !this.isFlying) {
|
||||
translate(0.0F, 0.03F, 0.0F);
|
||||
}
|
||||
} else if (this.size == 3) {
|
||||
translate(0.0F, -0.09F, 0.0F);
|
||||
scale(1.0F, 1.0F, 1.0F);
|
||||
if (this.issneak && !this.isFlying) {
|
||||
translate(0.0F, 0.03F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.issneak && !this.isFlying) {
|
||||
translate(0.0F, 0.4F, -0.12F);
|
||||
}
|
||||
|
||||
rotate(3.0F, 1.0F, 0.0F, 0.0F);
|
||||
rotate(2.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
this.bipedCape.render(0.0625F);
|
||||
popMatrix();
|
||||
public void renderCape(float scale) {
|
||||
this.bipedCape.render(scale);
|
||||
}
|
||||
|
||||
protected void compressWings() {
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.minelittlepony.minelp.model.pony.pm_Human;
|
|||
import com.minelittlepony.minelp.model.pony.pm_newPonyAdv;
|
||||
import com.minelittlepony.minelp.renderer.layer.LayerHeldPonyItem;
|
||||
import com.minelittlepony.minelp.renderer.layer.LayerPonyArmor;
|
||||
import com.minelittlepony.minelp.renderer.layer.LayerPonyCape;
|
||||
import com.minelittlepony.minelp.renderer.layer.LayerPonySkull;
|
||||
import com.minelittlepony.minelp.util.MineLPPrivateFields;
|
||||
import com.mumfrey.liteloader.transformers.AppendInsns;
|
||||
|
@ -47,6 +48,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
|
|||
this.addLayer(new LayerHeldPonyItem(this));
|
||||
this.addLayer(new LayerArrow(this));
|
||||
this.addLayer(new LayerPonySkull(this));
|
||||
this.addLayer(new LayerPonyCape(this));
|
||||
}
|
||||
|
||||
@Obfuscated({ "a", "func_180596_a" })
|
||||
|
|
|
@ -1,26 +1,146 @@
|
|||
package com.minelittlepony.minelp.renderer.layer;
|
||||
|
||||
import com.minelittlepony.minelp.model.ModelPony;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
|
||||
import com.minelittlepony.minelp.model.PMAPI;
|
||||
import com.minelittlepony.minelp.model.PlayerModel;
|
||||
import com.minelittlepony.minelp.model.pony.pm_newPonyAdv;
|
||||
import com.minelittlepony.minelp.renderer.IRenderPony;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class LayerHeldPonyItem implements LayerRenderer {
|
||||
|
||||
private final RendererLivingEntity livingPonyEntity;
|
||||
private LayerHeldItem held;
|
||||
|
||||
public LayerHeldPonyItem(RendererLivingEntity livingPony) {
|
||||
this.livingPonyEntity = livingPony;
|
||||
this.held = new LayerHeldItem(livingPony);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_,
|
||||
public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_,
|
||||
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||
ModelPony pony = (ModelPony) livingPonyEntity.getMainModel();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
pony.renderDrop(mc.getRenderManager(), mc.getItemRenderer(), entitylivingbaseIn);
|
||||
PlayerModel pony = ((IRenderPony) livingPonyEntity).getPony();
|
||||
if (pony == PMAPI.human) {
|
||||
held.doRenderLayer(entity, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_,
|
||||
p_177141_7_, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pony.model.isSleeping) {
|
||||
if (pony.model.isUnicorn && pony.model.glowColor != 0) {
|
||||
pm_newPonyAdv model = (pm_newPonyAdv) pony.model;
|
||||
if (pony.model.aimedBow) {
|
||||
renderDrop(pony, entity, model.unicornarm, 1.0F, 0.15F, 0.9375F, 0.0625F);
|
||||
} else if (pony.model.size == 0) {
|
||||
renderDrop(pony, entity, model.unicornarm, 1.0F, 0.35F, 0.5375F, -0.8F);
|
||||
} else {
|
||||
renderDrop(pony, entity, model.unicornarm, 1.0F, 0.35F, 0.5375F, -0.45F);
|
||||
}
|
||||
} else if (pony.model.size == 0) {
|
||||
renderDrop(pony, entity, pony.model.bipedRightArm, 1.0F, 0.08F, 0.8375F, 0.0625F);
|
||||
} else {
|
||||
renderDrop(pony, entity, pony.model.bipedRightArm, 1.0F, -0.0625F, 0.8375F, 0.0625F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderDrop(PlayerModel pony, EntityLivingBase entity, ModelRenderer box, float scalefactor,
|
||||
float posx, float posy, float posz) {
|
||||
ItemStack drop = entity.getHeldItem();
|
||||
if (drop != null) {
|
||||
pushMatrix();
|
||||
if (box != null) {
|
||||
box.postRender(scalefactor * 0.0625F);
|
||||
}
|
||||
|
||||
translate(posx, posy, posz);
|
||||
EnumAction playerAction = null;
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer is3D = (EntityPlayer) entity;
|
||||
if (is3D.fishEntity != null) {
|
||||
drop = new ItemStack(Items.stick);
|
||||
}
|
||||
|
||||
if (is3D.getItemInUseCount() > 0) {
|
||||
playerAction = drop.getItemUseAction();
|
||||
}
|
||||
}
|
||||
|
||||
if (drop.getItem() == Items.bow) {
|
||||
rotate(-20.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (drop.getItem().isFull3D()) {
|
||||
if (drop.getItem().shouldRotateAroundWhenRendering()) {
|
||||
rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
translate(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
|
||||
if (playerAction == EnumAction.BLOCK && entity instanceof EntityPlayer
|
||||
&& ((EntityPlayer) entity).getItemInUseCount() > 0) {
|
||||
translate(0.05F, 0.0F, -0.1F);
|
||||
rotate(-50.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(-10.0F, 1.0F, 0.0F, 0.0F);
|
||||
rotate(-60.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
float g;
|
||||
float b;
|
||||
int var20;
|
||||
|
||||
var20 = drop.getItem().getColorFromItemStack(drop, 0);
|
||||
float var19 = (var20 >> 16 & 255) / 255.0F;
|
||||
g = (var20 >> 8 & 255) / 255.0F;
|
||||
b = (var20 & 255) / 255.0F;
|
||||
color(var19, g, b, 1.0F);
|
||||
Minecraft.getMinecraft().getItemRenderer().renderItem(entity, drop, TransformType.THIRD_PERSON);
|
||||
|
||||
if (pony.model.isUnicorn && pony.model.glowColor != 0) {
|
||||
this.renderItemGlow(entity, drop, pony.model.glowColor);
|
||||
}
|
||||
|
||||
popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, int glowColor) {
|
||||
// FIXME doesn't blend
|
||||
pushMatrix();
|
||||
GL11.glPushAttrib(24577);
|
||||
GL11.glDisable(2896);
|
||||
float red = (glowColor >> 16 & 255) / 255.0F;
|
||||
float green = (glowColor >> 8 & 255) / 255.0F;
|
||||
float blue = (glowColor & 255) / 255.0F;
|
||||
float alpha = 0.2F;
|
||||
enableBlend();
|
||||
GL11.glEnable(3042);
|
||||
GL14.glBlendColor(red, green, blue, alpha);
|
||||
blendFunc('\u8001', 1);
|
||||
color(red, green, blue, alpha);
|
||||
// translate(1.1F, 1.1F, 1.1F);
|
||||
if (!(drop.getItem() instanceof ItemBlock) || !drop.getItem().isFull3D()) {
|
||||
translate(0.02F, -0.06F, -0.02F);
|
||||
}
|
||||
Minecraft.getMinecraft().getItemRenderer().renderItem(entity, drop, TransformType.THIRD_PERSON);
|
||||
popAttrib();
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,24 +1,108 @@
|
|||
package com.minelittlepony.minelp.renderer.layer;
|
||||
|
||||
import com.minelittlepony.minelp.model.ModelPony;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
|
||||
import com.minelittlepony.minelp.model.PMAPI;
|
||||
import com.minelittlepony.minelp.model.PlayerModel;
|
||||
import com.minelittlepony.minelp.renderer.IRenderPony;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerCape;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class LayerPonyCape implements LayerRenderer {
|
||||
|
||||
private RendererLivingEntity renderer;
|
||||
private LayerCape cape;
|
||||
|
||||
public LayerPonyCape(RendererLivingEntity entity) {
|
||||
renderer = entity;
|
||||
this.cape = new LayerCape((RenderPlayer) entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_,
|
||||
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||
((ModelPony) renderer.getMainModel()).renderCloak((EntityPlayer) entitylivingbaseIn, partialTicks);
|
||||
public void doRenderLayer(EntityLivingBase entity, float p2, float p3, float ticks, float p5, float p6, float p7,
|
||||
float scale) {
|
||||
doRenderLayer((AbstractClientPlayer) entity, p2, p3, ticks, p5, p6, p7, scale);
|
||||
}
|
||||
|
||||
public void doRenderLayer(AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6,
|
||||
float p7, float scale) {
|
||||
PlayerModel model = ((IRenderPony) renderer).getPony();
|
||||
if (model == PMAPI.human) {
|
||||
cape.doRenderLayer(clientPlayer, p2, p3, ticks, p5, p6, p7, scale);
|
||||
} else if (clientPlayer.hasPlayerInfo() && !clientPlayer.isInvisible()
|
||||
&& clientPlayer.isWearing(EnumPlayerModelParts.CAPE) && clientPlayer.getLocationCape() != null) {
|
||||
|
||||
pushMatrix();
|
||||
translate(0.0F, 0.24F, 0.0F);
|
||||
if (model.model.size == 0) {
|
||||
translate(0.0F, 0.67F, -0.04F);
|
||||
scale(0.6F, 0.6F, 0.6F);
|
||||
} else if (model.model.size == 2) {
|
||||
translate(0.0F, -0.14F, -0.1F);
|
||||
scale(1.15F, 1.2F, 1.2F);
|
||||
if (model.model.issneak && !model.model.isFlying) {
|
||||
translate(0.0F, 0.03F, 0.0F);
|
||||
}
|
||||
} else if (model.model.size == 3) {
|
||||
translate(0.0F, -0.09F, 0.0F);
|
||||
scale(1.0F, 1.0F, 1.0F);
|
||||
if (model.model.issneak && !model.model.isFlying) {
|
||||
translate(0.0F, 0.03F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.model.issneak && !model.model.isFlying) {
|
||||
translate(0.0F, 0.4F, -0.12F);
|
||||
}
|
||||
double d = clientPlayer.prevChasingPosX + (clientPlayer.chasingPosX - clientPlayer.prevChasingPosX) * scale
|
||||
- (clientPlayer.prevPosX + (clientPlayer.posX - clientPlayer.prevPosX) * scale);
|
||||
double d1 = clientPlayer.prevChasingPosY + (clientPlayer.chasingPosY - clientPlayer.prevChasingPosY) * scale
|
||||
- (clientPlayer.prevPosY + (clientPlayer.posY - clientPlayer.prevPosY) * scale);
|
||||
double d2 = clientPlayer.prevChasingPosZ + (clientPlayer.chasingPosZ - clientPlayer.prevChasingPosZ) * scale
|
||||
- (clientPlayer.prevPosZ + (clientPlayer.posZ - clientPlayer.prevPosZ) * scale);
|
||||
float f10 = clientPlayer.prevRenderYawOffset
|
||||
+ (clientPlayer.renderYawOffset - clientPlayer.prevRenderYawOffset) * scale;
|
||||
double d3 = MathHelper.sin(f10 * 3.1415927F / 180.0F);
|
||||
double d4 = (-MathHelper.cos(f10 * 3.1415927F / 180.0F));
|
||||
float f12 = (float) d1 * 10.0F;
|
||||
if (f12 < -6.0F) {
|
||||
f12 = -6.0F;
|
||||
}
|
||||
|
||||
if (f12 > 32.0F) {
|
||||
f12 = 32.0F;
|
||||
}
|
||||
|
||||
float f13 = (float) (d * d3 + d2 * d4) * 100.0F;
|
||||
float f14 = (float) (d * d4 - d2 * d3) * 100.0F;
|
||||
if (f13 < 0.0F) {
|
||||
f13 = 0.0F;
|
||||
}
|
||||
|
||||
float f15 = clientPlayer.prevCameraYaw + (clientPlayer.cameraYaw - clientPlayer.prevCameraYaw) * scale;
|
||||
f12 += MathHelper.sin((clientPlayer.prevDistanceWalkedModified
|
||||
+ (clientPlayer.distanceWalkedModified - clientPlayer.prevDistanceWalkedModified) * scale) * 6.0F)
|
||||
* 32.0F * f15;
|
||||
if (clientPlayer.isSneaking()) {
|
||||
f12 += 25.0F;
|
||||
}
|
||||
|
||||
rotate(2.0F + f13 / 12.0F + f12, 1.0F, 0.0F, 0.0F);
|
||||
rotate(f14 / 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
rotate(-f14 / 2.0F, 0.0F, 1.0F, 0.0F);
|
||||
rotate(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
this.renderer.bindTexture(clientPlayer.getLocationCape());
|
||||
model.model.renderCape(0.0625F);
|
||||
popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue