yugecin

Untitled

Aug 23rd, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.25 KB | None | 0 0
  1. package net.minecraft.yugecin;
  2.  
  3. import java.awt.MouseInfo;
  4. import org.lwjgl.input.Keyboard;
  5. import org.lwjgl.opengl.GL11;
  6. import net.minecraft.client.Minecraft;
  7. import net.minecraft.src.AchievementList;
  8. import net.minecraft.src.Gui;
  9. import net.minecraft.src.GuiScreen;
  10. import net.minecraft.src.NetworkManager;
  11.  
  12. public class Menu extends GuiScreen{
  13.    
  14.     private enum menu{
  15.         INVALID ,
  16.         PLAYER,
  17.         XRAY,
  18.         ESP,
  19.         WORLD
  20.     }
  21.    
  22.     public int offsetX = 0;
  23.     public int offsetY = 0;
  24.    
  25.     private int clickItem;
  26.     private int menuItem;
  27.    
  28.     public int x;
  29.     public int y;
  30.     private Minecraft mc;
  31.     private menu drag = menu.INVALID;
  32.    
  33.     public Menu(Minecraft minecraft){
  34.         x = MouseInfo.getPointerInfo().getLocation().x;
  35.         y = MouseInfo.getPointerInfo().getLocation().y;
  36.         mc = minecraft;
  37.         height = mc.displayHeight;
  38.         width = mc.displayWidth;
  39.     }
  40.    
  41.     public boolean doesGuiPauseGame(){
  42.         return false;
  43.     }
  44.    
  45.     public void initGui(){
  46.         mc.field_71439_g.addStat(AchievementList.openInventory, 1);
  47.         Keyboard.enableRepeatEvents(true);
  48.     }
  49.    
  50.     public void onGuiClosed(){
  51.         Keyboard.enableRepeatEvents(true);
  52.     }
  53.    
  54.     protected void keyTyped(char c, int i){
  55.         if(i == 1){
  56.             net.minecraft.yugecin.Main.menu = false;
  57.             mc.displayGuiScreen(null);
  58.             return;
  59.         }
  60.     }
  61.    
  62.     public void drawScreen(int i, int j, float f){
  63.         int pos[] = {0, 0, 0};
  64.         pos = new int[3];
  65.        
  66.         mouseDraggedMode(i, j);
  67.        
  68.         drawRect(0, height, width / 2 - 100, height - 12, 0x70000000);
  69.        
  70.         Main.drawOutlinedRect(2, height - 12, 53, height - 1, 0xA0000000, 0xFFFFFFFF, 1);
  71.         fontRenderer.drawString("Reset GUI", 4, height - 10, 0xFFFFFF);    
  72.        
  73.         drawTopMenuRect("Player", Main.playerX, Main.playerY, Main.playerWidth);
  74.         drawTopMenuRect("x-Ray §1[X] [W]", Main.xrayX, Main.xrayY, Main.xrayWidth);
  75.         drawTopMenuRect("ESP", Main.espX, Main.espY, Main.espWidth);
  76.         drawTopMenuRect("World", Main.worldX, Main.worldY, Main.worldWidth);
  77.  
  78.         //PLAYER
  79.         pos[0] = Main.playerX;
  80.         pos[1] = Main.playerY;
  81.         pos[2] = Main.playerWidth;
  82.         drawMenuRect(Main.playerX, Main.playerWidth, Main.playerY, 14);
  83.         drawMenuItem(pos, "Fastbreak", Main.fastbreak);
  84.         drawMenuItem(pos, "Dolphin", Main.dolphin);
  85.         drawMenuItem(pos, "Spider", Main.spider);
  86.         drawMenuItem(pos, "Nofall", Main.nofall);
  87.         drawMenuItem(pos, "Step", Main.step);
  88.         drawMenuItem(pos, "Sprint", Main.sprint);
  89.         drawMenuItem(pos, "Sneak", Main.sneak);
  90.         drawMenuItem(pos, "Herp", Main.herp);
  91.         drawMenuItem(pos, "Derp", Main.derp);
  92.         drawMenuItem(pos, "Kill Aura", Main.killaura);
  93.         drawMenuItem(pos, "Mob Aura", Main.mobaura);
  94.         drawMenuItem(pos, "Nopumpkin", Main.nopumpkin);
  95.         drawMenuItem(pos, "Noswing", Main.noswing);
  96.         drawMenuItem(pos, "Freecam", Main.freecam);
  97.         menuItem = 0;
  98.        
  99.         //XRAY
  100.         pos[0] = Main.xrayX;
  101.         pos[1] = Main.xrayY;
  102.         pos[2] = Main.xrayWidth;
  103.         drawMenuRect(Main.xrayX, Main.xrayWidth, Main.xrayY, 8);
  104.         drawMenuItem(pos, "Coal", Main.xCoal);
  105.         drawMenuItem(pos, "Iron", Main.xIron);
  106.         drawMenuItem(pos, "Gold", Main.xGold);
  107.         drawMenuItem(pos, "Diamond", Main.xDiamond);
  108.         drawMenuItem(pos, "Redstone", Main.xRedstone);
  109.         drawMenuItem(pos, "Lapiz", Main.xLapiz);
  110.         drawMenuItem(pos, "Emerald", Main.xEmerald);
  111.         drawMenuItem(pos, "Dungeon", Main.xDungeon);
  112.         menuItem = 0;
  113.        
  114.         //ESP
  115.         pos[0] = Main.espX;
  116.         pos[1] = Main.espY;
  117.         pos[2] = Main.espWidth;
  118.         drawMenuRect(Main.espX, Main.espWidth, Main.espY, 4);
  119.         drawMenuItem(pos, "Tracer", Main.esptracer);
  120.         drawMenuItem(pos, "Player", Main.espplayer);
  121.         drawMenuItem(pos, "Mobtracer", Main.espmobs);
  122.         drawMenuItem(pos, "Chest", Main.espchest);
  123.         menuItem = 0;
  124.        
  125.         //WORLD
  126.         pos[0] = Main.worldX;
  127.         pos[1] = Main.worldY;
  128.         pos[2] = Main.worldWidth;
  129.         drawMenuRect(Main.worldX, Main.worldWidth, Main.worldY, 3);
  130.         drawMenuItem(pos, "x-Ray", Main.xray);
  131.         drawMenuItem(pos, "Wallhack", Main.wallhack);
  132.         drawMenuItem(pos, "Fullbright", Main.fullbright);
  133.         menuItem = 0;
  134.        
  135.     }
  136.    
  137.     protected void mouseClicked(int i, int j, int k){
  138.         int pos[] = {0, 0, 0};
  139.         pos = new int[3];
  140.        
  141.        
  142.        
  143.         //PLAYER
  144.         pos[0] = Main.playerX;
  145.         pos[1] = Main.playerY;
  146.         pos[2] = Main.playerWidth;
  147.         if(clickedMenuItem(i, j, pos)) Main.fastbreak = !Main.fastbreak;
  148.         if(clickedMenuItem(i, j, pos)) Main.dolphin = !Main.dolphin;
  149.         if(clickedMenuItem(i, j, pos)) {
  150.             Main.spider = !Main.spider;
  151.             if(!Main.nofall) Main.nofall = true;
  152.         }
  153.         if(clickedMenuItem(i, j, pos)) Main.nofall = !Main.nofall;
  154.         if(clickedMenuItem(i, j, pos)) Main.step = !Main.step;
  155.         if(clickedMenuItem(i, j, pos)) Main.sprint = !Main.sprint;
  156.         if(clickedMenuItem(i, j, pos)) Main.sneak = !Main.sneak;
  157.         if(clickedMenuItem(i, j, pos)) {
  158.             Main.herp = !Main.herp;
  159.             Main.derp = false;
  160.         }
  161.         if(clickedMenuItem(i, j, pos)) {
  162.             Main.derp = !Main.derp;
  163.             Main.herp = false;
  164.         }
  165.         if(clickedMenuItem(i, j, pos)) Main.killaura = !Main.killaura;
  166.         if(clickedMenuItem(i, j, pos)) Main.mobaura = !Main.mobaura;
  167.         if(clickedMenuItem(i, j, pos)) Main.nopumpkin = !Main.nopumpkin;
  168.         if(clickedMenuItem(i, j, pos)) Main.noswing = !Main.noswing;
  169.         if(clickedMenuItem(i, j, pos)) {
  170.             Main.freecam = !Main.freecam;
  171.             if(Main.freecam){
  172.                 Main.freecamStartX = mc.field_71439_g.posX;
  173.                 Main.freecamStartY = mc.field_71439_g.posY;
  174.                 Main.freecamStartZ = mc.field_71439_g.posZ;
  175.                 Main.freecamStartPitch = mc.field_71439_g.rotationPitch;
  176.                 Main.freecamStartYaw = mc.field_71439_g.rotationYaw;
  177.                 mc.displayGuiScreen(null);
  178.             }
  179.         }
  180.         clickItem = 0;
  181.        
  182.         //XRAY
  183.         pos[0] = Main.xrayX;
  184.         pos[1] = Main.xrayY;
  185.         pos[2] = Main.xrayWidth;
  186.         if(clickedMenuItem(i, j, pos)) {
  187.             Main.xCoal = !Main.xCoal;
  188.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  189.         }
  190.         if(clickedMenuItem(i, j, pos)) {
  191.             Main.xIron = !Main.xIron;
  192.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  193.         }
  194.         if(clickedMenuItem(i, j, pos)) {
  195.             Main.xGold = !Main.xGold;
  196.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  197.         }
  198.         if(clickedMenuItem(i, j, pos)) {
  199.             Main.xDiamond = !Main.xDiamond;
  200.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  201.         }
  202.         if(clickedMenuItem(i, j, pos)) {
  203.             Main.xRedstone = !Main.xRedstone;
  204.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  205.         }
  206.         if(clickedMenuItem(i, j, pos)) {
  207.             Main.xLapiz = !Main.xLapiz;
  208.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  209.         }
  210.         if(clickedMenuItem(i, j, pos)) {
  211.             Main.xEmerald = !Main.xEmerald;
  212.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  213.         }
  214.         if(clickedMenuItem(i, j, pos)) {
  215.             Main.xDungeon = !Main.xDungeon;
  216.             if(Main.xray || Main.wallhack) mc.renderGlobal.loadRenderers();
  217.         }
  218.         clickItem = 0;
  219.        
  220.         //ESP
  221.         pos[0] = Main.espX;
  222.         pos[1] = Main.espY;
  223.         pos[2] = Main.espWidth;
  224.         if(clickedMenuItem(i, j, pos)) Main.esptracer = !Main.esptracer;
  225.         if(clickedMenuItem(i, j, pos)) Main.espplayer = !Main.espplayer;
  226.         if(clickedMenuItem(i, j, pos)) Main.espmobs = !Main.espmobs;
  227.         if(clickedMenuItem(i, j, pos)) Main.espchest = !Main.espchest;
  228.         clickItem = 0;
  229.        
  230.         //WORLD
  231.         pos[0] = Main.worldX;
  232.         pos[1] = Main.worldY;
  233.         pos[2] = Main.worldWidth;
  234.         if(clickedMenuItem(i, j, pos)) {
  235.             Main.wallhack = false;
  236.             Main.xray = !Main.xray;
  237.             mc.renderGlobal.loadRenderers();
  238.         }
  239.         if(clickedMenuItem(i, j, pos)) {
  240.             Main.xray = false;
  241.             Main.wallhack = !Main.wallhack;
  242.             mc.renderGlobal.loadRenderers();
  243.         }
  244.         if(clickedMenuItem(i, j, pos)) {
  245.             Main.fullbright = !Main.fullbright;
  246.             mc.renderGlobal.loadRenderers();
  247.         }
  248.         clickItem = 0;     
  249.        
  250.        
  251.         //DRAG
  252.         if(clickedTopMenu(i, j, Main.playerX, Main.playerY, Main.playerWidth)){
  253.             drag = menu.PLAYER;
  254.             setOffset(i, j, Main.playerX, Main.playerY);
  255.         }
  256.         if(clickedTopMenu(i, j, Main.xrayX, Main.xrayY, Main.xrayWidth)){
  257.             drag = menu.XRAY;
  258.             setOffset(i, j, Main.xrayX, Main.xrayY);
  259.         }
  260.         if(clickedTopMenu(i, j, Main.espX, Main.espY, Main.espWidth)){
  261.             drag = menu.ESP;
  262.             setOffset(i, j, Main.espX, Main.espY);
  263.         }
  264.         if(clickedTopMenu(i, j, Main.worldX, Main.worldY, Main.worldWidth)){
  265.             drag = menu.WORLD;
  266.             setOffset(i, j, Main.worldX, Main.worldY);
  267.         }
  268.        
  269.         if(clickedInRect(i, j, 2, height - 12, 53, height - 1)){ // RESET GUI
  270.             Main.playerY = Main.xrayY = Main.espY = Main.worldY = 14;
  271.             Main.playerX = 2;
  272.             Main.xrayX = Main.playerX + Main.playerWidth + 1;
  273.             Main.espX = Main.xrayX + Main.xrayWidth + 1;
  274.             Main.worldX = Main.espX + Main.espWidth + 1;
  275.         }
  276.        
  277.     }
  278.    
  279.     public void mouseDraggedMode(int i, int j)
  280.     {
  281.         if(drag != menu.INVALID){
  282.             switch(drag){
  283.                 case PLAYER:
  284.                     Main.playerX = i + offsetX;
  285.                     Main.playerY = j + offsetY;
  286.                     break;
  287.                 case XRAY:
  288.                     Main.xrayX = i + offsetX;
  289.                     Main.xrayY = j + offsetY;
  290.                     break;
  291.                 case ESP:
  292.                     Main.espX = i + offsetX;
  293.                     Main.espY = j + offsetY;
  294.                     break;
  295.                 case WORLD:
  296.                     Main.worldX = i + offsetX;
  297.                     Main.worldY = j + offsetY;
  298.                     break;
  299.                 default: drag = menu.INVALID;
  300.                     break;
  301.             }
  302.         }
  303.     }
  304.    
  305.     public void setOffset(int i, int j, int x, int y){
  306.         offsetX = x - i;
  307.         offsetY = y - j;
  308.     }
  309.    
  310.     protected void mouseMovedOrUp(int i, int j, int k){
  311.         if(k == 0){
  312.             drag = menu.INVALID;
  313.         }
  314.     }
  315.    
  316.     /************************ UTILS **************************/
  317.    
  318.     public boolean clickedTopMenu(int par0, int par1, int par2, int par3, int par4){
  319.         if(par2 <= par0 && par3 <= par1 && (par2 + par4) >= par0 && (par3 + 12) >= par1) return true;
  320.         return false;
  321.     }
  322.    
  323.     public boolean clickedInRect(int par0, int par1, int par2, int par3, int par4, int par5){
  324.         if(par2 <= par0 && par3 <= par1 && par5 >= par0 && par5 >= par1) return true;
  325.         return false;
  326.     }
  327.    
  328.     public boolean clickedMenuItem(int par0, int par1, int par2[]){
  329.         clickItem++;
  330.         if(par2[0] + par2[2] - 22 <= par0 && par2[1] + 12 + 1 + 2 + (clickItem - 1)*10 <= par1 && par2[0] + par2[2] - 2 >= par0 && par2[1] + 12 + 1 + 2 + (clickItem - 1)*10+8 >= par1) return true;
  331.         return false;
  332.     }
  333.    
  334.     public void drawOutlinedGradientRect(int x1, int y1, int x2, int y2, int color, int color1, int color2)
  335.     {
  336.             drawGradientRect(x1, y1, x2, y2, color1, color2);
  337.             drawHorizontalLine(x1, x2, y2, color);
  338.             drawHorizontalLine(x1, x2, y1, color);
  339.             drawVerticalLine(x1, y2, y1, color);
  340.             drawVerticalLine(x2, y2, y1, color);
  341.     }
  342.    
  343.     public void drawMenuItem(int pos[], String hack, boolean var){
  344.         fontRenderer.drawString(hack, Main.MainOffsetX + pos[0], pos[1] + 12 + 1 + 2 + menuItem*10, var ? 0x00FF00 : 0xFF0000);
  345.         drawGradientRect(pos[0] + pos[2] - 22, pos[1] + 12 + 1 + 2 + menuItem*10, pos[0] + pos[2] - 2, pos[1] + 12 + 1 + 2 + menuItem*10 + 8, 0xFF555555, 0xFFAAAAAA);
  346.         GL11.glScalef(0.5f, 0.5f, 0.5f);
  347.         fontRenderer.drawString(var ? "Disable" : "Enable", (pos[0] + pos[2] - 22 + 2)*2, (pos[1] + 12 +1 + 2 + menuItem*10 + 2)*2, 0xFFFFFF);
  348.         GL11.glScalef(2f,2f, 2f);
  349.        
  350.         menuItem++;
  351.     }
  352.    
  353.     public void drawMenuRect(int x, int width, int y, int items){
  354.         drawRect(x, y + 12 + 1, x + width, y + 12 + 1 + 12 + (items-1)*10, 0xA0000000);
  355.     }
  356.    
  357.     public void drawTopMenuRect(String par0, int par1, int par2, int par3){
  358.         drawRect(par1, par2, par1 + par3, par2 + 12, 0xA0000000); //world
  359.         fontRenderer.drawString(par0, Main.MainOffsetX + par1, par2 + 2, 0xFFFFFF); //player
  360.     }
  361. }
Advertisement
Add Comment
Please, Sign In to add comment