fix dragons
This commit is contained in:
parent
da3dfaf37c
commit
9a31abbb41
20 changed files with 271 additions and 995 deletions
|
@ -387,18 +387,6 @@ public class ClientPlayer implements IClientPlayer
|
|||
entity.serverPosZ = packetIn.getZ();
|
||||
entity.rotPitch = (float)(packetIn.getPitch() * 360) / 256.0F;
|
||||
entity.rotYaw = (float)(packetIn.getYaw() * 360) / 256.0F;
|
||||
Entity[] aentity = entity.getParts();
|
||||
|
||||
if (aentity != null)
|
||||
{
|
||||
int i = packetIn.getEntityID() - entity.getId();
|
||||
|
||||
for (int j = 0; j < aentity.length; ++j)
|
||||
{
|
||||
aentity[j].setId(aentity[j].getId() + i);
|
||||
}
|
||||
}
|
||||
|
||||
entity.setId(packetIn.getEntityID());
|
||||
this.gm.addEntityToWorld(packetIn.getEntityID(), entity);
|
||||
|
||||
|
@ -930,18 +918,6 @@ public class ClientPlayer implements IClientPlayer
|
|||
entitylivingbase.serverPosY = packetIn.getY();
|
||||
entitylivingbase.serverPosZ = packetIn.getZ();
|
||||
entitylivingbase.yawOffset = entitylivingbase.headYaw = (float)(packetIn.getHeadPitch() * 360) / 256.0F;
|
||||
Entity[] aentity = entitylivingbase.getParts();
|
||||
|
||||
if (aentity != null)
|
||||
{
|
||||
int i = packetIn.getEntityID() - entitylivingbase.getId();
|
||||
|
||||
for (int j = 0; j < aentity.length; ++j)
|
||||
{
|
||||
aentity[j].setId(aentity[j].getId() + i);
|
||||
}
|
||||
}
|
||||
|
||||
entitylivingbase.setId(packetIn.getEntityID());
|
||||
entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1);
|
||||
entitylivingbase.motionX = (double)((float)packetIn.getVelocityX() / 8000.0F);
|
||||
|
|
|
@ -1,102 +1,17 @@
|
|||
package client.renderer.entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.layers.LayerEnderDragonEyes;
|
||||
import client.renderer.model.ModelDragon;
|
||||
import common.entity.animal.EntityDragon;
|
||||
import common.util.ExtMath;
|
||||
|
||||
|
||||
public class RenderDragon extends RenderLiving<EntityDragon>
|
||||
{
|
||||
private static final String enderDragonTextures = "textures/creature/dragon.png";
|
||||
|
||||
/** An instance of the dragon model in RenderDragon */
|
||||
protected ModelDragon modelDragon;
|
||||
|
||||
public RenderDragon(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn, new ModelDragon(0.0F));
|
||||
this.modelDragon = (ModelDragon)this.mainModel;
|
||||
this.addLayer(new LayerEnderDragonEyes(this));
|
||||
// this.addLayer(new LayerEntityBreak());
|
||||
}
|
||||
|
||||
protected void rotateCorpse(EntityDragon bat, float p_77043_2_, float p_77043_3_, float partialTicks)
|
||||
{
|
||||
float f = (float)bat.getMovementOffsets(7, partialTicks)[0];
|
||||
float f1 = (float)(bat.getMovementOffsets(5, partialTicks)[1] - bat.getMovementOffsets(10, partialTicks)[1]);
|
||||
GL11.glRotatef(-f, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(f1 * 10.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
|
||||
if (bat.deathTime > 0)
|
||||
{
|
||||
float f2 = ((float)bat.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F;
|
||||
f2 = ExtMath.sqrtf(f2);
|
||||
|
||||
if (f2 > 1.0F)
|
||||
{
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
GL11.glRotatef(f2 * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the model in RenderLiving
|
||||
*/
|
||||
protected void renderModel(EntityDragon entitylivingbaseIn, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float scaleFactor)
|
||||
{
|
||||
// if (entitylivingbaseIn.deathTicks > 0)
|
||||
// {
|
||||
// float f = (float)entitylivingbaseIn.deathTicks / 200.0F;
|
||||
// GlState.depthFunc(GL11.GL_LEQUAL);
|
||||
// GlState.enableAlpha();
|
||||
// GlState.alphaFunc(GL11.GL_GREATER, f);
|
||||
// this.bindTexture(enderDragonExplodingTextures);
|
||||
// this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
|
||||
// GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
// GlState.depthFunc(GL11.GL_EQUAL);
|
||||
// }
|
||||
|
||||
this.bindEntityTexture(entitylivingbaseIn);
|
||||
this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
|
||||
|
||||
if (entitylivingbaseIn.hurtTime > 0)
|
||||
{
|
||||
GlState.depthFunc(GL11.GL_EQUAL);
|
||||
GlState.disableTexture2D();
|
||||
GlState.enableBlend();
|
||||
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlState.color(1.0F, 0.0F, 0.0F, 0.5F);
|
||||
this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
|
||||
GlState.enableTexture2D();
|
||||
GlState.disableBlend();
|
||||
GlState.depthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Renders the desired {@code T} type Entity.
|
||||
// */
|
||||
// public void doRender(EntityDragon entity, double x, double y, double z, float entityYaw, float partialTicks)
|
||||
// {
|
||||
// BossStatus.setBossStatus(entity);
|
||||
// super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||
//
|
||||
//// if (entity.healingEnderCrystal != null)
|
||||
//// {
|
||||
//// this.drawRechargeRay(entity, x, y, z, partialTicks);
|
||||
//// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
protected String getEntityTexture(EntityDragon entity)
|
||||
{
|
||||
return enderDragonTextures;
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package client.renderer.layers;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.entity.RenderDragon;
|
||||
import common.entity.animal.EntityDragon;
|
||||
|
||||
|
||||
public class LayerEnderDragonEyes implements LayerRenderer<EntityDragon>
|
||||
{
|
||||
private static final String TEXTURE = "textures/creature/dragon_eyes.png";
|
||||
private final RenderDragon dragonRenderer;
|
||||
|
||||
public LayerEnderDragonEyes(RenderDragon dragonRendererIn)
|
||||
{
|
||||
this.dragonRenderer = dragonRendererIn;
|
||||
}
|
||||
|
||||
public void doRenderLayer(EntityDragon 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)
|
||||
{
|
||||
this.dragonRenderer.bindTexture(TEXTURE);
|
||||
GlState.enableBlend();
|
||||
GlState.disableAlpha();
|
||||
GlState.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
GlState.disableLighting();
|
||||
GlState.depthFunc(GL11.GL_EQUAL);
|
||||
int i = 61680;
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F);
|
||||
GlState.enableLighting();
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.dragonRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
|
||||
this.dragonRenderer.setLightmap(entitylivingbaseIn, partialTicks);
|
||||
GlState.disableBlend();
|
||||
GlState.enableAlpha();
|
||||
GlState.depthFunc(GL11.GL_LEQUAL);
|
||||
}
|
||||
|
||||
public boolean shouldCombineTextures()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -139,6 +139,9 @@ public class ModelDragon extends ModelBase
|
|||
*/
|
||||
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||
GL11.glScalef(0.35f, 0.35f, 0.35f);
|
||||
GL11.glPushMatrix();
|
||||
EntityDragon entitydragon = (EntityDragon)entityIn;
|
||||
float f = entitydragon.prevAnimTime + (entitydragon.animTime - entitydragon.prevAnimTime) * this.partialTicks;
|
||||
|
@ -150,9 +153,8 @@ public class ModelDragon extends ModelBase
|
|||
float f2 = -30.0F;
|
||||
float f4 = 0.0F;
|
||||
float f5 = 1.5F;
|
||||
double[] adouble = entitydragon.getMovementOffsets(6, this.partialTicks);
|
||||
float f6 = this.updateRotations(entitydragon.getMovementOffsets(5, this.partialTicks)[0] - entitydragon.getMovementOffsets(10, this.partialTicks)[0]);
|
||||
float f7 = this.updateRotations(entitydragon.getMovementOffsets(5, this.partialTicks)[0] + (double)(f6 / 2.0F));
|
||||
float f6 = 0.0f;
|
||||
float f7 = this.updateRotations(p_78088_5_ + (double)(f6 / 2.0F));
|
||||
f2 = f2 + 2.0F;
|
||||
float f8 = f * (float)Math.PI * 2.0F;
|
||||
f2 = 20.0F;
|
||||
|
@ -160,11 +162,10 @@ public class ModelDragon extends ModelBase
|
|||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
double[] adouble1 = entitydragon.getMovementOffsets(5 - i, this.partialTicks);
|
||||
float f9 = (float)Math.cos((double)((float)i * 0.45F + f8)) * 0.15F;
|
||||
this.spine.rotateAngleY = this.updateRotations(adouble1[0] - adouble[0]) * (float)Math.PI / 180.0F * f5;
|
||||
this.spine.rotateAngleX = f9 + (float)(adouble1[1] - adouble[1]) * (float)Math.PI / 180.0F * f5 * 5.0F;
|
||||
this.spine.rotateAngleZ = -this.updateRotations(adouble1[0] - (double)f7) * (float)Math.PI / 180.0F * f5;
|
||||
this.spine.rotateAngleY = 0.0f * (float)Math.PI / 180.0F * f5;
|
||||
this.spine.rotateAngleX = f9 + (float)(0.0f) * (float)Math.PI / 180.0F * f5 * 5.0F;
|
||||
this.spine.rotateAngleZ = -this.updateRotations(p_78088_5_ - (double)f7) * (float)Math.PI / 180.0F * f5;
|
||||
this.spine.rotationPointY = f2;
|
||||
this.spine.rotationPointZ = f3;
|
||||
this.spine.rotationPointX = f4;
|
||||
|
@ -177,9 +178,8 @@ public class ModelDragon extends ModelBase
|
|||
this.head.rotationPointY = f2;
|
||||
this.head.rotationPointZ = f3;
|
||||
this.head.rotationPointX = f4;
|
||||
double[] adouble2 = entitydragon.getMovementOffsets(0, this.partialTicks);
|
||||
this.head.rotateAngleY = this.updateRotations(adouble2[0] - adouble[0]) * (float)Math.PI / 180.0F * 1.0F;
|
||||
this.head.rotateAngleZ = -this.updateRotations(adouble2[0] - (double)f7) * (float)Math.PI / 180.0F * 1.0F;
|
||||
this.head.rotateAngleY = 0.0f * (float)Math.PI / 180.0F * 1.0F;
|
||||
this.head.rotateAngleZ = -this.updateRotations(p_78088_5_ - (double)f7) * (float)Math.PI / 180.0F * 1.0F;
|
||||
this.head.render(scale);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 1.0F, 0.0F);
|
||||
|
@ -221,15 +221,13 @@ public class ModelDragon extends ModelBase
|
|||
f2 = 10.0F;
|
||||
f3 = 60.0F;
|
||||
f4 = 0.0F;
|
||||
adouble = entitydragon.getMovementOffsets(11, this.partialTicks);
|
||||
|
||||
for (int k = 0; k < 12; ++k)
|
||||
{
|
||||
adouble2 = entitydragon.getMovementOffsets(12 + k, this.partialTicks);
|
||||
f10 = (float)((double)f10 + Math.sin((double)((float)k * 0.45F + f8)) * 0.05000000074505806D);
|
||||
this.spine.rotateAngleY = (this.updateRotations(adouble2[0] - adouble[0]) * f5 + 180.0F) * (float)Math.PI / 180.0F;
|
||||
this.spine.rotateAngleX = f10 + (float)(adouble2[1] - adouble[1]) * (float)Math.PI / 180.0F * f5 * 5.0F;
|
||||
this.spine.rotateAngleZ = this.updateRotations(adouble2[0] - (double)f7) * (float)Math.PI / 180.0F * f5;
|
||||
this.spine.rotateAngleY = (0.0f * f5 + 180.0F) * (float)Math.PI / 180.0F;
|
||||
this.spine.rotateAngleX = f10 + (float)0.0f * (float)Math.PI / 180.0F * f5 * 5.0F;
|
||||
this.spine.rotateAngleZ = this.updateRotations(p_78088_5_ - (double)f7) * (float)Math.PI / 180.0F * f5;
|
||||
this.spine.rotationPointY = f2;
|
||||
this.spine.rotationPointZ = f3;
|
||||
this.spine.rotationPointX = f4;
|
||||
|
@ -240,6 +238,7 @@ public class ModelDragon extends ModelBase
|
|||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Loading…
Add table
Add a link
Reference in a new issue