Advertisement
ZornTaov

mod_fps

Oct 5th, 2011
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.52 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import net.minecraft.client.Minecraft;
  4. import org.lwjgl.input.*;
  5.  
  6. public class mod_FPS extends BaseMod
  7. {
  8.  
  9.     public boolean OnTickInGame(Minecraft minecraft)
  10.     {
  11.     ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings,
  12.         minecraft.displayWidth, minecraft.displayHeight);
  13.     int width = scaledresolution.getScaledWidth();
  14.     int height = scaledresolution.getScaledHeight();
  15.     FontRenderer fontRenderer = minecraft.fontRenderer;
  16.  
  17.     if (!minecraft.gameSettings.showDebugInfo && ModLoader.isGUIOpen(null))
  18.     {
  19.         fontRenderer.drawStringWithShadow((new StringBuilder()).append(minecraft.debug)
  20.             .toString(), 2, 10, 0xe0e0e0);
  21.         double iX = minecraft.thePlayer.posX;
  22.         double iY = minecraft.thePlayer.posY;
  23.         double iZ = minecraft.thePlayer.posZ;
  24.         Vec3D vec3D = Vec3D.createVector(iX, 0, iZ);
  25.         fontRenderer.drawStringWithShadow((new StringBuilder()).append("Pos: ")
  26.             .append((int) iX).append(", ").append((int) iY).append(", ").append((int) iZ)
  27.             .toString(), 2, 18, 0xe0e0e0);
  28.         // if (Keyboard.isKeyDown(15))
  29.         // {
  30.         if ((minecraft.thePlayer instanceof EntityClientPlayerMP))
  31.         {
  32.         for (int i = 0; i < minecraft.theWorld.playerEntities.size(); i++)
  33.         {
  34.             if ((minecraft.theWorld.playerEntities.get(i) instanceof EntityOtherPlayerMP))
  35.             {
  36.             minecraft.renderEngine.bindTexture(minecraft.renderEngine
  37.                 .getTexture("/gui/ArrowIcons.png"));
  38.             double jX = ((EntityPlayer) minecraft.theWorld.playerEntities.get(i)).posX;
  39.             double jY = ((EntityPlayer) minecraft.theWorld.playerEntities.get(i)).posY;
  40.             double jZ = ((EntityPlayer) minecraft.theWorld.playerEntities.get(i)).posZ;
  41.             Vec3D vec3D1 = Vec3D.createVector(jX, 0, jZ);
  42.  
  43.             double dis = Math.sqrt(((iX-jX)*(iX-jX))+((iY-jY)*(iY-jY))+((iZ-jZ)*(iZ-jZ)));
  44.             Vec3D vec3D2 = vec3D.subtract(vec3D1);
  45.             vec3D2 = vec3D2.normalize();
  46.             Vec3D vec3D3 = Vec3D.createVector(0, 0, 1);
  47.             double a1 = minecraft.thePlayer.rotationYaw;
  48.             double a2 = vec3D2.func_35612_b(vec3D3);
  49.             double a3 = ((Math.acos(a2) * 180D) / Math.PI);
  50.             if (jX > iX) a3 *= -1;
  51.             double a5;
  52.             for (a5 = a3 - a1; a5 >= 180D; a5 -= 360D)
  53.             {
  54.             }
  55.             for (; a5 < -180D; a5 += 360D)
  56.             {
  57.             }
  58.             //System.out.printf("me: %.0f you: %.0f both: %.0f\n", a1, a3, a5);
  59.  
  60.             String s = (new StringBuilder())
  61.                 .append(((EntityPlayer) minecraft.theWorld.playerEntities.get(i)).username)
  62.                 .append((int) jX).append(", ").append((int) jY).append(", ")
  63.                 .append((int) jZ).append(" D: ").append((int) dis).toString();
  64.             fontRenderer.drawStringWithShadow(s, 14, (i * 10) + 20, 0xe0e0e0);
  65.             byte byte1 = 0;
  66.             byte byte2 = (byte) (i%8);
  67.             if (a5 <= 22.5D && a5 >= -22.5D) {byte1 = 0;}
  68.             else if (a5 >= 22.5D && a5 < 67.5D) {byte1 = 1;}
  69.             else if (a5 >= 67.5D && a5 < 112.5D) {byte1 = 2;}
  70.             else if (a5 >= 112.5D && a5 < 157.5D) {byte1 = 3;}
  71.             else if ((a5 >= 157.5D && a5 < 180D) || (a5 >= -180.5D && a5 < -157.5D))
  72.                 {byte1 = 4;}
  73.             else if (a5 >= -157.5D && a5 < -112.5D) {byte1 = 5;}
  74.             else if (a5 >= -112.5D && a5 < -67.5D) {byte1 = 6;}
  75.             else if (a5 >= -67.5D && a5 < -22.5D) {byte1 = 7;}
  76.             minecraft.renderEngine.bindTexture(minecraft.renderEngine
  77.                 .getTexture("/gui/ArrowIcons.png"));
  78.             minecraft.ingameGUI.drawTexturedModalRect(4, (i * 10) + 20, byte2 * 8,
  79.                 byte1 * 8, 8, 8);
  80.             }
  81.         }
  82.        
  83.         }
  84.     }
  85.     return true;
  86.  
  87.     }
  88.  
  89.     public String Version()
  90.     {
  91.     return "1.8.1";
  92.     }
  93.  
  94.     public mod_FPS()
  95.     {
  96.     ModLoader.SetInGameHook(this, true, false);
  97.     }
  98.  
  99. }
  100.  
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement