Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.awt.Color; //temp so you get the idea
- import java.util.ArrayList;
- import java.util.HashMap;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.entity.RenderManager;
- import net.minecraft.entity.player.EntityPlayer;
- import org.lwjgl.opengl.GL11;
- import org.lwjgl.opengl.GL12;
- public class EntityLineCreator extends BaseMod
- {
- private /*Color*/ linecolor;
- private boolean colormodulation = false;
- private int linebrightness = 255
- private HashMap entitycolors = new HashMap();
- private /*Entity*/ trackedentitytype;
- private ArrayList</*Entity*/> entities = new ArrayList</*Entity*/>();
- private HashMap xcoords = new HashMap();
- private HashMap ycoords = new HashMap();
- private HashMap zcoords = new HashMap();
- private HashMap oldxcoords = new HashMap();
- private HashMap oldycoords = new HashMap();
- private HashMap oldzcoords = new HashMap();
- public EntityLineCreator(/*Entity*/ trackedentityclass, /*Color*/ colorofline, boolean modulatecolor) {
- trackedentitytype = trackedentityclass;
- linecolor = colorofline;
- colormodulation = modulatecolor;
- entities = /*World.getEntities(trackedentitytype)*/ //get all entities of the tracked type
- }
- public void render(RenderWorldLastEvent event)
- {
- if (player == null || info == null || info.getPoint1() == null && info.getPoint2() == null)
- return;
- GL11.glPushMatrix();
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- GL11.glDisable(GL11.GL_DEPTH_TEST);
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- Tessellator tess = Tessellator.instance;
- Tessellator.renderingWorldRenderer = false;
- entities = /*World.getEntities(trackedentitytype)*/
- if(entities.size() == 0) return; //if there aren't any entities return
- logCoords(); //make the current coords old
- getEntityCoords(); //get the new coords
- drawLine(tess); //draw a bunch of lines
- }
- public void logCoords() {
- oldxcoords = xcoords;
- oldycoords = ycoords;
- oldzcoords = zcoords;
- }
- public void getEntityCoords() {
- xcoords.clear();
- ycoords.clear();
- zcoords.clear();
- for(/*Entity e : entities*/) {
- xcoords.put(/*e.getID(), e.getX()*/);
- ycoords.put(/*e.getID(), e.getY()*/);
- zcoords.put(/*e.getID(), e.getZ()*/);
- }
- }
- private void drawLine(Tessellator tess)
- {
- if (oldxcoords.isEmpty() || oldycoords.isEmpty() || oldzcoords.isEmpty()) {
- if(colormodulation == true) {
- if(entitycolors.get(/*e.getID()*/) == null || entitycolors.get(/*e.getID()*/) == 0) {
- entitycolors.put(/*e.getID()*/, 255);
- } else {
- entitycolors.put(/*e.getID()*/, entitycolors.get(/*e.getID()*/) - 1);
- }
- /*tess.setDrawingColor(new Color(linecolor.getRed(),linecolor.getBlue(),linecolor.getGreen(),entitycolors.get(/*e.getID()*/)))*/
- } else {
- /*tess.setDrawingColor(new Color(linecolor.getRed(),linecolor.getBlue(),linecolor.getGreen())*/;
- }
- tess.startDrawing(GL11.GL_LINES);
- tess.addVertex(oldxcoords.get(/*e.getID()*/),oldycoords.get(/*e.getID()*/),oldzcoords.get(/*e.getID()*/));
- tess.addVertex(xcoords.get(/*e.getID()*/), ycoords.get(/*e.getID()*/), zcoords.get(/*e.getID()*/));
- tess.draw();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment