diff --git a/Templates/asmrender/ASMRender.java b/Templates/asmrender/ASMRender.java index 1b6df03..ecdae88 100644 --- a/Templates/asmrender/ASMRender.java +++ b/Templates/asmrender/ASMRender.java @@ -10,18 +10,18 @@ public class ASMRender { public static Minecraft minecraft = Minecraft.getMinecraft(); - - static boolean gl_lighting; - static boolean gl_texture_2d; - static boolean gl_point_smooth; - static boolean gl_line_smooth; - static boolean gl_depth_test; - static boolean gl_blend; - static float gl_point_size; - static float gl_line_width; - static int gl_blend_src; - static int gl_blend_dst; - + + static boolean gl_lighting; + static boolean gl_texture_2d; + static boolean gl_point_smooth; + static boolean gl_line_smooth; + static boolean gl_depth_test; + static boolean gl_blend; + static float gl_point_size; + static float gl_line_width; + static int gl_blend_src; + static int gl_blend_dst; + public static void translate(float x, float y, float z) { GL11.glTranslatef(-x, -y, -z); @@ -30,9 +30,9 @@ public static void translate(float x, float y, float z) private static void setGLConst(int glconst, boolean value) { if(value) - GL11.glEnable(glconst); + GL11.glEnable(glconst); else - GL11.glDisable(glconst); + GL11.glDisable(glconst); } public static void setup(boolean doDepth) @@ -63,15 +63,15 @@ public static void setup(boolean doDepth) public static void restore() { - setGLConst(GL11.GL_LIGHTING, gl_lighting); - setGLConst(GL11.GL_TEXTURE_2D, gl_texture_2d); - setGLConst(GL11.GL_POINT_SMOOTH, gl_point_smooth); - setGLConst(GL11.GL_LINE_SMOOTH, gl_line_smooth); - setGLConst(GL11.GL_DEPTH_TEST, gl_depth_test); - setGLConst(GL11.GL_BLEND, gl_blend); - - GL11.glBlendFunc(gl_blend_src, gl_blend_dst); - + setGLConst(GL11.GL_LIGHTING, gl_lighting); + setGLConst(GL11.GL_TEXTURE_2D, gl_texture_2d); + setGLConst(GL11.GL_POINT_SMOOTH, gl_point_smooth); + setGLConst(GL11.GL_LINE_SMOOTH, gl_line_smooth); + setGLConst(GL11.GL_DEPTH_TEST, gl_depth_test); + setGLConst(GL11.GL_BLEND, gl_blend); + + GL11.glBlendFunc(gl_blend_src, gl_blend_dst); + GL11.glLineWidth(gl_line_width); GL11.glPointSize(gl_point_size); GL11.glPopMatrix(); @@ -79,7 +79,7 @@ public static void restore() public static void drawLine(float startx, float starty, float startz, float endx, float endy, float endz, Color color, float width) { - GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); + GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); GL11.glLineWidth(width); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3f(startx, starty, startz); @@ -89,7 +89,7 @@ public static void drawLine(float startx, float starty, float startz, float endx public static void drawBox(float ax, float ay, float az, float bx, float by, float bz, Color color, float width) { - GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); + GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); GL11.glLineWidth(width); GL11.glBegin(GL11.GL_LINE_STRIP); @@ -126,58 +126,58 @@ public static void drawBox(float ax, float ay, float az, float bx, float by, flo private static void drawBoxPart(float args[][], int m[][]) { - GL11.glBegin(GL11.GL_QUADS); - for(int i = 0; i < m.length; i++) - GL11.glVertex3f(args[m[i][0]][0], args[m[i][1]][1], args[m[i][2]][2]); - GL11.glEnd(); + GL11.glBegin(GL11.GL_QUADS); + for(int i = 0; i < m.length; i++) + GL11.glVertex3f(args[m[i][0]][0], args[m[i][1]][1], args[m[i][2]][2]); + GL11.glEnd(); } public static void drawBoxWalls(float ax, float ay, float az, float bx, float by, float bz, Color color, float alpha) { - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - GL11.glDepthMask(false); - GL11.glColor4f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F, alpha); - - float args[][] = new float[][] { {ax,ay,az}, {bx,by,bz} }; - - // Outside - drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{0,1,1},{0,1,0}}); // Neg X - drawBoxPart(args, new int[][] {{1,0,0},{1,1,0},{1,1,1},{1,0,1}}); // Pos X - - drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,0,1},{0,0,1}}); // Neg Y - drawBoxPart(args, new int[][] {{0,1,0},{0,1,1},{1,1,1},{1,1,0}}); // Pos Y - - drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{1,1,0},{1,0,0}}); // Neg Z - drawBoxPart(args, new int[][] {{0,0,1},{1,0,1},{1,1,1},{0,1,1}}); // Pos Z - - // Inside - drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{0,1,1},{0,0,1}}); // Neg X - drawBoxPart(args, new int[][] {{1,0,0},{1,0,1},{1,1,1},{1,1,0}}); // Pos X - - drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{1,0,1},{1,0,0}}); // Neg Y - drawBoxPart(args, new int[][] {{0,1,0},{1,1,0},{1,1,1},{0,1,1}}); // Pos Y - - drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,1,0},{0,1,0}}); // Neg Z - drawBoxPart(args, new int[][] {{0,0,1},{0,1,1},{1,1,1},{1,0,1}}); // Pos Z - - GL11.glDepthMask(true); - GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO); - GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glDepthMask(false); + GL11.glColor4f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F, alpha); + + float args[][] = new float[][] { {ax,ay,az}, {bx,by,bz} }; + + // Outside + drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{0,1,1},{0,1,0}}); // Neg X + drawBoxPart(args, new int[][] {{1,0,0},{1,1,0},{1,1,1},{1,0,1}}); // Pos X + + drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,0,1},{0,0,1}}); // Neg Y + drawBoxPart(args, new int[][] {{0,1,0},{0,1,1},{1,1,1},{1,1,0}}); // Pos Y + + drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{1,1,0},{1,0,0}}); // Neg Z + drawBoxPart(args, new int[][] {{0,0,1},{1,0,1},{1,1,1},{0,1,1}}); // Pos Z + + // Inside + drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{0,1,1},{0,0,1}}); // Neg X + drawBoxPart(args, new int[][] {{1,0,0},{1,0,1},{1,1,1},{1,1,0}}); // Pos X + + drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{1,0,1},{1,0,0}}); // Neg Y + drawBoxPart(args, new int[][] {{0,1,0},{1,1,0},{1,1,1},{0,1,1}}); // Pos Y + + drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,1,0},{0,1,0}}); // Neg Z + drawBoxPart(args, new int[][] {{0,0,1},{0,1,1},{1,1,1},{1,0,1}}); // Pos Z + + GL11.glDepthMask(true); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO); + GL11.glDisable(GL11.GL_BLEND); } public static void drawSphere(float cx, float cy, float cz, double rad, int sphereSegments, Color color, float width) { - GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); + GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); GL11.glPointSize(width); final double dPhi = 2*Math.PI / sphereSegments; for(double phi = 0.0; phi < 2*Math.PI; phi += dPhi) { - double sinPhi = Math.sin(phi); - double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2))); - GL11.glBegin(GL11.GL_POINTS); + double sinPhi = Math.sin(phi); + double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2))); + GL11.glBegin(GL11.GL_POINTS); for(double theta = 0.0; theta < Math.PI; theta += dTheta) { float dx = (float)(rad * sinPhi * Math.cos(theta)); @@ -193,15 +193,15 @@ public static void drawSphere(float cx, float cy, float cz, double rad, int sphe public static void updateSphereBuf(int sphereSegments) { - float dvec[][] = new float[1+(int)(sphereSegments*sphereSegments*Math.PI/4.0)][]; - int dveclen = 0; - + float dvec[][] = new float[1+(int)(sphereSegments*sphereSegments*Math.PI/4.0)][]; + int dveclen = 0; + double dPhi = 2*Math.PI / sphereSegments; for(double phi = 0.0; phi < 2*Math.PI; phi += dPhi) { - double sinPhi = Math.sin(phi); - double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2))); + double sinPhi = Math.sin(phi); + double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2))); for(double theta = 0.0; theta < Math.PI; theta += dTheta) { float dx = (float)(sinPhi * Math.cos(theta)); @@ -213,19 +213,19 @@ public static void updateSphereBuf(int sphereSegments) sphereBufDVec = new float[dveclen][]; for(int i = 0; i < dveclen; i++) - sphereBufDVec[i] = dvec[i]; + sphereBufDVec[i] = dvec[i]; } public static void drawBufferedSphere(float cx, float cy, float cz, float rad, Color color, float width) { - GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); + GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F); GL11.glPointSize(width); int cnt = 0; GL11.glBegin(GL11.GL_POINTS); for(float unitvec[] : sphereBufDVec) { - GL11.glVertex3f(cx+unitvec[0]*rad, cy+unitvec[1]*rad, cz+unitvec[2]*rad); + GL11.glVertex3f(cx+unitvec[0]*rad, cy+unitvec[1]*rad, cz+unitvec[2]*rad); } GL11.glEnd(); } @@ -237,13 +237,13 @@ public static void markBlock(String[] text, float x, float y, float z, Color col GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glColor4f( - (color.getRed() / 255.0f) * alpha, - (color.getBlue() / 255.0f) * alpha, - (color.getGreen() / 255.0f) * alpha, - alpha); + (color.getRed() / 255.0f) * alpha, + (color.getBlue() / 255.0f) * alpha, + (color.getGreen() / 255.0f) * alpha, + alpha); int lineHeight = 10; @@ -264,7 +264,7 @@ public static void markBlock(String[] text, float x, float y, float z, Color col GL11.glTranslatef(0f, 0f, 0f); GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } } diff --git a/Templates/asmtick/ASMTick.java b/Templates/asmtick/ASMTick.java index 46f66c6..f025e5d 100644 --- a/Templates/asmtick/ASMTick.java +++ b/Templates/asmtick/ASMTick.java @@ -68,13 +68,13 @@ public static long serverSleep(long ms) if(sleepLock) { - try { + try { Thread.sleep(ms2Tick); } catch (InterruptedException e) { e.printStackTrace(); } - return 0; - } + return 0; + } do { try { diff --git a/Templates/eventmarker/ASMEventMarker.java b/Templates/eventmarker/ASMEventMarker.java index e073854..5075cc4 100644 --- a/Templates/eventmarker/ASMEventMarker.java +++ b/Templates/eventmarker/ASMEventMarker.java @@ -12,184 +12,184 @@ public class ASMEventMarker extends ASMRender { - public static final List tickCurrent = new ArrayList(); - public static final List tickPending = new ArrayList(); - public static final List tickBUD = new ArrayList(); - public static final ASMEventMarker INSTANCE = new ASMEventMarker(); - - public static long worldTime; - - public static void update(TreeSet pendingTickListEntriesTreeSet, List pendingTickListEntriesThisTick, long time) - { - if(time != worldTime) - { - worldTime = time; - tickCurrent.clear(); - tickPending.clear(); - tickBUD.clear(); - } + public static final List tickCurrent = new ArrayList(); + public static final List tickPending = new ArrayList(); + public static final List tickBUD = new ArrayList(); + public static final ASMEventMarker INSTANCE = new ASMEventMarker(); + + public static long worldTime; + + public static void update(TreeSet pendingTickListEntriesTreeSet, List pendingTickListEntriesThisTick, long time) + { + if(time != worldTime) + { + worldTime = time; + tickCurrent.clear(); + tickPending.clear(); + tickBUD.clear(); + } for(NextTickListEntry e : pendingTickListEntriesTreeSet) - ASMEventMarker.tickPending.add(new TickEntry(e)); + ASMEventMarker.tickPending.add(new TickEntry(e)); for(NextTickListEntry e : pendingTickListEntriesThisTick) - ASMEventMarker.tickCurrent.add(new TickEntry(e)); - } - - public static void render(double playerX, double playerY, double playerZ) - { - try - { - if(minecraft.isSingleplayer()) - { - setup(false); - translate((float)playerX, (float)playerY, (float)playerZ); - renderTicks(tickCurrent, Color.BLUE, "§4"); - renderTicks(tickPending, Color.BLUE, "§6"); - renderTicks(tickBUD, Color.GREEN, "§2"); - ASMRender.restore(); - } - } - catch(Exception e) - { - System.out.println(e.getMessage()); - } - } - - public static void renderTicks(List list, Color bcolor, String col) - { - HashMap map = new HashMap(); + ASMEventMarker.tickCurrent.add(new TickEntry(e)); + } + + public static void render(double playerX, double playerY, double playerZ) + { + try + { + if(minecraft.isSingleplayer()) + { + setup(false); + translate((float)playerX, (float)playerY, (float)playerZ); + renderTicks(tickCurrent, Color.BLUE, "§4"); + renderTicks(tickPending, Color.BLUE, "§6"); + renderTicks(tickBUD, Color.GREEN, "§2"); + ASMRender.restore(); + } + } + catch(Exception e) + { + System.out.println(e.getMessage()); + } + } + + public static void renderTicks(List list, Color bcolor, String col) + { + HashMap map = new HashMap(); for(int i = 0; i < list.size(); i++) - { - TickEntry entry = list.get(i); - entry.idx = i; - Long key = entry.getPosLong(); - TickEntry entries[] = map.get(key); - - if(entries == null) - { - map.put(key, new TickEntry[]{entry}); - } - else - { - TickEntry newEntries[] = new TickEntry[entries.length + 1]; - for(int j = 0; j < entries.length; j++) - newEntries[j] = entries[j]; - newEntries[entries.length] = entry; - map.put(entry.getPosLong(), newEntries); - } + { + TickEntry entry = list.get(i); + entry.idx = i; + Long key = entry.getPosLong(); + TickEntry entries[] = map.get(key); + + if(entries == null) + { + map.put(key, new TickEntry[]{entry}); + } + else + { + TickEntry newEntries[] = new TickEntry[entries.length + 1]; + for(int j = 0; j < entries.length; j++) + newEntries[j] = entries[j]; + newEntries[entries.length] = entry; + map.put(entry.getPosLong(), newEntries); + } } for(TickEntry[] ticks : map.values()) { - String[] text; - if(ticks[0].block == null) - { - text = new String[ticks.length * 3]; - for(int i = 0, ti = 0; i < ticks.length; i++) - { - text[ti++] = col +ticks[i].idx; - text[ti++] = "§7"+ticks[i].time; - text[ti++] = "§7"+ticks[i].p; - } - } - else - { - text = new String[ticks.length * 3]; - for(int i = 0, ti = 0; i < ticks.length; i++) - { - text[ti++] = col +ticks[i].idx; - text[ti++] = "§7"+ticks[i].action; - text[ti++] = "§7"+ticks[i].param; - } - } - ASMRender.drawBoxWalls( - ticks[0].x, ticks[0].y, ticks[0].z, - ticks[0].x+1f, ticks[0].y+1f, ticks[0].z+1f, - bcolor, 0.12f); + String[] text; + if(ticks[0].block == null) + { + text = new String[ticks.length * 3]; + for(int i = 0, ti = 0; i < ticks.length; i++) + { + text[ti++] = col +ticks[i].idx; + text[ti++] = "§7"+ticks[i].time; + text[ti++] = "§7"+ticks[i].p; + } + } + else + { + text = new String[ticks.length * 3]; + for(int i = 0, ti = 0; i < ticks.length; i++) + { + text[ti++] = col +ticks[i].idx; + text[ti++] = "§7"+ticks[i].action; + text[ti++] = "§7"+ticks[i].param; + } + } + ASMRender.drawBoxWalls( + ticks[0].x, ticks[0].y, ticks[0].z, + ticks[0].x+1f, ticks[0].y+1f, ticks[0].z+1f, + bcolor, 0.12f); - ASMRender.markBlock( - text, - ticks[0].x, ticks[0].y+1.0f, ticks[0].z, - bcolor, 0.8f); + ASMRender.markBlock( + text, + ticks[0].x, ticks[0].y+1.0f, ticks[0].z, + bcolor, 0.8f); + } + } + + public static class TickEntry + { + public int idx; + public int x, y, z; + public int p; + public long time; + public String block; + public String action; + public String param; + + public TickEntry(NextTickListEntry e) + { + this.x = e.position.getX(); + this.y = e.position.getY(); + this.z = e.position.getZ(); + this.p = e.priority; + this.time = e.scheduledTime; } - } - - public static class TickEntry - { - public int idx; - public int x, y, z; - public int p; - public long time; - public String block; - public String action; - public String param; - - public TickEntry(NextTickListEntry e) - { - this.x = e.position.getX(); - this.y = e.position.getY(); - this.z = e.position.getZ(); - this.p = e.priority; - this.time = e.scheduledTime; - } - public TickEntry(BlockEventData e) - { - this.x = e.getPosition().getX(); - this.y = e.getPosition().getY(); - this.z = e.getPosition().getZ(); - block = e.getBlock().getUnlocalizedName(); - if(block.startsWith("tile.")) - block = block.substring(5); - - action = "" + e.getEventID() + " "; - param = "" + e.getEventParameter() + " "; - - if(block.contains("note_block") || block.contains("music")) - { - switch(e.getEventID()) { - case 0: action += "Harp"; break; - case 1: action += "Double Bass"; break; - case 2: action += "Snare Drum"; break; - case 3: action += "Clicks/Sticks"; break; - case 4: action += "Bass Drum"; break; - default: action += "Unknown"; - } - - param += "[Pitch]"; - } - - else if(block.contains("piston")) - { - switch(e.getEventID()) { - case 0: action += "Pushing"; break; - case 1: action += "Pulling"; break; - default: action += "Unknown"; - } - - switch(e.getEventParameter()) { - case 0: param += "Down"; break; - case 1: param += "Up"; break; - case 2: param += "South"; break; - case 3: param += "West"; break; - case 4: param += "North"; break; - case 5: param += "East"; break; - default: param += "Unknown"; - } - } - - else if(block.contains("chest") || block.contains("Chest")) - { - param += "[Players]"; - } - } - - public Long getPosLong() - { - return Long.valueOf( - (((long)x & 0x3FFFFFF) << 38) | - (((long)y & 0xFFF) << 26) | - ((long)z & 0x3FFFFFF) ); - } - } + public TickEntry(BlockEventData e) + { + this.x = e.getPosition().getX(); + this.y = e.getPosition().getY(); + this.z = e.getPosition().getZ(); + block = e.getBlock().getUnlocalizedName(); + if(block.startsWith("tile.")) + block = block.substring(5); + + action = "" + e.getEventID() + " "; + param = "" + e.getEventParameter() + " "; + + if(block.contains("note_block") || block.contains("music")) + { + switch(e.getEventID()) { + case 0: action += "Harp"; break; + case 1: action += "Double Bass"; break; + case 2: action += "Snare Drum"; break; + case 3: action += "Clicks/Sticks"; break; + case 4: action += "Bass Drum"; break; + default: action += "Unknown"; + } + + param += "[Pitch]"; + } + + else if(block.contains("piston")) + { + switch(e.getEventID()) { + case 0: action += "Pushing"; break; + case 1: action += "Pulling"; break; + default: action += "Unknown"; + } + + switch(e.getEventParameter()) { + case 0: param += "Down"; break; + case 1: param += "Up"; break; + case 2: param += "South"; break; + case 3: param += "West"; break; + case 4: param += "North"; break; + case 5: param += "East"; break; + default: param += "Unknown"; + } + } + + else if(block.contains("chest") || block.contains("Chest")) + { + param += "[Players]"; + } + } + + public Long getPosLong() + { + return Long.valueOf( + (((long)x & 0x3FFFFFF) << 38) | + (((long)y & 0xFFF) << 26) | + ((long)z & 0x3FFFFFF) ); + } + } } diff --git a/Templates/net/minecraft/block/Block.java b/Templates/net/minecraft/block/Block.java index 12a2a08..7d754c6 100644 --- a/Templates/net/minecraft/block/Block.java +++ b/Templates/net/minecraft/block/Block.java @@ -2,8 +2,8 @@ public class Block { - public String getUnlocalizedName() - { - return null; - } + public String getUnlocalizedName() + { + return null; + } } diff --git a/Templates/net/minecraft/block/BlockEventData.java b/Templates/net/minecraft/block/BlockEventData.java index da327f6..2167c2c 100644 --- a/Templates/net/minecraft/block/BlockEventData.java +++ b/Templates/net/minecraft/block/BlockEventData.java @@ -8,7 +8,7 @@ public BlockPos getPosition() { return null; } - + public int getEventID() { return 0; diff --git a/Templates/net/minecraft/client/Minecraft.java b/Templates/net/minecraft/client/Minecraft.java index b0a11a3..5b2aa41 100644 --- a/Templates/net/minecraft/client/Minecraft.java +++ b/Templates/net/minecraft/client/Minecraft.java @@ -7,21 +7,21 @@ public class Minecraft { - public EntityPlayerSP thePlayer; - public Timer timer; - public FontRenderer fontRendererObj; - - public static Minecraft getMinecraft() + public EntityPlayerSP thePlayer; + public Timer timer; + public FontRenderer fontRendererObj; + + public static Minecraft getMinecraft() { return null; } public boolean isSingleplayer() { - return true; - } - - public IntegratedServer getIntegratedServer() + return true; + } + + public IntegratedServer getIntegratedServer() { return null; } diff --git a/Templates/net/minecraft/client/entity/EntityPlayerSP.java b/Templates/net/minecraft/client/entity/EntityPlayerSP.java index 0c2c889..8266568 100644 --- a/Templates/net/minecraft/client/entity/EntityPlayerSP.java +++ b/Templates/net/minecraft/client/entity/EntityPlayerSP.java @@ -2,6 +2,6 @@ public class EntityPlayerSP { - // Actually, dimension is in Entity.java - public int dimension; + // Actually, dimension is in Entity.java + public int dimension; } diff --git a/Templates/net/minecraft/client/gui/FontRenderer.java b/Templates/net/minecraft/client/gui/FontRenderer.java index 21315f6..a5cedcb 100644 --- a/Templates/net/minecraft/client/gui/FontRenderer.java +++ b/Templates/net/minecraft/client/gui/FontRenderer.java @@ -14,8 +14,8 @@ public int drawString(String text, float x, float y, int color, boolean dropShad return 0; } - public int getStringWidth(String text) + public int getStringWidth(String text) { - return 0; - } + return 0; + } } diff --git a/Templates/net/minecraft/server/MinecraftServer.java b/Templates/net/minecraft/server/MinecraftServer.java index 475b52c..ede1f57 100644 --- a/Templates/net/minecraft/server/MinecraftServer.java +++ b/Templates/net/minecraft/server/MinecraftServer.java @@ -4,8 +4,8 @@ public class MinecraftServer { - public WorldServer worldServerForDimension(int dimension) + public WorldServer worldServerForDimension(int dimension) { - return null; - } + return null; + } } diff --git a/Templates/net/minecraft/util/Timer.java b/Templates/net/minecraft/util/Timer.java index ff7fce5..668bc9d 100644 --- a/Templates/net/minecraft/util/Timer.java +++ b/Templates/net/minecraft/util/Timer.java @@ -10,5 +10,5 @@ public class Timer public Timer(float rate) { - } + } } diff --git a/Templates/net/minecraft/world/NextTickListEntry.java b/Templates/net/minecraft/world/NextTickListEntry.java index 9ece1a5..3f8523d 100644 --- a/Templates/net/minecraft/world/NextTickListEntry.java +++ b/Templates/net/minecraft/world/NextTickListEntry.java @@ -5,8 +5,8 @@ public class NextTickListEntry implements Comparable { - private static long nextTickEntryID; - private final Block block; + private static long nextTickEntryID; + private final Block block; public final BlockPos position; public long scheduledTime; public int priority; diff --git a/Templates/net/minecraft/world/World.java b/Templates/net/minecraft/world/World.java index c2bba14..acffade 100644 --- a/Templates/net/minecraft/world/World.java +++ b/Templates/net/minecraft/world/World.java @@ -4,8 +4,8 @@ public abstract class World { - public VillageCollection getVillageCollection() + public VillageCollection getVillageCollection() { - return null; - } + return null; + } } diff --git a/Templates/villagemarker/ASMVillageMarker.java b/Templates/villagemarker/ASMVillageMarker.java index ed278ac..ed1d4fd 100644 --- a/Templates/villagemarker/ASMVillageMarker.java +++ b/Templates/villagemarker/ASMVillageMarker.java @@ -36,33 +36,33 @@ public class ASMVillageMarker extends ASMRender public static final ASMVillageMarker INSTANCE = new ASMVillageMarker(); - public static void render(double playerX, double playerY, double playerZ) - { - try - { - if(minecraft.isSingleplayer()) - { - setup(doDepthCheck); - translate((float)playerX, (float)playerY, (float)playerZ); - render(); - ASMRender.restore(); - } - } - catch(Exception e) - { - System.out.println(e.getMessage()); - } - } - + public static void render(double playerX, double playerY, double playerZ) + { + try + { + if(minecraft.isSingleplayer()) + { + setup(doDepthCheck); + translate((float)playerX, (float)playerY, (float)playerZ); + render(); + ASMRender.restore(); + } + } + catch(Exception e) + { + System.out.println(e.getMessage()); + } + } + public static void render() { ArrayList villageList = new ArrayList(); villageList.addAll( - minecraft - .getIntegratedServer() - .worldServerForDimension(minecraft.thePlayer.dimension) - .getVillageCollection() - .getVillageList()); + minecraft + .getIntegratedServer() + .worldServerForDimension(minecraft.thePlayer.dimension) + .getVillageCollection() + .getVillageList()); int c = 0; for(Village village : villageList) @@ -79,30 +79,30 @@ public static void render() if(drawSphere) ASMRender.drawBufferedSphere( - centerX, centerY, centerZ, - radius, vcol, sphereDotSize); + centerX, centerY, centerZ, + radius, vcol, sphereDotSize); if(drawDoorLines) for(VillageDoorInfo doorInfo : doors) { - BlockPos doorPos = doorInfo.getDoorBlockPos(); - ASMRender.drawLine( - centerX, centerY, centerZ, - doorPos.getX(), doorPos.getY(), doorPos.getZ(), - vcol, doorLineWidth); + BlockPos doorPos = doorInfo.getDoorBlockPos(); + ASMRender.drawLine( + centerX, centerY, centerZ, + doorPos.getX(), doorPos.getY(), doorPos.getZ(), + vcol, doorLineWidth); } if(drawBoxEdge) ASMRender.drawBox( - centerX-(8F+boxEdgeExpansion), centerY-(3F+boxEdgeExpansion), centerZ-(8F+boxEdgeExpansion), - centerX+(8F+boxEdgeExpansion), centerY+(3F+boxEdgeExpansion), centerZ+(8F+boxEdgeExpansion), - vcol, boxEdgeWidth); + centerX-(8F+boxEdgeExpansion), centerY-(3F+boxEdgeExpansion), centerZ-(8F+boxEdgeExpansion), + centerX+(8F+boxEdgeExpansion), centerY+(3F+boxEdgeExpansion), centerZ+(8F+boxEdgeExpansion), + vcol, boxEdgeWidth); if(drawBoxWalls) ASMRender.drawBoxWalls( - centerX-(8F+boxWallExpansion), centerY-(3F+boxWallExpansion), centerZ-(8F+boxWallExpansion), - centerX+(8F+boxWallExpansion), centerY+(3F+boxWallExpansion), centerZ+(8F+boxWallExpansion), - vcol, wallAlpha); + centerX-(8F+boxWallExpansion), centerY-(3F+boxWallExpansion), centerZ-(8F+boxWallExpansion), + centerX+(8F+boxWallExpansion), centerY+(3F+boxWallExpansion), centerZ+(8F+boxWallExpansion), + vcol, wallAlpha); } } @@ -115,140 +115,140 @@ public static void log(String msg) public ASMVillageMarker() { - init(); + init(); + } + + public static void init() + { + if(!configFile.exists()) + writeOptions(); + else + readOptions(); + + ASMRender.updateSphereBuf(sphereSegments); } - public static void init() + private static String col2hex(Color c) { - if(!configFile.exists()) - writeOptions(); - else - readOptions(); - - ASMRender.updateSphereBuf(sphereSegments); + return '#'+Integer.toHexString((c.getRGB() & 0xffffff) | 0x1000000).substring(1); } - private static String col2hex(Color c) - { - return '#'+Integer.toHexString((c.getRGB() & 0xffffff) | 0x1000000).substring(1); - } - - private static Color hex2col(String str) - { - if(str.startsWith("0x")) - str = str.substring(2); - if(!str.startsWith("#")) - str = "#"+str; - return Color.decode(str); - } - - public static void writeOptions() + private static Color hex2col(String str) { - try - { - PrintWriter writer = new PrintWriter(new FileWriter(configFile)); - writer.println("doDepthCheck="+doDepthCheck); - writer.println("drawSphere="+drawSphere); - writer.println("drawDoorLines="+drawDoorLines); - writer.println("drawBoxEdge="+drawBoxEdge); - writer.println("drawBoxWalls="+drawBoxWalls); - writer.println("sphereSegments="+sphereSegments); - writer.println("doorLineWidth="+doorLineWidth); - writer.println("sphereDotSize="+sphereDotSize); - writer.println("boxEdgeWidth="+boxEdgeWidth); - writer.println("boxEdgeExpansion="+boxEdgeExpansion); - writer.println("boxWallExpansion="+boxWallExpansion); - writer.println("wallAlpha="+wallAlpha); - - writer.print("colors=["+col2hex(cols[0])); - for(int i = 1; i < cols.length; i++) - writer.print(","+col2hex(cols[i])); - writer.print("]\n"); - - writer.close(); - } - catch(Exception e) - { - log("Couldn't create options file: " + e); - } + if(str.startsWith("0x")) + str = str.substring(2); + if(!str.startsWith("#")) + str = "#"+str; + return Color.decode(str); } - public static void readOptions() + public static void writeOptions() { - try - { - BufferedReader reader = new BufferedReader(new FileReader(configFile)); - String line = null; + try + { + PrintWriter writer = new PrintWriter(new FileWriter(configFile)); + writer.println("doDepthCheck="+doDepthCheck); + writer.println("drawSphere="+drawSphere); + writer.println("drawDoorLines="+drawDoorLines); + writer.println("drawBoxEdge="+drawBoxEdge); + writer.println("drawBoxWalls="+drawBoxWalls); + writer.println("sphereSegments="+sphereSegments); + writer.println("doorLineWidth="+doorLineWidth); + writer.println("sphereDotSize="+sphereDotSize); + writer.println("boxEdgeWidth="+boxEdgeWidth); + writer.println("boxEdgeExpansion="+boxEdgeExpansion); + writer.println("boxWallExpansion="+boxWallExpansion); + writer.println("wallAlpha="+wallAlpha); + + writer.print("colors=["+col2hex(cols[0])); + for(int i = 1; i < cols.length; i++) + writer.print(","+col2hex(cols[i])); + writer.print("]\n"); + + writer.close(); + } + catch(Exception e) + { + log("Couldn't create options file: " + e); + } + } + + public static void readOptions() + { + try + { + BufferedReader reader = new BufferedReader(new FileReader(configFile)); + String line = null; while((line = reader.readLine()) != null) { try { String[] opt = line.split("="); if(opt.length < 2 || opt[0].equals("")) { - continue; + continue; } else if(opt[0].equals("doDepthCheck")) { - doDepthCheck = Boolean.parseBoolean(opt[1]); + doDepthCheck = Boolean.parseBoolean(opt[1]); } else if(opt[0].equals("drawSphere")) { - drawSphere = Boolean.parseBoolean(opt[1]); + drawSphere = Boolean.parseBoolean(opt[1]); } else if(opt[0].equals("drawDoorLines")) { - drawDoorLines = Boolean.parseBoolean(opt[1]); + drawDoorLines = Boolean.parseBoolean(opt[1]); } else if(opt[0].equals("drawBoxEdge")) { - drawBoxEdge = Boolean.parseBoolean(opt[1]); + drawBoxEdge = Boolean.parseBoolean(opt[1]); } else if(opt[0].equals("drawBoxWalls")) { - drawBoxWalls = Boolean.parseBoolean(opt[1]); + drawBoxWalls = Boolean.parseBoolean(opt[1]); } else if(opt[0].equals("sphereSegments")) { - sphereSegments = Integer.parseInt(opt[1]); + sphereSegments = Integer.parseInt(opt[1]); } else if(opt[0].equals("doorLineWidth")) { - doorLineWidth = Float.parseFloat(opt[1]); + doorLineWidth = Float.parseFloat(opt[1]); } else if(opt[0].equals("sphereDotSize")) { - sphereDotSize = Float.parseFloat(opt[1]); + sphereDotSize = Float.parseFloat(opt[1]); } else if(opt[0].equals("boxEdgeWidth")) { - boxEdgeWidth = Float.parseFloat(opt[1]); + boxEdgeWidth = Float.parseFloat(opt[1]); } else if(opt[0].equals("boxEdgeExpansion")) { - boxEdgeExpansion = Float.parseFloat(opt[1]); + boxEdgeExpansion = Float.parseFloat(opt[1]); } else if(opt[0].equals("boxWallExpansion")) { - boxWallExpansion = Float.parseFloat(opt[1]); + boxWallExpansion = Float.parseFloat(opt[1]); } else if(opt[0].equals("wallAlpha")) { - wallAlpha = Float.parseFloat(opt[1]); + wallAlpha = Float.parseFloat(opt[1]); } else if(opt[0].equals("colors")) { - String colStrList[] = opt[1] - .replaceAll("\\[","") - .replaceAll("\\]","").split(","); - Color cl[] = new Color[colStrList.length]; - for(int i = 0; i < colStrList.length; i++) - cl[i] = hex2col(colStrList[i]); - cols = cl; + String colStrList[] = opt[1] + .replaceAll("\\[","") + .replaceAll("\\]","").split(","); + Color cl[] = new Color[colStrList.length]; + for(int i = 0; i < colStrList.length; i++) + cl[i] = hex2col(colStrList[i]); + cols = cl; } else { - log("Ignoring unrecognized option: "+opt[0]); + log("Ignoring unrecognized option: "+opt[0]); } } catch(Exception e) { - log("Skipping bad option value: "+line); + log("Skipping bad option value: "+line); } } reader.close(); - } - catch(Exception e) - { - log("Couldn't read options file: "+e); - } + } + catch(Exception e) + { + log("Couldn't read options file: "+e); + } } - + }