Initial 1.11.2 update
This commit is contained in:
@@ -19,23 +19,23 @@ public class RenderArc extends Render<EntityArc> {
|
||||
|
||||
public RenderArc(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
for(int i=0;i<16;i++){
|
||||
for(int i = 0; i < 16; i++){
|
||||
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/arc_" + i + ".png");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityArc arc, double d0, double d1, double d2,
|
||||
float fa, float fb) {
|
||||
public void doRender(EntityArc arc, double d0, double d1, double d2, float fa, float fb){
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)d0, (float)d1, (float)d2);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //This line fixes the weird brightness bug.
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // This line fixes the weird
|
||||
// brightness bug.
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
//System.out.println("Entity coords: " + entity.posX + ", " + entity.posY + ", " + entity.posZ);
|
||||
//System.out.println("doRender parameters: " + d0 + ", " + d1 + ", " + d2 + ", " + fa + ", " + fb);
|
||||
// System.out.println("Entity coords: " + entity.posX + ", " + entity.posY + ", " + entity.posZ);
|
||||
// System.out.println("doRender parameters: " + d0 + ", " + d1 + ", " + d2 + ", " + fa + ", " + fb);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
@@ -57,62 +57,66 @@ public class RenderArc extends Render<EntityArc> {
|
||||
dy = arc.y1 - arc.posY + 0.3;
|
||||
dz = arc.z1 - arc.posZ;// + d0/lengthOffsetRatio;
|
||||
|
||||
// The distance from caster to target
|
||||
double arcLength = Math.sqrt(dz * dz + dx * dx);
|
||||
|
||||
//The distance from caster to target
|
||||
double arcLength = Math.sqrt(dz*dz+dx*dx);
|
||||
// The ratio between the length of the arc and the offset of the start point from the player's centre (which
|
||||
// is always 0.3).
|
||||
// double lengthOffsetRatio = arcLength/0.3;
|
||||
|
||||
//The ratio between the length of the arc and the offset of the start point from the player's centre (which is always 0.3).
|
||||
//double lengthOffsetRatio = arcLength/0.3;
|
||||
// EntityClientPlayerMP player = Minecraft.getMinecraft().player;
|
||||
|
||||
//EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
// double xViewDist = player.posX - d0;
|
||||
// double yViewDist = player.posY + player.eyeHeight - d1;
|
||||
// double zViewDist = player.posZ - d2;
|
||||
|
||||
//double xViewDist = player.posX - d0;
|
||||
//double yViewDist = player.posY + player.eyeHeight - d1;
|
||||
//double zViewDist = player.posZ - d2;
|
||||
// double xzViewDist = Math.sqrt(xViewDist * xViewDist + zViewDist * zViewDist);
|
||||
|
||||
//double xzViewDist = Math.sqrt(xViewDist * xViewDist + zViewDist * zViewDist);
|
||||
// The angle above the horizontal that this particular player is viewing the arc from
|
||||
// double viewAngle = Math.atan(yViewDist/xzViewDist);
|
||||
|
||||
//The angle above the horizontal that this particular player is viewing the arc from
|
||||
//double viewAngle = Math.atan(yViewDist/xzViewDist);
|
||||
|
||||
//Half the width of the arc
|
||||
// Half the width of the arc
|
||||
double arcWidth = 0.3d;
|
||||
|
||||
//Right hand side of vertical plane
|
||||
// Right hand side of vertical plane
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
//Target end
|
||||
// Target end
|
||||
buffer.pos(0, -0.5, 0).tex(1, 1).endVertex();
|
||||
buffer.pos(0, 0.5, 0).tex(1, 0).endVertex();
|
||||
//Caster end
|
||||
// Caster end
|
||||
buffer.pos(dx, dy, dz).tex(0, 0).endVertex();
|
||||
buffer.pos(dx, dy-1, dz).tex(0, 1).endVertex();
|
||||
buffer.pos(dx, dy - 1, dz).tex(0, 1).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
//Left
|
||||
// Left
|
||||
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
|
||||
//Target end
|
||||
// Target end
|
||||
buffer.pos(0, -0.5, 0).tex(1, 1).endVertex();
|
||||
//Caster end
|
||||
buffer.pos(dx, dy-1, dz).tex(0, 1).endVertex();
|
||||
// Caster end
|
||||
buffer.pos(dx, dy - 1, dz).tex(0, 1).endVertex();
|
||||
buffer.pos(dx, dy, dz).tex(0, 0).endVertex();
|
||||
//Target end
|
||||
// Target end
|
||||
buffer.pos(0, 0.5, 0).tex(1, 0).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
//Bottom of horizontal plane
|
||||
// Bottom of horizontal plane
|
||||
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((arcWidth/arcLength)*dz, 0, (-arcWidth/arcLength)*dx).tex(1, 1).endVertex();
|
||||
buffer.pos(dx + (arcWidth/arcLength)*dz, dy-0.5, dz - (arcWidth/arcLength)*dx).tex(0, 1).endVertex();
|
||||
buffer.pos(dx - (arcWidth/arcLength)*dz, dy-0.5, dz + (arcWidth/arcLength)*dx).tex(0, 0).endVertex();
|
||||
buffer.pos((-arcWidth/arcLength)*dz, 0, (arcWidth/arcLength)*dx).tex(1, 0).endVertex();
|
||||
buffer.pos((arcWidth / arcLength) * dz, 0, (-arcWidth / arcLength) * dx).tex(1, 1).endVertex();
|
||||
buffer.pos(dx + (arcWidth / arcLength) * dz, dy - 0.5, dz - (arcWidth / arcLength) * dx).tex(0, 1)
|
||||
.endVertex();
|
||||
buffer.pos(dx - (arcWidth / arcLength) * dz, dy - 0.5, dz + (arcWidth / arcLength) * dx).tex(0, 0)
|
||||
.endVertex();
|
||||
buffer.pos((-arcWidth / arcLength) * dz, 0, (arcWidth / arcLength) * dx).tex(1, 0).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
//Top
|
||||
// Top
|
||||
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((arcWidth/arcLength)*dz, 0, (-arcWidth/arcLength)*dx).tex(1, 1).endVertex();
|
||||
buffer.pos((-arcWidth/arcLength)*dz, 0, (arcWidth/arcLength)*dx).tex(1, 0).endVertex();
|
||||
buffer.pos(dx - (arcWidth/arcLength)*dz, dy-0.5, dz + (arcWidth/arcLength)*dx).tex(0, 0).endVertex();
|
||||
buffer.pos(dx + (arcWidth/arcLength)*dz, dy-0.5, dz - (arcWidth/arcLength)*dx).tex(0, 1).endVertex();
|
||||
buffer.pos((arcWidth / arcLength) * dz, 0, (-arcWidth / arcLength) * dx).tex(1, 1).endVertex();
|
||||
buffer.pos((-arcWidth / arcLength) * dz, 0, (arcWidth / arcLength) * dx).tex(1, 0).endVertex();
|
||||
buffer.pos(dx - (arcWidth / arcLength) * dz, dy - 0.5, dz + (arcWidth / arcLength) * dx).tex(0, 0)
|
||||
.endVertex();
|
||||
buffer.pos(dx + (arcWidth / arcLength) * dz, dy - 0.5, dz - (arcWidth / arcLength) * dx).tex(0, 1)
|
||||
.endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@@ -122,7 +126,7 @@ public class RenderArc extends Render<EntityArc> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityArc entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityArc entity){
|
||||
return textures[entity.textureIndex];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user