From ecbc21d712116f66c1a8d2c3464599701933d98f Mon Sep 17 00:00:00 2001 From: Sen Date: Sat, 12 Jul 2025 11:10:56 +0200 Subject: [PATCH] client class cleanup --- client/src/main/java/client/Client.java | 725 ++++++------------ client/src/main/java/client/gui/Gui.java | 14 +- client/src/main/java/client/gui/GuiMenu.java | 18 +- .../java/client/gui/character/GuiChar.java | 6 +- .../client/gui/container/GuiContainer.java | 28 +- .../java/client/gui/element/Dropdown.java | 2 +- .../main/java/client/gui/element/Element.java | 2 +- .../main/java/client/gui/element/GuiList.java | 18 +- .../main/java/client/gui/element/Textbox.java | 2 +- .../main/java/client/renderer/Drawing.java | 2 +- .../java/client/renderer/EntityRenderer.java | 12 +- 11 files changed, 300 insertions(+), 529 deletions(-) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 079cbdb2..3e5e8a30 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -142,7 +142,6 @@ import common.log.LogLevel; import common.net.bootstrap.Bootstrap; import common.net.channel.Channel; import common.net.channel.ChannelException; -import common.net.channel.ChannelHandler; import common.net.channel.ChannelInitializer; import common.net.channel.ChannelOption; import common.net.channel.nio.NioEventLoopGroup; @@ -275,16 +274,7 @@ public class Client implements IThreadListener { void execute(Keysym key); } - private class DebugFunction { - public final DebugRunner runner; - public final Keysym key; - public final String help; - - public DebugFunction(Keysym key, DebugRunner runner, String help) { - this.key = key; - this.runner = runner; - this.help = help; - } + private record DebugFunction(Keysym key, DebugRunner runner, String help) { } public static final String VERSION = Version.NAME + " Client " + Util.VERSION; @@ -310,6 +300,11 @@ public class Client implements IThreadListener { private final List feed = Lists.newArrayList(); private final List hotbar = Lists.newArrayList(); private final File config = new File(System.getProperty("config.file", "client.cfg")); + private final Bind[] keyBindsHotbar = new Bind[] { + Bind.SELECT1, Bind.SELECT2, Bind.SELECT3, Bind.SELECT4, Bind.SELECT5, Bind.SELECT6, Bind.SELECT7, Bind.SELECT8, Bind.SELECT9 + }; + private final int[] tickTimes = new int[240]; + private final long[] frames = new long[240]; public final Map playerList = Maps.newTreeMap(); public final List characterList = Lists.newArrayList(); @@ -318,6 +313,18 @@ public class Client implements IThreadListener { private boolean tertiary; private boolean quarternary; private boolean showHud = true; + private boolean cfgDirty; + private boolean waitingForFile; + private boolean refreshing; + private boolean debugPlayer; + private boolean mouseFirst; + private boolean nograb = System.getProperty("mouse.nograb") != null; + private boolean syncLimited; + private boolean vsync; + private boolean screenshot; + private boolean saving; + private boolean drawFps; + private boolean drawDebug; public boolean jump; public boolean sneak; public boolean debugCamEnable; @@ -326,69 +333,84 @@ public class Client implements IThreadListener { public boolean sprint; public boolean renderOutlines; public boolean setGamma; - public boolean nickChanged; public boolean xrayActive; public boolean tileOverlay; public boolean itemCheat; - public boolean debugPlayer; public boolean cameraUsed; public boolean charEditor; + public boolean fullscreen; + public boolean interrupted; private int leftClickCounter; private int rightClickTimer; private int chunkLoadTimer; - + private int tickTarget; + private int tickFrame; + private int mouseRawX; + private int mouseRawY; + private int scale = 1; + private int lastTickTime = -1; + private int tickIndex; + private int lastIndex; + private int frameCounter; + private int frameIndex; public int thirdPersonView; public int chunksUpdated; public int selectedCharacter = -1; + public int fbRawX; + public int fbRawY; + public int fbX; + public int fbY; + public int mouseX; + public int mouseY; + public int total; + public int progress = -1; private long lastTicked = 0L; private long debugUpdateTime = System.currentTimeMillis(); private long tickStart; - - private float deltaX; - private float deltaY; - public float moveStrafe; - public float moveForward; - public float zoomLevel; - + private long frameLast; + private long frameWait; + private long startNanoTime = System.nanoTime(); private long tmr_timer; private long tmr_start; private long tmr_current; private long tmr_last; - private long tmr_delta; private long tmr_update; private long tmr_frames; private long tmr_iters; - private long tick_torun; private long tick_done; private long tick_total; private long tick_time; private long tick_stime; private long tick_ftime; - private long tick_ttime; private long tick_update; - - private double tick_fraction; + private long syncLimit; + + private float deltaX; + private float deltaY; private float framerate; private float tickrate; private float fdelta; - private int tickTarget; - private int tickFrame; + public float moveStrafe; + public float moveForward; + public float zoomLevel; + + private double tickFraction; private TextureManager textureManager; private RenderManager renderManager; private RenderItem renderItem; private ItemRenderer itemRenderer; - public RenderGlobal renderGlobal; - public EffectRenderer effectRenderer; - public EntityRenderer entityRenderer; private TextureMap textureMap; private ModelManager modelManager; private BlockRenderer blockRenderer; + public RenderGlobal renderGlobal; + public EffectRenderer effectRenderer; + public EntityRenderer entityRenderer; public Gui open; private SoundManager soundManager; @@ -396,12 +418,17 @@ public class Client implements IThreadListener { private NetConnection connection; private Entity viewEntity; private Entity pointedEntity; - private BufferedImage skin; - private Object popupTarget; + private String serverInfo; + private AudioInterface audio; + private String buffer = ""; public PlayerController controller; public WorldClient world; public EntityNPC player; public HitPosition pointed; + public DisplayMode vidMode; + public String dimensionName; + public String message; + @Variable(name = "chunk_view_distance", category = CVarCategory.RENDER, min = 2, max = 16, callback = DistanceFunction.class, display = "Sichtweite", unit = "Chunks") public int renderDistance = 8; @@ -410,158 +437,103 @@ public class Client implements IThreadListener { @Variable(name = "gl_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1) public float fov = 70.0f; @Variable(name = "gl_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus") - public boolean wireframe = false; + private boolean wireframe = false; @Variable(name = "con_timestamps", category = CVarCategory.CONSOLE, display = "Zeiten") - public boolean conTimestamps = false; + private boolean conTimestamps = false; @Variable(name = "con_loglevel", category = CVarCategory.CONSOLE, display = "Ausgabe", callback = LevelFunction.class) - public LogLevel level = LogLevel.INFO; + private LogLevel level = LogLevel.INFO; @Variable(name = "win_sync", category = CVarCategory.WINDOW, min = -1, max = 16384, callback = SyncFunction.class, display = "Maximale Bildrate") public int sync = 0; @Variable(name = "win_width", category = CVarCategory.WINDOW, min = MIN_WIDTH, max = 65536, display = "Fensterbreite") - public int xsize = 1280; + private int sizeX = 1280; @Variable(name = "win_height", category = CVarCategory.WINDOW, min = MIN_HEIGHT, max = 65536, display = "Fensterhöhe") - public int ysize = 800; + private int sizeY = 800; @Variable(name = "win_pos_x", category = CVarCategory.WINDOW, min = -65536, max = 65536, display = "Fenster X-Position") - public int saved_xpos = 0x80000000; + private int savedX = 0x80000000; @Variable(name = "win_pos_y", category = CVarCategory.WINDOW, min = -65536, max = 65536, display = "Fenster Y-Position") - public int saved_ypos = 0x80000000; - - public int fb_raw_x; - public int fb_raw_y; - private int mouse_raw_x; - private int mouse_raw_y; - public int fb_x; - public int fb_y; - public int mouse_x; - public int mouse_y; - private int scale = 1; + private int savedY = 0x80000000; @Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung", unit = "x", callback = RedrawFunction.class) private int scaleVar = 2; - @Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%") - public float sensitivity = 1.0f; - public boolean fullscreen; - public long syncLimit; - public boolean mouseFirst; - public boolean nograb = System.getProperty("mouse.nograb") != null; - public DisplayMode vidMode; + private float sensitivity = 1.0f; @Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms") public int dclickDelay = 250; @Variable(name = "console_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ConsoleFunction.class, display = "Nachrichten in Konsole") - public int consoleSize = 32; + private int consoleSize = 32; @Variable(name = "chat_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ChatFunction.class, display = "Nachrichten im Chat") - public int chatSize = 32; + private int chatSize = 32; @Variable(name = "feed_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = FeedFunction.class, display = "Nachrichten im Feed") - public int feedSize = 8; + private int feedSize = 8; @Variable(name = "hotbar_size", category = CVarCategory.CONSOLE, min = 0, max = 16, callback = HotbarFunction.class, display = "Nachrichten in Hotbar") - public int hotbarSize = 2; + private int hotbarSize = 2; @Variable(name = "overlay_fadeout", category = CVarCategory.CONSOLE, min = 1, max = 60, display = "Anzeigedauer", unit = "s") - public int hudFadeout = 8; + private int hudFadeout = 8; @Variable(name = "overlay_enabled", category = CVarCategory.CONSOLE, display = "Nachrichten-Overlay") - public boolean hudOverlay = true; + private boolean hudOverlay = true; @Variable(name = "chat_permanent", category = CVarCategory.CONSOLE, display = "Chat immer einblenden") - public boolean chatPermanent = false; + private boolean chatPermanent = false; @Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund") - public int hudOpacity = 0x40; - public boolean syncLimited; - public boolean vsync; - public boolean screenshot; - public boolean saving; - public boolean drawFps; - public boolean drawDebug; + private int hudOpacity = 0x40; @Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren") - public boolean glFlush = false; + private boolean glFlush = false; @Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen") public boolean conAutoclose = true; - public boolean interrupted; @Variable(name = "gui_theme", category = CVarCategory.GUI, display = "Design", callback = StyleFunction.class) public Style style = Style.DEFAULT; @Variable(name = "gui_scroll_lines", category = CVarCategory.GUI, min = 1, max = 10, display = "Scrollbreite", unit = "Zeilen") public int scrollLines = 3; @Variable(name = "gui_font", category = CVarCategory.GUI, display = "Schriftart", callback = FontFunction.class) - public Font font = Font.SMALL; + private Font font = Font.SMALL; @Variable(name = "draw_downfall_range", category = CVarCategory.RENDER, min = 0, max = 15, display = "Niederschlag-Radius") public int downfallRange = 4; @Variable(name = "draw_rain_particle_range", category = CVarCategory.RENDER, min = 0, max = 25, display = "Regen-Partikel-Radius") public int rainParticleRange = 10; @Variable(name = "crosshair_size", category = CVarCategory.GUI, min = 0, max = 32, display = "Größe des Fadenkreuzes") - public int crosshairSize = 6; + private int crosshairSize = 6; @Variable(name = "crosshair_color_notarget", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (ohne Ziel)") - public int crosshairColorBase = 0xffcfcfcf; + private int crosshairColorBase = 0xffcfcfcf; @Variable(name = "crosshair_color_target", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (mit Ziel)") - public int crosshairColorTarget = 0xffffffff; + private int crosshairColorTarget = 0xffffffff; @Variable(name = "tic_target", category = CVarCategory.SYSTEM, min = 1.0f, max = 1200.0f, callback = TickFunction.class, display = "Tickrate") - public float tpsTarget = 20.0f; + private float tpsTarget = 20.0f; @Variable(name = "tic_timeout", category = CVarCategory.SYSTEM, min = 1, max = 60000, display = "Tick-Timeout-Zeit") - public int tickTimeout = 2000; + private int tickTimeout = 2000; @Variable(name = "snd_enabled", category = CVarCategory.SOUND, display = "Tonausgabe") - public boolean soundEnabled = true; + private boolean soundEnabled = true; @Variable(name = "snd_buffer_size", category = CVarCategory.SOUND, min = 0, max = 1048576, display = "Puffer") - public int soundBufferSize = 16384; + private int soundBufferSize = 16384; @Variable(name = "snd_frame_size", category = CVarCategory.SOUND, min = 2, max = 8192, display = "Intervall") - public int soundFrameSize = 32; + private int soundFrameSize = 32; - private String serverInfo; - private int lastTickTime = -1; - private AudioInterface audio; - private boolean cfgDirty; - private String buffer = ""; - private boolean waitingForFile; - private boolean refreshing; - - public String dimensionName; - - public String message; - public int total; - public int progress = -1; - - private final int[] tickTimes = new int[240]; - private final long[] frames = new long[240]; - private int tickIndex; - private int lastIndex; - private int frameCounter; - private int frameIndex; - private long frameLast; - private long frameWait; - private long startNanoTime = System.nanoTime(); public static final Client CLIENT = new Client(); - - private final Bind[] keyBindsHotbar = new Bind[] { - Bind.SELECT1, Bind.SELECT2, Bind.SELECT3, Bind.SELECT4, Bind.SELECT5, Bind.SELECT6, Bind.SELECT7, Bind.SELECT8, Bind.SELECT9 - }; private Client() { } - private static NetConnection createNetworkManagerAndConnect(InetAddress address, int serverPort) - { - final NetConnection networkmanager = new NetConnection(); - ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group(CLIENT_NIO_EVENTLOOP.getValue())).handler(new ChannelInitializer() - { - protected void initChannel(Channel p_initChannel_1_) throws Exception - { - try - { - p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); - } - catch (ChannelException var3) - { - ; - } - - p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"splitter", (ChannelHandler)(new PacketSplitter())).addLast((String)"decoder", (ChannelHandler)(new PacketDecoder(false))).addLast((String)"prepender", (ChannelHandler)(new PacketPrepender())).addLast((String)"encoder", (ChannelHandler)(new PacketEncoder(true))).addLast((String)"packet_handler", (ChannelHandler)networkmanager); - } - })).channel(NioSocketChannel.class)).connect(address, serverPort).syncUninterruptibly(); - return networkmanager; - } + private NetConnection connect(InetAddress address, int port) { + final NetConnection connection = new NetConnection(); + new Bootstrap().group(CLIENT_NIO_EVENTLOOP.getValue()).handler(new ChannelInitializer() { + protected void initChannel(Channel channel) throws Exception { + try { + channel.config().setOption(ChannelOption.TCP_NODELAY, true); + } + catch(ChannelException e) { + } + channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("splitter", new PacketSplitter()) + .addLast("decoder", new PacketDecoder(false)).addLast("prepender", new PacketPrepender()) + .addLast("encoder", new PacketEncoder(true)).addLast("packet_handler", connection); + } + }).channel(NioSocketChannel.class).connect(address, port).syncUninterruptibly(); + return connection; + } public void displayConnecting(ServerInfo server) { this.show(GuiLoading.makeWaitTask("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort() + " ...")); @@ -575,7 +547,7 @@ public class Client implements IThreadListener { final NetConnection connection; try { - connection = createNetworkManagerAndConnect(server.getAddress() == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(server.getAddress())), server.getPort()); + connection = Client.this.connect(server.getAddress() == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(server.getAddress())), server.getPort()); connection.setNetHandler(new ClientLoginHandler(connection, Client.this, server)); connection.sendPacket(new HPacketHandshake(Util.PROTOCOL), new GenericFutureListener>() { public void operationComplete(Future u) throws Exception { @@ -776,24 +748,17 @@ public class Client implements IThreadListener { if(this.zooming && !hadZoom) { this.zoomLevel = 2.0f; } -// this.overlay = this.keyBindPlayerList.isKeyDown(); for (int l = 0; l < 9; ++l) { if (this.keyBindsHotbar[l].isPressed()) { -// if(!this.showDebugProfilerChart) { if(this.player.inventory.currentItem != l) this.controller.resetUseCooldown(); this.player.inventory.currentItem = l; -// } } } -// if (SKC.isBindPressed(SKC.KEY_INVENTORY)) -// { -// } - if (Bind.THROW.isPressed()) { this.player.dropOneItem(this.ctrl()); @@ -816,9 +781,8 @@ public class Client implements IThreadListener { { --this.rightClickTimer; } -// this.ingameGui.updateTick(); this.entityRenderer.getMouseOver(1.0F); - if (/* !this.paused && */ this.world != null) + if (this.world != null) { this.controller.update(); } @@ -907,7 +871,7 @@ public class Client implements IThreadListener { if (this.world != null) { this.world.tick(); - if (/* !this.paused && */ this.world != null) + if (this.world != null) { this.world.displayTick(ExtMath.floord(this.player.posX), ExtMath.floord(this.player.posY), ExtMath.floord(this.player.posZ)); } @@ -929,7 +893,7 @@ public class Client implements IThreadListener { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); if(this.wireframe) { GL11.glLineWidth(1.0f); - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); // GL_FRONT_AND_BACK, GL_LINE + GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); } if(this.open == null) { if(this.player != null) @@ -937,28 +901,27 @@ public class Client implements IThreadListener { this.deltaX = this.deltaY = 0.0f; } if(this.player != null) - this.soundManager.setListener(this.player, (float)this.tick_fraction); + this.soundManager.setListener(this.player, (float)this.tickFraction); if(this.player != null && this.player.isEntityInsideOpaqueBlock()) this.thirdPersonView = 0; GL11.glPushMatrix(); GL11.glClear(16640); GlState.enableTexture2D(); if(this.world != null) - this.entityRenderer.renderWorld((float)this.tick_fraction, System.nanoTime() - this.tickStart); + this.entityRenderer.renderWorld((float)this.tickFraction, System.nanoTime() - this.tickStart); GL11.glPopMatrix(); GlState.disableTexture2D(); GlState.disableCull(); GlState.enableBlend(); if(this.wireframe) - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); // GL_FRONT_AND_BACK, GL_FILL + GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); } private static int stats(int x, int y, String name, int value, int max, int color) { int w = (int)(246.0f * (float)value / (float)max); Drawing.drawTextboxRight(name, x + 250, y, 0x3f000000); Drawing.drawTextbox(String.format(TextColor.GREEN + "%d " + TextColor.GRAY + "/ " + TextColor.NEON + "%d", value, max), x, y, 0x3f000000); -// Drawing.drawRectColor(x, y + 20, 250, 10, 0xff000000); Drawing.drawRectBorder(x, y + 20, 250, 10, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); Drawing.drawGradient(x + 2 + 246 - w, y + 20 + 2, w, 6, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000)); return y + 40; @@ -966,8 +929,6 @@ public class Client implements IThreadListener { private static int bar(int x, int y, String name, float fill, int color) { Drawing.drawTextbox(name, x, y, 0x3f000000); -// Drawing.drawRectColor(x, y + 20, 250, 10, 0xff000000); -// Drawing.drawRectColor(x, y + 20, (int)(250.0f * fill), 10, color | 0xff000000); Drawing.drawRectBorder(x, y + 20, 250, 10, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); Drawing.drawGradient(x + 2, y + 20 + 2, (int)(246.0f * fill), 6, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000)); return y + 40; @@ -979,28 +940,28 @@ public class Client implements IThreadListener { if(this.open == null) { if(this.thirdPersonView == 0) { if(this.drawDebug) { - this.renderWorldDirections((float)this.tick_fraction); + this.renderWorldDirections((float)this.tickFraction); } else if(this.crosshairSize > 0) { - Drawing.drawRect(this.fb_x / 2 - 1, this.fb_y / 2 - this.crosshairSize, 2, this.crosshairSize * 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase); - Drawing.drawRect(this.fb_x / 2 - this.crosshairSize, this.fb_y / 2 - 1, this.crosshairSize * 2, 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase); + Drawing.drawRect(this.fbX / 2 - 1, this.fbY / 2 - this.crosshairSize, 2, this.crosshairSize * 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase); + Drawing.drawRect(this.fbX / 2 - this.crosshairSize, this.fbY / 2 - 1, this.crosshairSize * 2, 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase); } } int selected = this.player.inventory.currentItem; for(int n = 0; n < 9; n++) { - int x = this.fb_x / 2 - 180 + n * 40 + 4; - int y = this.fb_y - 40; + int x = this.fbX / 2 - 180 + n * 40 + 4; + int y = this.fbY - 40; Drawing.drawRectBorder(x - 1, y - 1, 36, 36, 0xff6f6f6f, selected == n ? 0xffffffff : 0xff000000, 0xffafafaf, 0xff4f4f4f); } ItemStack itemstack = this.player.inventory.getCurrentItem(); String current = itemstack != null ? itemstack.getItem().getHotbarText(this.player, itemstack) : ""; if(!current.isEmpty()) - Drawing.drawTextUpward(current, this.fb_x / 2, this.fb_y - 60, 0xffffffff); + Drawing.drawTextUpward(current, this.fbX / 2, this.fbY - 60, 0xffffffff); } - int x = this.fb_x / 2; + int x = this.fbX / 2; int y = 0; Iterator> iter = this.bars.entrySet().iterator(); long now = System.currentTimeMillis(); @@ -1016,8 +977,6 @@ public class Client implements IThreadListener { Drawing.drawTextboxCentered(s, x, y, 0x3f000000); Drawing.drawRectBorder(x - 200, y + 20, 400, 10, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); Drawing.drawGradient(x - 200 + 2, y + 20 + 2, (int)(396.0f * ((float)entity.getHealth() / (float)entity.getMaxHealth())), 6, entity.getColor() | 0xff000000, Util.mixColor(entity.getColor() | 0xff000000, 0xff000000)); -// Drawing.drawRectColor(x - 200, y + 20, 400, 10, 0xff000000); -// Drawing.drawRectColor(x - 200, y + 20, , 0xff000000 | ); y += 40; } else { @@ -1050,8 +1009,8 @@ public class Client implements IThreadListener { if(entity.getEnergy(energy) > 0) stats += 1; } - x = this.fb_x - 40 - 250; - y = this.fb_y - 40 - stats * 40; + x = this.fbX - 40 - 250; + y = this.fbY - 40 - stats * 40; int hp = entity.getHealth(); int max = entity.getMaxHealth(); y = stats(x, y, TextColor.RED + "Schaden", hp, max, 0xff0000); @@ -1084,45 +1043,31 @@ public class Client implements IThreadListener { } x = 40; - y = this.fb_y - 40 - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40; + y = this.fbY - 40 - (this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f ? 2 : 1) * 40; if(this.player.isRidingHorse() && this.player.getHorseJumpPower() != 0.0f) // { y = bar(x, y, String.format(TextColor.NEON + "Sprungkraft: " + TextColor.CYAN + "%d %%", (int)(this.player.getHorseJumpPower() * 100.0f)), this.player.getHorseJumpPower(), 0x4040ff); y = bar(x, y, String.format(TextColor.ACID + "EXP: " + TextColor.GREEN + "Level %d, %d/%d", this.player.experienceLevel, (int)((float)this.player.xpBarCap() * this.player.experience), this.player.xpBarCap()), this.player.experience, 0x40ff40); } -// gdr.shader = 0; -// glUseProgram(0); -// glBindVertexArray(0); -// glActiveTexture(GL_TEXTURE0); -// GlState.setActiveTexture(WCF.GL_TEXTURE0); -// glBindTexture(GL_TEXTURE_2D, 0); GlState.bindTexture(0); -// jsys.tooltip[0] = 0; -// this.tooltip = null; -// GlState.resetTextures(); GlState.setActiveTexture(GL13.GL_TEXTURE0); GlState.enableTexture2D(); -// GlState.disableDepth(); if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) { GlState.enableRescaleNormal(); GlState.enableBlend(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - // GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); ItemRenderer.enableGUIStandardItemLighting(); -// this.getTextureManager().bindTexture("textures/gui/inventory.png"); GL11.glPushMatrix(); - GL11.glTranslatef((float)(this.fb_x / 2 - 180 + 4 + 1), (float)(this.fb_y - 40 + 1), 0.0f); + GL11.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(this.fbY - 40 + 1), 0.0f); GL11.glScalef(2.0f, 2.0f, 2.0f); for(int index = 0; index < 9; ++index) { int xPos = index * 20; -// int yPos = this.fb_y - 40; ItemStack itemstack = this.player.inventory.mainInventory[index]; if(itemstack != null) { GlState.enableDepth(); this.renderItem.renderItemAndEffectIntoGUI(itemstack, xPos, 0); -// this.renderItem.renderItemOverlayIntoGUI(itemstack, xPos, 0, null); } } @@ -1133,7 +1078,7 @@ public class Client implements IThreadListener { if(item != null) { GL11.glPopMatrix(); GL11.glPushMatrix(); - GL11.glTranslatef((float)(this.fb_x / 2 - 180 + 4 + 1), (float)(40 + 1), 0.0f); + GL11.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(40 + 1), 0.0f); GL11.glScalef(2.0f, 2.0f, 2.0f); GlState.enableDepth(); this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0); @@ -1150,17 +1095,13 @@ public class Client implements IThreadListener { GlState.disableTexture2D(); GlState.disableCull(); GlState.enableBlend(); -// SKC.gui(); -// java_callv(gui, (sys.console->mouse_x - jsys.container_x) / 2, (sys.console->mouse_y - jsys.container_y) / 2); -// java_check_exc(); GlState.disableDepth(); -// SKC.foreground(); if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) { for(int index = 0; index < 9; ++index) { ItemStack itemstack = this.player.inventory.mainInventory[index]; if(itemstack != null) { GuiContainer.renderItemOverlay(itemstack, - this.fb_x / 2 - 180 + 4 + 1 + index * 40, this.fb_y - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax()); + this.fbX / 2 - 180 + 4 + 1 + index * 40, this.fbY - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax()); } } } @@ -1172,11 +1113,11 @@ public class Client implements IThreadListener { this.drawInfo(); if(this.hudOverlay && !(this.open instanceof GuiConsole)) { this.drawOverlay(this.feed, this.feedSize, false, 1, 0, 0); - this.drawOverlay(this.console, this.consoleSize, true, 1, 0, this.fb_y); - this.drawOverlay(this.hotbar, this.hotbarSize, true, 0, this.fb_x / 2, this.fb_y - 120); - this.drawOverlay(this.chat, this.chatSize, true, -1, this.fb_x, this.fb_y); + this.drawOverlay(this.console, this.consoleSize, true, 1, 0, this.fbY); + this.drawOverlay(this.hotbar, this.hotbarSize, true, 0, this.fbX / 2, this.fbY - 120); + this.drawOverlay(this.chat, this.chatSize, true, -1, this.fbX, this.fbY); } - if(this.drawFps) { // && !(this.open instanceof GuiConsole) + if(this.drawFps) { if(this.drawDebug) { if(this.open == null) { this.renderStats(); @@ -1186,7 +1127,7 @@ public class Client implements IThreadListener { Drawing.drawText(String.format("%s%.2f" + TextColor.RESET + " %s [%s" + TextColor.RESET + "], %.3f ms, W %d x %d%s", this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS", this.vsync ? TextColor.DGRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"), - (float)PerfSection.getTotal(false) / 1000.0f, this.fb_raw_x, this.fb_raw_y, + (float)PerfSection.getTotal(false) / 1000.0f, this.fbRawX, this.fbRawY, this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh()) + " Hz" : ""), 0, 0, 0xffffffff); } @@ -1200,16 +1141,10 @@ public class Client implements IThreadListener { public void renderStats() { int offset = 5; - int x1 = this.fb_x - 320; + int x1 = this.fbX - 320; int y1 = 0; - int y2 = this.fb_y; -// int pos = 0; + int y2 = this.fbY; String str = this.getLeft(); -// if(jstr) -// str = (*jsys.env)->GetStringUTFChars(jsys.env, jstr, NULL); - // elem->r_dirty = 1; - // if(!value) - // return; offset += str != null ? 18 : 0; String draw = String.format( "OpenGL: %s\n" + @@ -1218,25 +1153,20 @@ public class Client implements IThreadListener { "Tickrate: %s%.2f" + TextColor.RESET + " %s [" + TextColor.GREEN + "%.1f" + TextColor.RESET + "], %.3f ms, E %d ms" + "%s%s" , - GL11.glGetString(GL11.GL_VERSION), // WCF.glGetString(WCF.GL_SHADING_LANGUAGE_VERSION), + GL11.glGetString(GL11.GL_VERSION), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VENDOR), this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS", this.vsync ? TextColor.DGRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"), - (float)PerfSection.getTotal(false) / 1000.0f, this.fb_raw_x, this.fb_raw_y, + (float)PerfSection.getTotal(false) / 1000.0f, this.fbRawX, this.fbRawY, this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh()) + " Hz" : "", this.tpscode(), this.tickrate < 1.0f ? 1.0f / this.tickrate : this.tickrate, this.tickrate < 1.0f ? "SPT" : "TPS", (float)this.tickTarget / 1000.0f, (float)this.tick_time / 1000.0f, this.tickTimeout, str != null ? "\n" : "", str != null ? str : "" ); -// if(str) -// (*jsys.env)->ReleaseStringUTFChars(jsys.env, jstr, str); - // gui_render_text(elem, 0, 0, sys.style.text_label, sys.work_buf); Drawing.drawText(draw, 0, 0, 0xffffffff); str = this.getRight(this.debugPlayer); -// str = jstr ? (*jsys.env)->GetStringUTFChars(jsys.env, jstr, NULL) : NULL; - // offset = 10 + (str ? 10 : 0); StringBuilder sb = new StringBuilder(); for(PerfSection perf : PerfSection.values()) { if(sb.length() > 0) @@ -1244,7 +1174,6 @@ public class Client implements IThreadListener { sb.append(perf.getName()); } Drawing.drawText(sb.toString(), x1 + 0, y1, 0xffffffff); -// pos = 0; sb.setLength(0); for(PerfSection perf : PerfSection.values()) { if(sb.length() > 0) @@ -1252,7 +1181,6 @@ public class Client implements IThreadListener { sb.append(String.format("%.3f ms", (float)perf.getLast() / 1000.0f)); } Drawing.drawText(sb.toString(), x1 + 120, y1, 0xffffffff); -// pos = 0; sb.setLength(0); long total = PerfSection.getTotal(true); for(PerfSection perf : PerfSection.values()) { @@ -1264,7 +1192,6 @@ public class Client implements IThreadListener { if(str != null) { y1 = Font.YGLYPH * 10; Drawing.drawText(str, x1, y1, 0xffffffff); -// (*jsys.env)->ReleaseStringUTFChars(jsys.env, jstr, str); } } @@ -1287,20 +1214,8 @@ public class Client implements IThreadListener { this.debugUpdateTime += 1000L; } } - -// public void action(int btn) { -// if(this.open != null) { -// this.soundManager.playSound(new PositionedSound(SoundEvent.CLICK, 1.0F)); -// this.open.actionPerformed(btn); -// } -// } public void scroll(int dir) { -// if(this.open != null) // { -// return; -// if(this.open instanceof GuiCheat) -// ((GuiCheat)this.open).scroll(dir); -// } if(this.zooming) this.zoomLevel = ExtMath.clampf(this.zoomLevel + (dir < 0 ? -0.25f : 0.25f), 2.0f, 16.0f); else if(this.player != null) { @@ -1309,38 +1224,11 @@ public class Client implements IThreadListener { } } -// public void resize(int width, int height) -// { -// this.fb_x = width; -// this.fb_y = height; -// // if(this.open != null) -// // this.open.initialize(this, this.fb_x, this.fb_y); -// } - -// public void distance(int distance) -// { -// this.renderDistance = distance; -// this.updateViewDistance(); -// } - -// public void buildTime(int time) -// { -// this.maxBuildTime = time; -// } - public void moveCamera(float x, float y) { this.deltaX += x; this.deltaY += y; } -// public void closeScreen() { -// if(this.open != null) { -// if(this.thePlayer != null) -// this.thePlayer.setScreenClosed(); -// this.displayGuiScreen(null); -// } -// } - public void show(Gui gui) { if(!this.refreshing) @@ -1351,36 +1239,16 @@ public class Client implements IThreadListener { { this.open.onGuiClosed(); } -// if(this.thePlayer != null && this.thePlayer.getHealth() <= 0 && this.open instanceof GuiGameOver) -// this.thePlayer.respawnPlayer(); - -// if (guiScreenIn == null && this.theWorld == null) -// { -// guiScreenIn = new GuiMainMenu(); -// } -// else if (gui == null && this.world != null && this.player.getHealth() <= 0) { gui = GuiGameOver.INSTANCE; } -// else if(gui == null && this.open instanceof GuiInventory && this.itemCheat) { -// gui = new GuiCheat(); -// } this.open = gui; if (gui != null) { this.menu(true); -// if(this.open != null) { -// this.open.init(); -// } -// else { -// } gui.init(); -// if(gui instanceof GuiEmpty) -// SKC.setGuiMenu(); -// else -// SKC.setGuiAny(); Window.setTitle(String.format("%s - %s", VERSION, gui.getTitle())); } else @@ -1389,7 +1257,6 @@ public class Client implements IThreadListener { this.leftClickCounter = 10000; Bind.disableMouse(); Window.setTitle(String.format("%s - %s%s", VERSION, "Welt / Render", this.nograb ? "" : " (Maus gefangen)")); -// SKC.setGuiNone(); } } @@ -1499,11 +1366,6 @@ public class Client implements IThreadListener { switch (this.pointed.type) { case ENTITY: -// if (this.controller.isPlayerRightClickingOnEntity(this.thePlayer, this.pointed.entityHit, this.pointed)) -// { -// flag = false; -// } -// else if (this.controller.interact(this.player, this.pointed.entity)) { flag = false; @@ -1533,7 +1395,7 @@ public class Client implements IThreadListener { { this.player.inventory.mainInventory[this.player.inventory.currentItem] = null; } - else if (itemstack.getSize() != i) // || this.controller.isCreative()) + else if (itemstack.getSize() != i) { this.entityRenderer.itemRenderer.resetProgress(); } @@ -1584,7 +1446,6 @@ public class Client implements IThreadListener { } Block block1 = item instanceof ItemBlock && !block.isPickStrict() ? item.getBlock() : block; - // meta = block1.getDamageValue(this.world, blockpos); TODO: data } else { @@ -1619,15 +1480,6 @@ public class Client implements IThreadListener { } } } - -// private void printDebugMessage(String text) { -// this.printDebugMessage(text, null); -// } -// -// private void printDebugMessage(String text, String desc) { -// SKC.notify(text, desc); -// this.soundManager.playSound(new PositionedSound(SoundEvent.CLICK)); -// } public void loadWorld(WorldClient world, int type) { @@ -1657,7 +1509,6 @@ public class Client implements IThreadListener { this.viewEntity = this.player; System.gc(); -// SKC.loaded(true); } public void setDimensionAndSpawnPlayer(int type) @@ -1680,12 +1531,6 @@ public class Client implements IThreadListener { this.world.spawnEntityInWorld(this.player); this.player.rotYaw = -180.0F; this.player.setId(i); - -// if (this.open instanceof GuiGameOver) -// { -// if(!this.charEditor) -// this.displayGuiScreen(null); -// } } public ClientPlayer getNetHandler() @@ -1693,33 +1538,6 @@ public class Client implements IThreadListener { return this.player != null ? (ClientPlayer)this.player.client : null; } -// public void setSkin(BufferedImage skin, String id, ModelType model, boolean slim) -// { -// this.skinSet = id == null ? "" : id; -// this.skinSlim = slim; -// if(this.getNetHandler() != null) { -// this.getNetHandler().addToSendQueue(new CPacketSkin(skin, model)); -// } -// else { -// this.confirmSkin(true); -// } -// } - -// public void confirmSkin(boolean changed) { -// if(changed && this.skinSet != null) { -// this.skinId = this.skinSet; -// if(this.thePlayer != null) -// this.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_MODELPARTS, -// (this.thePlayer.getModelParts() & ~ModelPart.ARMS_SLIM.getMask()) | -// (this.skinSlim ? ModelPart.ARMS_SLIM.getMask() : 0))); -// } -// else if(changed) { -// this.skinId = ""; -// } -// this.skinSet = null; -// this.skinSlim = false; -// } - public TextureManager getTextureManager() { return this.textureManager; @@ -1914,9 +1732,9 @@ public class Client implements IThreadListener { if(this.world.isBlockLoaded(blockpos)) { ChunkClient chunk = this.world.getChunk(blockpos); biome = chunk.getBiome(blockpos); - bline = "Biom: " + biome.display + " (" + biome.name + ")" + /* (this.debugHideInfo ? "" : */ (", D: " + + bline = "Biom: " + biome.display + " (" + biome.name + "), D: " + TextColor.stripCodes(this.world.dimension.getFormattedName(false)) + - " (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")"); + " (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")"; lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, " + chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format( "%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: " @@ -1944,7 +1762,6 @@ public class Client implements IThreadListener { this.renderGlobal.getDebugInfoEntities() + "\n" + "Partikel: " + this.effectRenderer.getParticleCount() + ". O: " + this.world.getDebugLoadedEntities() + "\n" + this.world.getInfo() + "\n" + - // "", String.format("XYZ: %.3f / %.3f / %.3f", this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ) + "\n" + String.format("Block: %d %d %d, R: '%s/%s'", blockpos.getX(), blockpos.getY(), blockpos.getZ(), @@ -1980,9 +1797,6 @@ public class Client implements IThreadListener { ) + "\n" + "Startwert: " + this.world.dimension.getSeed() + (this.serverInfo != null ? "\n" + this.serverInfo : "") -// IWorldServer world = this.server.getWorld(this.theWorld.dimension.getDimensionId()); -// if(world != null) -// list.add("Seed: " + world.getSeed()); ; } @@ -2057,48 +1871,41 @@ public class Client implements IThreadListener { private void fbsize(int x, int y) { GL11.glViewport(0, 0, x, y); - fb_raw_x = x; - fb_raw_y = y; + this.fbRawX = x; + this.fbRawY = y; this.rescale(); - if(!fullscreen) { - xsize = x; - ysize = y; + if(!this.fullscreen) { + this.sizeX = x; + this.sizeY = y; } } private void pos(int x, int y) { - if(!fullscreen) { - saved_xpos = x; - saved_ypos = y; + if(!this.fullscreen) { + this.savedX = x; + this.savedY = y; } } private void mouse(int x, int y) { - if(!mouseFirst && open == null) - this.moveCamera((float)(x - mouse_raw_x) * sensitivity, (float)(mouse_raw_y - y) * sensitivity); - mouse_raw_x = x; - mouse_raw_y = y; - mouse_x = x / this.scale; - mouse_y = y / this.scale; - mouseFirst = false; - if(open != null && Bind.isInputEnabled() && Button.isMouseDown() /* && !(win->mouse & 0xfc) */ && !ctrl()) { -// if(mouse_clickx < 0 || mouse_clicky < 0) { -// return; -// } - -// SKC.drag(mouse_x, mouse_y); - open.drag(mouse_x, mouse_y); + if(!this.mouseFirst && this.open == null) + this.moveCamera((float)(x - this.mouseRawX) * this.sensitivity, (float)(this.mouseRawY - y) * this.sensitivity); + this.mouseRawX = x; + this.mouseRawY = y; + this.mouseX = x / this.scale; + this.mouseY = y / this.scale; + this.mouseFirst = false; + if(this.open != null && Bind.isInputEnabled() && Button.isMouseDown() && !ctrl()) { + this.open.drag(this.mouseX, this.mouseY); } } private void scroll(int x, int y) { x *= -1; - if(open != null && Bind.isInputEnabled()) { -// if(y != 0) -// this.scroll(ExtMath.clampi(y, -1, 1)); - open.scroll(x, y, mouse_x, mouse_y, ctrl(), shift()); + if(this.open != null && Bind.isInputEnabled()) { + this.open.scroll(x, y, this.mouseX, this.mouseY, ctrl(), shift()); } - else if(open != null) { + else if(this.open != null) { if((x != 0) || (y != 0)) Bind.setBind((x < 0) ? Wheel.SCROLL_LEFT : ((x > 0) ? Wheel.SCROLL_RIGHT : ((y < 0) ? Wheel.SCROLL_DOWN : Wheel.SCROLL_UP)), false); } @@ -2119,56 +1926,49 @@ public class Client implements IThreadListener { } private void button(Button btn, boolean press) { -// if(btn < 0 || btn >= 8) { -// return; -// } -// byte press = act == KEY_PRESS; boolean prev = btn.isDown(); - if(open != null && prev != press && Bind.isInputEnabled() && !Button.isMouseDown()) { -// SKC.press(btn, mouse_x, mouse_y); - open.mouse(btn, mouse_x, mouse_y, ctrl(), shift()); + if(this.open != null && prev != press && Bind.isInputEnabled() && !Button.isMouseDown()) { + this.open.mouse(btn, this.mouseX, this.mouseY, ctrl(), shift()); } - else if(open != null && press) { + else if(this.open != null && press) { Bind.setBind(btn, false); } btn.setDown(press); - if(open != null && prev != press && Bind.isInputEnabled() && !Button.isMouseDown()) { -// SKC.release(btn, mouse_x, mouse_y); - open.mouserel(btn, mouse_x, mouse_y); + if(this.open != null && prev != press && Bind.isInputEnabled() && !Button.isMouseDown()) { + this.open.mouserel(btn, this.mouseX, this.mouseY); } } private void key(Keysym key, KeyEvent act) { if((act == KeyEvent.PRESS) && Bind.isInputEnabled() && Bind.CHEAT.isDown() && this.handleDebugKey(key)) return; - if(open != null && (act != KeyEvent.RELEASE) && Bind.isInputEnabled()) { - open.key(key, ctrl(), shift()); + if(this.open != null && (act != KeyEvent.RELEASE) && Bind.isInputEnabled()) { + this.open.key(key, ctrl(), shift()); } - else if(open != null && (act != KeyEvent.REPEAT)) { + else if(this.open != null && (act != KeyEvent.REPEAT)) { Bind.setBind(key, act == KeyEvent.RELEASE); } } private void character(char code) { - if(open != null && Bind.isInputEnabled()) { - open.character(code); + if(this.open != null && Bind.isInputEnabled()) { + this.open.character(code); } } private void focus(boolean focus) { Bind.setWindowActive(focus); - if(open != null) - open.mouse(Button.MOUSE_LEFT, -1, -1, false, false); -// open.restyle(); + if(this.open != null) + this.open.mouse(Button.MOUSE_LEFT, -1, -1, false, false); } private void rescale() { this.scale = this.scaleVar; - while(this.scale > 1 && (this.fb_raw_x / this.scale < MIN_WIDTH || this.fb_raw_y / this.scale < MIN_HEIGHT)) { + while(this.scale > 1 && (this.fbRawX / this.scale < MIN_WIDTH || this.fbRawY / this.scale < MIN_HEIGHT)) { this.scale--; } - this.fb_x = Math.max(this.fb_raw_x / this.scale, MIN_WIDTH); - this.fb_y = Math.max(this.fb_raw_y / this.scale, MIN_HEIGHT); + this.fbX = Math.max(this.fbRawX / this.scale, MIN_WIDTH); + this.fbY = Math.max(this.fbRawY / this.scale, MIN_HEIGHT); if(this.open != null) { this.refreshing = true; this.show(this.open); @@ -2177,7 +1977,7 @@ public class Client implements IThreadListener { } private void closed() { - interrupted = true; + this.interrupted = true; } public void poll() { @@ -2224,34 +2024,34 @@ public class Client implements IThreadListener { public void menu(boolean menu) { - Window.grabCursor(!menu && !nograb); - mouseFirst = true; + Window.grabCursor(!menu && !this.nograb); + this.mouseFirst = true; } public void full(boolean full) { - if((full != fullscreen || full) && (!full || vidMode != null)) { + if((full != this.fullscreen || full) && (!full || this.vidMode != null)) { if(full) { - Window.setFullscreen(vidMode.width(), vidMode.height(), vidMode.refresh()); + Window.setFullscreen(this.vidMode.width(), this.vidMode.height(), this.vidMode.refresh()); } else { - Window.setWindowed(saved_xpos, saved_ypos, xsize, ysize); + Window.setWindowed(this.savedX, this.savedY, this.sizeX, this.sizeY); } - Window.setVSync(vsync); - fullscreen = full; + Window.setVSync(this.vsync); + this.fullscreen = full; } } public void sync(int sync) { - vsync = sync == 0; - syncLimited = sync > 0; + this.vsync = sync == 0; + this.syncLimited = sync > 0; if(sync > 0) { - syncLimit = sync; + this.syncLimit = sync; } else { DisplayMode mode = Window.getDisplayMode(); - syncLimit = mode != null ? mode.refresh() : 60; + this.syncLimit = mode != null ? mode.refresh() : 60; } - Window.setVSync(vsync); + Window.setVSync(this.vsync); } public void setupOverlay() { @@ -2262,7 +2062,7 @@ public class Client implements IThreadListener { GL11.glClear(256); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); - GL11.glOrtho(0.0D, (double)this.fb_raw_x, (double)this.fb_raw_y, 0.0D, 1000.0D, 3000.0D); + GL11.glOrtho(0.0D, (double)this.fbRawX, (double)this.fbRawY, 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); @@ -2327,10 +2127,9 @@ public class Client implements IThreadListener { this.vidMode = Window.getDisplayMode(); if(this.vidMode != null && (this.vidMode.width() < MIN_WIDTH || this.vidMode.height() < MIN_HEIGHT)) this.vidMode = null; - Window.initWindow(this.saved_xpos, this.saved_ypos, this.xsize, this.ysize, MIN_WIDTH, MIN_HEIGHT); + Window.initWindow(this.savedX, this.savedY, this.sizeX, this.sizeY, MIN_WIDTH, MIN_HEIGHT); Window.setIcon(genTriwave(64, 64, 0x00000000, 0xffff0000, 0xff00ff00, 0xff0000ff, 0xff7f00ff, 0xff000000), 64, 64); this.sync(this.sync); -// this.startSound(true); this.getVar("tic_target").setDefault(); this.show(GuiMenu.INSTANCE); Log.SYSTEM.info("Client gestartet in " + String.format("%.1f", (double)(System.currentTimeMillis() - time) / 1000.0) + " Sekunden"); @@ -2388,7 +2187,7 @@ public class Client implements IThreadListener { unload(false); this.getSoundManager().unload(); this.renderGlobal.stopChunkBuilders(); - if(audio.end()) + if(this.audio.end()) Log.SOUND.info("Audiogerät geschlossen"); Log.flushLog(); this.save(); @@ -2398,14 +2197,6 @@ public class Client implements IThreadListener { } - -// public void complete(String[] comp) { -// -// } -// public void infolist(String[] list, int[] data) { -// -// } - public void disconnected(String msg) { Log.NETWORK.info("Getrennt: %s", msg); this.unload(true); @@ -2449,7 +2240,7 @@ public class Client implements IThreadListener { if(this.player.isRiding() && this.player.vehicle instanceof EntityHorse) this.player.sendHorseInventory(); else - this.show(/* this.itemCheat ? new GuiCheat() : */ new GuiInventory(this.player)); + this.show(new GuiInventory(this.player)); } } } @@ -2469,23 +2260,23 @@ public class Client implements IThreadListener { if(this.saving) return; this.saving = true; - final int stride = ((this.fb_raw_x * 3) & 3) != 0 ? 4 + ((this.fb_raw_x * 3) & ~3) : (this.fb_raw_x * 3); - final ByteBuffer data = ByteBuffer.allocateDirect(stride * this.fb_raw_y).order(ByteOrder.nativeOrder()); - GL11.glReadPixels(0, 0, this.fb_raw_x, this.fb_raw_y, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data); + final int stride = ((this.fbRawX * 3) & 3) != 0 ? 4 + ((this.fbRawX * 3) & ~3) : (this.fbRawX * 3); + final ByteBuffer data = ByteBuffer.allocateDirect(stride * this.fbRawY).order(ByteOrder.nativeOrder()); + GL11.glReadPixels(0, 0, this.fbRawX, this.fbRawY, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data); new Thread(new Runnable() { public void run() { - byte[] pixels = new byte[stride * Client.this.fb_raw_y]; + byte[] pixels = new byte[stride * Client.this.fbRawY]; data.get(pixels); - byte[] conv = new byte[Client.this.fb_raw_x * Client.this.fb_raw_y * 3]; - for(int l = 0; l < Client.this.fb_raw_y; l++) { - System.arraycopy(pixels, l * stride, conv, (Client.this.fb_raw_y - 1 - l) * Client.this.fb_raw_x * 3, Client.this.fb_raw_x * 3); + byte[] conv = new byte[Client.this.fbRawX * Client.this.fbRawY * 3]; + for(int l = 0; l < Client.this.fbRawY; l++) { + System.arraycopy(pixels, l * stride, conv, (Client.this.fbRawY - 1 - l) * Client.this.fbRawX * 3, Client.this.fbRawX * 3); } - BufferedImage image = new BufferedImage(Client.this.fb_raw_x, Client.this.fb_raw_y, BufferedImage.TYPE_INT_ARGB); - int[] img = new int[Client.this.fb_raw_x * Client.this.fb_raw_y]; + BufferedImage image = new BufferedImage(Client.this.fbRawX, Client.this.fbRawY, BufferedImage.TYPE_INT_ARGB); + int[] img = new int[Client.this.fbRawX * Client.this.fbRawY]; for(int z = 0; z < img.length; z++) { img[z] = (int)(conv[(z * 3) + 2] & 0xff) | ((int)(conv[(z * 3) + 1] & 0xff) << 8) | ((int)(conv[(z * 3) + 0] & 0xff) << 16) | 0xff000000; } - image.setRGB(0, 0, Client.this.fb_raw_x, Client.this.fb_raw_y, img, 0, Client.this.fb_raw_x); + image.setRGB(0, 0, Client.this.fbRawX, Client.this.fbRawY, img, 0, Client.this.fbRawX); File dir = new File("screenshots"); dir.mkdirs(); @@ -2551,7 +2342,7 @@ public class Client implements IThreadListener { break; } } - this.tick_fraction = ((double)this.tick_torun) / 1000000.0; + this.tickFraction = ((double)this.tick_torun) / 1000000.0; this.tick_ttime += this.tick_ftime; this.tick_time = this.tickFrame != 0 ? (this.tick_ftime / (long)this.tickFrame) : 0L; } @@ -2573,8 +2364,8 @@ public class Client implements IThreadListener { private void startSound(boolean load) { if(load) SoundManager.loadSounds(); - audio = new AudioInterface(this.soundFrameSize, this.soundBufferSize, !this.soundEnabled); - boolean started = audio.start(); + this.audio = new AudioInterface(this.soundFrameSize, this.soundBufferSize, !this.soundEnabled); + boolean started = this.audio.start(); Log.flushLog(); if(started) Log.SOUND.info("Audiogerät geöffnet"); @@ -2588,14 +2379,14 @@ public class Client implements IThreadListener { public void restartSound(boolean load) { Client.this.logFeed("Lade Sound-System " + (load ? "und alle Sounds " : "") + "neu"); this.soundManager.unload(); - if(audio.end()) + if(this.audio.end()) Log.SOUND.info("Audiogerät geschlossen"); this.startSound(load); Client.this.logFeed("Das Sound-System " + (load ? "und alle Sounds wurden" : "wurde") + " neu geladen"); } public AudioInterface getAudioInterface() { - return audio; + return this.audio; } public void distance(int distance) { @@ -2853,15 +2644,6 @@ public class Client implements IThreadListener { } - - private static float tri(float x, float p, float a) { - return ((4.0f * a) / p) * ExtMath.absf(((x - p / 4.0f) % p) - p / 2.0f) - a; - } - - private static void memcpy(byte[] dest, int doff, byte[] src, int soff, int len) { - System.arraycopy(src, soff, dest, doff, len); - } - private static byte[] genTriwave(int w, int h, int color1, int color2, int color3, int color4, int color5, int color6) { byte[] data = new byte[w * h * 4]; byte[] color = new byte[24]; @@ -2882,34 +2664,36 @@ public class Client implements IThreadListener { for(int y = 0; y < h; y++) { int offs = ((y / 2 == h / 16) || (y / 2 == (h / 2 - h / 16) - 1)) ? 16 : (((y / 2 == h / 16 + 1) || (y / 2 == (h / 2 - h / 16) - 2)) ? 20 : 0); for(int x = 0; x < w; x++) { - memcpy(data, (y*w+x) << 2, color, offs, 4); + System.arraycopy(color, offs, data, (y*w+x) << 2, 4); } } for(int x = 0; x < w; x++) { - int y = ((x < w / 8) || (x >= w - w / 8)) ? (h / 2) : (h / 2 + (int)tri((float)(w / 4 + x), (float)((w * 3) / 4), (float)(((h * 3) / 4) / 2))); - // sys_assert(y - 8 >= 0 && y + 7 < h) - memcpy(data, ((y-8)*w+x) << 2, color, 0, 4); - memcpy(data, ((y-7)*w+x) << 2, color, 0, 4); - memcpy(data, ((y-6)*w+x) << 2, color, 0, 4); - memcpy(data, ((y-5)*w+x) << 2, color, 4, 4); - memcpy(data, ((y-4)*w+x) << 2, color, 4, 4); - memcpy(data, ((y-3)*w+x) << 2, color, 0, 4); - memcpy(data, ((y-2)*w+x) << 2, color, 0, 4); - memcpy(data, ((y-1)*w+x) << 2, color, 8, 4); - memcpy(data, ((y+0)*w+x) << 2, color, 8, 4); - memcpy(data, ((y+1)*w+x) << 2, color, 0, 4); - memcpy(data, ((y+2)*w+x) << 2, color, 0, 4); - memcpy(data, ((y+3)*w+x) << 2, color, 12, 4); - memcpy(data, ((y+4)*w+x) << 2, color, 12, 4); - memcpy(data, ((y+5)*w+x) << 2, color, 0, 4); - memcpy(data, ((y+6)*w+x) << 2, color, 0, 4); - memcpy(data, ((y+7)*w+x) << 2, color, 0, 4); + float fx = (float)(w / 4 + x); + float fp = (float)((w * 3) / 4); + float fa = (float)(((h * 3) / 4) / 2); + int y = ((x < w / 8) || (x >= w - w / 8)) ? (h / 2) : (h / 2 + (int)(((4.0f * fa) / fp) * ExtMath.absf(((fx - fp / 4.0f) % fp) - fp / 2.0f) - fa)); + System.arraycopy(color, 0, data, ((y-8)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y-7)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y-6)*w+x) << 2, 4); + System.arraycopy(color, 4, data, ((y-5)*w+x) << 2, 4); + System.arraycopy(color, 4, data, ((y-4)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y-3)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y-2)*w+x) << 2, 4); + System.arraycopy(color, 8, data, ((y-1)*w+x) << 2, 4); + System.arraycopy(color, 8, data, ((y+0)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y+1)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y+2)*w+x) << 2, 4); + System.arraycopy(color, 12, data, ((y+3)*w+x) << 2, 4); + System.arraycopy(color, 12, data, ((y+4)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y+5)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y+6)*w+x) << 2, 4); + System.arraycopy(color, 0, data, ((y+7)*w+x) << 2, 4); } return data; } public T getVar(String name) { - return (T)cvars.get(name); + return (T)this.cvars.get(name); } public Iterable getVars() { @@ -2917,19 +2701,19 @@ public class Client implements IThreadListener { } public void setDirty() { - cfgDirty = true; + this.cfgDirty = true; } public boolean isDirty() { - return cfgDirty; + return this.cfgDirty; } public String getBuffer() { - return buffer; + return this.buffer; } public float getTickFraction() { - return (float)this.tick_fraction; + return (float)this.tickFraction; } public long getPassedTime() { @@ -2937,9 +2721,9 @@ public class Client implements IThreadListener { } private void regVar(CVar cv) { - if(cvars.containsKey(cv.getCVarName())) + if(this.cvars.containsKey(cv.getCVarName())) throw new IllegalArgumentException("Variable " + cv.getCVarName() + " existiert bereits!"); - cvars.put(cv.getCVarName(), cv); + this.cvars.put(cv.getCVarName(), cv); } private void regVars(Class clazz, Object object) { @@ -3013,11 +2797,11 @@ public class Client implements IThreadListener { regVars(GuiServer.INSTANCE); regVars(GuiChar.INSTANCE); - if(!config.exists()) + if(!this.config.exists()) return; String data; try { - data = FileUtils.read(config); + data = FileUtils.read(this.config); } catch(IOException e) { Log.IO.error(e, "Konnte Konfigurationsdatei nicht laden"); @@ -3025,7 +2809,7 @@ public class Client implements IThreadListener { } if(data == null) return; - for(String line : data.split("\n")) { // new String(data, CharsetUtil.UTF_8).split("\n") + for(String line : data.split("\n")) { if(line.startsWith("#")) continue; String[] tok = line.split("=", 2); @@ -3046,15 +2830,15 @@ public class Client implements IThreadListener { } public void save() { - cfgDirty = false; + this.cfgDirty = false; StringBuilder sb = new StringBuilder(); - for(CVar cv : cvars.values()) { + for(CVar cv : this.cvars.values()) { if(sb.length() > 0) sb.append('\n'); sb.append(cv.getCVarName() + "=" + cv.format()); } try { - FileUtils.write(config, sb.toString()); + FileUtils.write(this.config, sb.toString()); } catch(IOException e) { Log.IO.error(e, "Konnte Konfigurationsdatei nicht speichern"); @@ -3070,11 +2854,10 @@ public class Client implements IThreadListener { public void exec(String line) { if(line.equals("#")) { - for(CVar cv : cvars.values()) { + for(CVar cv : this.cvars.values()) { printVar(cv); } - this.logConsole(TextColor.GREEN + "CVARs insgesamt registriert: %d", cvars.size()); -// this.command(line); + this.logConsole(TextColor.GREEN + "CVARs insgesamt registriert: %d", this.cvars.size()); return; } else if(line.startsWith("#")) { @@ -3088,7 +2871,7 @@ public class Client implements IThreadListener { } String value = tok.substring(space + 1).trim(); if(cv.parse(value)) { - cfgDirty = true; + this.cfgDirty = true; this.logConsole("%s -> %s", cv.getCVarName(), cv.format()); } else { @@ -3099,8 +2882,6 @@ public class Client implements IThreadListener { } if(this.player != null && this.getNetHandler() != null) this.getNetHandler().addToSendQueue(new CPacketMessage(line.startsWith("/") ? CPacketMessage.Type.COMMAND : CPacketMessage.Type.CHAT, line.startsWith("/") ? line.substring(1) : line)); -// Log.CONSOLE.user("%s", line); -// this.command(line); } public void reset() { @@ -3135,15 +2916,14 @@ public class Client implements IThreadListener { public void log(String prefixed, String line) { String msg = this.conTimestamps ? prefixed : line; -// this.addMessage(msg); - if((buffer.length() + msg.length() + 1) > LOG_BUFFER) { + if((this.buffer.length() + msg.length() + 1) > LOG_BUFFER) { int offset = (msg.length() + 1) > 1024 ? (msg.length() + 1) : 1024; - int nl = buffer.indexOf('\n', offset); - buffer = nl >= 0 ? buffer.substring(nl + 1) : ""; + int nl = this.buffer.indexOf('\n', offset); + this.buffer = nl >= 0 ? this.buffer.substring(nl + 1) : ""; } - buffer = buffer + "\n" + msg; + this.buffer = this.buffer + "\n" + msg; if(this.open instanceof GuiConsole) { - ((GuiConsole)this.open).setLog(buffer); + ((GuiConsole)this.open).setLog(this.buffer); } } @@ -3280,11 +3060,11 @@ public class Client implements IThreadListener { if(netHandler != null) { int size = this.playerList.size(); int w = size > 80 ? 4 : (size > 40 ? 3 : (size > 10 ? 2 : 1)); - w = Math.min(w, Math.max(1, this.fb_x / 300)); + w = Math.min(w, Math.max(1, this.fbX / 300)); int bx = 0; int by = 0; for(Entry elem : this.playerList.entrySet()) { - int x = this.fb_x / 2 - (w * 300) / 2 + bx * 300; + int x = this.fbX / 2 - (w * 300) / 2 + bx * 300; int y = 10 + by * (Font.YGLYPH + 2); Drawing.drawGradient(x, y, 300, Font.YGLYPH + 2, 0x7f404040, 0x7f000000); Drawing.drawText(elem.getKey(), x + 4, y + 1, 0xffffffff); @@ -3303,14 +3083,9 @@ public class Client implements IThreadListener { GL11.glLineWidth(1.0F); GlState.disableTexture2D(); GlState.depthMask(false); -// GlState.color(1.0f, 1.0f, 1.0f, 1.0f); GL11.glPushMatrix(); -// WCF.glMatrixMode(5888); -// WCF.glLoadIdentity(); - GL11.glTranslatef((float)(this.fb_x / 2), (float)(this.fb_y / 2), 0.0F); + GL11.glTranslatef((float)(this.fbX / 2), (float)(this.fbY / 2), 0.0F); this.entityRenderer.rotateCamera(this.viewEntity, partialTicks); -// WCF.glScalef(-1.0f, -1.0f, -1.0f); -// Drawing.drawRectColor(0, 0, 10, 2, 0xff00ff00); RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 24D, 1D, 1D), 255, 0, 0, 255); RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, 1D, 24D), 0, 0, 255, 255); RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, -20D, 1D), 0, 255, 0, 255); @@ -3343,9 +3118,8 @@ public class Client implements IThreadListener { } private void renderLagometer() { -// GlState.disableDepth(); - int w = this.fb_x; - int h = this.fb_y; + int w = this.fbX; + int h = this.fbY; int shifted = this.lastIndex; int x = 0; Drawing.drawRect(0, h - 74, 240, 60, 0x90505050); @@ -3388,8 +3162,6 @@ public class Client implements IThreadListener { Drawing.drawText("60ms", w - 240 + 2, h - 60 - 14, 0xffE0E0E0); Drawing.drawTextRight("ms/Tick", w - 2, h - 60 - 14, 0xffE0E0E0); } - -// GlState.enableDepth(); } public static enum FileMode { @@ -3455,7 +3227,6 @@ public class Client implements IThreadListener { else result = chooser.showOpenDialog(null); if(result != JFileChooser.APPROVE_OPTION) { -// Client.this.logFeed(TextColor.RED + "Konnte Dateibrowser nicht öffnen"); Client.this.waitingForFile = false; return; } diff --git a/client/src/main/java/client/gui/Gui.java b/client/src/main/java/client/gui/Gui.java index c53f8d40..753d011d 100644 --- a/client/src/main/java/client/gui/Gui.java +++ b/client/src/main/java/client/gui/Gui.java @@ -146,9 +146,9 @@ public abstract class Gui { } protected void shift() { - if(this.gm.fb_x != 0 && this.gm.fb_y != 0) { - int shift_x = (this.gm.fb_x - (this.max_x - this.min_x)) / 2 - this.min_x; - int shift_y = (this.gm.fb_y - (this.max_y - this.min_y)) / 2 - this.min_y; + if(this.gm.fbX != 0 && this.gm.fbY != 0) { + int shift_x = (this.gm.fbX - (this.max_x - this.min_x)) / 2 - this.min_x; + int shift_y = (this.gm.fbY - (this.max_y - this.min_y)) / 2 - this.min_y; for(Element elem : this.elems) { elem.shift(shift_x, shift_y); } @@ -160,7 +160,7 @@ public abstract class Gui { this.min_x = this.min_y = Integer.MAX_VALUE; this.max_x = this.max_y = Integer.MIN_VALUE; this.elems.clear(); - this.init(this.gm.fb_x, this.gm.fb_y); + this.init(this.gm.fbX, this.gm.fbY); } public void update() { @@ -210,14 +210,14 @@ public abstract class Gui { } if(elem != null && elem.enabled && elem.visible) elem.drawOverlay(); - elem = this.clicked(this.gm.mouse_x, this.gm.mouse_y); + elem = this.clicked(this.gm.mouseX, this.gm.mouseY); if(elem != null && elem.enabled && elem.visible && elem.canHover()) elem.drawHover(); } public void drawMainBackground() { if(this.gm.world != null && !this.gm.charEditor) { - Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010); + Drawing.drawGradient(0, 0, this.gm.fbX, this.gm.fbY, 0xc0101010, 0xd0101010); } else { Drawing.drawScaled(this.gm, BACKGROUND); @@ -227,7 +227,7 @@ public abstract class Gui { public void render() { this.drawMainBackground(); this.drawBackground(); - if(this.gm.fb_x != 0 && this.gm.fb_y != 0) + if(this.gm.fbX != 0 && this.gm.fbY != 0) this.draw(); GlState.bindTexture(0); GlState.setActiveTexture(GL13.GL_TEXTURE0); diff --git a/client/src/main/java/client/gui/GuiMenu.java b/client/src/main/java/client/gui/GuiMenu.java index 4b3735ae..c5ee2093 100644 --- a/client/src/main/java/client/gui/GuiMenu.java +++ b/client/src/main/java/client/gui/GuiMenu.java @@ -25,7 +25,7 @@ public class GuiMenu extends Gui { if(this.gm.world != null) super.drawMainBackground(); else - this.gm.renderGlobal.renderStarField(this.gm.fb_x, this.gm.fb_y, 0x000000, 0xffffff, (float)this.ticks + this.gm.getTickFraction(), this.rand); + this.gm.renderGlobal.renderStarField(this.gm.fbX, this.gm.fbY, 0x000000, 0xffffff, (float)this.ticks + this.gm.getTickFraction(), this.rand); } private final Random rand = new Random(); @@ -83,12 +83,12 @@ public class GuiMenu extends Gui { public void drawHover() { if(GuiMenu.this.hacked == 10) { Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x287f00ff); - GuiMenu.this.rand.setSeed(((long)this.gm.mouse_x * 7652657L) ^ ((long)this.gm.mouse_y * 87262826276L)); + GuiMenu.this.rand.setSeed(((long)this.gm.mouseX * 7652657L) ^ ((long)this.gm.mouseY * 87262826276L)); int width = Drawing.getWidth("Hax!"); for(int z = 0; z < 64; z++) { - Drawing.drawText("Hax!", GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_x - width)) + + Drawing.drawText("Hax!", GuiMenu.this.rand.zrange(Math.max(1, this.gm.fbX - width)) + (int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + this.gm.getTickFraction()) / 100.0f * (float)Math.PI * 2.0f) * 16.0f), - GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_y - Font.YGLYPH)) + + GuiMenu.this.rand.zrange(Math.max(1, this.gm.fbY - Font.YGLYPH)) + (int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + this.gm.getTickFraction()) / 100.0f * (float)Math.PI * 2.0f) * 16.0f), 0xff0000ff | (GuiMenu.this.rand.zrange(256) << 16)); } @@ -138,7 +138,7 @@ public class GuiMenu extends Gui { this.animLen = 0; this.animDir = 0; this.animStep = false; - this.animWidth = Math.max(5, (this.gm.fb_x - 5) / 10); + this.animWidth = Math.max(5, (this.gm.fbX - 5) / 10); this.animGrowth = this.animWidth / 15; this.animGrow = new int[this.animWidth]; } @@ -295,10 +295,10 @@ public class GuiMenu extends Gui { int y = 99; int h = 16; int n = Drawing.getWidth(this.splashLabel.getText()); - Drawing.drawRect(0, y, this.gm.fb_x / 2 - n / 2 - 10, h, 0x7f7f00ff); - Drawing.drawRect(this.gm.fb_x / 2 + n / 2 + 10, y, this.gm.fb_x - (this.gm.fb_x / 2 + n / 2 + 10), h, 0x7f7f00ff); - Drawing.drawText(this.animBack, this.gm.fb_x - Drawing.getWidth(this.animBack), this.gm.fb_y - 18, 0xffffffff); - Drawing.drawText(this.animStr, this.gm.fb_x - Drawing.getWidth(this.animStr) - 3 - ((this.animWidth - this.animPos - 4) * 10), this.gm.fb_y - 20, 0xffffffff); + Drawing.drawRect(0, y, this.gm.fbX / 2 - n / 2 - 10, h, 0x7f7f00ff); + Drawing.drawRect(this.gm.fbX / 2 + n / 2 + 10, y, this.gm.fbX - (this.gm.fbX / 2 + n / 2 + 10), h, 0x7f7f00ff); + Drawing.drawText(this.animBack, this.gm.fbX - Drawing.getWidth(this.animBack), this.gm.fbY - 18, 0xffffffff); + Drawing.drawText(this.animStr, this.gm.fbX - Drawing.getWidth(this.animStr) - 3 - ((this.animWidth - this.animPos - 4) * 10), this.gm.fbY - 20, 0xffffffff); } } } diff --git a/client/src/main/java/client/gui/character/GuiChar.java b/client/src/main/java/client/gui/character/GuiChar.java index 5b2dd786..7c3802f4 100755 --- a/client/src/main/java/client/gui/character/GuiChar.java +++ b/client/src/main/java/client/gui/character/GuiChar.java @@ -461,10 +461,10 @@ public class GuiChar extends GuiList if(this.adjust != null) { float factor = this.gm.player.width > 2.15f ? 2.15f / this.gm.player.width : 1.0f; factor = this.gm.player.height > 3.0f && 3.0f / this.gm.player.height < factor ? 3.0f / this.gm.player.height : factor; - if(this.gm.fb_x >= 784 + 460 && this.gm.fb_y >= 128 + 640) - drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y - 160, 160.0f * factor, this.yaw, this.pitch, this.gm.player); + if(this.gm.fbX >= 784 + 460 && this.gm.fbY >= 128 + 640) + drawEntity(400 + (this.gm.fbX - 400 - 400) / 2, this.gm.fbY - 160, 160.0f * factor, this.yaw, this.pitch, this.gm.player); else - drawEntity(390 - 4 - 115 / 2, this.gm.fb_y - 60, 40.0f * factor, this.yaw, this.pitch, this.gm.player); + drawEntity(390 - 4 - 115 / 2, this.gm.fbY - 60, 40.0f * factor, this.yaw, this.pitch, this.gm.player); } } diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index e186d35b..bbd2581d 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -262,8 +262,8 @@ public abstract class GuiContainer extends Gui if(this.gm.itemCheat) { this.cheatX = this.container_x + this.container_w + 4; this.cheatY = 16; - this.cheatWidth = Math.max((this.gm.fb_x - this.container_x - this.container_w - 16) / 18, 1); - this.cheatHeight = Math.max((this.gm.fb_y - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 100) / 18, 1); + this.cheatWidth = Math.max((this.gm.fbX - this.container_x - this.container_w - 16) / 18, 1); + this.cheatHeight = Math.max((this.gm.fbY - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 100) / 18, 1); } } @@ -302,7 +302,7 @@ public abstract class GuiContainer extends Gui if(this.gm.itemCheat) { GL11.glPushMatrix(); - GL11.glTranslatef(-(float)((this.gm.fb_x - this.xSize * 2) / 2) * 0.5f, -(float)((this.gm.fb_y - this.ySize * 2) / 2) * 0.5f, 0.0f); + GL11.glTranslatef(-(float)((this.gm.fbX - this.xSize * 2) / 2) * 0.5f, -(float)((this.gm.fbY - this.ySize * 2) / 2) * 0.5f, 0.0f); GL11.glScalef(0.5f, 0.5f, 0.5f); int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; int j = (int)((double)(this.currentScroll * (float)i) + 0.5D); @@ -324,7 +324,7 @@ public abstract class GuiContainer extends Gui GlState.enableDepth(); this.itemRender.renderItemAndEffectIntoGUI(ITEM_LIST.get(i1), this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1); this.itemRender.zLevel = 0.0F; - if(this.isPointInRegion(this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1, 16, 16, this.gm.mouse_x, this.gm.mouse_y)) + if(this.isPointInRegion(this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1, 16, 16, this.gm.mouseX, this.gm.mouseY)) this.renderToolTip(ITEM_LIST.get(i1), mouseX, mouseY); } } @@ -345,7 +345,7 @@ public abstract class GuiContainer extends Gui this.drawnOverlays.clear(); if(this.tooltip != null) { int width = Drawing.getBoxWidth(this.tooltip); - Drawing.drawTextbox(this.tooltip, this.hover_x + width > this.gm.fb_x ? this.hover_x - width - 32 : this.hover_x, this.hover_y, 0xaf000000); + Drawing.drawTextbox(this.tooltip, this.hover_x + width > this.gm.fbX ? this.hover_x - width - 32 : this.hover_x, this.hover_y, 0xaf000000); } this.tooltip = null; } @@ -361,7 +361,7 @@ public abstract class GuiContainer extends Gui int x2 = x1 + 8; int y2 = y1 + this.cheatHeight * 18; - if (!this.wasClicking && flag && this.gm.mouse_x >= x1 && this.gm.mouse_y >= y1 && this.gm.mouse_x < x2 && this.gm.mouse_y < y2) + if (!this.wasClicking && flag && this.gm.mouseX >= x1 && this.gm.mouseY >= y1 && this.gm.mouseX < x2 && this.gm.mouseY < y2) { this.isScrolling = this.needsScrollBars(); } @@ -375,7 +375,7 @@ public abstract class GuiContainer extends Gui if (this.isScrolling) { - this.currentScroll = ((float)(this.gm.mouse_y - y1) - 7.5F) / ((float)(y2 - y1) - 15.0F); + this.currentScroll = ((float)(this.gm.mouseY - y1) - 7.5F) / ((float)(y2 - y1) - 15.0F); this.currentScroll = ExtMath.clampf(this.currentScroll, 0.0F, 1.0F); } } @@ -496,9 +496,9 @@ public abstract class GuiContainer extends Gui public void drawPost() { GL11.glPushMatrix(); - GL11.glTranslatef((float)((this.gm.fb_x - this.xSize * 2) / 2), (float)((this.gm.fb_y - this.ySize * 2) / 2), 0.0f); + GL11.glTranslatef((float)((this.gm.fbX - this.xSize * 2) / 2), (float)((this.gm.fbY - this.ySize * 2) / 2), 0.0f); GL11.glScalef(2.0f, 2.0f, 2.0f); - this.drawScreen((this.gm.mouse_x - this.container_x) / 2, (this.gm.mouse_y - this.container_y) / 2); + this.drawScreen((this.gm.mouseX - this.container_x) / 2, (this.gm.mouseY - this.container_y) / 2); GL11.glPopMatrix(); ItemRenderer.disableStandardItemLighting(); } @@ -609,13 +609,13 @@ public abstract class GuiContainer extends Gui this.cheatStack = null; return; } - if((mouseButton == 0 || mouseButton == 1 || mouseButton == 2) && this.clickSide(this.gm.mouse_x, this.gm.mouse_y, -1, this.gm.shift() || mouseButton == 1, this.gm.ctrl() || mouseButton == 2)) + if((mouseButton == 0 || mouseButton == 1 || mouseButton == 2) && this.clickSide(this.gm.mouseX, this.gm.mouseY, -1, this.gm.shift() || mouseButton == 1, this.gm.ctrl() || mouseButton == 2)) return; if(mouseButton == 0) { if(this.gm.itemCheat && this.gm.player != null && this.gm.player.inventory.getItemStack() == null) { for (CheatTab tab : CheatTab.values()) { - if (this.isInsideTab(tab, this.gm.mouse_x, this.gm.mouse_y)) + if (this.isInsideTab(tab, this.gm.mouseX, this.gm.mouseY)) { this.setCurrentTab(tab); return; @@ -819,7 +819,7 @@ public abstract class GuiContainer extends Gui } public void dropItem() { - if (!this.clickSide(this.gm.mouse_x, this.gm.mouse_y, -100, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.theSlot != null && this.theSlot.getHasStack()) + if (!this.clickSide(this.gm.mouseX, this.gm.mouseY, -100, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.theSlot != null && this.theSlot.getHasStack()) { this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, this.gm.ctrl() ? 1 : 0, 4); } @@ -834,7 +834,7 @@ public abstract class GuiContainer extends Gui public void useHotbar(int slot) { - if (!this.clickSide(this.gm.mouse_x, this.gm.mouse_y, slot, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null && this.theSlot != null) + if (!this.clickSide(this.gm.mouseX, this.gm.mouseY, slot, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null && this.theSlot != null) { this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, slot, 2); } @@ -918,7 +918,7 @@ public abstract class GuiContainer extends Gui private boolean renderInventoryHoveringText(CheatTab tab, int x, int z) { - if (this.isPointInRegion(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, this.gm.mouse_x, this.gm.mouse_y)) + if (this.isPointInRegion(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, this.gm.mouseX, this.gm.mouseY)) { this.hover(tab.getName(), x, z); return true; diff --git a/client/src/main/java/client/gui/element/Dropdown.java b/client/src/main/java/client/gui/element/Dropdown.java index 773cda0e..1f6cb6f5 100644 --- a/client/src/main/java/client/gui/element/Dropdown.java +++ b/client/src/main/java/client/gui/element/Dropdown.java @@ -58,7 +58,7 @@ public class Dropdown extends Element { } public void drawHover() { - int m = ((this.gm.mouse_y - (this.pos_y + this.margin_y1)) * Dropdown.this.values.length / (this.size_y - (this.margin_y1 + this.margin_y2))); + int m = ((this.gm.mouseY - (this.pos_y + this.margin_y1)) * Dropdown.this.values.length / (this.size_y - (this.margin_y1 + this.margin_y2))); // if((sys.mouse_y - this.pos_y) < (this.size_y - this.margin_y2)) Drawing.drawRect(this.pos_x + this.margin_x1, this.pos_y + this.margin_y1 + ExtMath.clampi(m, 0, Dropdown.this.values.length - 1) * ((this.size_y - (this.margin_y1 + this.margin_y2)) / Dropdown.this.values.length), this.size_x - (this.margin_x1 + this.margin_x2), (this.size_y - (this.margin_y1 + this.margin_y2)) / Dropdown.this.values.length, Gui.HOVER_COLOR); } diff --git a/client/src/main/java/client/gui/element/Element.java b/client/src/main/java/client/gui/element/Element.java index f6701567..966c7970 100644 --- a/client/src/main/java/client/gui/element/Element.java +++ b/client/src/main/java/client/gui/element/Element.java @@ -221,7 +221,7 @@ public abstract class Element { int x2 = this.size_x - (this.margin_x1 + this.margin_x2); int y2 = this.size_y - (this.margin_y1 + this.margin_y2); // if(elem.type == ElemType.FIELD) { - this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2); + this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fbY - (y1 + y2)) < 0 ? 0 : (this.gm.fbY - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2); GL11.glEnable(GL11.GL_SCISSOR_TEST); // } // if(this.type == ElemType.CUSTOM) diff --git a/client/src/main/java/client/gui/element/GuiList.java b/client/src/main/java/client/gui/element/GuiList.java index 0727984a..97f3fff0 100755 --- a/client/src/main/java/client/gui/element/GuiList.java +++ b/client/src/main/java/client/gui/element/GuiList.java @@ -126,14 +126,14 @@ public abstract class GuiList extends Gui public void draw() { - int mouseXIn = this.gm.mouse_x; - int mouseYIn = this.gm.mouse_y; + int mouseXIn = this.gm.mouseX; + int mouseYIn = this.gm.mouseY; this.mouseX = mouseXIn; this.mouseY = mouseYIn; this.drawBackground(); this.bindAmountScrolled(); - Drawing.drawScaled(this.gm, Gui.BACKGROUND, 0, this.top, this.gm.fb_x, this.bottom - this.top, 0xff7f7f7f); + Drawing.drawScaled(this.gm, Gui.BACKGROUND, 0, this.top, this.gm.fbX, this.bottom - this.top, 0xff7f7f7f); int x = this.left + (this.isScrollbarRight() ? 0 : SCROLLBAR_WIDTH); int y = this.top + 4 - (int)this.amountScrolled; @@ -154,14 +154,14 @@ public abstract class GuiList extends Gui Drawing.drawRect(x, y1 - 2, this.width - SCROLLBAR_WIDTH, this.getSlotHeight(), Gui.HOVER_COLOR); } - Drawing.drawScaled(this.gm, Gui.BACKGROUND, 0, 0, this.gm.fb_x, this.top, 0xffffffff); - Drawing.drawScaled(this.gm, Gui.BACKGROUND, 0, this.bottom, this.gm.fb_x, this.height - this.bottom, 0xffffffff); - Drawing.drawRect(-1, -1, this.gm.fb_x + 2, this.top + 1, 0, this.gm.style.brdr_top, this.gm.style.brdr_btm); - Drawing.drawRect(-1, this.bottom, this.gm.fb_x + 2, this.height - this.bottom + 1, 0, this.gm.style.brdr_top, this.gm.style.brdr_btm); + Drawing.drawScaled(this.gm, Gui.BACKGROUND, 0, 0, this.gm.fbX, this.top, 0xffffffff); + Drawing.drawScaled(this.gm, Gui.BACKGROUND, 0, this.bottom, this.gm.fbX, this.height - this.bottom, 0xffffffff); + Drawing.drawRect(-1, -1, this.gm.fbX + 2, this.top + 1, 0, this.gm.style.brdr_top, this.gm.style.brdr_btm); + Drawing.drawRect(-1, this.bottom, this.gm.fbX + 2, this.height - this.bottom + 1, 0, this.gm.style.brdr_top, this.gm.style.brdr_btm); int edge = 2; - Drawing.drawGradient(0, this.top, this.gm.fb_x, edge, 0xff000000, 0x00000000); - Drawing.drawGradient(0, this.bottom - edge, this.gm.fb_x, edge, 0x00000000, 0xff000000); + Drawing.drawGradient(0, this.top, this.gm.fbX, edge, 0xff000000, 0x00000000); + Drawing.drawGradient(0, this.bottom - edge, this.gm.fbX, edge, 0x00000000, 0xff000000); int max = this.getMaxScroll(); diff --git a/client/src/main/java/client/gui/element/Textbox.java b/client/src/main/java/client/gui/element/Textbox.java index dd696745..efcfc1fd 100644 --- a/client/src/main/java/client/gui/element/Textbox.java +++ b/client/src/main/java/client/gui/element/Textbox.java @@ -242,7 +242,7 @@ abstract class Textbox extends Element { int y1 = this.pos_y + this.margin_y1; int x2 = this.size_x - (this.margin_x1 + this.margin_x2); int y2 = this.size_y - (this.margin_y1 + this.margin_y2); - this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2); + this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fbY - (y1 + y2)) < 0 ? 0 : (this.gm.fbY - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2); GL11.glEnable(GL11.GL_SCISSOR_TEST); Drawing.drawRect(this.getCursorX(x1, x2), this.getCursorY(y1, y2), 1, Font.YGLYPH, 0xff000000 | (~Util.mixColor(this.gm.style.field_top, this.gm.style.field_btm))); GL11.glDisable(GL11.GL_SCISSOR_TEST); diff --git a/client/src/main/java/client/renderer/Drawing.java b/client/src/main/java/client/renderer/Drawing.java index 16e055af..40128ca6 100644 --- a/client/src/main/java/client/renderer/Drawing.java +++ b/client/src/main/java/client/renderer/Drawing.java @@ -553,7 +553,7 @@ public abstract class Drawing { } public static void drawScaled(Client gm, String texture) { - drawScaled(gm, texture, 0, 0, gm.fb_x, gm.fb_y, 0xffffffff); + drawScaled(gm, texture, 0, 0, gm.fbX, gm.fbY, 0xffffffff); } public static void drawScaled(Client gm, String texture, int x, int y, int width, int height, int color) { diff --git a/client/src/main/java/client/renderer/EntityRenderer.java b/client/src/main/java/client/renderer/EntityRenderer.java index 5eb6e721..7ee8068d 100755 --- a/client/src/main/java/client/renderer/EntityRenderer.java +++ b/client/src/main/java/client/renderer/EntityRenderer.java @@ -589,7 +589,7 @@ public class EntityRenderer { // SKC.glScaled(this.cameraZoom, this.cameraZoom, 1.0D); // } - Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fb_raw_x / (float)this.gm.fb_raw_y, 0.05F, this.farPlaneDistance * SQRT_2); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * SQRT_2); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); @@ -664,7 +664,7 @@ public class EntityRenderer { // SKC.glTranslatef((float)(-(xOffset * 2 - 1)) * f, 0.0F, 0.0F); // } - Project.gluPerspective(this.getFOVModifier(partialTicks, false), (float)this.gm.fb_raw_x / (float)this.gm.fb_raw_y, 0.05F, this.farPlaneDistance * 2.0F); + Project.gluPerspective(this.getFOVModifier(partialTicks, false), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * 2.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); @@ -955,12 +955,12 @@ public class EntityRenderer { this.setupFog(-1, partialTicks); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); - Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fb_raw_x / (float)this.gm.fb_raw_y, 0.05F, this.farPlaneDistance * 2.0F); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * 2.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); renderglobal.renderSky(partialTicks); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); - Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fb_raw_x / (float)this.gm.fb_raw_y, 0.05F, this.farPlaneDistance * SQRT_2); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * SQRT_2); GL11.glMatrixMode(GL11.GL_MODELVIEW); } @@ -1077,7 +1077,7 @@ public class EntityRenderer { { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); - Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fb_raw_x / (float)this.gm.fb_raw_y, 0.05F, this.farPlaneDistance * 4.0F); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * 4.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); this.setupFog(0, partialTicks); @@ -1088,7 +1088,7 @@ public class EntityRenderer { GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); - Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fb_raw_x / (float)this.gm.fb_raw_y, 0.05F, this.farPlaneDistance * SQRT_2); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * SQRT_2); GL11.glMatrixMode(GL11.GL_MODELVIEW); } }