mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-22 04:52:18 +00:00
cleanup
This commit is contained in:
1 parent
0b8b56a74b
commit
3aef354b3a
16 files changed
+325
-269
No files matched your search
@@ -1,84 +0,0 @@
|
||||
package emt.client.renderer;
|
||||
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import emt.entity.EntityElectroBall;
|
||||
import emt.util.EMTRandomHelper.Bolt;
|
||||
import emt.util.EMTRandomHelper.Point;
|
||||
|
||||
public class RenderElectroBall extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float p1, float p2) {
|
||||
EntityElectroBall ball = (EntityElectroBall) entity;
|
||||
|
||||
if (ball.shootingEntity == null) {
|
||||
if (ball.worldObj.isRemote) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
glPushMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glTranslated(x, y, z);
|
||||
|
||||
renderBolt(ball, tessellator, 0, 0, 0, 8);
|
||||
|
||||
if (ball.inTile) {
|
||||
|
||||
renderBolt(ball, tessellator, 0, 0, 0, 0.5F);
|
||||
|
||||
if (ball.entityPositions != null) {
|
||||
for (Point pos : ball.entityPositions) {
|
||||
double trX = pos.x - entity.posX;
|
||||
double trY = pos.y - entity.posY;
|
||||
double trZ = pos.z - entity.posZ;
|
||||
|
||||
renderBolt(ball, tessellator, trX, trY, trZ, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glEnable(GL_FOG);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderBolt(EntityElectroBall ball, Tessellator tess, double x, double y, double z, double scale) {
|
||||
for (int i = 0; i < ball.bolts.length; i++) {
|
||||
Bolt bolt = ball.bolts[i];
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(x, y, z);
|
||||
glRotatef(bolt.angleZ, 0, 0, 1);
|
||||
glRotatef(bolt.angleY, 0, 1, 0);
|
||||
glLineWidth(2);
|
||||
|
||||
tess.startDrawing(GL_LINE_STRIP);
|
||||
tess.setColorRGBA(255, 255, 255, 255);
|
||||
for (Point point : bolt.points) {
|
||||
tess.addVertex((point.x / scale), (point.y / scale), (point.z / scale));
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package emt.client.renderer;
|
||||
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import emt.entity.EntityEnergyBall;
|
||||
import emt.util.EMTRandomHelper.Bolt;
|
||||
import emt.util.EMTRandomHelper.Point;
|
||||
|
||||
public class RenderEnergyBall extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float p1, float p2) {
|
||||
EntityEnergyBall ball = (EntityEnergyBall) entity;
|
||||
|
||||
if (ball.shootingEntity == null) {
|
||||
if (ball.worldObj.isRemote) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
glPushMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glTranslated(x, y, z);
|
||||
|
||||
/*******************************************/
|
||||
for (int i = 0; i < ball.bolts.length; i++) {
|
||||
Bolt bolt = ball.bolts[i];
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(bolt.angleZ, 0, 0, 1);
|
||||
glRotatef(bolt.angleY, 0, 1, 0);
|
||||
glLineWidth(2);
|
||||
|
||||
tess.startDrawing(GL_LINE_STRIP);
|
||||
for (Point point : bolt.points) {
|
||||
tess.setColorRGBA(point.r & 0xff, point.g & 0xff, point.b & 0xff, 255);
|
||||
tess.addVertex((point.x / 10), (point.y / 10), (point.z / 10));
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
/*******************************************/
|
||||
|
||||
if (ball.inTile) {
|
||||
|
||||
/** Horizontal **/
|
||||
for (int i = 0; i < ball.bolts.length; i++) {
|
||||
Bolt bolt = ball.bolts[i];
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(bolt.angleY, 0, 1, 0);
|
||||
glLineWidth(2);
|
||||
|
||||
tess.startDrawing(GL_LINE_STRIP);
|
||||
tess.setColorRGBA(255, 255, 255, 255);
|
||||
for (Point point : bolt.points) {
|
||||
tess.addVertex(point.x / (60 / ball.ticksAlive), point.y / 4, point.z / (60 / ball.ticksAlive));
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
/****************/
|
||||
|
||||
if (ball.entityPositions != null) {
|
||||
for (int i = 0; i < ball.entityPositions.length; i++) {
|
||||
Point pos = ball.entityPositions[i];
|
||||
double trX = pos.x - entity.posX;
|
||||
double trY = pos.y - entity.posY;
|
||||
double trZ = pos.z - entity.posZ;
|
||||
|
||||
for(int e = 0; e < ball.MAX_COUNT_OF_BOLTS; e++) {
|
||||
Bolt bolt = ball.entityBolts[i][e];
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(trX, trY, trZ);
|
||||
glRotatef(bolt.angleZ, 0, 0, 1);
|
||||
glRotatef(bolt.angleY, 0, 1, 0);
|
||||
glLineWidth(2);
|
||||
|
||||
tess.startDrawing(GL_LINE_STRIP);
|
||||
for (Point point : bolt.points) {
|
||||
tess.setColorRGBA(point.r & 0xff, point.g & 0xff, point.b & 0xff, 255);
|
||||
tess.addVertex(point.x / 4 , point.y / 4, point.z / 4);
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glEnable(GL_FOG);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,13 +14,14 @@ public class RenderLaser extends Render {
|
||||
|
||||
private static final ResourceLocation laserTexture = new ResourceLocation(ModInformation.texturePath, "textures/models/lasermodel.png");
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityLaser);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90, 0, 1, 0);
|
||||
GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0, 0, 1);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Tessellator tess = Tessellator.instance;
|
||||
byte b0 = 0;
|
||||
float f2 = 0.4f;
|
||||
float f3 = 0.7f;
|
||||
@@ -38,22 +39,21 @@ public class RenderLaser extends Render {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
GL11.glNormal3f(0, 0, f10);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(-8, 0, 0, f2, f4);
|
||||
tessellator.addVertexWithUV(8, 0, 0, f3, f4);
|
||||
tessellator.addVertexWithUV(8, 4, 0, f3, f5);
|
||||
tessellator.addVertexWithUV(-8, 4, 0, f2, f5);
|
||||
tessellator.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(-8, 0, 0, f2, f4);
|
||||
tess.addVertexWithUV(8, 0, 0, f3, f4);
|
||||
tess.addVertexWithUV(8, 4, 0, f3, f5);
|
||||
tess.addVertexWithUV(-8, 4, 0, f2, f5);
|
||||
tess.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(8, 0, 0, f2, f4);
|
||||
tessellator.addVertexWithUV(-8, 0, 0, f3, f4);
|
||||
tessellator.addVertexWithUV(-8, 4, 0, f3, f5);
|
||||
tessellator.addVertexWithUV(8, 4, 0, f2, f5);
|
||||
tessellator.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(8, 0, 0, f2, f4);
|
||||
tess.addVertexWithUV(-8, 0, 0, f3, f4);
|
||||
tess.addVertexWithUV(-8, 4, 0, f3, f5);
|
||||
tess.addVertexWithUV(8, 4, 0, f2, f5);
|
||||
tess.draw();
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -62,7 +62,8 @@ public class RenderLaser extends Render {
|
||||
return laserTexture;
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.getArrowTextures((EntityLaser) par1Entity);
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getArrowTextures((EntityLaser) entity);
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@ public class RenderShield extends Render {
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entityShield, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityShield);
|
||||
|
||||
|
||||
Reference in new issue
Block a user