initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
79
java/src/game/renderer/layers/LayerCape.java
Executable file
79
java/src/game/renderer/layers/LayerCape.java
Executable file
|
@ -0,0 +1,79 @@
|
|||
package game.renderer.layers;
|
||||
|
||||
import game.ExtMath;
|
||||
import game.WCF;
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.renderer.GlState;
|
||||
import game.renderer.entity.RenderHumanoid;
|
||||
import game.renderer.model.ModelRenderer;
|
||||
|
||||
public class LayerCape implements LayerRenderer<EntityNPC>
|
||||
{
|
||||
private final RenderHumanoid renderer;
|
||||
private final ModelRenderer bipedCape;
|
||||
private final float shift;
|
||||
private final int height;
|
||||
|
||||
public LayerCape(RenderHumanoid npcRendererIn, int shift, int height)
|
||||
{
|
||||
this.renderer = npcRendererIn;
|
||||
this.shift = (float)shift; // 0.0F
|
||||
this.height = height;
|
||||
this.bipedCape = new ModelRenderer(0, 0, 64, 32);
|
||||
this.bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, height, 1, 0.0f);
|
||||
}
|
||||
|
||||
public void doRenderLayer(EntityNPC 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)
|
||||
{
|
||||
if(/* !entitylivingbaseIn.isInvisible() && */ // entitylivingbaseIn.isWearing(ModelPart.CAPE)
|
||||
// &&
|
||||
entitylivingbaseIn.getLocationCape() != null) {
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.renderer.bindTexture(entitylivingbaseIn.getLocationCape());
|
||||
WCF.glPushMatrix();
|
||||
WCF.glTranslatef(0.0F, 0.0F, 0.125F);
|
||||
if(entitylivingbaseIn.isPlayer()) {
|
||||
EntityNPC player = (EntityNPC)entitylivingbaseIn;
|
||||
double d0 = player.prevChasingPosX + (player.chasingPosX - player.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevX) * (double)partialTicks);
|
||||
double d1 = player.prevChasingPosY + (player.chasingPosY - player.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevY) * (double)partialTicks);
|
||||
double d2 = player.prevChasingPosZ + (player.chasingPosZ - player.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevZ) * (double)partialTicks);
|
||||
float f = entitylivingbaseIn.prevYawOffset + (entitylivingbaseIn.yawOffset - entitylivingbaseIn.prevYawOffset) * partialTicks;
|
||||
double d3 = (double)ExtMath.sin(f * (float)Math.PI / 180.0F);
|
||||
double d4 = (double)(-ExtMath.cos(f * (float)Math.PI / 180.0F));
|
||||
float f1 = (float)d1 * 10.0F;
|
||||
f1 = ExtMath.clampf(f1, -6.0F, 32.0F);
|
||||
float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F;
|
||||
float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F;
|
||||
|
||||
if (f2 < 0.0F)
|
||||
{
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
float f4 = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * partialTicks;
|
||||
f1 = f1 + ExtMath.sin((entitylivingbaseIn.prevWalkDistMod + (entitylivingbaseIn.walkDistMod - entitylivingbaseIn.prevWalkDistMod) * partialTicks) * 6.0F) * 32.0F * f4;
|
||||
|
||||
if (entitylivingbaseIn.isSneakingVisually())
|
||||
{
|
||||
f1 += 25.0F;
|
||||
}
|
||||
|
||||
WCF.glRotatef(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F);
|
||||
WCF.glRotatef(f3 / 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
WCF.glRotatef(-f3 / 2.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else {
|
||||
WCF.glRotatef(entitylivingbaseIn.isSneakingVisually() ? 25.0F : 5.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
WCF.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
this.bipedCape.rotationPointY = this.shift + (entitylivingbaseIn.isSneakingVisually() ? 2.0f : 0.0f);
|
||||
this.bipedCape.render(0.0625F);
|
||||
WCF.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldCombineTextures()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue