Fix entity rendering, but screw up all the animations n stuff.. sigh

This commit is contained in:
Bernhard Bonigl committed 2014-10-10 17:37:39 +02:00
1 parent 2988b75490
commit 69fad3c103
3 files changed
+32 -31

No files matched your search

@@ -101,6 +101,8 @@ public class FlexibleToolRenderer implements IItemRenderer {
specialAnimation(type, item);
}
else
GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft.
// prepare colors
int[] color = new int[iconParts];
@@ -113,10 +115,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
for (int i = 0; i < iconParts; ++i)
{
tess.setColorOpaque_I(color[i]);
tess.addVertexWithUV(-0.5, -0.5, +depth, xMax[i], yMax[i]);
tess.addVertexWithUV(+0.5, -0.5, +depth, xMin[i], yMax[i]);
tess.addVertexWithUV(+0.5, +0.5, +depth, xMin[i], yMin[i]);
tess.addVertexWithUV(-0.5, +0.5, +depth, xMax[i], yMin[i]);
tess.addVertexWithUV(0, 0, +depth, xMax[i], yMax[i]);
tess.addVertexWithUV(1, 0, +depth, xMin[i], yMax[i]);
tess.addVertexWithUV(1, 1, +depth, xMin[i], yMin[i]);
tess.addVertexWithUV(0, 1, +depth, xMax[i], yMin[i]);
}
tess.draw();
@@ -126,10 +128,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
for (int i = 0; i < iconParts; ++i)
{
tess.setColorOpaque_I(color[i]);
tess.addVertexWithUV(-0.5, +0.5, -depth, xMax[i], yMin[i]);
tess.addVertexWithUV(+0.5, +0.5, -depth, xMin[i], yMin[i]);
tess.addVertexWithUV(+0.5, -0.5, -depth, xMin[i], yMax[i]);
tess.addVertexWithUV(-0.5, -0.5, -depth, xMax[i], yMax[i]);
tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]);
tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]);
tess.addVertexWithUV(1, 0, -depth, xMin[i], yMax[i]);
tess.addVertexWithUV(0, 0, -depth, xMax[i], yMax[i]);
}
tess.draw();
@@ -147,11 +149,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
{
pos = k / w;
iconPos = m + d * pos - s;
pos -= 0.5f;
tess.addVertexWithUV(pos, -0.5, -depth, iconPos, yMax[i]);
tess.addVertexWithUV(pos, -0.5, +depth, iconPos, yMax[i]);
tess.addVertexWithUV(pos, +0.5, +depth, iconPos, yMin[i]);
tess.addVertexWithUV(pos, +0.5, -depth, iconPos, yMin[i]);
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
tess.addVertexWithUV(pos, 0, +depth, iconPos, yMax[i]);
tess.addVertexWithUV(pos, 1, +depth, iconPos, yMin[i]);
tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin[i]);
}
}
@@ -169,12 +170,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
{
pos = k / w;
iconPos = m + d * pos - s;
pos -= 0.5f;
posEnd = pos + d2;
tess.addVertexWithUV(posEnd, +0.5, -depth, iconPos, yMin[i]);
tess.addVertexWithUV(posEnd, +0.5, +depth, iconPos, yMin[i]);
tess.addVertexWithUV(posEnd, -0.5, +depth, iconPos, yMax[i]);
tess.addVertexWithUV(posEnd, -0.5, -depth, iconPos, yMax[i]);
tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin[i]);
tess.addVertexWithUV(posEnd, 1, +depth, iconPos, yMin[i]);
tess.addVertexWithUV(posEnd, 0, +depth, iconPos, yMax[i]);
tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax[i]);
}
}
@@ -191,12 +191,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
{
pos = k / h;
iconPos = m + d * pos - s;
pos -= 0.5f;
posEnd = pos + d2;
tess.addVertexWithUV(-0.5, posEnd, +depth, xMax[i], iconPos);
tess.addVertexWithUV(+0.5, posEnd, +depth, xMin[i], iconPos);
tess.addVertexWithUV(+0.5, posEnd, -depth, xMin[i], iconPos);
tess.addVertexWithUV(-0.5, posEnd, -depth, xMax[i], iconPos);
tess.addVertexWithUV(0, posEnd, +depth, xMax[i], iconPos);
tess.addVertexWithUV(1, posEnd, +depth, xMin[i], iconPos);
tess.addVertexWithUV(1, posEnd, -depth, xMin[i], iconPos);
tess.addVertexWithUV(0, posEnd, -depth, xMax[i], iconPos);
}
}
@@ -212,11 +211,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
{
pos = k / h;
iconPos = m + d * pos - s;
pos -= 0.5f;
tess.addVertexWithUV(+0.5, pos, +depth, xMin[i], iconPos);
tess.addVertexWithUV(-0.5, pos, +depth, xMax[i], iconPos);
tess.addVertexWithUV(-0.5, pos, -depth, xMax[i], iconPos);
tess.addVertexWithUV(+0.5, pos, -depth, xMin[i], iconPos);
tess.addVertexWithUV(1, pos, +depth, xMin[i], iconPos);
tess.addVertexWithUV(0, pos, +depth, xMax[i], iconPos);
tess.addVertexWithUV(0, pos, -depth, xMax[i], iconPos);
tess.addVertexWithUV(1, pos, -depth, xMin[i], iconPos);
}
}
@@ -33,7 +33,7 @@ public class ProjectileBaseRenderer<T extends ProjectileBase> extends Render {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
// last step: translate from 0/0/0 to correct position in world
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glTranslated(x, y, z);
// mkae it smaller
GL11.glScalef(0.5F, 0.5F, 0.5F);
@@ -50,7 +50,9 @@ public class ProjectileBaseRenderer<T extends ProjectileBase> extends Render {
// draw correct texture. not some weird block fragments.
renderManager.renderEngine.bindTexture(TextureMap.locationItemsTexture);
// rendering code has been optimized to be exactly at the center and without translation
GL11.glTranslatef(0.0f, -0.25f, 0);
toolCoreRenderer.renderItem(IItemRenderer.ItemRenderType.ENTITY, entity.getEntityItem());
GL11.glTranslatef(0.0f, 0.25f, 0);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
@@ -43,13 +43,14 @@ public class ShurikenEntity extends ProjectileBase {
super.readSpawnData(data);
// this is only relevant clientside only, so we don't actually have it on the server
rollAngle = (TinkerWeaponry.random.nextInt(3)-1)*45 + TinkerWeaponry.random.nextInt(30)-15;
//rollAngle = (TinkerWeaponry.random.nextInt(3)-1)*45 + TinkerWeaponry.random.nextInt(30)-15;
spin = TinkerWeaponry.random.nextInt(360);
}
@Override
protected double getGravity() {
return (this.ticksExisted/8) * 0.018d; // integer division. so the first 20 ticks it will have no gravity at all.
return 0;
//return (this.ticksExisted/8) * 0.018d; // integer division. so the first 20 ticks it will have no gravity at all.
}
@Override