Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.ArrayList;
- import net.minecraft.client.Minecraft;
- import org.lwjgl.input.Keyboard;
- public class GuiConsole extends GuiScreen
- {
- protected String message;
- private int updateCounter;
- public static int fcposX;
- public static int fcposY;
- public static int fcposZ;
- public static int fcpitch;
- public static int fcyaw;
- public GuiConsole()
- {
- message = "";
- updateCounter = 0;
- }
- /**
- * Adds the buttons (and other controls) to the screen in question.
- */
- public void initGui()
- {
- Keyboard.enableRepeatEvents(true);
- }
- /**
- * Called when the screen is unloaded. Used to disable keyboard repeat events
- */
- public void onGuiClosed()
- {
- Keyboard.enableRepeatEvents(false);
- }
- /**
- * Called from the main game loop to update the screen.
- */
- public void updateScreen()
- {
- updateCounter++;
- }
- /**
- * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
- */
- protected void keyTyped(char c, int i)
- {
- if (i == 1)
- {
- mc.displayGuiScreen(null);
- return;
- }
- if (i == 28)
- {
- String s = message.trim();
- Vars vars = new Vars();
- if (s.equals("xray"))
- {
- Vars.xray = !Vars.xray;
- }
- if (s.equals("fullb"))
- {
- Vars.fullb = !Vars.fullb;
- }
- if (s.equals("kill"))
- {
- Vars.killAura = !Vars.killAura;
- }
- if (s.equals("tracer"))
- {
- Vars.tracer = !Vars.tracer;
- }
- if (s.equals("step"))
- {
- Vars.step = !Vars.step;
- }
- if (s.equals("fly"))
- {
- Vars.fly = !Vars.fly;
- }
- if (s.startsWith("friend remove"))
- {
- try
- {
- String as[] = s.split(" ");
- String s1 = as[2];
- if (s1 != null)
- {
- if (Vars.friends.contains(s1))
- {
- Vars.friends.remove(Vars.friends.indexOf(s1));
- mc.thePlayer.addChatMessage((new StringBuilder()).append("\247b[Console]\247e Friend ").append(s1).append(" removed from the list!").toString());
- }
- else
- {
- mc.thePlayer.addChatMessage((new StringBuilder()).append("\247b[Console]\2474 Friend ").append(s1).append(" was already removed from the list.").toString());
- }
- }
- }
- catch (Exception exception)
- {
- mc.thePlayer.addChatMessage("\247b[Console]\2474 Could not remove the friend.");
- }
- }
- if (s.startsWith("friend add"))
- {
- try
- {
- String as1[] = s.split(" ");
- String s2 = as1[2];
- if (s2 != null)
- {
- if (!Vars.friends.contains(s2))
- {
- Vars.friends.add(s2);
- mc.thePlayer.addChatMessage((new StringBuilder()).append("\247b[Console]\247e Friend ").append(s2).append(" added to the list!").toString());
- }
- else
- {
- mc.thePlayer.addChatMessage((new StringBuilder()).append("\247b[Console]\2474 Friend ").append(s2).append(" is already in the list.").toString());
- }
- }
- }
- catch (Exception exception1)
- {
- mc.thePlayer.addChatMessage("\247b[Console]\2474 Could not add the friend.");
- }
- }
- if (s.startsWith("spawn"))
- {
- try
- {
- String as2[] = s.split(" ");
- String s3 = as2[1];
- if (s3 != null)
- {
- EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(mc.theWorld, s3);
- entityotherplayermp.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 1.5D, mc.thePlayer.posZ);
- mc.thePlayer.worldObj.spawnEntityInWorld(entityotherplayermp);
- mc.thePlayer.addChatMessage((new StringBuilder()).append("\247b[Console]\247e Spawned player: ").append(s3).append(" to your current position.").toString());
- }
- }
- catch (Exception exception2)
- {
- mc.thePlayer.addChatMessage("\247b[Console]\2474 Could not spawn player, try again.");
- }
- }
- if (s.toLowerCase().startsWith("freecam"))
- {
- Vars.freecam = !Vars.freecam;
- if (Vars.freecam)
- {
- fcposX = (int)mc.thePlayer.posX;
- fcposY = (int)mc.thePlayer.posY;
- fcposZ = (int)mc.thePlayer.posZ;
- fcpitch = (int)mc.thePlayer.rotationPitch;
- fcyaw = (int)mc.thePlayer.rotationYaw;
- mc.thePlayer.addChatMessage((new StringBuilder()).append("Freecam enabled [Saved pos X: ").append(fcposX).append(", Y: ").append(fcposY).append(", Z: ").append(fcposZ).append("]").toString());
- }
- else
- {
- mc.thePlayer.setPositionAndRotation(fcposX, fcposY, fcposZ, fcpitch, fcyaw);
- mc.thePlayer.addChatMessage("Freecam disabled, returned to previous location");
- }
- }
- mc.displayGuiScreen(null);
- return;
- }
- if (i == 14 && message.length() > 0)
- {
- message = message.substring(0, message.length() - 1);
- }
- if (!(!ChatAllowedCharacters.isAllowedCharacter(c) || message.length() >= 100));
- message += c;
- }
- /**
- * Draws the screen and all the components in it.
- */
- public void drawScreen(int i, int j, float f)
- {
- drawBorderedRect(2, height - 13, width - 2, height - 2, 1, 0xff000000, 0x80000000);
- int k = height - 24;
- for (int l = 0; l < Vars.consoleText.length; l++)
- {
- if (!Vars.consoleText[l].startsWith(message))
- {
- continue;
- }
- String s = Vars.consoleText[l];
- if (message.length() > 0)
- {
- drawBorderedRect(2, k - 2, width - 2, k + 10, 1, 0xff000000, 0x80000000);
- drawString(fontRenderer, s, 4, k, 0xffffff);
- }
- k -= 14;
- }
- drawString(fontRenderer, (new StringBuilder()).append("[CONSOLE]>").append(message).append((updateCounter / 6) % 2 == 0 ? "_" : "").toString(), 4, height - 11, 0xe0e0e0);
- super.drawScreen(i, j, f);
- }
- public void drawBorderedRect(int i, int j, int k, int l, int i1, int j1, int k1)
- {
- drawRect(i + i1, j + i1, k - i1, l - i1, k1);
- drawRect(i + i1, j + i1, k, j, j1);
- drawRect(i, j, i + i1, l, j1);
- drawRect(k, l, k - i1, j + i1, j1);
- drawRect(i, l - i1, k, l, j1);
- }
- /**
- * Called when the mouse is clicked.
- */
- protected void mouseClicked(int i, int j, int k)
- {
- if (k != 0)
- {
- return;
- }
- if (mc.ingameGUI.field_933_a == null)
- {
- super.mouseClicked(i, j, k);
- return;
- }
- if (!(message.length() <= 0 || message.endsWith(" " ))) message += " ";
- message += mc.ingameGUI.field_933_a;
- byte byte0 = 100;
- if (message.length() > byte0)
- {
- message = message.substring(0, byte0);
- }
- return;
- }
- }
Add Comment
Please, Sign In to add comment