Advertisement
yugecin

Untitled

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