From 3f726497f9422f47320ce9f64551d73b6303432a Mon Sep 17 00:00:00 2001 From: Cubitect Date: Fri, 9 Sep 2016 11:21:05 +0200 Subject: [PATCH] updated to 1.10 (Cubitick only) --- README.md | 2 +- src/CommandRerender.java | 59 - src/CommandTickSync.java | 41 - src/CommandTickrate.java | 41 - src/GuiPacketOptionsList.java | 139 - src/GuiServerPackets.java | 105 - src/MinecraftServer.java | 1141 ----- src/Namepipe.java | 18 - src/ServerPacketData.java | 1218 ------ src/bc.java | 126 - src/bcc.java | 2760 ------------ src/bcz.java | 257 -- src/beb.java | 201 - src/bes.java | 155 - src/bkp.java | 1814 -------- src/bnd.java | 1629 ------- src/{ => minecraft/cubimod}/Cubitick.java | 39 +- .../cubimod/command/CommandRerender.java | 59 + .../cubimod/command/CommandTickSync.java | 57 + .../cubimod/command/CommandTickrate.java | 57 + .../net/minecraft/client/Minecraft.java | 3742 +++++++++++++++++ .../net/minecraft/client/gui/GuiChat.java | 320 ++ .../minecraft/client/gui/GuiOverlayDebug.java | 304 ++ .../client/renderer/EntityRenderer.java | 2293 ++++++++++ .../command/ServerCommandManager.java | 180 + .../net/minecraft/server/MinecraftServer.java | 1595 +++++++ 26 files changed, 8628 insertions(+), 9724 deletions(-) delete mode 100644 src/CommandRerender.java delete mode 100644 src/CommandTickSync.java delete mode 100644 src/CommandTickrate.java delete mode 100644 src/GuiPacketOptionsList.java delete mode 100644 src/GuiServerPackets.java delete mode 100644 src/MinecraftServer.java delete mode 100644 src/Namepipe.java delete mode 100644 src/ServerPacketData.java delete mode 100644 src/bc.java delete mode 100644 src/bcc.java delete mode 100644 src/bcz.java delete mode 100644 src/beb.java delete mode 100644 src/bes.java delete mode 100644 src/bkp.java delete mode 100644 src/bnd.java rename src/{ => minecraft/cubimod}/Cubitick.java (73%) create mode 100644 src/minecraft/cubimod/command/CommandRerender.java create mode 100644 src/minecraft/cubimod/command/CommandTickSync.java create mode 100644 src/minecraft/cubimod/command/CommandTickrate.java create mode 100644 src/minecraft/net/minecraft/client/Minecraft.java create mode 100644 src/minecraft/net/minecraft/client/gui/GuiChat.java create mode 100644 src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java create mode 100644 src/minecraft/net/minecraft/client/renderer/EntityRenderer.java create mode 100644 src/minecraft/net/minecraft/command/ServerCommandManager.java create mode 100644 src/minecraft/net/minecraft/server/MinecraftServer.java diff --git a/README.md b/README.md index ac5a8fb..1c9bca0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Don't enable this at a world-tickrate of zero, or your game will freeze! When no arguments are specified, `/rerender` will do the same as pressing F3+A. However, if a region of blocks is specified, then that region is marked in the code to be rendered again (without reloading). This command is still experimental and might change syntax in the future. ### Packet Analysis -Cubitick 1.4.X+ comes bundled with a packet analysis tool which lets you view the content of some packets that are sent between the minecraft client and server. +Cubitick 1.4 to 1.5.1 comes bundled with a packet analysis tool which lets you view the content of some packets that are sent between the minecraft client and server. ## Source The source code [here](https://github.com/Cubitect/Cubitick/tree/master) contains the modified classes in the decompiled minecraft code from [Mod Coder Pack](http://www.modcoderpack.com). The unmodified classes are not included. diff --git a/src/CommandRerender.java b/src/CommandRerender.java deleted file mode 100644 index 2cd0110..0000000 --- a/src/CommandRerender.java +++ /dev/null @@ -1,59 +0,0 @@ -import java.util.List; - -public class CommandRerender extends i -{ - @Override - public String c() - { - return "rerender"; - } - - @Override - public int a() - { - return 0; - } - - @Override - public String b(m sender) - { - return "/rerender [fromX fromY fromZ toX toY toZ]\n§7Marks a region to be rendered again (without reloading)\n§7Specifying no arguments will also reload and do the same as F3+A"; - } - - @Override - public void a(MinecraftServer server, m sender, String[] args) throws bz - { - if(args.length == 0) { - bcc.z().scheduledReload = true; - } - else if(args.length <= 5) { - a(sender, this, "§cUsage:\n§c"+b(sender)); - return; - } else { - cj pos1 = a(sender, args, 0, false); - cj pos2 = a(sender, args, 3, false); - - cj from = new cj(Math.min(pos1.p(), pos2.p()), Math.min(pos1.q(), pos2.q()), Math.min(pos1.r(), pos2.r())); - cj to = new cj(Math.max(pos1.p(), pos2.p()), Math.max(pos1.q(), pos2.q()), Math.max(pos1.r(), pos2.r())); - sender.e().b(from, to); - } - } - - @Override - public List a(MinecraftServer server, m sender, String[] args, cj pos) - { - return null; - } - - @Override - public boolean b(String[] args, int index) - { - return index == 0; - } - - @Override - public int compareTo(k o) { - // TODO Auto-generated method stub - return 0; - } -} \ No newline at end of file diff --git a/src/CommandTickSync.java b/src/CommandTickSync.java deleted file mode 100644 index 2abd079..0000000 --- a/src/CommandTickSync.java +++ /dev/null @@ -1,41 +0,0 @@ -public class CommandTickSync extends i -{ - public String c() - { - return "ticksync"; - } - - public int a() - { - return 2; - } - - public String b(m sender) - { - return "/ticksync [true/false]"; - } - - public void a(MinecraftServer server, m sender, String[] args) throws bz - { - if(args.length < 1) { - a(sender, this, (Cubitick.synctick) ? "Tickrate is currently synchronised" : "Tickrate is currently desynchronised"); - return; - } else { - if(args[0].equals("true") || args[0].equals("on")) { - Cubitick.synctick = true; - a(sender, this, "Tickrate is now synchronised"); - } else if(args[0].equals("false") || args[0].equals("off")) { - Cubitick.synctick = false; - a(sender, this, "Tickrate is now desynchronised"); - } else { - a(sender, this, "Tickrate synchronisation can only be true/on or false/off"); - } - } - } - - @Override - public int compareTo(k o) { - // TODO Auto-generated method stub - return 0; - } -} diff --git a/src/CommandTickrate.java b/src/CommandTickrate.java deleted file mode 100644 index 1dda9d1..0000000 --- a/src/CommandTickrate.java +++ /dev/null @@ -1,41 +0,0 @@ -public class CommandTickrate extends i -{ - public String c() - { - return "tickrate"; - } - - public int a() - { - return 2; - } - - public String b(m sender) - { - return "/tickrate [rate]"; - } - - public void a(MinecraftServer server, m sender, String[] args) throws bz - { - if(args.length < 1) { - a(sender, this, "Tickrate is " + Cubitick.tickrateWorld + " ticks per second"); - return; - } else { - float tickspeed = (float)a(args[0], 0F); - if(tickspeed >= 0) { - Cubitick.setTickWorld(tickspeed); - a(sender, this, "Tickrate set to " + tickspeed); - } else { - a(sender, this, "Tickrate should be a non-negative floating point number"); - return; - } - } - } - - @Override - public int compareTo(k o) { - // TODO Auto-generated method stub - return 0; - } -} - diff --git a/src/GuiPacketOptionsList.java b/src/GuiPacketOptionsList.java deleted file mode 100644 index 8ed53be..0000000 --- a/src/GuiPacketOptionsList.java +++ /dev/null @@ -1,139 +0,0 @@ -public class GuiPacketOptionsList extends bdi -{ - private final GuiServerPackets guiServerPackets; - private final bcc mc; - private final bdi.a listEntries[]; - private int maxListLabelWidth = 0; - public static int lastBtnIndex; - - public boolean isActive[]; - - public GuiPacketOptionsList(GuiServerPackets guiServerPackets, bcc mcIn) - { - super(mcIn, guiServerPackets.l, guiServerPackets.m, 63, guiServerPackets.m - 32, 20); - this.guiServerPackets = guiServerPackets; - this.mc = mcIn; - this.listEntries = new bdi.a[ServerPacketData.isActive.length]; - - isActive = new boolean[this.listEntries.length]; - isActive = ServerPacketData.isActive.clone(); - - for(int packetID = 0; packetID < this.listEntries.length; packetID++) - { - this.listEntries[packetID] = new PacketOptionEntry(packetID); - } - } - - // getSize() - @Override - protected int b() - { - return this.listEntries.length; - } - - // getListEntry() - @Override - public bdi.a b(int idx) - { - if(idx < 0 || idx >= this.b()) { - System.err.println("[Cubitick]: index out of bounds in GuiPacketOptionsList.getListEntry()"); - return null; - } - return this.listEntries[idx]; - } - - // getScrollBarX() - @Override - protected int d() - { - return super.d() + 15; - } - - // getListWidth() - @Override - public int c() - { - return super.c() + 32; - } - - public void setAll(boolean state) - { - for(int i = 0; i < listEntries.length; i++) - { - isActive[i] = state; - } - } - - - - public class PacketOptionEntry implements bdi.a - { - public final String baseLabel; - public final bcw btn; - public final int packetID; - - private PacketOptionEntry(int packetID) - { - this.packetID = packetID; - this.baseLabel = ServerPacketData.packetName[packetID]; - this.btn = new bcw(0, 0, 0, 250, 18, this.baseLabel); - } - - // drawEntry(..) - public void a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) - { - if(this.baseLabel == null) - { - this.btn.j = ""; - this.btn.l = false; - } - else - { - this.btn.j = this.baseLabel + ": " + (isActive[this.packetID] ? "§aactive":"§cinactive"); - this.btn.l = guiServerPackets.enabled; - } - - this.btn.h = x; - this.btn.i = y; - - this.btn.a(GuiPacketOptionsList.this.mc, mouseX, mouseY); - } - - // mousePressed(..) - public boolean a(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) - { - if(this.btn.l && this.btn.c(GuiPacketOptionsList.this.mc, x, y)) - { - if(GuiPacketOptionsList.lastBtnIndex != slotIndex) - { - GuiPacketOptionsList.lastBtnIndex = slotIndex; - isActive[slotIndex] = !isActive[slotIndex]; - } - else { - GuiPacketOptionsList.lastBtnIndex = -1; - return false; - } - //GuiPacketOptionsList.this.guiServerPackets.buttonId = this.packetID; - - return true; - } - else - { - return false; - } - } - - // mouseReleased(..) - public void b(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) - { - this.btn.a(x, y); - System.out.println("Release- Slot: " + slotIndex + ", Event: " + mouseEvent); - } - - // setSelected - @Override - public void a(int arg0, int arg1, int arg2) { - // TODO Auto-generated method stub - } - } -} \ No newline at end of file diff --git a/src/GuiServerPackets.java b/src/GuiServerPackets.java deleted file mode 100644 index 5905ade..0000000 --- a/src/GuiServerPackets.java +++ /dev/null @@ -1,105 +0,0 @@ -public class GuiServerPackets extends bey -{ - private bey parentScreen; - private bce options; - protected String screenTitle = "Server Packet Analysis..."; - - private GuiPacketOptionsList optionsList; - private bcw buttonDone, bEnable, bActivateAll, bDeactivateAll; - public boolean enabled; - - - public GuiServerPackets(bey screen, bce settings) - { - this.parentScreen = screen; - this.options = settings; - } - - // initGui() - @Override - public void b() - { - this.enabled = ServerPacketData.enabled; - - optionsList = new GuiPacketOptionsList(this, this.j); - - // l = width, m = height, bwl.a() = I18n.format() - n.add(new bcw(200, l / 2 - 155 + 160, m - 29, 150, 20, bwl.a("gui.done", new Object[0]))); - n.add(bEnable = new bcw(201, l / 2 - 155, m - 29, 150, 20, this.enabled ? "Packet Analysis: Enabled" : "Packet Analysis: Disabled")); - n.add(bActivateAll = new bcw(202, l / 2 - 155, 20, 150, 20, "Activate All")); - n.add(bDeactivateAll = new bcw(203, l / 2 - 155 + 160, 20, 150, 20, "Deactivate All")); - - bActivateAll.l = this.enabled; - bDeactivateAll.l = this.enabled; - } - - // handleMouseInput - @Override - public void k() - { - super.k(); - this.optionsList.p(); - } - - // mouseClicked - @Override - protected void a(int mouseX, int mouseY, int mouseButton) - { - super.a(mouseX, mouseY, mouseButton); // checks menu action buttons - this.optionsList.b(mouseX, mouseY, mouseButton); - } - - // mouseReleased - @Override - protected void b(int mouseX, int mouseY, int state) - { - if(state != 0 || !this.optionsList.b(mouseX, mouseY, state)) - { - super.b(mouseX, mouseY, state); - } - } - - // actionPerformed - @Override - protected void a(bcw button) - { - if(button.k == 200) // Done - { - ServerPacketData.enabled = this.enabled; - ServerPacketData.isActive = this.optionsList.isActive; - ServerPacketData.saveSettings(); - this.j.a(this.parentScreen); - } - else if(button.k == 201) // Enable - { - this.enabled = !this.enabled; - bActivateAll.l = this.enabled; - bDeactivateAll.l = this.enabled; - this.bEnable.j = this.enabled ? "Packet Analysis: Enabled" : "Packet Analysis: Disabled"; - } - else if(button.k == 202) // Activate All - { - optionsList.setAll(true); - } - else if(button.k == 203) // Deactivate All - { - optionsList.setAll(false); - } - else - { - } - - GuiPacketOptionsList.lastBtnIndex = -1; - } - - // drawScreen - @Override - public void a(int mouseX, int mouseY, float partialTicks) - { - this.c(); // drawDefaultBackground - this.optionsList.a(mouseX, mouseY, partialTicks); - // drawString(fontRendererObj .. ) - this.a(this.q, this.screenTitle, this.l / 2, 8, 16777215); - super.a(mouseX, mouseY, partialTicks); - } -} \ No newline at end of file diff --git a/src/MinecraftServer.java b/src/MinecraftServer.java deleted file mode 100644 index 2128ccb..0000000 --- a/src/MinecraftServer.java +++ /dev/null @@ -1,1141 +0,0 @@ -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * com.google.common.base.Charsets - * com.google.common.collect.Lists - * com.google.common.collect.Queues - * com.google.common.util.concurrent.Futures - * com.google.common.util.concurrent.ListenableFuture - * com.google.common.util.concurrent.ListenableFutureTask - * com.mojang.authlib.GameProfile - * com.mojang.authlib.GameProfileRepository - * com.mojang.authlib.minecraft.MinecraftSessionService - * com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService - * io.netty.buffer.ByteBuf - * io.netty.buffer.ByteBufOutputStream - * io.netty.buffer.Unpooled - * io.netty.handler.codec.base64.Base64 - * org.apache.commons.lang3.Validate - * org.apache.logging.log4j.LogManager - * org.apache.logging.log4j.Logger - */ -import com.google.common.base.Charsets; -import com.google.common.collect.Lists; -import com.google.common.collect.Queues; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListenableFutureTask; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.GameProfileRepository; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufOutputStream; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.base64.Base64; -import java.awt.GraphicsEnvironment; -import java.awt.image.BufferedImage; -import java.awt.image.RenderedImage; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.net.Proxy; -import java.nio.charset.Charset; -import java.security.KeyPair; -import java.text.SimpleDateFormat; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Queue; -import java.util.Random; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.Executors; -import java.util.concurrent.FutureTask; -import javax.imageio.ImageIO; -import org.apache.commons.lang3.Validate; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public abstract class MinecraftServer -implements Runnable, -m, -qc, -qx { - // Cubitick: msToTick = milliseconds until server ticks - public static long msToTick; - - private static final Logger logger = LogManager.getLogger(); - public static final File a = new File("usercache.json"); - private final azj l; - private final qw m; - private final File n; - private final List o; - protected final l b; - public final oo c; - private final ma p; - private final jz q; - private final Random r; - private final pb s; - private int u; - public lp[] d; - private mm v; - private boolean w; - private boolean x; - private int y; - protected final Proxy e; - public String f; - public int g; - private boolean z; - private boolean A; - private boolean B; - private boolean C; - private boolean D; - private String E; - private int F; - private int G; - public final long[] h; - public long[][] i; - private KeyPair H; - private String I; - private String J; - private String K; - private boolean L; - private boolean M; - private String N; - private String O; - private boolean P; - private long Q; - private String R; - private boolean S; - private boolean T; - private final YggdrasilAuthenticationService U; - private final MinecraftSessionService V; - private final GameProfileRepository W; - private final mi X; - private long Y; - protected final Queue> j; - private Thread Z; - - // Cubitick : made static - private static long aa; - - private boolean ab; - - public MinecraftServer(File file, Proxy proxy, pb pb2, YggdrasilAuthenticationService yggdrasilAuthenticationService, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, mi mi2) { - this.m = new qw("server", this, MinecraftServer.av()); - this.o = Lists.newArrayList(); - this.c = new oo(); - this.q = new jz(); - this.r = new Random(); - this.u = -1; - this.w = true; - this.G = 0; - this.h = new long[100]; - this.N = ""; - this.O = ""; - this.Y = 0; - this.j = Queues.newArrayDeque(); - this.aa = MinecraftServer.av(); - this.e = proxy; - this.U = yggdrasilAuthenticationService; - this.V = minecraftSessionService; - this.W = gameProfileRepository; - this.X = mi2; - this.n = file; - this.p = new ma(this); - this.b = this.i(); - this.l = new azc(file, pb2); - this.s = pb2; - } - - // Cubitick: used in the GuiChat class to interrupt the server's sleep - public static void interruptTickSleep() - { - /*MinecraftServer mcs = this; - if(mcs == null) { - logger.warn("[Cubitick] Warning: Tried to interrupt server tick sleep, but server is null."); - return; - }*/ - MinecraftServer.aa = MinecraftServer.av(); - MinecraftServer.msToTick = -1; - } - - protected bc i() { - return new bc(this); - } - - protected abstract boolean j() throws IOException; - - protected void a(String string) { - if (this.W().b(string)) { - logger.info("Converting map!"); - this.b("menu.convertingLevel"); - this.W().a(string, new op(){ - private long b; - - @Override - public void a(String string) { - } - - @Override - public void b(String string) { - } - - @Override - public void a(int n2) { - if (MinecraftServer.av() - this.b >= 1000) { - this.b = MinecraftServer.av(); - logger.info("Converting... " + n2 + "%"); - } - } - - @Override - public void a() { - } - - @Override - public void c(String string) { - } - }); - } - } - - protected synchronized void b(String string) { - this.R = string; - } - - public synchronized String k() { - return this.R; - } - - protected void a(String string, String string2, long l2, ahy ahy2, String string3) { - ahw ahw2; - this.a(string); - this.b("menu.loadingLevel"); - this.d = new lp[3]; - this.i = new long[this.d.length][100]; - azh azh2 = this.l.a(string, true); - this.a(this.S(), azh2); - azg azg2 = azh2.d(); - if (azg2 == null) { - if (this.V()) { - ahw2 = lj.a; - } else { - ahw2 = new ahw(l2, this.n(), this.m(), this.p(), ahy2); - ahw2.a(string3); - if (this.M) { - ahw2.a(); - } - } - azg2 = new azg(ahw2, string2); - } else { - azg2.a(string2); - ahw2 = new ahw(azg2); - } - for (int i2 = 0; i2 < this.d.length; ++i2) { - int n2 = 0; - if (i2 == 1) { - n2 = -1; - } - if (i2 == 2) { - n2 = 1; - } - if (i2 == 0) { - this.d[i2] = this.V() ? (lp)new lj(this, azh2, azg2, n2, this.c).b() : (lp)new lp(this, azh2, azg2, n2, this.c).b(); - this.d[i2].a(ahw2); - } else { - this.d[i2] = (lp)new ll(this, azh2, n2, this.d[0], this.c).b(); - } - this.d[i2].a(new lq(this, this.d[i2])); - if (this.R()) continue; - this.d[i2].T().a(this.n()); - } - this.v.a(this.d); - this.a(this.o()); - this.l(); - } - - protected void l() { - int n2 = 16; - int n3 = 4; - int n4 = 192; - int n5 = 625; - int n6 = 0; - this.b("menu.generatingTerrain"); - int n7 = 0; - logger.info("Preparing start region for level " + n7); - lp lp2 = this.d[n7]; - cj cj2 = lp2.R(); - long l2 = MinecraftServer.av(); - for (int i2 = -192; i2 <= 192 && this.w(); i2 += 16) { - for (int i3 = -192; i3 <= 192 && this.w(); i3 += 16) { - long l3 = MinecraftServer.av(); - if (l3 - l2 > 1000) { - this.a_("Preparing spawn area", n6 * 100 / 625); - l2 = l3; - } - ++n6; - lp2.r().d(cj2.p() + i2 >> 4, cj2.r() + i3 >> 4); - } - } - this.t(); - } - - protected void a(String string, azh azh2) { - File file = new File(azh2.b(), "resources.zip"); - if (file.isFile()) { - this.a_("level://" + string + "/" + "resources.zip", ""); - } - } - - public abstract boolean m(); - - public abstract ahw.a n(); - - public abstract qk o(); - - public abstract boolean p(); - - public abstract int q(); - - public abstract boolean r(); - - public abstract boolean s(); - - protected void a_(String string, int n2) { - this.f = string; - this.g = n2; - logger.info(string + ": " + n2 + "%"); - } - - protected void t() { - this.f = null; - this.g = 0; - } - - public void a(boolean bl2) { - for (lp lp2 : this.d) { - if (lp2 == null) continue; - if (!bl2) { - logger.info("Saving chunks for level '" + lp2.T().j() + "'/" + lp2.s.p().b()); - } - try { - lp2.a(true, null); - continue; - } - catch (ahu err) { - logger.warn(err.getMessage()); - } - } - } - - public void u() { - logger.info("Stopping server"); - if (this.am() != null) { - this.am().b(); - } - if (this.v != null) { - logger.info("Saving players"); - this.v.j(); - this.v.u(); - } - if (this.d != null) { - int n2; - logger.info("Saving worlds"); - for (n2 = 0; n2 < this.d.length; ++n2) { - if (this.d[n2] == null) continue; - this.d[n2].b = false; - } - this.a(false); - for (n2 = 0; n2 < this.d.length; ++n2) { - if (this.d[n2] == null) continue; - this.d[n2].s(); - } - } - if (this.m.d()) { - this.m.e(); - } - } - - public boolean w() { - return this.w; - } - - public void x() { - this.w = false; - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - @Override - public void run() { - block27 : { - try { - if (this.j()) { - this.aa = MinecraftServer.av(); - long l2 = 0; - this.q.a(new fa(this.E)); - this.q.a(new jz.c("1.9.2", 109)); - this.a(this.q); - while (this.w) { - long l3 = MinecraftServer.av(); - long l4 = l3 - this.aa; - - // Cubitick - if (l4 > 100*Cubitick.getTickms() && this.aa - this.Q >= 15000) { - logger.warn("Can't keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[]{l4, l4 / 50}); - l4 = (long)(100*Cubitick.getTickms()); - this.Q = this.aa; - } - if (l4 < 0) { - logger.warn("Time ran backwards! Did the system time change?"); - l4 = 0; - } - l2 += l4; - this.aa = l3; - if (this.d[0].g()) { // if(this.worldServers[0].areAllPlayersAsleep()) - this.C(); - l2 = 0; - } else { - while (l2 >= Cubitick.getTickms()) { - l2 -= Cubitick.getTickms(); - this.C(); - } - } - // Thread.sleep(Math.max(1, 50 - l2)); - - msToTick = (long)(Cubitick.getTickms() - l2); - if(msToTick <= 0L) { - if(Cubitick.tickrateWorld > 20.0 && !Cubitick.synctick) msToTick = 0L; - else msToTick = 1L; - } - for(long i = 0; i < msToTick; i++) { - Thread.sleep(1L); - if(!Cubitick.synctick) { - } - } - - - // Cubitick: process the chat (for low tickrates where we can't wait for the tick to finish) - if(!Cubitick.synctick && msToTick < 0) - { - synchronized (this.j) - { - while (!this.j.isEmpty()) - { - try - { - ((FutureTask)this.j.poll()).run(); - } - catch (Throwable var9) - { - logger.fatal(var9); - } - } - } - } - - this.P = true; - } - break block27; - } - this.a((b)null); - } - catch (Throwable err) { - logger.error("Encountered an unexpected exception", err); - b b2 = null; - b2 = err instanceof e ? this.b(((e)err).a()) : this.b(new b("Exception in server tick loop", err)); - File file = new File(new File(this.A(), "crash-reports"), "crash-" + new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(new Date()) + "-server.txt"); - if (b2.a(file)) { - logger.error("This crash report has been saved to: " + file.getAbsolutePath()); - } else { - logger.error("We were unable to save this crash report to disk."); - } - this.a(b2); - } - finally { - try { - this.x = true; - this.u(); - } - catch (Throwable err) { - logger.error("Exception stopping the server", err); - } - finally { - this.B(); - } - } - } - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - public void a(jz jz2) { - File file = this.d("server-icon.png"); - if (!file.exists()) { - file = this.W().b(this.S(), "icon.png"); - } - if (file.isFile()) { - ByteBuf byteBuf = Unpooled.buffer(); - try { - BufferedImage bufferedImage = ImageIO.read(file); - Validate.validState((boolean)(bufferedImage.getWidth() == 64), (String)"Must be 64 pixels wide", (Object[])new Object[0]); - Validate.validState((boolean)(bufferedImage.getHeight() == 64), (String)"Must be 64 pixels high", (Object[])new Object[0]); - ImageIO.write((RenderedImage)bufferedImage, "PNG", (OutputStream)new ByteBufOutputStream(byteBuf)); - ByteBuf byteBuf2 = Base64.encode((ByteBuf)byteBuf); - jz2.a("data:image/png;base64," + byteBuf2.toString(Charsets.UTF_8)); - } - catch (Exception err) { - logger.error("Couldn't load server icon", (Throwable)err); - } - finally { - byteBuf.release(); - } - } - } - - public boolean y() { - this.ab = this.ab || this.z().isFile(); - return this.ab; - } - - public File z() { - return this.W().b(this.S(), "icon.png"); - } - - public File A() { - return new File("."); - } - - protected void a(b b2) { - } - - protected void B() { - } - - public void C() { - long l2 = System.nanoTime(); - ++this.y; - if (this.S) { - this.S = false; - this.c.a = true; - this.c.a(); - } - this.c.a("root"); - this.D(); - if (l2 - this.Y >= 5000000000L) { - this.Y = l2; - this.q.a(new jz.a(this.I(), this.H())); - GameProfile[] arrgameProfile = new GameProfile[Math.min(this.H(), 12)]; - int n2 = on.a(this.r, 0, this.H() - arrgameProfile.length); - for (int i2 = 0; i2 < arrgameProfile.length; ++i2) { - arrgameProfile[i2] = this.v.v().get(n2 + i2).cK(); - } - Collections.shuffle(Arrays.asList(arrgameProfile)); - this.q.b().a(arrgameProfile); - } - if (this.y % 900 == 0) { - this.c.a("save"); - this.v.j(); - this.a(true); - this.c.b(); - } - this.c.a("tallying"); - this.h[this.y % 100] = System.nanoTime() - l2; - this.c.b(); - this.c.a("snooper"); - if (!this.m.d() && this.y > 100) { - this.m.a(); - } - if (this.y % 6000 == 0) { - this.m.b(); - } - this.c.b(); - this.c.b(); - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - public void D() { - int n2; - this.c.a("jobs"); - Queue> queue = this.j; - synchronized (queue) { - while (!this.j.isEmpty()) { - Namepipe.g.a(this.j.poll(), logger); - } - } - this.c.c("levels"); - for (n2 = 0; n2 < this.d.length; ++n2) { - long l2 = System.nanoTime(); - if (n2 == 0 || this.E()) { - lp lp2 = this.d[n2]; - this.c.a(lp2.T().j()); - if (this.y % 20 == 0) { - this.c.a("timeSync"); - this.v.a(new hw(lp2.P(), lp2.Q(), lp2.U().b("doDaylightCycle")), lp2.s.p().a()); - this.c.b(); - } - this.c.a("tick"); - try { - lp2.d(); - } - catch (Throwable err) { - b b2 = Namepipe.b.a(err, "Exception ticking world"); - lp2.a(b2); - throw new e(b2); - } - try { - lp2.k(); - } - catch (Throwable err) { - b b3 = Namepipe.b.a(err, "Exception ticking world entities"); - lp2.a(b3); - throw new e(b3); - } - this.c.b(); - this.c.a("tracker"); - lp2.v().a(); - this.c.b(); - this.c.b(); - } - this.i[n2][this.y % 100] = System.nanoTime() - l2; - } - this.c.c("connection"); - this.am().c(); - this.c.c("players"); - this.v.e(); - this.c.c("tickables"); - for (n2 = 0; n2 < this.o.size(); ++n2) { - this.o.get(n2).c(); - } - this.c.b(); - } - - public boolean E() { - return true; - } - - public void F() { - this.Z = new Thread((Runnable)this, "Server thread"); - this.Z.start(); - } - - public File d(String string) { - return new File(this.A(), string); - } - - public void f(String string) { - logger.warn(string); - } - - public lp a(int n2) { - if (n2 == -1) { - return this.d[1]; - } - if (n2 == 1) { - return this.d[2]; - } - return this.d[0]; - } - - public String G() { - return "1.9.2"; - } - - public int H() { - return this.v.o(); - } - - public int I() { - return this.v.p(); - } - - public String[] J() { - return this.v.f(); - } - - public GameProfile[] K() { - return this.v.g(); - } - - public String getServerModName() { - return "vanilla"; - } - - public b b(b b2) { - b2.g().a("Profiler Position", new Callable(){ - - public String a() throws Exception { - return MinecraftServer.this.c.a ? MinecraftServer.this.c.c() : "N/A (disabled)"; - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - if (this.v != null) { - b2.g().a("Player Count", new Callable(){ - - public String a() { - return "" + MinecraftServer.this.v.o() + " / " + MinecraftServer.this.v.p() + "; " + MinecraftServer.this.v.v(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - } - return b2; - } - - public List a(m m2, String string, cj cj2, boolean bl2) { - ArrayList arrayList = Lists.newArrayList(); - boolean bl3 = string.startsWith("/"); - if (bl3) { - string = string.substring(1); - } - if (bl3 || bl2) { - boolean bl4 = !string.contains(" "); - List list = this.b.a(m2, string, cj2); - if (!list.isEmpty()) { - for (String string2 : list) { - if (bl4) { - arrayList.add("/" + string2); - continue; - } - arrayList.add(string2); - } - } - return arrayList; - } - String[] arrstring = string.split(" ", -1); - String string3 = arrstring[arrstring.length - 1]; - for (String string4 : this.v.f()) { - if (!Namepipe.i.a(string3, string4)) continue; - arrayList.add(string4); - } - return arrayList; - } - - public boolean M() { - return this.n != null; - } - - @Override - public String h_() { - return "Server"; - } - - @Override - public void a(eu eu2) { - logger.info(eu2.c()); - } - - @Override - public boolean a(int n2, String string) { - return true; - } - - public l N() { - return this.b; - } - - public KeyPair O() { - return this.H; - } - - public String Q() { - return this.I; - } - - public void i(String string) { - this.I = string; - } - - public boolean R() { - return this.I != null; - } - - public String S() { - return this.J; - } - - public void j(String string) { - this.J = string; - } - - public void k(String string) { - this.K = string; - } - - public String T() { - return this.K; - } - - public void a(KeyPair keyPair) { - this.H = keyPair; - } - - public void a(qk qk2) { - for (int i2 = 0; i2 < this.d.length; ++i2) { - lp lp2 = this.d[i2]; - if (lp2 == null) continue; - if (lp2.T().s()) { - lp2.T().a(qk.d); - lp2.a(true, true); - continue; - } - if (this.R()) { - lp2.T().a(qk2); - lp2.a(lp2.ae() != qk.a, true); - continue; - } - lp2.T().a(qk2); - lp2.a(this.U(), this.A); - } - } - - protected boolean U() { - return true; - } - - public boolean V() { - return this.L; - } - - public void b(boolean bl2) { - this.L = bl2; - } - - public void c(boolean bl2) { - this.M = bl2; - } - - public azj W() { - return this.l; - } - - public String X() { - return this.N; - } - - public String Y() { - return this.O; - } - - public void a_(String string, String string2) { - this.N = string; - this.O = string2; - } - - @Override - public void a(qw qw2) { - qw2.a("whitelist_enabled", false); - qw2.a("whitelist_count", 0); - if (this.v != null) { - qw2.a("players_current", this.H()); - qw2.a("players_max", this.I()); - qw2.a("players_seen", this.v.q().length); - } - qw2.a("uses_auth", this.z); - qw2.a("gui_state", this.ao() ? "enabled" : "disabled"); - qw2.a("run_time", (MinecraftServer.av() - qw2.g()) / 60 * 1000); - qw2.a("avg_tick_ms", (int)(on.a(this.h) * 1.0E-6)); - int n2 = 0; - if (this.d != null) { - for (int i2 = 0; i2 < this.d.length; ++i2) { - if (this.d[i2] == null) continue; - lp lp2 = this.d[i2]; - azg azg2 = lp2.T(); - qw2.a("world[" + n2 + "][dimension]", lp2.s.p().a()); - qw2.a("world[" + n2 + "][mode]", (Object)((Object)azg2.q())); - qw2.a("world[" + n2 + "][difficulty]", (Object)((Object)lp2.ae())); - qw2.a("world[" + n2 + "][hardcore]", azg2.s()); - qw2.a("world[" + n2 + "][generator_name]", azg2.t().a()); - qw2.a("world[" + n2 + "][generator_version]", azg2.t().d()); - qw2.a("world[" + n2 + "][height]", this.F); - qw2.a("world[" + n2 + "][chunks_loaded]", lp2.r().g()); - ++n2; - } - } - qw2.a("worlds", n2); - } - - @Override - public void b(qw qw2) { - qw2.b("singleplayer", this.R()); - qw2.b("server_brand", this.getServerModName()); - qw2.b("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported"); - qw2.b("dedicated", this.aa()); - } - - @Override - public boolean Z() { - return true; - } - - public abstract boolean aa(); - - public boolean ab() { - return this.z; - } - - public void d(boolean bl2) { - this.z = bl2; - } - - public boolean ac() { - return this.A; - } - - public void e(boolean bl2) { - this.A = bl2; - } - - public boolean ad() { - return this.B; - } - - public abstract boolean ae(); - - public void f(boolean bl2) { - this.B = bl2; - } - - public boolean af() { - return this.C; - } - - public void g(boolean bl2) { - this.C = bl2; - } - - public boolean ag() { - return this.D; - } - - public void h(boolean bl2) { - this.D = bl2; - } - - public abstract boolean ah(); - - public String ai() { - return this.E; - } - - public void l(String string) { - this.E = string; - } - - public int aj() { - return this.F; - } - - public void c(int n2) { - this.F = n2; - } - - public boolean ak() { - return this.x; - } - - public mm al() { - return this.v; - } - - public void a(mm mm2) { - this.v = mm2; - } - - public void a(ahw.a a2) { - for (int i2 = 0; i2 < this.d.length; ++i2) { - this.d[i2].T().a(a2); - } - } - - public ma am() { - return this.p; - } - - public boolean an() { - return this.P; - } - - public boolean ao() { - return false; - } - - public abstract String a(ahw.a var1, boolean var2); - - public int ap() { - return this.y; - } - - public void aq() { - this.S = true; - } - - public qw ar() { - return this.m; - } - - @Override - public cj c() { - return cj.a; - } - - @Override - public bbg d() { - return bbg.a; - } - - @Override - public aht e() { - return this.d[0]; - } - - @Override - public rr f() { - return null; - } - - public boolean a(aht aht2, cj cj2, zj zj2) { - return false; - } - - public boolean at() { - return this.T; - } - - public Proxy au() { - return this.e; - } - - public static long av() { - return System.currentTimeMillis(); - } - - public int aw() { - return this.G; - } - - public void d(int n2) { - this.G = n2; - } - - @Override - public eu i_() { - return new fa(this.h_()); - } - - public boolean ax() { - return true; - } - - public MinecraftSessionService ay() { - return this.V; - } - - public GameProfileRepository az() { - return this.W; - } - - public mi aA() { - return this.X; - } - - public jz aB() { - return this.q; - } - - public void aC() { - this.Y = 0; - } - - public rr a(UUID uUID) { - for (lp lp2 : this.d) { - rr rr2; - if (lp2 == null || (rr2 = lp2.a(uUID)) == null) continue; - return rr2; - } - return null; - } - - @Override - public boolean z_() { - return this.d[0].U().b("sendCommandFeedback"); - } - - @Override - public void a(n.a a2, int n2) { - } - - @Override - public MinecraftServer h() { - return this; - } - - public int aD() { - return 29999984; - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - public ListenableFuture a(Callable callable) { - Validate.notNull(callable); - if (!this.aE() && !this.ak()) { - ListenableFutureTask listenableFutureTask = ListenableFutureTask.create(callable); - Queue> queue = this.j; - synchronized (queue) { - this.j.add((ListenableFutureTask)listenableFutureTask); - } - return listenableFutureTask; - } - try { - return Futures.immediateFuture(callable.call()); - } - catch (Exception err) { - return Futures.immediateFailedCheckedFuture((Exception)err); - } - } - - @Override - public ListenableFuture a(Runnable runnable) { - Validate.notNull((Object)runnable); - return this.a(Executors.callable(runnable)); - } - - @Override - public boolean aE() { - return Thread.currentThread() == this.Z; - } - - public int aF() { - return 256; - } - - public pb aI() { - return this.s; - } - - public int a(lp lp2) { - if (lp2 != null) { - return lp2.U().c("spawnRadius"); - } - return 10; - } - -} diff --git a/src/Namepipe.java b/src/Namepipe.java deleted file mode 100644 index d7e2977..0000000 --- a/src/Namepipe.java +++ /dev/null @@ -1,18 +0,0 @@ -// pipe for enums, classes and static fields that are unaccessible due to name conflicts - -public class Namepipe -{ - public static a a = null; - public static b b = null; - public static c c = null; - public static g g = null; - public static g.a g_a = null; - public static i i = null; - public static bce.a bce_a = null; - public static bbf.a bbf_a = null; - public static gy.a gy_a = null; - public static bku.a bku_a = null; - public static cj.b cj_b = null; - public static ase.a ase_a = null; - public static cq.c cq_c = null; -} diff --git a/src/ServerPacketData.java b/src/ServerPacketData.java deleted file mode 100644 index ff38f03..0000000 --- a/src/ServerPacketData.java +++ /dev/null @@ -1,1218 +0,0 @@ -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.UUID; - -public class ServerPacketData -{ - public static final String configFileName = "packet_analysis.cfg"; - - public static final String[] packetName = - { - "S00 Spawn Object", - "S01 Spawn Experience Orb", - "S02 Spawn Global Entity", - "S03 Spawn Mob", - "S04 Spawn Painting", - "S05 Spawn Player", - "S06 Animation", - "S07 Statistics", - "S08 Block Break Animation", - "S09 Update Block Entity", - "S0A Block Action", - "S0B Block Change", - "S0C Boss Bar", - "S0D Server Difficulty", - "S0E Tab-Complete", - "S0F Chat Message", - "S10 Multi Block Change", - "S11 Confirm Transaction", - "S12 Close Window", - "S13 Open Window", - "S14 Window Items", - "S15 Window Property", - "S16 Set Slot", - "S17 Set Cooldown", - "S18 Plugin Message", - "S19 Named Sound Effect", - "S1A Disconnect", - "S1B Entity Status", - "S1C Explosion", - "S1D Unload Chunk", - "S1E Change Game State", - "S1F Keep Alive", - "S20 Chunk Data", - "S21 Effect", - "S22 Particle", - "S23 Join Game", - "S24 Map", - "S25 Entity Relative Move", - "S26 Entity Look And Relative Move", - "S27 Entity Look", - "S28 Entity", - "S29 Vehicle Move", - "S2A Open Sign Editor", - "S2B Player Abilities", - "S2C Combat Event", - "S2D Player List Item", - "S2E Player Position And Look", - "S2F Use Bed", - "S30 Destroy Entities", - "S31 Remove Entity Effect", - "S32 Resource Pack Send", - "S33 Respawn", - "S34 Entity Head Look", - "S35 World Border", - "S36 Camera", - "S37 Held Item Change", - "S38 Display Scoreboard", - "S39 Entity Metadata", - "S3A Attach Entity", - "S3B Entity Velocity", - "S3C Entity Equipment", - "S3D Set Experience", - "S3E Update Health", - "S3F Scoreboard Objective", - "S40 Set Passengers", - "S41 Teams", - "S42 Update Score", - "S43 Spawn Position", - "S44 Time Update", - "S45 Title", - "S46 Update Sign", - "S47 Sound Effect", - "S48 Player List Header And Footer", - "S49 Collect Item", - "S4A Entity Teleport", - "S4B Entity Properties", - "S4C Entity Effect" - }; - - public static final String packetTip[] = - { - - }; - - - public static boolean enabled = false; - public static boolean isActive[] = new boolean[packetName.length]; - - public static void init() - { - Arrays.fill(isActive, false); - loadSettings(); - } - - public static void saveSettings() - { - Properties prop = new Properties(); - OutputStream output = null; - - try { - output = new FileOutputStream(configFileName); - - for(int i = 0; i < packetName.length; i++) - { - if(packetName[i] != null && !packetName[i].isEmpty()) - prop.setProperty(packetName[i], Boolean.toString(isActive[i])); - } - - prop.store(output, null); - } - catch (IOException io) { - io.printStackTrace(); - } - finally { - if(output != null) { - try { - output.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - public static void loadSettings() - { - Properties prop = new Properties(); - InputStream input = null; - - try { - input = new FileInputStream(configFileName); - - prop.load(input); - - for(int i = 0; i < packetName.length; i++) - { - if(packetName[i] != null && !packetName[i].isEmpty()) - isActive[i] = Boolean.parseBoolean(prop.getProperty(packetName[i])); - } - } - catch (IOException io) { - io.printStackTrace(); - } - finally { - if(input != null) { - try { - input.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - public static void playerChat(String str) - { - if(bcc.z().h == null) return; - bcc.z().h.b(new fa(str)); - } - - public static void playerChat(String str, String hoverText) - { - if(bcc.z().h == null) return; - fa strChat = new fa(str); // fa : ChatComponentText, eu : IChatComponent - fa hoverChat = new fa(hoverText); - ew he = new ew(ew.a.a, hoverChat); // ew : HoverEvent - strChat.b().a(he); // strChat.getChatStyle().setChatHoverEvent(he); - bcc.z().h.a(strChat); - } - - private static void playerChatPacketInfo(int packetID, String quickInfo, String hoverInfo) - { - if(packetID < 0 || packetID >= ServerPacketData.isActive.length || !ServerPacketData.isActive[packetID]) return; - String chatStr = "§eTick §f" + bcc.z().tickcounter + " §e[" + packetName[packetID] + "]"; - if(quickInfo != null && !quickInfo.isEmpty()) chatStr += " §7" + quickInfo; - playerChat(chatStr, hoverInfo); - } - - private static String eid2str(int entityID) - { - bkr world = bcc.z().f; - if(world != null) - { - rr entity = world.a(entityID); // getEntityByID(.) - if(entity != null) return entity.h_(); // getName() - } - return "(null)"; - } - - private static String eidTag(int entityID) - { - String str = "EntityID: " + entityID; - bkr world = bcc.z().f; - if(world != null) - { - rr entity = world.a(entityID); - - if(entity != null) { - str += " §7→" + entity.h_(); - } - else { - str += " §7→(null)"; - } - } - return str; - } - - private static String eidInfo(int entityID) { - return eid2str(entityID) + " (" + entityID + ")"; - } - - private static String pos2str(cj pos) { - return "[" + pos.p() + "," + pos.q() + "," + pos.r() + "]"; - } - - private static String pos2str(int x, int z) { - return "[" + x + "," + z + "]"; - } - - private static String pos2str(int x, int y, int z) { - return "[" + x + "," + y + "," + z + "]"; - } - - private static String pos2str(double x, double y, double z) { - return "[" + x + "," + y + "," + z + "]"; - } - - private static String rot2str(float yaw, float pitch) { - return "[Yaw:" + yaw + ",Pitch:" + pitch + "]"; - } - - // Spawn Object 00 - public static void display_S00(int entityID, UUID uuid, int type, double x, double y, double z, float yaw, float pitch, int data, double velX, double velY, double velZ) - { - String info = - eidTag(entityID) + "\n" + - "UUID: " + ((uuid==null)?"(null)":uuid.toString()) + "\n" + - "Type: " + type + "\n" + - "Position" + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "Data: " + data + "\n" + - "Velocity: " + pos2str(velX,velY,velZ); - playerChatPacketInfo(0x00, eidInfo(entityID), info); - } - - // Spawn Experience Orb 01 - public static void display_S01(int entityID, double x, double y, double z, int count) - { - String info = - eidTag(entityID) + "\n" + - "Position: " + pos2str(x,y,z) + "\n" + - "Count: " + count; - playerChatPacketInfo(0x01, "Count: " + count, info); - } - - // Spawn Global Entity 02 - public static void displayS02(int entityID, int isLightningBlot, double x, double y, double z) - { - String info = - eidTag(entityID) + "\n" + - "Is Lightning Blot: " + isLightningBlot + "\n" + - "Position: " + pos2str(x,y,z); - playerChatPacketInfo(0x02, eid2str(entityID), info); - } - - // Spawn Mob 03 - public static void display_S03(int entityID, UUID uuid, int type, double x, double y, double z, float yaw, float pitch, float headPitch, double velX, double velY, double velZ, List meta) - { - String info = - eidTag(entityID) + "\n" + - "UUID: " + ((uuid==null)?"(null)":uuid.toString()) + "\n" + - "Type: " + type + "\n" + - "Position" + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "Head Pitch: " + headPitch + "\n" + - "Velocity: " + pos2str(velX,velY,velZ) + "\n" + - ""; - playerChatPacketInfo(0x03, eidInfo(entityID) + " @" + pos2str(x,y,z), info); - } - - // Spawn Painting 04 - public static void display_S04(int entityID, UUID uuid, String title, cj location, String facing) - { - String info = - eidTag(entityID) + "\n" + - "UUID: " + ((uuid==null)?"(null)":uuid.toString()) + "\n" + - "Title: " + title + "\n" + - "Position: " + pos2str(location) + "\n" + - "Facing: " + facing; - playerChatPacketInfo(0x04, "", info); - } - - // Spawn Player 05 - public static void display_S05(int entityID, UUID uuid, double x, double y, double z, float yaw, float pitch, List meta) - { - // meta = held item id - String info = - eidTag(entityID) + "\n" + - "UUID: " + ((uuid==null)?"(null)":uuid.toString()) + "\n" + - "Position" + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "Held Meta: " + meta; // TODO - playerChatPacketInfo(0x05, eidInfo(entityID), info); - } - - // Animation 06 - public static void display_S06(int entityID, int animation) - { - // animation: - // 0 = Swing arm, 1 = Take damage, 2 = Leave bed, 3 = Eat food, 4 = Critical effect, 5 = Magic critical effect - String anim; - switch(animation){ - case 0: anim = "Swing Arm"; break; - case 1: anim = "Take Damage"; break; - case 2: anim = "Leave Bed"; break; - case 3: anim = "Eat Food"; break; - case 4: anim = "Critical Effect"; break; - case 5: anim = "Magic Critical Effect"; break; - default: anim = "Unknown"; break; - } - - String info = - eidTag(entityID) + "\n" + - "Animation: " + animation + " §7[" + anim + "]"; - playerChatPacketInfo(0x06, eidInfo(entityID), info); - } - - // Statistics 07 - public static void display_S07() - { - String info = - ""; - playerChatPacketInfo(0x07, "", info); - } - - // Block Break Animation 08 - public static void display_S08(int entityID, cj pos, int destroyStage) - { - String info = - eidTag(entityID) + "\n" + - "Position: " + pos2str(pos) + "\n" + - "Destroy Stage: " + destroyStage; - playerChatPacketInfo(0x08, eidInfo(entityID), info); - } - - // Update Block Entity 09 - public static void display_S09(cj pos, int type, Object nbt) - { - String typestr; - switch(type) { - case 1: typestr = "TileEntityMobSpawner"; break; - case 2: typestr = "TileEntityCommandBlock"; break; - case 3: typestr = "TileEntityBeacon"; break; - case 4: typestr = "TileEntitySkull"; break; - case 5: typestr = "TileEntityFlowerPot"; break; - case 6: typestr = "TileEntityBanner"; break; - default: typestr = "Unknown"; - } - - - String info = - "Position: " + pos2str(pos) + "\n" + - "Type: " + typestr + "\n" + - ""; - playerChatPacketInfo(0x09, typestr, info); - } - - - // Block Action 0A - public static void display_S0A(cj pos, ajt block, int event, int eventParam) - { - String blockName = bwl.a(block.a() + ".name", new Object[0]); - String action = ""; - String info = - "Block: " + blockName + "\n" + - "Position: " + pos2str(pos) + "\n" + - "Action: " + event + " §7["; - - if(block instanceof and) // BlockNote : and - { - switch(event) { - case 0: action += "Harp"; break; - case 1: action += "Double Bass"; break; - case 2: action += "Snare Drum"; break; - case 3: action += "Clicks/Sticks"; break; - case 4: action += "Bass Drum"; break; - default: action += "Unknown"; - } - - info += action + "]\nParameter: " + eventParam + " §7[Pitch]"; - } - // BlockPistonBase : aqu, BlockPistonExtension : aqv - else if(block instanceof aqu || block instanceof aqv) - { - switch(event) { - case 0: action += "Pushing"; break; - case 1: action += "Pulling"; break; - default: action += "Unknown"; - } - - info += action + "]\nParameter: " + eventParam + " §7["; - - switch(eventParam) { - case 0: info += "Down"; break; - case 1: info += "Up"; break; - case 2: info += "South"; break; - case 3: info += "West"; break; - case 4: info += "North"; break; - case 5: info += "East"; break; - default: info += "Unknown"; - } - - info += "]"; - } - // BlockChest : ake, BlockEnderChest : alf - else if(block instanceof ake || block instanceof alf) - { - info += "]\n" + "Parameter: " + eventParam + " §7[Players Opening]"; - } - else - { - info += "Unknown]\n" + "Parameter: " + eventParam + " §7[Unknown]"; - } - - String quickInfo = "§c" + blockName; - if(!action.isEmpty()) quickInfo += ": §7" + action; - playerChatPacketInfo(0x0A, quickInfo, info); - } - - // Block Change 0B - public static void display_S0B(cj pos, arc ibs) - { - String info = pos2str(pos) + ":§c" + (ibs + "").substring(10).replace("[", "§7["); - playerChatPacketInfo(0x0B, pos2str(pos), info); - } - - // Boss Bar 0C - public static void display_S0C(UUID uuid, String action, eu title, float health, String color, String division, boolean bool1, boolean bool2, boolean bool3) - { - // meta = held item id - String info = - "UUID: " + ((uuid==null)?"(null)":uuid.toString()) + "\n" + - "Action: " + action + "\n" + - "Title: " + title.c() + "\n" + - "Health: " + health + "\n" + - "Color: " + color + "\n" + - "Type: " + division + "\n" + - "B1: " + bool1 + ", B2: " + bool2 + ", B3: " + bool3; - playerChatPacketInfo(0x0C, "", info); - } - - // Server Difficulty 0D - public static void display_S0D(int difficulty, boolean isLocked) - { - String info = - "Difficulty: " + difficulty + "\n" + - "Locked: " + isLocked; - playerChatPacketInfo(0x0D, "", info); - } - - // Tab-Complete (clientbound) 0E - public static void display_S0E(String strs[]) - { - String info = ""; - final int dispMax = 9; - for(int i = 0; i < strs.length; i++) - { - if(i >= dispMax) { - info += "..."; - break; - } - info += strs[i]; - if(i < strs.length-1) info += "\n"; - } - - playerChatPacketInfo(0x0E, "", info); - } - - // Chat Message 0F - public static void display_S0F(eu chat, byte position) - { - String pos; - switch(position){ - case 0: pos = "chat"; break; - case 1: pos = "system message"; break; - case 2: pos = "above hotbar"; break; - default: pos = "Unknown"; - } - - String info = - "Text: " + chat.c() + "\n" + - "Position: " + position + " §7[" + pos + "]"; - playerChatPacketInfo(0x0F, "", info); - } - - - // Multi Block Change 10 - public static void display_S10(fz.a blockUpdates[]) - { - String info = ""; - - for(int i = 0; i < blockUpdates.length; i++) - { - fz.a update = blockUpdates[i]; - cj pos = update.a(); - arc ibs = update.c(); - - info += pos2str(pos) + ":§c" + (ibs + "").substring(10).replace("[", "§7["); - if(i < blockUpdates.length-1) info += "\n"; - } - - playerChatPacketInfo(0x10, "" + blockUpdates.length + " Block Updates", info); - } - - // Confirm Transaction (clientbound) 11 - public static void display_S11(int windowID, int actionNumber, boolean accepted) - { - String info = - "WindowID: " + windowID + "\n" + - "Action Number: " + actionNumber + "\n" + - "Accepted: " + accepted; - playerChatPacketInfo(0x11, "", info); - } - - // Close Window 12 - public static void display_S12() - { - String info = "§7[Closes Current Window]"; - playerChatPacketInfo(0x12, "", info); - } - - // Open Window 13 - public static void display_S13(int windowID, String type, eu title, int slotNum, int entityID) - { - String info = - "WindowID: " + windowID + "\n" + - "Type: " + type + "\n" + - "Title: " + (title == null ? "(null)" : title.c()) + "\n" + - "Number of Slots: " + slotNum + "\n" + - eidTag(entityID); - playerChatPacketInfo(0x13, type, info); - } - - // Window Items 14 - public static void display_S14(int count, adq slots[]) - { - String info = - "Count: " + count; - - final int dispMax = 9; - int dispCnt = 0; - for(int i = 0; i < slots.length && dispCnt < dispMax; i++) - { - if(slots[i] == null) continue; - - String stackName = slots[i] == null ? "(null)" : slots[i].q() + " §8×" + slots[i].b; - info += "\nSlot: " + i + " §7[" + stackName + "§7]"; - dispCnt++; - } - if(dispCnt >= dispMax) info += "\n..."; - - playerChatPacketInfo(0x14, "", info); - } - - // Window Property 15 - public static void display_S15(int windowID, int property, int value) - { - String info = - "WindowID: " + windowID + "\n" + - "Property: " + property + "\n" + - "Value: " + value; - playerChatPacketInfo(0x15, "", info); - } - - // Set Slot 16 - public static void display_S16(int windowID, int slot, adq stack) - { - String stackStr; - if(stack == null) stackStr = "(null)"; - else stackStr = stack.q() + " §7×" + stack.b; // ItemStack.stacksize : adq.b - - String info = - "WindowID: " + windowID + "\n" + - "Slot: " + slot + "\n" + - "ItemStack: " + stackStr; - playerChatPacketInfo(0x16, "" + slot + " → [" + stackStr + "]", info); - } - - // Set Cooldown 17 (NEW) - public static void display_S17(String itemId, int coolDown) - { - String info = - "Item: " + itemId + "\n" + - "Cooldown Ticks: " + coolDown; - playerChatPacketInfo(0x17, "", info); - } - - // Plugin Message (clientbound) 18 - public static void display_S18(String channelName) - { - String info = - "Channel Name: " + channelName + "\n" + - ""; - playerChatPacketInfo(0x18, channelName, info); - } - - // Named Sound Effect - public static void display_S19(double x, double y, double z, String soundName, String soundCategory, float volume, float pitch) - { - String info = - "Sound Name: " + soundName + "\n" + - "Sound Category: " + soundCategory + "\n" + - "Position: " + pos2str(x,y,z) + "\n" + - "Volume: " + volume + "\n" + - "Pitch: " + pitch; - playerChatPacketInfo(0x19, soundName, info); - } - - // Disconnect (play) 1A - public static void display_S1A(eu reason) - { - String info = "Reason: " + reason.c(); - playerChatPacketInfo(0x1A, "", info); - } - - // Entity Status 1B - public static void display_S1B(int entityID, int statusID) - { - String info = - eidTag(entityID) + "\n" + - "Status: " + statusID; - playerChatPacketInfo(0x1B, eidInfo(entityID), info); - } - - // Explosion 1C - public static void display_S1C(double x, double y, double z, float radius, List affectedBlockOffsets, float velX, float velY, float velZ) - { - String info = - "Position: " + pos2str(x,y,z) + "\n" + - "Radius: " + radius + "\n" + - "Player Motion: " + pos2str(velX,velY,velZ) + "\n" + - "No. of Affected Blocks: " + affectedBlockOffsets.size() + "\n" + - "Affected Block Coordinated:"; - - final int maxLen = 20; - for(int i = 0; i < maxLen && i < affectedBlockOffsets.size(); i++) - { - if(i % 5 == 0) info += "\n"; - info += pos2str((cj)affectedBlockOffsets.get(i)) + " "; - } - - if(affectedBlockOffsets.size() > maxLen) info += "..."; - - playerChatPacketInfo(0x1C, "@" + pos2str(Math.floor(x),Math.floor(y),Math.floor(z)), info); - } - - // Unload Chunk 1D (NEW) TODO: ADD - public static void display_S1D(int chunkX, int chunkZ) - { - String info = "Chunk Coords: " + pos2str(chunkX,chunkZ); - playerChatPacketInfo(0x1D, pos2str(chunkX,chunkZ), info); - } - - // Change Game State 1E - public static void display_S1E(int reason, float data) - { - String info = ""; - - String str; - switch(reason) { - case 0: str = "Invalid Bed"; break; - case 1: str = "End raining"; break; - case 2: str = "Begin raining"; break; - case 3: str = "Change game mode"; break; - case 4: str = "Enter credits"; break; - case 5: str = "Demo message"; break; - case 6: str = "Arrow hitting player"; break; - case 7: str = "Rain strength"; break; - case 8: str = "Thunder strength"; break; - case 10: str = "Play mob appearance"; break; - default: str = "Unknown"; - } - info += "State: " + str + "\n" + - "Value: " + data; - - playerChatPacketInfo(0x1E, str, info); - } - - // Keep Alive 1F - public static void displayS1F(int keepAlive) - { - String info = "Keep Alive ID: " + keepAlive; - playerChatPacketInfo(0x1F, "", info); - } - - // Chunk Data 20 - public static void display_S20(int chunkX, int chunkZ, boolean groundUpCont, int primBitMask, int size, byte data[], byte biomes[]) - { - String info = - "Chunk Position: " + pos2str(chunkX,chunkZ) + "\n" + - "Ground-Up Continuous: " + groundUpCont + "\n" + - "Primary Bit Mask: " + String.format("%16s", Integer.toBinaryString(primBitMask)) - .replace(' ', '0').replace("1", "§a1§f") + "\n" + - // "Size:" + size + "\n" + - "\n" + - ""; - playerChatPacketInfo(0x20, pos2str(chunkX,chunkZ), info); - } - - // Effect 21 - public static void display_S21(int effectID, cj pos, int data, boolean noRelativeVol) - { - String info = - "Effect ID: " + effectID + "\n" + - "Position: " + pos2str(pos) + "\n" + - "Data: " + data + "\n" + - "Serverwide: " + noRelativeVol; - playerChatPacketInfo(0x21, "", info); - } - - // Particle 22 - public static void display_S22(String particleID, int count, boolean isLongDist, double x, double y, double z, float Dx, float Dy, float Dz, float offsetScale) - { - String info = - "ParticleType: " + particleID + "\n" + - "Count: " + count + "\n" + - "Is Long Distance: " + isLongDist + "\n" + - "Position: " + pos2str(x,y,z) + "\n" + - "Offset: " + pos2str(Dx,Dy,Dz) + "\n" + - "Offset Scale: " + offsetScale; - playerChatPacketInfo(0x22, particleID + " ×" + count, info); - } - - // Join Game 23 - public static void display_S23(int entityID, int gameMode, int dimension, int difficulty, int maxPlayers, String levelType, boolean reducedDebugInfo) - { - String info = - eidTag(entityID) + "\n" + - "Gamemode: " + gameMode + "\n" + - "Dimension: " + dimension + "\n" + - "Difficulty: " + difficulty + "\n" + - "Max Players: " + maxPlayers + "\n" + - "Level Type: " + levelType + "\n" + - "Reduced Debug Info: " + reducedDebugInfo; - playerChatPacketInfo(0x23, "", info); - } - - // Map 24 - public static void display_S24(int mapID) - { - String info = - "MapID: " + mapID + "\n" + - ""; - playerChatPacketInfo(0x24, "", info); - } - - // Entity Relative Move 25 - public static void display_S25(int entityID, double x, double y, double z, boolean onGround) - { - String info = - eidTag(entityID) + "\n" + - "Delta Position: " + pos2str(x,y,z) + "\n" + - "On Ground: " + onGround; - playerChatPacketInfo(0x25, eidInfo(entityID), info); - } - - // Entity Look 26 - public static void display_S26(int entityID, float yaw, float pitch, boolean onGround) - { - String info = - eidTag(entityID) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "On Ground: " + onGround; - playerChatPacketInfo(0x26, eidInfo(entityID), info); - } - - // Entity Look And Relative Move 27 - public static void display_S27(int entityID, double x, double y, double z, float yaw, float pitch, boolean onGround) - { - String info = - eidTag(entityID) + "\n" + - "Delta Position: " + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "On Ground: " + onGround; - playerChatPacketInfo(0x27, eidInfo(entityID), info); - } - - // Entity 28 - public static void display_S28(int entityID) - { - String info = eidTag(entityID); - playerChatPacketInfo(0x28, eidInfo(entityID), info); - } - - // Vehicle Move (clientbound) 29 (NEW) TODO: ADD - public static void display_S29(double x, double y, double z, float yaw, float pitch) - { - String info = - "Position: " + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch);; - playerChatPacketInfo(0x29, "", info); - } - - // Open Sign Editor 2A - public static void display_S2A(cj pos) - { - String info = "Position: " + pos2str(pos); - playerChatPacketInfo(0x2A, "", info); - } - - // Player Abilities (clientbound) 2B - public static void display_S2B(boolean isFlying, boolean isCreativeMode, boolean isInvulnerable, boolean isAllowFlying, float flySpeed, float fieldOfView) - { - String info = - "IsFlying: " + isFlying + "\n" + - "IsCreativeMode: " + isCreativeMode + "\n" + - "IsInvulnerable: " + isInvulnerable + "\n" + - "IsAllowFlying: " + isAllowFlying + "\n" + - "Flying Speed: " + flySpeed + "\n" + - "Field of View: " + fieldOfView; - playerChatPacketInfo(0x2B, "", info); - } - - // Combat Event 2C : - GuiDeathScreen - public static void display_S2C(String event, int playerID, eu chatComponent) - { - // IChatComponent : eu - String info = - "Event: " + event + "\n" + - "PlayerID: " + playerID + " §7→" + eid2str(playerID) + "\n" + - "Message: " + chatComponent.c(); - playerChatPacketInfo(0x2C, "", info); - } - - // Player List Item 2D - public static void display_S2D(String uuids[], String[] action) - { - String info = ""; - for(int i = 0; i < uuids.length; i++) - { - info += uuids[i] + ": " + action[i]; - if(i < uuids.length-1) info += "\n"; - } - - playerChatPacketInfo(0x2D, "", info); - } - - // Player Position And Look 2E - public static void display_S2E(double x, double y, double z, float yaw, float pitch, String flags, Integer teleportID) - { - // about flags: - // It's a bitfield, X/Y/Z/Y_ROT/X_ROT. If X is set, the x value is relative and not absolute. - String info = - "Position: " + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "Flags: " + flags + "\n" + - "TeleportID: " + teleportID; - playerChatPacketInfo(0x2E, "", info); - } - - // Use Bed 2F - public static void display_S2F(zj player, cj location) - { - String info = - "Player: " + player.h_() + "\n" + - "Location: " + pos2str(location); - playerChatPacketInfo(0x2F, player.h_(), info); - } - - // Destroy Entities 30 - // Called before processing to determine the entities before they are destroyed - public static void display_S30(int count, int entityIDs[]) - { - final int displayMax = 8; - String info = "Count: " + count; - for(int i = 0; i < count && i < displayMax; i++) - { - info += "\nEntity[" + i + "]: " + eid2str(entityIDs[i]) + " (" + entityIDs[i] + ")"; - } - if(count > displayMax) info += " ..."; - playerChatPacketInfo(0x30, "", info); - } - - // Remove Entity Effect 31 - public static void display_S31(int entityID, String effect) - { - String info = - eidTag(entityID) + "\n" + - "Effect: " + effect; - playerChatPacketInfo(0x31, eidInfo(entityID), info); - } - - // Resource Pack Send 32 - public static void display_S32(String url, String hash) - { - String info = - "URL: " + url + "\n" + - "Hash: " + hash; - playerChatPacketInfo(0x32, url, info); - } - - // Respawn 33 - public static void display_S33(int dimension, int difficulty, int gameMode, String levelType) - { - String info = - "Dimension: " + dimension + "\n" + - "Difficulty: " + difficulty + "\n" + - "Gamemode: " + gameMode + "\n" + - "Level Type: " + levelType; - playerChatPacketInfo(0x33, "", info); - } - - // Entity Head Look 34 - public static void display_S34(int entityID, float yaw) - { - String info = - eidTag(entityID) + "\n" + - "Head Yaw: " + yaw; - playerChatPacketInfo(0x34, eidInfo(entityID), info); - } - - // World Border 35 - public static void display_S35() - { - String info = ""; - playerChatPacketInfo(0x35, "", info); - } - - // Camera 36 - public static void display_S36(int camEntityID) - { - String info = "Camera " + eidTag(camEntityID); - playerChatPacketInfo(0x36, eidInfo(camEntityID), info); - } - - // Held Item Change (clientbound) 37 - public static void display_S37(int slot) - { - String info = "Slot: " + slot; - playerChatPacketInfo(0x37, "", info); - } - - // Display Scoreboard 38 - public static void display_S38(int pos, String scoreName) - { - String posstr = pos == 0 ? "List" : pos == 1 ? "Sidebar" : pos == 2 ? "Below Name" : "Unknown"; - - String info = - "Position: " + pos + " §7[" + posstr + "]\n" + - "Score Name: " + scoreName; - playerChatPacketInfo(0x38, "", info); - } - - // Entity Metadata 39 - public static void display_S39(int entityID, List meta) - { - String info = - eidTag(entityID) + "\n" + - ""; - playerChatPacketInfo(0x39, eidInfo(entityID), info); - } - - // Attach Entity 3A (NEW) - public static void display_S3A(int entityID, int holdingEntityID) - { - String info = - eidTag(entityID) + "\n" + - "Holding " + eidTag(holdingEntityID); - playerChatPacketInfo(0x3A, "", info); - } - - // Entity Velocity 3B - public static void display_S3B(int entityID, double velX, double velY, double velZ) - { - String info = - eidTag(entityID) + "\n" + - "Velocity: " + pos2str(velX,velY,velZ); - playerChatPacketInfo(0x3B, eidInfo(entityID), info); - } - - // Entity Equipment 3C - public static void display_S3C(int entityID, String slotName, adq stack) - { - String itemName = (stack == null) ? "(null)" : stack.q(); // getDisplayName() - String info = - eidTag(entityID) + "\n" + - "Slot: " + slotName + "\n" + - "Item: " + itemName; - playerChatPacketInfo(0x3C, "\"" + itemName + "\" for " + eidInfo(entityID), info); - } - - // Set Experience 3D - public static void display_S3D(float expBar, int level, int total) - { - String info = - "Experience bar: " + expBar + "\n" + - "Level: " + level + "\n" + - "Total Experience: " + total; - playerChatPacketInfo(0x3D, "", info); - } - - // Update Health 3E - public static void display_S3E(float health, int food, float saturation) - { - String info = - "Health: " + health + "\n" + - "Food: " + food + "\n" + - "Saturation: " + saturation; - playerChatPacketInfo(0x3E, "", info); - } - - // Scoreboard Objective 3F - public static void display_S3F(String name, String type, int mode, String renderType) - { - String info = - "Name: " + name + "\n" + - "Type: " + type + "\n" + - "Mode: " + mode + "\n" + - "Render Type: " + renderType; - playerChatPacketInfo(0x3F, "", info); - } - - // Set Passengers 40 - public static void display_S40(int entityID, int passengerEntityIDs[]) - { - String info = eidTag(entityID); - for(int i = 0; i < passengerEntityIDs.length; i++) - info += "\nPassenger[" + i + "]: " + eid2str(passengerEntityIDs[i]); - playerChatPacketInfo(0x40, "", info); - } - - // Teams 41 - public static void display_S41(int mode, String teamName, - String teamDispName, String prefix, String suffix, - int chatFormatting, int friendlyFire, String nameTagVisibility, - Collection playerNames) - { - String modeStr; - switch(mode) { - case 0: modeStr = "Create Team"; break; - case 1: modeStr = "Remove Team"; break; - case 2: modeStr = "Update Team Info"; break; - case 3: modeStr = "Add Players to Team"; break; - case 4: modeStr = "Remove Players from Team"; break; - default: modeStr = "Unknown"; - } - - String info = - "Mode: " + mode + " §7[" + modeStr + "]\n" + - "Team Name: " + teamName + "\n" + - "Team Display Name: " + teamDispName + "\n" + - "Prefix: " + prefix + "\n" + - "Suffix: " + suffix + "\n" + - "Chat Formatting: " + chatFormatting + "\n" + - "Friendly Fire: " + friendlyFire + "\n" + - "Name Tag Visibility: " + nameTagVisibility + "\n" + - "Players: "; - - String player; - Iterator iterator = playerNames.iterator(); - - if(iterator == null) - { - info += "(null)"; - } - else - { - final int dispMax = 4; - int i; - for(i = 0; iterator.hasNext() && i < dispMax; i++) - { - info += (String)iterator.next(); - if(iterator.hasNext()) info += ", "; - } - if(i >= dispMax) info += "..."; - } - - playerChatPacketInfo(0x41, "", info); - } - - // Update Score 42 - public static void display_S42(String scoreName, String objectiveName, String action, int value) - { - String info = - "Score Name: " + scoreName + "\n" + - "Objective Name: " + objectiveName + "\n" + - "Action: " + action + "\n" + - "Value: " + value; - playerChatPacketInfo(0x42, "", info); - } - - // Spawn Position 43 - public static void display_S43(cj position) - { - String posStr = pos2str(position); - String info = "Position: " + posStr; - playerChatPacketInfo(0x43, posStr, info); - } - - // Time Update 44 - public static void display_S44(long worldAge, long timeOfDay) - { - String info = - "World Age: " + worldAge + "\n" + - "Time of Day: " + timeOfDay; - playerChatPacketInfo(0x44, "(" + worldAge + ", " + timeOfDay + ")", info); - } - - // Title 45 - public static void display_S45(String action, String title, String subTitle, int fadeIn, int stay, int fadeOut) - { - String info = - "Action: " + action + "\n" + - "Title: " + title + "\n" + - "Subtitle: " + subTitle + "\n" + - "Fade In: " + fadeIn + "\n" + - "Stay: " + stay + "\n" + - "Fade Out: " + fadeOut; - playerChatPacketInfo(0x45, "", info); - } - - // Update Sign (clientbound) 46 - public static void display_S46(cj pos, eu lines[]) - { - String info = - "Position: " + pos2str(pos); - - for(int i = 0; i < lines.length; i++) - { - info += "\nL" + i + ": " + (lines[i] == null ? "(null)" : lines[i].c()); - } - - playerChatPacketInfo(0x46, "", info); - } - - // Sound Effect (NEW) TODO: sort out difference between 0x19 and 0x47 - public static void display_S47(double x, double y, double z, String soundName, String soundCategory, float volume, float pitch) - { - String info = - "Sound Name: " + soundName + "\n" + - "Sound Category: " + soundCategory + "\n" + - "Position: " + pos2str(x,y,z) + "\n" + - "Volume: " + volume + "\n" + - "Pitch: " + pitch; - playerChatPacketInfo(0x47, soundName, info); - } - - // Player List Header And Footer 48 - public static void display_S48(eu header, eu footer) - { - String info = - "Header: " + header.c() + "\n" + - "Footer: " + footer.c(); - playerChatPacketInfo(0x48, "", info); - } - - // Collect Item 49 - // Called before the collected item is destroyed - public static void display_S49(int collectedEntityID, int collectorEntityID) - { - String info = - "Collected " + eidTag(collectedEntityID) + "\n" + - "Collector " + eidTag(collectorEntityID); - playerChatPacketInfo(0x49, "", info); - } - - // Entity Teleport 4A - public static void display_S4A(int entityID, double x, double y, double z, float yaw, float pitch, boolean onGround) - { - String info = - eidTag(entityID) + "\n" + - "Position: " + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "On Ground: " + onGround; - playerChatPacketInfo(0x4A, eidInfo(entityID), info); - } - - // Entity Properties 4B - public static void display_S4B(int entityID, List attributes) - { - String info = - eidTag(entityID) + "\n" + - ""; - - playerChatPacketInfo(0x4B, eidInfo(entityID), info); - } - - // Entity Effect 4C - public static void display_S4C(int entityID, String effect, int duration, int amplifier, boolean ambient, boolean particles) - { - String info = - eidTag(entityID) + "\n" + - "Effect: " + effect + "\n" + - "Amplifier: " + amplifier + "\n" + - "Duration: " + duration + "\n" + - "Ambient: " + ambient + "\n" + - "Particles: " + particles; - playerChatPacketInfo(0x4C, eidInfo(entityID), info); - } -} diff --git a/src/bc.java b/src/bc.java deleted file mode 100644 index c84697d..0000000 --- a/src/bc.java +++ /dev/null @@ -1,126 +0,0 @@ -// ServerCommandManager - -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * com.mojang.authlib.GameProfile - */ -import com.mojang.authlib.GameProfile; -import java.util.List; - -public class bc -extends j -implements h { - private final MinecraftServer a; - - public bc(MinecraftServer minecraftServer) { - this.a = minecraftServer; - this.a(new br()); - this.a(new ah()); - this.a(new ag()); - this.a(new y()); - this.a(new am()); - this.a(new bt()); - this.a(new bv()); - this.a(new ae()); - this.a(new bm()); - this.a(new aj()); - this.a(new aw()); - this.a(new bj()); - this.a(new z()); - this.a(new ab()); - this.a(new at()); - this.a(new aa()); - this.a(new bh()); - this.a(new ak()); - this.a(new x()); - this.a(new ap()); - this.a(new ba()); - this.a(new bg()); - this.a(new be()); - this.a(new ai()); - this.a(new t()); - this.a(new bq()); - this.a(new bi()); - this.a(new au()); - this.a(new bb()); - this.a(new ad()); - this.a(new bu()); - this.a(new p()); - this.a(new bl()); - this.a(new bd()); - this.a(new af()); - this.a(new u()); - this.a(new v()); - this.a(new s()); - this.a(new bp()); - this.a(new bn()); - this.a(new bx()); - this.a(new bs()); - this.a(new ac()); - - // Cubitick - this.a(new CommandRerender()); - this.a(new CommandTickSync()); - this.a(new CommandTickrate()); - - if (minecraftServer.aa()) { - this.a(new aq()); - this.a(new w()); - this.a(new bk()); - this.a(new ax()); - this.a(new ay()); - this.a(new az()); - this.a(new q()); - this.a(new ar()); - this.a(new r()); - this.a(new an()); - this.a(new as()); - this.a(new al()); - this.a(new ao()); - this.a(new bw()); - this.a(new bf()); - } else { - this.a(new av()); - } - i.a(this); - } - - @Override - public /* varargs */ void a(m m2, k k2, int n2, String string, Object ... arrobject) { - boolean bl2 = true; - MinecraftServer minecraftServer = this.a; - if (!m2.z_()) { - bl2 = false; - } - fb fb2 = new fb("chat.type.admin", m2.h_(), new fb(string, arrobject)); - fb2.b().a(Namepipe.a.h); - fb2.b().b(true); - if (bl2) { - for (zj zj2 : minecraftServer.al().v()) { - boolean bl3; - if (zj2 == m2 || !minecraftServer.al().h(zj2.cK()) || !k2.a(this.a, m2)) continue; - boolean bl4 = m2 instanceof MinecraftServer && this.a.s(); - boolean bl5 = bl3 = m2 instanceof my && this.a.r(); - if (!bl4 && !bl3 && (m2 instanceof my || m2 instanceof MinecraftServer)) continue; - zj2.a(fb2); - } - } - if (m2 != minecraftServer && minecraftServer.d[0].U().b("logAdminCommands")) { - minecraftServer.a(fb2); - } - boolean bl6 = minecraftServer.d[0].U().b("sendCommandFeedback"); - if (m2 instanceof ahj) { - bl6 = ((ahj)m2).n(); - } - if ((n2 & 1) != 1 && bl6 || m2 instanceof MinecraftServer) { - m2.a(new fb(string, arrobject)); - } - } - - @Override - protected MinecraftServer a() { - return this.a; - } -} diff --git a/src/bcc.java b/src/bcc.java deleted file mode 100644 index 0425e36..0000000 --- a/src/bcc.java +++ /dev/null @@ -1,2760 +0,0 @@ -// Minecraft - -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * com.google.common.collect.Lists - * com.google.common.collect.Maps - * com.google.common.collect.Multimap - * com.google.common.collect.Queues - * com.google.common.collect.Sets - * com.google.common.util.concurrent.Futures - * com.google.common.util.concurrent.ListenableFuture - * com.google.common.util.concurrent.ListenableFutureTask - * com.mojang.authlib.GameProfile - * com.mojang.authlib.GameProfileRepository - * com.mojang.authlib.minecraft.MinecraftSessionService - * com.mojang.authlib.properties.PropertyMap - * com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService - * org.apache.commons.io.IOUtils - * org.apache.commons.lang3.Validate - * org.apache.logging.log4j.LogManager - * org.apache.logging.log4j.Logger - * org.lwjgl.LWJGLException - * org.lwjgl.Sys - * org.lwjgl.input.Keyboard - * org.lwjgl.input.Mouse - * org.lwjgl.opengl.ContextCapabilities - * org.lwjgl.opengl.Display - * org.lwjgl.opengl.DisplayMode - * org.lwjgl.opengl.GLContext - * org.lwjgl.opengl.OpenGLException - * org.lwjgl.opengl.PixelFormat - * org.lwjgl.util.glu.GLU - */ -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; -import com.google.common.collect.Queues; -import com.google.common.collect.Sets; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListenableFutureTask; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.GameProfileRepository; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.Proxy; -import java.net.SocketAddress; -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.text.DecimalFormat; -import java.text.MessageFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.Executors; -import java.util.concurrent.FutureTask; -import javax.imageio.ImageIO; -import net.minecraft.client.ClientBrandRetriever; -import net.minecraft.server.MinecraftServer; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.Validate; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.LWJGLException; -import org.lwjgl.Sys; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.ContextCapabilities; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.DisplayMode; -import org.lwjgl.opengl.GLContext; -import org.lwjgl.opengl.OpenGLException; -import org.lwjgl.opengl.PixelFormat; -import org.lwjgl.util.glu.GLU; - -public class bcc -implements qc, -qx { - private static final Logger L = LogManager.getLogger(); - private static final kk M = new kk("textures/gui/title/mojang.png"); - public static final boolean a = Namepipe.g.a() == Namepipe.g_a.d; - public static byte[] b = new byte[10485760]; - private static final List N = Lists.newArrayList(new DisplayMode[]{new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)}); - private final File O; - private final PropertyMap P; - private final PropertyMap Q; - private bku R; - private bvf S; - private static bcc T; - private final pb U = pc.a(); - public bkq c; - private boolean V; - private boolean W = true; - private boolean X; - private b Y; - public int d; - public int e; - private boolean Z = false; - - // Cubitick: make timer public - public bci timerWorld = new bci(Cubitick.tickrateWorld); - public bci timer = new bci(Cubitick.tickrate); - public static long tickcounter = 0; - public boolean scheduledReload = false; - - private qw ab; - public bkr f; - public bnl g; - private brj ac; - private brw ad; - private bnh ae; - public bmq h; - private rr af; - public rr i; - public blv j; - private final bcj ag; - private boolean ah; - public bcq k; - public bcq l; - public bey m; - public bcf n; - public bnd o; - public bqp p; - private int ai; - private int aj; - private int ak; - private byl al; - public bfi q; - public bcr r; - public boolean s; - public bbf t; - public bce u; - public bcd v; - public final File w; - private final File am; - private final String an; - private final String ao; - private final Proxy ap; - private azj aq; - private static int ar; - private int as; - private String at; - private int au; - public boolean x; - long y; - private int av; - public final oc z; - long A; - private final boolean aw; - private final boolean ax; - private ek ay; - private boolean az; - public final oo B; - private long aA; - private bwb aB; - private final bwt aC; - private final List aD; - private final bvu aE; - private bwh aF; - private bwn aG; - private bcl aH; - private bco aI; - private bnq aJ; - private bvd aK; - private byv aL; - private bys aM; - private kk aN; - private final MinecraftSessionService aO; - private bwk aP; - private final Queue> aQ; - private long aR; - private final Thread aS; - private bxp aT; - private bnz aU; - volatile boolean C; - public String D; - public boolean E; - public boolean F; - public boolean G; - public boolean H; - long I; - int J; - private boolean aV; - long K; - private String aW; - - public bcc(bhy bhy2) { - this.ab = new qw("client", this, MinecraftServer.av()); - this.y = bcc.I(); - this.z = new oc(); - this.A = System.nanoTime(); - this.B = new oo(); - this.aA = -1; - this.aC = new bwt(); - this.aD = Lists.newArrayList(); - this.aQ = Queues.newArrayDeque(); - this.aR = 0; - this.aS = Thread.currentThread(); - this.C = true; - this.D = ""; - this.E = false; - this.F = false; - this.G = false; - this.H = true; - this.I = bcc.I(); - this.K = -1; - this.aW = "root"; - T = this; - this.w = bhy2.c.a; - this.am = bhy2.c.c; - this.O = bhy2.c.b; - this.an = bhy2.d.b; - this.ao = bhy2.d.c; - this.P = bhy2.a.b; - this.Q = bhy2.a.c; - this.aE = new bvu(bhy2.c.a()); - this.ap = bhy2.a.d == null ? Proxy.NO_PROXY : bhy2.a.d; - this.aO = new YggdrasilAuthenticationService(this.ap, UUID.randomUUID().toString()).createMinecraftSessionService(); - this.ag = bhy2.a.a; - L.info("Setting user: " + this.ag.c()); - L.debug("(Session ID is " + this.ag.a() + ")"); - this.ax = bhy2.d.a; - this.d = bhy2.b.a > 0 ? bhy2.b.a : 1; - this.e = bhy2.b.b > 0 ? bhy2.b.b : 1; - this.aj = bhy2.b.a; - this.ak = bhy2.b.b; - this.V = bhy2.b.c; - this.aw = bcc.as(); - this.al = null; - if (bhy2.e.a != null) { - this.at = bhy2.e.a; - this.au = bhy2.e.b; - } - ImageIO.setUseCache(false); - kn.c(); - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - - /* - public void a_broken() { - block17 : { - this.C = true; - try { - this.an(); - } - catch (Throwable err) { - b b2 = Namepipe.b.a(err, "Initializing game"); - b2.a("Initialization"); - this.c(this.b(b2)); - return; - } - do { - try { - if (this.C) { - if (this.X && this.Y != null) { - this.c(this.Y); - return; - } - try { - this.av(); - } - catch (OutOfMemoryError err) { - this.m(); - this.a(new bet()); - System.gc(); - } - continue; - } - break block17; - } - catch (bch err) {} - catch (e err) { - this.b(err.a()); - this.m(); - L.fatal("Reported exception thrown!", (Throwable)err); - this.c(err.a()); - } - catch (Throwable err) { - b b3 = this.b(new b("Unexpected error", err)); - this.m(); - L.fatal("Unreported exception thrown!", err); - this.c(b3); - } - } while (true); - finally { - this.h(); - } - } - }*/ - - // fixed bcc.a() = Minecraft.run() - public void a() { - this.C = true; - try { - this.an(); - - // Cubitick - new Cubitick(); - } - catch (Throwable t) { - return; - } - try { - while (this.C) { - if (this.X && this.Y != null) { - this.c(this.Y); - return; - } - try { - this.av(); - } - catch (OutOfMemoryError outOfMemoryError) { - this.m(); - this.a(new bet()); - System.gc(); - } - } - } - catch (bch err) {} - catch (e e) { - this.b(e.a()); - this.m(); - L.fatal("Reported exception thrown!", (Throwable)e); - this.c(e.a()); - } - catch (Throwable t) { - final b b = this.b(new b("Unexpected error", t)); - this.m(); - L.fatal("Unreported exception thrown!", t); - this.c(b); - } - finally { - this.h(); - } - } - - private void an() throws LWJGLException, IOException { - this.u = new bce(this, this.w); - this.aD.add(this.aE); - this.at(); - if (this.u.C > 0 && this.u.B > 0) { - this.d = this.u.B; - this.e = this.u.C; - } - L.info("LWJGL Version: " + Sys.getVersion()); - this.ar(); - this.aq(); - this.ap(); - bze.a(); - this.aJ = new bnq(this.d, this.e, true); - this.aJ.a(0.0f, 0.0f, 0.0f, 0.0f); - this.ao(); - this.aF = new bwh(this.O, new File(this.w, "server-resource-packs"), this.aE, this.aC, this.u); - this.aB = new bwi(this.aC); - this.aG = new bwn(this.aC, this.u.aC); - this.aB.a(this.aG); - this.f(); - this.S = new bvf(this.aB); - this.aB.a(this.S); - this.a(this.S); - this.aP = new bwk(this.S, new File(this.am, "skins"), this.aO); - this.aq = new azc(new File(this.w, "saves"), this.U); - this.aL = new byv(this.aB, this.u); - this.aB.a(this.aL); - this.aM = new bys(this); - this.k = new bcq(this.u, new kk("textures/font/ascii.png"), this.S, false); - if (this.u.aC != null) { - this.k.a(this.e()); - this.k.b(this.aG.b()); - } - this.l = new bcq(this.u, new kk("textures/font/ascii_sga.png"), this.S, false); - this.aB.a(this.k); - this.aB.a(this.l); - this.aB.a(new bwa()); - this.aB.a(new bvz()); - nk.f.a(new nl(){ - - @Override - public String a(String string) { - try { - return String.format(string, bce.c(bcc.this.u.X.j())); - } - catch (Exception err) { - return "Error: " + err.getLocalizedMessage(); - } - } - }); - this.v = new bcd(); - this.a("Pre startup"); - bnf.y(); - bnf.j(7425); - bnf.a(1.0); - bnf.k(); - bnf.c(515); - bnf.e(); - bnf.a(516, 0.1f); - bnf.a(bnf.i.b); - bnf.n(5889); - bnf.F(); - bnf.n(5888); - this.a("Startup"); - this.aK = new bvd("textures"); - this.aK.a(this.u.J); - this.S.a(bvd.g, this.aK); - this.S.a(bvd.g); - this.aK.a(false, this.u.J > 0); - this.aT = new bxp(this.aK); - this.aB.a(this.aT); - this.aH = bcl.a(); - this.aI = bco.a(this.aH); - this.ad = new brw(this.S, this.aT, this.aI); - this.ac = new brj(this.S, this.ad); - this.ae = new bnh(this); - this.aB.a(this.ad); - this.o = new bnd(this, this.aB); - this.aB.a(this.o); - this.aU = new bnz(this.aT.c(), this.aH); - this.aB.a(this.aU); - this.g = new bnl(this); - this.aB.a(this.g); - this.q = new bfi(this); - bnf.b(0, 0, this.d, this.e); - this.j = new blv(this.f, this.S); - this.a("Post startup"); - this.r = new bcr(this); - if (this.at != null) { - this.a(new bef(new bff(), this, this.at, this.au)); - } else { - this.a(new bff()); - } - this.S.c(this.aN); - this.aN = null; - this.n = new bcf(this); - this.p = new bqp(this); - if (this.u.s && !this.V) { - this.r(); - } - try { - Display.setVSyncEnabled((boolean)this.u.t); - } - catch (OpenGLException err) { - this.u.t = false; - this.u.b(); - } - this.g.b(); - } - - private void ao() { - this.aC.a(new bxj(), bxi.class); - this.aC.a(new bwz(), bwy.class); - this.aC.a(new bww(), bwv.class); - this.aC.a(new bxf(), bxe.class); - this.aC.a(new bxc(), bxb.class); - } - - private void ap() throws LWJGLException { - Display.setResizable((boolean)true); - Display.setTitle((String)"Minecraft 1.9.2"); - try { - Display.create((PixelFormat)new PixelFormat().withDepthBits(24)); - } - catch (LWJGLException err) { - L.error("Couldn't set pixel format", (Throwable)err); - try { - Thread.sleep(1000); - } - catch (InterruptedException var2_2) { - // empty catch block - } - if (this.V) { - this.au(); - } - Display.create(); - } - } - - private void aq() throws LWJGLException { - if (this.V) { - Display.setFullscreen((boolean)true); - DisplayMode displayMode = Display.getDisplayMode(); - this.d = Math.max(1, displayMode.getWidth()); - this.e = Math.max(1, displayMode.getHeight()); - } else { - Display.setDisplayMode((DisplayMode)new DisplayMode(this.d, this.e)); - } - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - private void ar() { - g.a a2 = Namepipe.g.a(); - if (a2 != Namepipe.g_a.d) { - InputStream inputStream = null; - InputStream inputStream2 = null; - try { - inputStream = this.aE.c(new kk("icons/icon_16x16.png")); - inputStream2 = this.aE.c(new kk("icons/icon_32x32.png")); - if (inputStream != null && inputStream2 != null) { - Display.setIcon((ByteBuffer[])new ByteBuffer[]{this.a(inputStream), this.a(inputStream2)}); - } - } - catch (IOException err) { - L.error("Couldn't set icon", (Throwable)err); - } - finally { - IOUtils.closeQuietly((InputStream)inputStream); - IOUtils.closeQuietly((InputStream)inputStream2); - } - } - } - - private static boolean as() { - String[] arrstring; - for (String string : arrstring = new String[]{"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"}) { - String string2 = System.getProperty(string); - if (string2 == null || !string2.contains("64")) continue; - return true; - } - return false; - } - - public bnq b() { - return this.aJ; - } - - public String c() { - return this.an; - } - - public String d() { - return this.ao; - } - - private void at() { - Thread thread = new Thread("Timer hack thread"){ - - @Override - public void run() { - while (bcc.this.C) { - try { - Thread.sleep(Integer.MAX_VALUE); - } - catch (InterruptedException var1_1) {} - } - } - }; - thread.setDaemon(true); - thread.start(); - } - - public void a(b b2) { - this.X = true; - this.Y = b2; - } - - public void c(b b2) { - File file = new File(bcc.z().w, "crash-reports"); - File file2 = new File(file, "crash-" + new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(new Date()) + "-client.txt"); - kn.a(b2.e()); - if (b2.f() != null) { - kn.a("#@!@# Game crashed! Crash report saved to: #@!@# " + b2.f()); - System.exit(-1); - } else if (b2.a(file2)) { - kn.a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); - System.exit(-1); - } else { - kn.a("#@?@# Game crashed! Crash report could not be saved. #@?@#"); - System.exit(-2); - } - } - - public boolean e() { - return this.aG.a() || this.u.aD; - } - - public void f() { - ArrayList arrayList = Lists.newArrayList(this.aD); - if (this.al != null) { - this.al.b(); - } - for (bwh.a a2 : this.aF.d()) { - arrayList.add(a2.c()); - } - if (this.aF.f() != null) { - arrayList.add(this.aF.f()); - } - try { - this.aB.a(arrayList); - } - catch (RuntimeException err) { - L.info("Caught error stitching, removing all assigned resourcepacks", (Throwable)err); - arrayList.clear(); - arrayList.addAll(this.aD); - this.aF.a(Collections.emptyList()); - this.aB.a(arrayList); - this.u.k.clear(); - this.u.l.clear(); - this.u.b(); - } - this.aG.a(arrayList); - if (this.g != null) { - this.g.a(); - } - } - - private ByteBuffer a(InputStream inputStream) throws IOException { - BufferedImage bufferedImage = ImageIO.read(inputStream); - int[] arrn = bufferedImage.getRGB(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), null, 0, bufferedImage.getWidth()); - ByteBuffer byteBuffer = ByteBuffer.allocate(4 * arrn.length); - for (int n2 : arrn) { - byteBuffer.putInt(n2 << 8 | n2 >> 24 & 255); - } - byteBuffer.flip(); - return byteBuffer; - } - - private void au() throws LWJGLException { - HashSet hashSet = Sets.newHashSet(); - Collections.addAll(hashSet, Display.getAvailableDisplayModes()); - DisplayMode displayMode = Display.getDesktopDisplayMode(); - if (!hashSet.contains((Object)displayMode) && Namepipe.g.a() == Namepipe.g_a.d) { - block0 : for (DisplayMode displayMode2 : N) { - boolean bl2 = true; - for (DisplayMode displayMode32 : hashSet) { - if (displayMode32.getBitsPerPixel() != 32 || displayMode32.getWidth() != displayMode2.getWidth() || displayMode32.getHeight() != displayMode2.getHeight()) continue; - bl2 = false; - break; - } - if (bl2) continue; - for (DisplayMode displayMode32 : hashSet) { - if (displayMode32.getBitsPerPixel() != 32 || displayMode32.getWidth() != displayMode2.getWidth() / 2 || displayMode32.getHeight() != displayMode2.getHeight() / 2) continue; - displayMode = displayMode32; - continue block0; - } - } - } - Display.setDisplayMode((DisplayMode)displayMode); - this.d = displayMode.getWidth(); - this.e = displayMode.getHeight(); - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - private void a(bvf bvf2) throws LWJGLException { - bcu bcu2 = new bcu(this); - int n2 = bcu2.e(); - bnq bnq2 = new bnq(bcu2.a() * n2, bcu2.b() * n2, true); - bnq2.a(false); - bnf.n(5889); - bnf.F(); - bnf.a(0.0, bcu2.a(), bcu2.b(), 0.0, 1000.0, 3000.0); - bnf.n(5888); - bnf.F(); - bnf.c(0.0f, 0.0f, -2000.0f); - bnf.g(); - bnf.p(); - bnf.j(); - bnf.y(); - InputStream inputStream = null; - try { - inputStream = this.aE.a(M); - this.aN = bvf2.a("logo", new buu(ImageIO.read(inputStream))); - bvf2.a(this.aN); - } - catch (IOException err) { - L.error("Unable to load logo: " + M, (Throwable)err); - } - finally { - IOUtils.closeQuietly((InputStream)inputStream); - } - bnr bnr2 = bnr.a(); - bmw bmw2 = bnr2.c(); - bmw2.a(7, bvm.i); - bmw2.b(0.0, (double)this.e, 0.0).a(0.0, 0.0).b(255, 255, 255, 255).d(); - bmw2.b((double)this.d, (double)this.e, 0.0).a(0.0, 0.0).b(255, 255, 255, 255).d(); - bmw2.b((double)this.d, 0.0, 0.0).a(0.0, 0.0).b(255, 255, 255, 255).d(); - bmw2.b(0.0, 0.0, 0.0).a(0.0, 0.0).b(255, 255, 255, 255).d(); - bnr2.b(); - bnf.c(1.0f, 1.0f, 1.0f, 1.0f); - int n3 = 256; - int n4 = 256; - this.a((bcu2.a() - n3) / 2, (bcu2.b() - n4) / 2, 0, 0, n3, n4, 255, 255, 255, 255); - bnf.g(); - bnf.p(); - bnq2.e(); - bnq2.c(bcu2.a() * n2, bcu2.b() * n2); - bnf.e(); - bnf.a(516, 0.1f); - this.i(); - } - - public void a(int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11) { - float f2 = 0.00390625f; - float f3 = 0.00390625f; - bmw bmw2 = bnr.a().c(); - bmw2.a(7, bvm.i); - bmw2.b((double)n2, (double)(n3 + n7), 0.0).a((float)n4 * f2, (float)(n5 + n7) * f3).b(n8, n9, n10, n11).d(); - bmw2.b((double)(n2 + n6), (double)(n3 + n7), 0.0).a((float)(n4 + n6) * f2, (float)(n5 + n7) * f3).b(n8, n9, n10, n11).d(); - bmw2.b((double)(n2 + n6), (double)n3, 0.0).a((float)(n4 + n6) * f2, (float)n5 * f3).b(n8, n9, n10, n11).d(); - bmw2.b((double)n2, (double)n3, 0.0).a((float)n4 * f2, (float)n5 * f3).b(n8, n9, n10, n11).d(); - bnr.a().b(); - } - - public azj g() { - return this.aq; - } - - public void a(bey bey2) { - if (this.m != null) { - this.m.m(); - } - if (bey2 == null && this.f == null) { - bey2 = new bff(); - } else if (bey2 == null && this.h.bQ() <= 0.0f) { - bey2 = new bej(null); - } - if (bey2 instanceof bff || bey2 instanceof bgo) { - this.u.ar = false; - this.r.d().a(); - } - this.m = bey2; - if (bey2 != null) { - this.p(); - bbz.b(); - while (Mouse.next()) { - } - while (Keyboard.next()) { - } - bcu bcu2 = new bcu(this); - int n2 = bcu2.a(); - int n3 = bcu2.b(); - bey2.a(this, n2, n3); - this.s = false; - } else { - this.aL.e(); - this.o(); - } - } - - private void a(String string) { - if (!this.W) { - return; - } - int n2 = bnf.L(); - if (n2 != 0) { - String string2 = GLU.gluErrorString((int)n2); - L.error("########## GL ERROR ##########"); - L.error("@ " + string); - L.error("" + n2 + ": " + string2); - } - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - public void h() { - try { - L.info("Stopping!"); - try { - this.a((bkr)null); - } - catch (Throwable var1_1) { - // empty catch block - } - this.aL.d(); - } - finally { - Display.destroy(); - if (!this.X) { - System.exit(0); - } - } - System.gc(); - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - private void av() { - long l2 = System.nanoTime(); - this.B.a("root"); - if (Display.isCreated() && Display.isCloseRequested()) { - this.n(); - } - if (this.ah && this.f != null) { - float f2 = this.timer.c; - this.timer.a(); - this.timer.c = f2; - - // Cubitick - float rptw = this.timerWorld.c; //renderPartialTicks; - this.timerWorld.a(); //updateTimer(); - this.timerWorld.c = rptw; - } else { - this.timer.a(); - - // Cubitick - this.timerWorld.a(); - } - - // Cubitick : reset tickrates upon loading a new world - // theWorld : f - if(this.f == null && Cubitick.tickrateWorld != Cubitick.tickrate) - { - Cubitick.setTickWorld(Cubitick.tickrate); - Cubitick.synctick = false; - } - else if(this.f != null) - { - // Cubitick : World init - if(!Cubitick.initialised && tickcounter > 100) Cubitick.instance.checkVersion(); - } - - this.B.a("scheduledExecutables"); - Queue f2 = this.aQ; - synchronized (f2) { - while (!this.aQ.isEmpty()) { - Namepipe.g.a(this.aQ.poll(), L); - } - } - this.B.b(); - long l3 = System.nanoTime(); - this.B.a("tick"); - - /* - for (int i2 = 0; i2 < this.aa.b; ++i2) { - this.t(); - } - */ - - // Cubitick - if(Cubitick.synctick) - { - // original runTick() call (with added tickcounter increment) - // elapsedTicks : b - for(int i = 0; i < this.timerWorld.b; ++i) - { - // isGamePaused : ah - if(!this.ah) this.tickcounter++; - this.t(); - } - } - else - { - int worldTicks = this.timerWorld.b; - int playerTicks = this.timer.b; - - while(playerTicks > 0 && worldTicks > 0) - { - if(!this.ah) this.tickcounter++; - this.t(); - playerTicks--; worldTicks--; - } - - while(playerTicks > 0) - { - this.runTickPlayer(); - playerTicks--; - } - - while(worldTicks > 0) - { - if(!this.ah) this.tickcounter++; - this.runTickWorld(); - worldTicks--; - } - } - - this.B.c("preRenderErrors"); - long l4 = System.nanoTime() - l3; - this.a("Pre render"); - this.B.c("sound"); - this.aL.a(this.h, this.timerWorld.c); - this.B.b(); - this.B.a("render"); - bnf.G(); - bnf.m(16640); - this.aJ.a(true); - this.B.a("display"); - bnf.y(); - this.B.b(); - if (!this.s) { - this.B.c("gameRenderer"); - this.o.a(this.timerWorld.c, l2); - this.B.b(); - } - this.B.b(); - if (this.u.ar && this.u.as && !this.u.ap) { - if (!this.B.a) { - this.B.a(); - } - this.B.a = true; - this.a(l4); - } else { - this.B.a = false; - this.K = System.nanoTime(); - } - this.q.a(); - this.aJ.e(); - bnf.H(); - bnf.G(); - this.aJ.c(this.d, this.e); - bnf.H(); - bnf.G(); - this.o.b(this.timer.c); // entityRenderer - bnf.H(); - this.B.a("root"); - this.i(); - Thread.yield(); - this.a("Post render"); - ++this.J; - this.ah = this.E() && this.m != null && this.m.d() && !this.al.a(); - long l5 = System.nanoTime(); - this.z.a(l5 - this.A); - this.A = l5; - while (bcc.I() >= this.I + 1000) { - ar = this.J; - Object[] arrobject = new Object[8]; - arrobject[0] = ar; - arrobject[1] = bqc.a; - arrobject[2] = bqc.a != 1 ? "s" : ""; - arrobject[3] = (float)this.u.g == Namepipe.bce_a.i.f() ? "inf" : Integer.valueOf(this.u.g); - arrobject[4] = this.u.t ? " vsync" : ""; - arrobject[5] = this.u.i ? "" : " fast"; - arrobject[6] = this.u.h == 0 ? "" : (this.u.h == 1 ? " fast-clouds" : " fancy-clouds"); - arrobject[7] = bze.f() ? " vbo" : ""; - this.D = String.format("%d fps (%d chunk update%s) T: %s%s%s%s%s", arrobject); - bqc.a = 0; - this.I += 1000; - this.J = 0; - this.ab.b(); - if (this.ab.d()) continue; - this.ab.a(); - } - if (this.l()) { - this.B.a("fpslimit_wait"); - Display.sync((int)this.k()); - this.B.b(); - } - this.B.b(); - } - - public void i() { - this.B.a("display_update"); - Display.update(); - this.B.b(); - this.j(); - } - - protected void j() { - if (!this.V && Display.wasResized()) { - int n2 = this.d; - int n3 = this.e; - this.d = Display.getWidth(); - this.e = Display.getHeight(); - if (this.d != n2 || this.e != n3) { - if (this.d <= 0) { - this.d = 1; - } - if (this.e <= 0) { - this.e = 1; - } - this.a(this.d, this.e); - } - } - } - - public int k() { - if (this.f == null && this.m != null) { - return 30; - } - return this.u.g; - } - - public boolean l() { - return (float)this.k() < Namepipe.bce_a.i.f(); - } - - public void m() { - try { - b = new byte[0]; - this.g.l(); - } - catch (Throwable var1_1) { - // empty catch block - } - try { - System.gc(); - this.a((bkr)null); - } - catch (Throwable var1_2) { - // empty catch block - } - System.gc(); - } - - private void b(int n2) { - List list = this.B.b(this.aW); - if (list == null || list.isEmpty()) { - return; - } - oo.a a2 = list.remove(0); - if (n2 == 0) { - int n3; - if (!a2.c.isEmpty() && (n3 = this.aW.lastIndexOf(".")) >= 0) { - this.aW = this.aW.substring(0, n3); - } - } else if (--n2 < list.size() && !list.get((int)n2).c.equals("unspecified")) { - if (!this.aW.isEmpty()) { - this.aW = this.aW + "."; - } - this.aW = this.aW + list.get((int)n2).c; - } - } - - private void a(long l2) { - int n2; - if (!this.B.a) { - return; - } - List list = this.B.b(this.aW); - oo.a a2 = list.remove(0); - bnf.m(256); - bnf.n(5889); - bnf.h(); - bnf.F(); - bnf.a(0.0, this.d, this.e, 0.0, 1000.0, 3000.0); - bnf.n(5888); - bnf.F(); - bnf.c(0.0f, 0.0f, -2000.0f); - bnf.d(1.0f); - bnf.z(); - bnr bnr2 = bnr.a(); - bmw bmw2 = bnr2.c(); - int n3 = 160; - int n4 = this.d - n3 - 10; - int n5 = this.e - n3 * 2; - bnf.m(); - bmw2.a(7, bvm.f); - bmw2.b((double)((float)n4 - (float)n3 * 1.1f), (double)((float)n5 - (float)n3 * 0.6f - 16.0f), 0.0).b(200, 0, 0, 0).d(); - bmw2.b((double)((float)n4 - (float)n3 * 1.1f), (double)(n5 + n3 * 2), 0.0).b(200, 0, 0, 0).d(); - bmw2.b((double)((float)n4 + (float)n3 * 1.1f), (double)(n5 + n3 * 2), 0.0).b(200, 0, 0, 0).d(); - bmw2.b((double)((float)n4 + (float)n3 * 1.1f), (double)((float)n5 - (float)n3 * 0.6f - 16.0f), 0.0).b(200, 0, 0, 0).d(); - bnr2.b(); - bnf.l(); - double d2 = 0.0; - for (int i2 = 0; i2 < list.size(); ++i2) { - float f2; - int n6; - float f3; - float f4; - oo.a profilerResult = list.get(i2); - n2 = on.c(profilerResult.a / 4.0) + 1; - bmw2.a(6, bvm.f); - int n7 = profilerResult.a(); - int n8 = n7 >> 16 & 255; - int n9 = n7 >> 8 & 255; - int n10 = n7 & 255; - bmw2.b((double)n4, (double)n5, 0.0).b(n8, n9, n10, 255).d(); - for (n6 = n2; n6 >= 0; --n6) { - f2 = (float)((d2 + profilerResult.a * (double)n6 / (double)n2) * 6.2831854820251465 / 100.0); - f4 = on.a(f2) * (float)n3; - f3 = on.b(f2) * (float)n3 * 0.5f; - bmw2.b((double)((float)n4 + f4), (double)((float)n5 - f3), 0.0).b(n8, n9, n10, 255).d(); - } - bnr2.b(); - bmw2.a(5, bvm.f); - for (n6 = n2; n6 >= 0; --n6) { - f2 = (float)((d2 + profilerResult.a * (double)n6 / (double)n2) * 6.2831854820251465 / 100.0); - f4 = on.a(f2) * (float)n3; - f3 = on.b(f2) * (float)n3 * 0.5f; - bmw2.b((double)((float)n4 + f4), (double)((float)n5 - f3), 0.0).b(n8 >> 1, n9 >> 1, n10 >> 1, 255).d(); - bmw2.b((double)((float)n4 + f4), (double)((float)n5 - f3 + 10.0f), 0.0).b(n8 >> 1, n9 >> 1, n10 >> 1, 255).d(); - } - bnr2.b(); - d2 += profilerResult.a; - } - DecimalFormat decimalFormat = new DecimalFormat("##0.00"); - bnf.y(); - String object = ""; - if (!a2.c.equals("unspecified")) { - object = (String)object + "[0] "; - } - object = a2.c.isEmpty() ? (String)object + "ROOT " : (String)object + a2.c + " "; - n2 = 16777215; - this.k.a((String)object, (float)(n4 - n3), (float)(n5 - n3 / 2 - 16), n2); - object = decimalFormat.format(a2.b) + "%"; - this.k.a((String)object, (float)(n4 + n3 - this.k.a((String)object)), (float)(n5 - n3 / 2 - 16), n2); - for (int i3 = 0; i3 < list.size(); ++i3) { - oo.a a3 = list.get(i3); - String string = ""; - string = a3.c.equals("unspecified") ? string + "[?] " : string + "[" + (i3 + 1) + "] "; - string = string + a3.c; - this.k.a(string, (float)(n4 - n3), (float)(n5 + n3 / 2 + i3 * 8 + 20), a3.a()); - string = decimalFormat.format(a3.a) + "%"; - this.k.a(string, (float)(n4 + n3 - 50 - this.k.a(string)), (float)(n5 + n3 / 2 + i3 * 8 + 20), a3.a()); - string = decimalFormat.format(a3.b) + "%"; - this.k.a(string, (float)(n4 + n3 - this.k.a(string)), (float)(n5 + n3 / 2 + i3 * 8 + 20), a3.a()); - } - } - - public void n() { - this.C = false; - } - - public void o() { - if (!Display.isActive()) { - return; - } - if (this.x) { - return; - } - if (!a) { - bbz.a(); - } - this.x = true; - this.v.a(); - this.a((bey)null); - this.ai = 10000; - } - - public void p() { - if (!this.x) { - return; - } - this.x = false; - this.v.b(); - } - - public void q() { - if (this.m != null) { - return; - } - this.a(new beu()); - if (this.E() && !this.al.a()) { - this.aL.a(); - } - } - - private void b(boolean bl2) { - if (!bl2) { - this.ai = 0; - } - if (this.ai > 0 || this.h.cs()) { - return; - } - if (bl2 && this.t != null && this.t.a == Namepipe.bbf_a.b) { - cj cj2 = this.t.a(); - if (this.f.o(cj2).a() != axd.a && this.c.b(cj2, this.t.b)) { - this.j.a(cj2, this.t.b); - this.h.a(qm.a); - } - return; - } - this.c.c(); - } - - private void aw() { - if (this.ai > 0) { - return; - } - if (this.t == null) { - L.error("Null returned as 'hitResult', this shouldn't happen!"); - if (this.c.g()) { - this.ai = 10; - } - return; - } - if (this.h.M()) { - return; - } - switch (this.t.a) { - case c: { - this.c.a(this.h, this.t.d); - break; - } - case b: { - cj cj2 = this.t.a(); - if (this.f.o(cj2).a() != axd.a) { - this.c.a(cj2, this.t.b); - break; - } - } - default: { - if (this.c.g()) { - this.ai = 10; - } - this.h.cZ(); - } - } - this.h.a(qm.a); - } - - private void ax() { - if (this.c.m()) { - return; - } - this.as = 4; - if (this.h.M()) { - return; - } - for (qm qm2 : qm.values()) { - Object object; - adq adq2 = this.h.b(qm2); - if (this.t == null) { - L.warn("Null returned as 'hitResult', this shouldn't happen!"); - } else { - switch (this.t.a) { - case c: { - if (this.c.a(this.h, this.t.d, this.t, this.h.b(qm2), qm2) == qo.a) { - return; - } - if (this.c.a((zj)this.h, this.t.d, this.h.b(qm2), qm2) != qo.a) break; - return; - } - case b: { - object = this.t.a(); - if (this.f.o((cj)object).a() == axd.a) break; - int n2 = adq2 != null ? adq2.b : 0; - qo qo2 = this.c.a(this.h, this.f, adq2, (cj)object, this.t.b, this.t.c, qm2); - if (qo2 != qo.a) break; - this.h.a(qm2); - if (adq2 != null) { - if (adq2.b == 0) { - this.h.a(qm2, null); - } else if (adq2.b != n2 || this.c.h()) { - this.o.c.a(qm2); - } - } - return; - } - } - } - object = this.h.b(qm2); - if (object == null || this.c.a((zj)this.h, this.f, (adq)object, qm2) != qo.a) continue; - this.o.c.a(qm2); - return; - } - } - - public void r() { - try { - this.u.s = this.V = !this.V; - if (this.V) { - this.au(); - this.d = Display.getDisplayMode().getWidth(); - this.e = Display.getDisplayMode().getHeight(); - if (this.d <= 0) { - this.d = 1; - } - if (this.e <= 0) { - this.e = 1; - } - } else { - Display.setDisplayMode((DisplayMode)new DisplayMode(this.aj, this.ak)); - this.d = this.aj; - this.e = this.ak; - if (this.d <= 0) { - this.d = 1; - } - if (this.e <= 0) { - this.e = 1; - } - } - if (this.m != null) { - this.a(this.d, this.e); - } else { - this.ay(); - } - Display.setFullscreen((boolean)this.V); - Display.setVSyncEnabled((boolean)this.u.t); - this.i(); - } - catch (Exception err) { - L.error("Couldn't toggle fullscreen", (Throwable)err); - } - } - - private void a(int n2, int n3) { - this.d = Math.max(1, n2); - this.e = Math.max(1, n3); - if (this.m != null) { - bcu bcu2 = new bcu(this); - this.m.b(this, bcu2.a(), bcu2.b()); - } - this.n = new bcf(this); - this.ay(); - } - - private void ay() { - this.aJ.a(this.d, this.e); - if (this.o != null) { - this.o.a(this.d, this.e); - } - } - - public bys s() { - return this.aM; - } - - - public void runTickPlayer() { - if (this.as > 0) { - --this.as; - } - this.B.a("gui"); - if (!this.ah) { - this.r.c(); // ingameGUI.updateTick(); - } - this.B.b(); - this.o.a(1.0f); // entityRenderer.getMouseOver(1.0F); - this.B.a("gameMode"); - if (!this.ah && this.f != null) { - this.c.e(); // playerController.updateController(); - } - this.B.c("textures"); - if (!this.ah) { - this.S.e(); // renderEngine.tick(); - } - if (this.m == null && this.h != null) { - if (this.h.bQ() <= 0.0f && !(this.m instanceof bej)) { // thePlayer.getHealth() <= 0.0F - this.a((bey)null); - } else if (this.h.cl() && this.f != null) { // thePlayer.isPlayerSleeping() - this.a(new bep()); - } - } else if (this.m != null && this.m instanceof bep && !this.h.cl()) { - this.a((bey)null); // displayGuiScreen((GuiScreen)null); - } - if (this.m != null) { - this.ai = 10000; - } - if (this.m != null) { - try { - this.m.p(); // currentScreen.handleInput(); - } - catch (Throwable err) { - b b2 = Namepipe.b.a(err, "Updating screen events"); - c c2 = b2.a("Affected screen"); - c2.a("Screen name", new Callable(){ - - public String a() throws Exception { - return bcc.this.m.getClass().getCanonicalName(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - throw new e(b2); - } - if (this.m != null) { - try { - this.m.e(); // currentScreen.updateScreen(); - } - catch (Throwable err) { - b b3 = Namepipe.b.a(err, "Ticking screen"); - c c3 = b3.a("Affected screen"); - c3.a("Screen name", new Callable(){ - - public String a() throws Exception { - return bcc.this.m.getClass().getCanonicalName(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - throw new e(b3); - } - } - } - if (this.m == null || this.m.p) { - this.B.c("mouse"); - this.aB(); // mouse input is now handled in its own method - if (this.ai > 0) { - --this.ai; - } - this.B.c("keyboard"); - this.az(); // keyboard input is now handled in its own method - } - - if (this.f != null) { - - // Cubitick - // if(!this.isGamePaused) this.theWorld.updateEntity(thePlayer); - if(!this.ah) this.f.g(this.h); - - if (this.h != null) { - ++this.av; // this.joinPlayerCounter++; - if (this.av == 30) { - this.av = 0; - this.f.h(this.h); - } - } - - this.B.c("gameRenderer"); - if (!this.ah) { - this.o.e(); // entityRenderer.updateRenderer(); - } - this.B.c("levelRenderer"); - } - - // PacketAnalysis: rerender - if(scheduledReload){ - this.g.a(); - scheduledReload = false; - } - - if (!this.ah) { - this.aM.c(); // mcMusicTicker.update(); - this.aL.c(); // mcSoundHandler.update(); - } - } - - public void runTickWorld() - { - if (this.f != null) { - if (this.h != null) { - ++this.av; // this.joinPlayerCounter++; - if (this.av == 30) { - this.av = 0; - this.f.h(this.h); - } - } - this.B.c("gameRenderer"); - if (!this.ah) { - //this.o.e(); // this.entityRenderer.updateRenderer(); - } - this.B.c("levelRenderer"); - if (!this.ah) { - this.g.k(); // renderGlobal.updateClouds(); - } - this.B.c("level"); - - if (!this.ah) { - if (this.f.ag() > 0) { - this.f.d(this.f.ag() - 1); // theWorld.setLastLightningBolt(..) - } - - // Cubitick: temporarily remove player from world.loadedEntityList - this.f.e.remove(this.h); - this.f.k(); // original updateEntities(); - this.f.e.add(this.h); - } - } else if (this.o.a()) { - this.o.b(); - } - if (!this.ah) { - this.aM.c(); // mcMusicTicker.update(); - this.aL.c(); // mcSoundHandler.update(); - } - if (this.f != null) { - if (!this.ah) { - // theWorld.setAllowedSpawnTypes(this.theWorld.getDifficulty() != EnumDifficulty.PEACEFUL, true); - this.f.a(this.f.ae() != qk.a, true); - try { - this.f.d(); // theWorld.tick(); - } - catch (Throwable err) { - b b4 = Namepipe.b.a(err, "Exception in world tick"); - if (this.f == null) { - c c4 = b4.a("Affected level"); - c4.a("Problem", "Level is null!"); - } else { - this.f.a(b4); - } - throw new e(b4); - } - } - this.B.c("animateTick"); - if (!this.ah && this.f != null) { - this.f.b(on.c(this.h.p), on.c(this.h.q), on.c(this.h.r)); // theWorld.doVoidFogParticles(..) - } - this.B.c("particles"); - if (!this.ah) { - this.j.a(); // effectRenderer.updateEffects(); - } - } else if (this.ay != null) { - this.B.c("pendingConnection"); - this.ay.a(); // myNetworkManager.processReceivedPackets(); - } - this.B.b(); - this.y = bcc.I(); // systemTime = getSystemTime(); - } - - - // runTick() - public void t() { - if (this.as > 0) { - --this.as; - } - this.B.a("gui"); - if (!this.ah) { - this.r.c(); - } - this.B.b(); - this.o.a(1.0f); - this.B.a("gameMode"); - if (!this.ah && this.f != null) { - this.c.e(); - } - this.B.c("textures"); - if (!this.ah) { - this.S.e(); - } - if (this.m == null && this.h != null) { - if (this.h.bQ() <= 0.0f && !(this.m instanceof bej)) { - this.a((bey)null); - } else if (this.h.cl() && this.f != null) { - this.a(new bep()); - } - } else if (this.m != null && this.m instanceof bep && !this.h.cl()) { - this.a((bey)null); - } - if (this.m != null) { - this.ai = 10000; - } - if (this.m != null) { - try { - this.m.p(); - } - catch (Throwable err) { - b b2 = Namepipe.b.a(err, "Updating screen events"); - c c2 = b2.a("Affected screen"); - c2.a("Screen name", new Callable(){ - - public String a() throws Exception { - return bcc.this.m.getClass().getCanonicalName(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - throw new e(b2); - } - if (this.m != null) { - try { - this.m.e(); - } - catch (Throwable err) { - b b3 = Namepipe.b.a(err, "Ticking screen"); - c c3 = b3.a("Affected screen"); - c3.a("Screen name", new Callable(){ - - public String a() throws Exception { - return bcc.this.m.getClass().getCanonicalName(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - throw new e(b3); - } - } - } - if (this.m == null || this.m.p) { - this.B.c("mouse"); - this.aB(); - if (this.ai > 0) { - --this.ai; - } - this.B.c("keyboard"); - this.az(); - } - if (this.f != null) { - if (this.h != null) { - ++this.av; - if (this.av == 30) { - this.av = 0; - this.f.h(this.h); - } - } - this.B.c("gameRenderer"); - if (!this.ah) { - this.o.e(); - } - this.B.c("levelRenderer"); - if (!this.ah) { - this.g.k(); - } - this.B.c("level"); - if (!this.ah) { - if (this.f.ag() > 0) { - this.f.d(this.f.ag() - 1); - } - this.f.k(); - } - } else if (this.o.a()) { - this.o.b(); - } - if (!this.ah) { - this.aM.c(); - this.aL.c(); - } - if (this.f != null) { - if (!this.ah) { - this.f.a(this.f.ae() != qk.a, true); - try { - this.f.d(); - } - catch (Throwable err) { - b b4 = Namepipe.b.a(err, "Exception in world tick"); - if (this.f == null) { - c c4 = b4.a("Affected level"); - c4.a("Problem", "Level is null!"); - } else { - this.f.a(b4); - } - throw new e(b4); - } - } - this.B.c("animateTick"); - if (!this.ah && this.f != null) { - this.f.b(on.c(this.h.p), on.c(this.h.q), on.c(this.h.r)); - } - this.B.c("particles"); - if (!this.ah) { - this.j.a(); - } - } else if (this.ay != null) { - this.B.c("pendingConnection"); - this.ay.a(); - } - this.B.b(); - this.y = bcc.I(); - } - - private void az() { - while (Keyboard.next()) { - int n2; - boolean bl2; - int n3 = n2 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); - if (this.aA > 0) { - if (bcc.I() - this.aA >= 6000) { - throw new e(new b("Manually triggered debug crash", new Throwable())); - } - if (!Keyboard.isKeyDown((int)46) || !Keyboard.isKeyDown((int)61)) { - this.aA = -1; - } - } else if (Keyboard.isKeyDown((int)46) && Keyboard.isKeyDown((int)61)) { - this.aV = true; - this.aA = bcc.I(); - } - this.W(); - if (this.m != null) { - this.m.l(); - } - if (bl2 = Keyboard.getEventKeyState()) { - if (n2 == 62 && this.o != null) { - this.o.c(); - } - boolean bl3 = false; - if (this.m == null) { - if (n2 == 1) { - this.q(); - } - bl3 = Keyboard.isKeyDown((int)61) && this.c(n2); - this.aV |= bl3; - if (n2 == 59) { - boolean bl4 = this.u.ap = !this.u.ap; - } - } - if (bl3) { - bbz.a(n2, false); - } else { - bbz.a(n2, true); - bbz.a(n2); - } - if (!this.u.as) continue; - if (n2 == 11) { - this.b(0); - } - for (int i2 = 0; i2 < 9; ++i2) { - if (n2 != 2 + i2) continue; - this.b(i2 + 1); - } - continue; - } - bbz.a(n2, false); - if (n2 != 61) continue; - if (this.aV) { - this.aV = false; - continue; - } - this.u.ar = !this.u.ar; - this.u.as = this.u.ar && bey.r(); - this.u.at = this.u.ar && bey.s(); - } - this.aA(); - } - - private boolean c(int n2) { - if (n2 == 30) { - this.g.a(); - this.a("Reloading all chunks", new Object[0]); - return true; - } - if (n2 == 48) { - boolean bl2 = !this.ac.b(); - this.ac.b(bl2); - Object[] arrobject = new Object[1]; - arrobject[0] = bl2 ? "shown" : "hidden"; - this.a("Hitboxes: {0}", arrobject); - return true; - } - if (n2 == 32) { - if (this.r != null) { - this.r.d().a(); - } - return true; - } - if (n2 == 33) { - this.u.a(Namepipe.bce_a.f, bey.r() ? -1 : 1); - this.a("RenderDistance: {0}", this.u.c); - return true; - } - if (n2 == 35) { - this.u.x = !this.u.x; - Object[] arrobject = new Object[1]; - arrobject[0] = this.u.x ? "shown" : "hidden"; - this.a("Advanced tooltips: {0}", arrobject); - this.u.b(); - return true; - } - if (n2 == 49) { - if (!this.h.a(2, "")) { - this.a("Unable to switch gamemode, no permission", new Object[0]); - } else if (this.h.l_()) { - this.h.g("/gamemode spectator"); - } else if (this.h.y()) { - this.h.g("/gamemode creative"); - } - return true; - } - if (n2 == 25) { - this.u.y = !this.u.y; - this.u.b(); - Object[] arrobject = new Object[1]; - arrobject[0] = this.u.y ? "enabled" : "disabled"; - this.a("PauseOnLostFocus: {0}", arrobject); - return true; - } - if (n2 == 16) { - this.a("Keybindings:", new Object[0]); - bcx bcx2 = this.r.d(); - bcx2.a(new fa("F3 + A = Reload chunks")); - bcx2.a(new fa("F3 + B = Show hitboxes")); - bcx2.a(new fa("F3 + D = Clear chat")); - bcx2.a(new fa("F3 + F = Cycle renderdistance (Shift to inverse)")); - bcx2.a(new fa("F3 + H = Advanced tooltips")); - bcx2.a(new fa("F3 + N = Cycle creative <-> spectator")); - bcx2.a(new fa("F3 + P = Pause on lost focus")); - bcx2.a(new fa("F3 + Q = Show this list")); - bcx2.a(new fa("F3 + T = Reload resourcepacks")); - return true; - } - if (n2 == 20) { - this.f(); - this.a("Reloaded resourcepacks", new Object[0]); - return true; - } - return false; - } - - private void aA() { - int n2; - while (this.u.ah.g()) { - ++this.u.aq; - if (this.u.aq > 2) { - this.u.aq = 0; - } - if (this.u.aq == 0) { - this.o.a(this.aa()); - } else if (this.u.aq == 1) { - this.o.a((rr)null); - } - this.g.o(); - } - while (this.u.ai.g()) { - this.u.av = !this.u.av; - } - for (n2 = 0; n2 < 9; ++n2) { - if (!this.u.al[n2].g()) continue; - if (this.h.y()) { - this.r.g().a(n2); - continue; - } - this.h.br.d = n2; - } - while (this.u.X.g()) { - this.v().a(new ik(ik.a.c)); - if (this.c.j()) { - this.h.D(); - continue; - } - this.a(new bgh(this.h)); - } - while (this.u.Y.g()) { - if (this.h.y()) continue; - this.v().a(new ix(ix.a.g, cj.a, cq.a)); - } - while (this.u.Z.g()) { - if (this.h.y()) continue; - this.h.a(bey.q()); - } - int n3 = n2 = this.u.m != zj.b.c ? 1 : 0; - if (n2 != 0) { - while (this.u.ad.g()) { - this.a(new beb()); - } - if (this.m == null && this.u.af.g()) { - this.a(new beb("/")); - } - } - if (this.h.cs()) { - if (!this.u.aa.e()) { - this.c.c(this.h); - } - while (this.u.ab.g()) { - } - while (this.u.aa.g()) { - } - while (this.u.ac.g()) { - } - } else { - while (this.u.ab.g()) { - this.aw(); - } - while (this.u.aa.g()) { - this.ax(); - } - while (this.u.ac.g()) { - this.aC(); - } - } - if (this.u.aa.e() && this.as == 0 && !this.h.cs()) { - this.ax(); - } - this.b(this.m == null && this.u.ab.e() && this.x); - } - - private void aB() { - while (Mouse.next()) { - long l2; - int n2 = Mouse.getEventButton(); - bbz.a(n2 - 100, Mouse.getEventButtonState()); - if (Mouse.getEventButtonState()) { - if (this.h.y() && n2 == 2) { - this.r.g().b(); - } else { - bbz.a(n2 - 100); - } - } - - // Cubitick: adjust timing - if ((l2 = bcc.I() - this.y) > (long)Math.max(200F*(Cubitick.tickrate/Cubitick.tickrateWorld), 200L)) continue; - int n3 = Mouse.getEventDWheel(); - if (n3 != 0) { - if (this.h.y()) { - int n4 = n3 = n3 < 0 ? -1 : 1; - if (this.r.g().a()) { - this.r.g().b(- n3); - } else { - float f2 = on.a(this.h.bJ.a() + (float)n3 * 0.005f, 0.0f, 0.2f); - this.h.bJ.a(f2); - } - } else { - this.h.br.f(n3); - } - } - if (this.m == null) { - if (this.x || !Mouse.getEventButtonState()) continue; - this.o(); - continue; - } - if (this.m == null) continue; - this.m.k(); - } - } - - private /* varargs */ void a(String string, Object ... arrobject) { - this.r.d().a(new fa("").a(new fa("[Debug]: ").a(new ez().a(Namepipe.a.o).a(true))).a(MessageFormat.format(string, arrobject))); - } - - public void a(String string, String string2, ahw ahw2) { - this.a((bkr)null); - System.gc(); - azh azh2 = this.aq.a(string, false); - azg azg2 = azh2.d(); - if (azg2 == null && ahw2 != null) { - azg2 = new azg(ahw2, string); - azh2.a(azg2); - } - if (ahw2 == null) { - ahw2 = new ahw(azg2); - } - try { - YggdrasilAuthenticationService yas = new YggdrasilAuthenticationService(this.ap, UUID.randomUUID().toString()); - MinecraftSessionService mss = yas.createMinecraftSessionService(); - GameProfileRepository gameProfileRepository = yas.createProfileRepository(); - mi mi2 = new mi(gameProfileRepository, new File(this.w, MinecraftServer.a.getName())); - aqo.a(mi2); - aqo.a((MinecraftSessionService)mss); - mi.a(false); - this.al = new byl(this, string, string2, ahw2, (YggdrasilAuthenticationService)yas, (MinecraftSessionService)mss, gameProfileRepository, mi2); - this.al.F(); - this.az = true; - } - catch (Throwable err) { - b b2 = Namepipe.b.a(err, "Starting integrated server"); - c c2 = b2.a("Starting integrated server"); - c2.a("Level ID", string); - c2.a("Level Name", string2); - throw new e(b2); - } - this.n.a(bwl.a("menu.loadingLevel", new Object[0])); - while (!this.al.an()) { - String str = this.al.k(); - if (str != null) { - this.n.c(bwl.a((String)str, new Object[0])); - } else { - this.n.c(""); - } - try { - Thread.sleep(200); - } - catch (InterruptedException b2) {} - } - this.a(new bew()); - SocketAddress sa = this.al.am().a(); - ek ek1 = ek.a((SocketAddress)sa); - ek1.a(new bko((ek)(ek1), this, null)); - ek1.a(new jj(109, sa.toString(), 0, el.d)); - ek1.a(new js(this.K().e())); - this.ay = ek1; - } - - public void a(bkr bkr2) { - this.a(bkr2, ""); - } - - public void a(bkr bkr2, String string) { - bkp bkp2; - if (bkr2 == null) { - bkp2 = this.v(); - if (bkp2 != null) { - bkp2.b(); - } - if (this.al != null && this.al.M()) { - this.al.x(); - } - this.al = null; - this.q.b(); - this.o.k().a(); - this.c = null; - } - this.af = null; - this.ay = null; - if (this.n != null) { - this.n.b(string); - this.n.c(""); - } - if (bkr2 == null && this.f != null) { - this.aF.g(); - this.r.i(); - this.a((bku)null); - this.az = false; - } - this.aL.b(); - this.f = bkr2; - if (this.g != null) { - this.g.a(bkr2); - } - if (this.j != null) { - this.j.a(bkr2); - } - bpj.a.a(bkr2); - if (bkr2 != null) { - if (!this.az) { - YggdrasilAuthenticationService yas = new YggdrasilAuthenticationService(this.ap, UUID.randomUUID().toString()); - MinecraftSessionService minecraftSessionService = yas.createMinecraftSessionService(); - GameProfileRepository gameProfileRepository = yas.createProfileRepository(); - mi mi2 = new mi(gameProfileRepository, new File(this.w, MinecraftServer.a.getName())); - aqo.a(mi2); - aqo.a(minecraftSessionService); - mi.a(false); - } - if (this.h == null) { - this.h = this.c.a(bkr2, new nu()); - this.c.b(this.h); - } - this.h.S(); - bkr2.a(this.h); - this.h.e = new bmp(this.u); - this.c.a(this.h); - this.af = this.h; - } else { - this.aq.d(); - this.h = null; - } - System.gc(); - this.y = 0; - } - - public void a(int n2) { - this.f.h(); - this.f.c(); - int n3 = 0; - String string = null; - if (this.h != null) { - n3 = this.h.O(); - this.f.e(this.h); - string = this.h.E(); - } - this.af = null; - bmq bmq2 = this.h; - this.h = this.c.a(this.f, this.h == null ? new nu() : this.h.G()); - this.h.R().a(bmq2.R().c()); - this.h.am = n2; - this.af = this.h; - this.h.S(); - this.h.h(string); - this.f.a(this.h); - this.c.b(this.h); - this.h.e = new bmp(this.u); - this.h.f(n3); - this.c.a(this.h); - this.h.m(bmq2.cX()); - if (this.m instanceof bej) { - this.a((bey)null); - } - } - - public final boolean u() { - return this.ax; - } - - public bkp v() { - if (this.h != null) { - return this.h.d; - } - return null; - } - - public static boolean w() { - return T == null || !bcc.T.u.ap; - } - - public static boolean x() { - return T != null && bcc.T.u.i; - } - - public static boolean y() { - return T != null && bcc.T.u.j != 0; - } - - private void aC() { - adq adq2; - if (this.t == null || this.t.a == Namepipe.bbf_a.a) { - return; - } - boolean bl2 = this.h.bJ.d; - apv apv2 = null; - if (this.t.a == Namepipe.bbf_a.b) { - cj cj1 = this.t.a(); - arc arc1 = this.f.o((cj)cj1); - ajt ajt2 = arc1.t(); - if (arc1.a() == axd.a) { - return; - } - adq2 = ajt2.a((aht)this.f, (cj)cj1, (arc)arc1); - if (adq2 == null) { - return; - } - if (bl2 && bey.q() && ajt2.m()) { - apv2 = this.f.r((cj)cj1); - } - } else if (this.t.a == Namepipe.bbf_a.c && this.t.d != null && bl2) { - if (this.t.d instanceof xu) { - adq2 = new adq(ads.ap); - } else if (this.t.d instanceof xt) { - adq2 = new adq(ads.cx); - } else if (this.t.d instanceof xs) { - xs object = (xs)this.t.d; - adq object2 = object.r(); - adq2 = object2 == null ? new adq(ads.bZ) : adq.c((adq)object2); - } else if (this.t.d instanceof aah) { - aah object = (aah)this.t.d; - ado object2; - switch (object.v()) { - case c: { - object2 = ads.aV; - break; - } - case b: { - object2 = ads.aU; - break; - } - case d: { - object2 = ads.cr; - break; - } - case f: { - object2 = ads.cs; - break; - } - case g: { - object2 = ads.cz; - break; - } - default: { - object2 = ads.aB; - } - } - adq2 = new adq((ado)object2); - } else if (this.t.d instanceof aag) { - adq2 = new adq(((aag)this.t.d).j()); - } else if (this.t.d instanceof xq) { - adq2 = new adq(ads.ct); - } else if (this.t.d instanceof wt) { - adq2 = new adq(ads.cP); - } else { - String object = rt.b(this.t.d); - if (!rt.a.containsKey(object)) { - return; - } - adq2 = new adq(ads.bT); - aeu.a(adq2, (String)object); - } - } else { - return; - } - if (adq2.b() == null) { - String object = ""; - if (this.t.a == Namepipe.bbf_a.b) { - object = ajt.h.b(this.f.o(this.t.a()).t()).toString(); - } else if (this.t.a == Namepipe.bbf_a.c) { - object = rt.b(this.t.d); - } - L.warn("Picking on: [{}] {} gave null item", new Object[]{this.t.a, object}); - return; - } - zi object = this.h.br; - if (apv2 != null) { - this.a(adq2, apv2); - } - int n2 = object.b(adq2); - if (bl2) { - object.a(adq2); - this.c.a(this.h.b(qm.a), 36 + object.d); - } else if (n2 != -1) { - if (zi.e(n2)) { - object.d = n2; - } else { - this.c.a(n2); - } - } - } - - private adq a(adq adq2, apv apv2) { - dn dn2 = new dn(); - apv2.b(dn2); - if (adq2.b() == ads.ch && dn2.e("Owner")) { - dn dn3 = dn2.o("Owner"); - dn dn4 = new dn(); - dn4.a("SkullOwner", dn3); - adq2.d(dn4); - return adq2; - } - adq2.a("BlockEntityTag", dn2); - dn dn5 = new dn(); - du du2 = new du(); - du2.a(new ea("(+NBT)")); - dn5.a("Lore", du2); - adq2.a("display", dn5); - return adq2; - } - - public b b(b b2) { - b2.g().a("Launched Version", new Callable(){ - - public String a() { - return bcc.this.an; - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("LWJGL", new Callable(){ - - public String a() { - return Sys.getVersion(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("OpenGL", new Callable(){ - - public String a() { - return bnf.u(7937) + " GL version " + bnf.u(7938) + ", " + bnf.u(7936); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("GL Caps", new Callable(){ - - public String a() { - return bze.c(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("Using VBOs", new Callable(){ - - public String a() { - return bcc.this.u.u ? "Yes" : "No"; - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("Is Modded", new Callable(){ - - public String a() throws Exception { - String string = ClientBrandRetriever.getClientModName(); - if (!string.equals("vanilla")) { - return "Definitely; Client brand changed to '" + string + "'"; - } - if (bcc.class.getSigners() == null) { - return "Very likely; Jar signature invalidated"; - } - return "Probably not. Jar signature remains and client brand is untouched."; - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("Type", new Callable(){ - - public String a() throws Exception { - return "Client (map_client.txt)"; - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("Resource Packs", new Callable(){ - - public String a() throws Exception { - StringBuilder stringBuilder = new StringBuilder(); - for (String string : bcc.this.u.k) { - if (stringBuilder.length() > 0) { - stringBuilder.append(", "); - } - stringBuilder.append(string); - if (!bcc.this.u.l.contains(string)) continue; - stringBuilder.append(" (incompatible)"); - } - return stringBuilder.toString(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("Current Language", new Callable(){ - - public String a() throws Exception { - return bcc.this.aG.c().toString(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("Profiler Position", new Callable(){ - - public String a() throws Exception { - return bcc.this.B.a ? bcc.this.B.c() : "N/A (disabled)"; - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - b2.g().a("CPU", new Callable(){ - - public String a() { - return bze.k(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - if (this.f != null) { - this.f.a(b2); - } - return b2; - } - - public static bcc z() { - return T; - } - - public ListenableFuture A() { - return this.a(new Runnable(){ - - @Override - public void run() { - bcc.this.f(); - } - }); - } - - @Override - public void a(qw qw2) { - qw2.a("fps", ar); - qw2.a("vsync_enabled", this.u.t); - qw2.a("display_frequency", Display.getDisplayMode().getFrequency()); - qw2.a("display_type", this.V ? "fullscreen" : "windowed"); - qw2.a("run_time", (MinecraftServer.av() - qw2.g()) / 60 * 1000); - qw2.a("current_action", this.aD()); - qw2.a("language", this.u.aC == null ? "en_US" : this.u.aC); - String string = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big"; - qw2.a("endianness", string); - qw2.a("subtitles", this.u.O); - qw2.a("resource_packs", this.aF.d().size()); - int n2 = 0; - for (bwh.a a2 : this.aF.d()) { - qw2.a("resource_pack[" + n2++ + "]", a2.d()); - } - if (this.al != null && this.al.ar() != null) { - qw2.a("snooper_partner", this.al.ar().f()); - } - } - - private String aD() { - if (this.al != null) { - if (this.al.a()) { - return "hosting_lan"; - } - return "singleplayer"; - } - if (this.R != null) { - if (this.R.d()) { - return "playing_lan"; - } - return "multiplayer"; - } - return "out_of_game"; - } - - @Override - public void b(qw qw2) { - qw2.b("opengl_version", bnf.u(7938)); - qw2.b("opengl_vendor", bnf.u(7936)); - qw2.b("client_brand", ClientBrandRetriever.getClientModName()); - qw2.b("launched_version", this.an); - ContextCapabilities contextCapabilities = GLContext.getCapabilities(); - qw2.b("gl_caps[ARB_arrays_of_arrays]", contextCapabilities.GL_ARB_arrays_of_arrays); - qw2.b("gl_caps[ARB_base_instance]", contextCapabilities.GL_ARB_base_instance); - qw2.b("gl_caps[ARB_blend_func_extended]", contextCapabilities.GL_ARB_blend_func_extended); - qw2.b("gl_caps[ARB_clear_buffer_object]", contextCapabilities.GL_ARB_clear_buffer_object); - qw2.b("gl_caps[ARB_color_buffer_float]", contextCapabilities.GL_ARB_color_buffer_float); - qw2.b("gl_caps[ARB_compatibility]", contextCapabilities.GL_ARB_compatibility); - qw2.b("gl_caps[ARB_compressed_texture_pixel_storage]", contextCapabilities.GL_ARB_compressed_texture_pixel_storage); - qw2.b("gl_caps[ARB_compute_shader]", contextCapabilities.GL_ARB_compute_shader); - qw2.b("gl_caps[ARB_copy_buffer]", contextCapabilities.GL_ARB_copy_buffer); - qw2.b("gl_caps[ARB_copy_image]", contextCapabilities.GL_ARB_copy_image); - qw2.b("gl_caps[ARB_depth_buffer_float]", contextCapabilities.GL_ARB_depth_buffer_float); - qw2.b("gl_caps[ARB_compute_shader]", contextCapabilities.GL_ARB_compute_shader); - qw2.b("gl_caps[ARB_copy_buffer]", contextCapabilities.GL_ARB_copy_buffer); - qw2.b("gl_caps[ARB_copy_image]", contextCapabilities.GL_ARB_copy_image); - qw2.b("gl_caps[ARB_depth_buffer_float]", contextCapabilities.GL_ARB_depth_buffer_float); - qw2.b("gl_caps[ARB_depth_clamp]", contextCapabilities.GL_ARB_depth_clamp); - qw2.b("gl_caps[ARB_depth_texture]", contextCapabilities.GL_ARB_depth_texture); - qw2.b("gl_caps[ARB_draw_buffers]", contextCapabilities.GL_ARB_draw_buffers); - qw2.b("gl_caps[ARB_draw_buffers_blend]", contextCapabilities.GL_ARB_draw_buffers_blend); - qw2.b("gl_caps[ARB_draw_elements_base_vertex]", contextCapabilities.GL_ARB_draw_elements_base_vertex); - qw2.b("gl_caps[ARB_draw_indirect]", contextCapabilities.GL_ARB_draw_indirect); - qw2.b("gl_caps[ARB_draw_instanced]", contextCapabilities.GL_ARB_draw_instanced); - qw2.b("gl_caps[ARB_explicit_attrib_location]", contextCapabilities.GL_ARB_explicit_attrib_location); - qw2.b("gl_caps[ARB_explicit_uniform_location]", contextCapabilities.GL_ARB_explicit_uniform_location); - qw2.b("gl_caps[ARB_fragment_layer_viewport]", contextCapabilities.GL_ARB_fragment_layer_viewport); - qw2.b("gl_caps[ARB_fragment_program]", contextCapabilities.GL_ARB_fragment_program); - qw2.b("gl_caps[ARB_fragment_shader]", contextCapabilities.GL_ARB_fragment_shader); - qw2.b("gl_caps[ARB_fragment_program_shadow]", contextCapabilities.GL_ARB_fragment_program_shadow); - qw2.b("gl_caps[ARB_framebuffer_object]", contextCapabilities.GL_ARB_framebuffer_object); - qw2.b("gl_caps[ARB_framebuffer_sRGB]", contextCapabilities.GL_ARB_framebuffer_sRGB); - qw2.b("gl_caps[ARB_geometry_shader4]", contextCapabilities.GL_ARB_geometry_shader4); - qw2.b("gl_caps[ARB_gpu_shader5]", contextCapabilities.GL_ARB_gpu_shader5); - qw2.b("gl_caps[ARB_half_float_pixel]", contextCapabilities.GL_ARB_half_float_pixel); - qw2.b("gl_caps[ARB_half_float_vertex]", contextCapabilities.GL_ARB_half_float_vertex); - qw2.b("gl_caps[ARB_instanced_arrays]", contextCapabilities.GL_ARB_instanced_arrays); - qw2.b("gl_caps[ARB_map_buffer_alignment]", contextCapabilities.GL_ARB_map_buffer_alignment); - qw2.b("gl_caps[ARB_map_buffer_range]", contextCapabilities.GL_ARB_map_buffer_range); - qw2.b("gl_caps[ARB_multisample]", contextCapabilities.GL_ARB_multisample); - qw2.b("gl_caps[ARB_multitexture]", contextCapabilities.GL_ARB_multitexture); - qw2.b("gl_caps[ARB_occlusion_query2]", contextCapabilities.GL_ARB_occlusion_query2); - qw2.b("gl_caps[ARB_pixel_buffer_object]", contextCapabilities.GL_ARB_pixel_buffer_object); - qw2.b("gl_caps[ARB_seamless_cube_map]", contextCapabilities.GL_ARB_seamless_cube_map); - qw2.b("gl_caps[ARB_shader_objects]", contextCapabilities.GL_ARB_shader_objects); - qw2.b("gl_caps[ARB_shader_stencil_export]", contextCapabilities.GL_ARB_shader_stencil_export); - qw2.b("gl_caps[ARB_shader_texture_lod]", contextCapabilities.GL_ARB_shader_texture_lod); - qw2.b("gl_caps[ARB_shadow]", contextCapabilities.GL_ARB_shadow); - qw2.b("gl_caps[ARB_shadow_ambient]", contextCapabilities.GL_ARB_shadow_ambient); - qw2.b("gl_caps[ARB_stencil_texturing]", contextCapabilities.GL_ARB_stencil_texturing); - qw2.b("gl_caps[ARB_sync]", contextCapabilities.GL_ARB_sync); - qw2.b("gl_caps[ARB_tessellation_shader]", contextCapabilities.GL_ARB_tessellation_shader); - qw2.b("gl_caps[ARB_texture_border_clamp]", contextCapabilities.GL_ARB_texture_border_clamp); - qw2.b("gl_caps[ARB_texture_buffer_object]", contextCapabilities.GL_ARB_texture_buffer_object); - qw2.b("gl_caps[ARB_texture_cube_map]", contextCapabilities.GL_ARB_texture_cube_map); - qw2.b("gl_caps[ARB_texture_cube_map_array]", contextCapabilities.GL_ARB_texture_cube_map_array); - qw2.b("gl_caps[ARB_texture_non_power_of_two]", contextCapabilities.GL_ARB_texture_non_power_of_two); - qw2.b("gl_caps[ARB_uniform_buffer_object]", contextCapabilities.GL_ARB_uniform_buffer_object); - qw2.b("gl_caps[ARB_vertex_blend]", contextCapabilities.GL_ARB_vertex_blend); - qw2.b("gl_caps[ARB_vertex_buffer_object]", contextCapabilities.GL_ARB_vertex_buffer_object); - qw2.b("gl_caps[ARB_vertex_program]", contextCapabilities.GL_ARB_vertex_program); - qw2.b("gl_caps[ARB_vertex_shader]", contextCapabilities.GL_ARB_vertex_shader); - qw2.b("gl_caps[EXT_bindable_uniform]", contextCapabilities.GL_EXT_bindable_uniform); - qw2.b("gl_caps[EXT_blend_equation_separate]", contextCapabilities.GL_EXT_blend_equation_separate); - qw2.b("gl_caps[EXT_blend_func_separate]", contextCapabilities.GL_EXT_blend_func_separate); - qw2.b("gl_caps[EXT_blend_minmax]", contextCapabilities.GL_EXT_blend_minmax); - qw2.b("gl_caps[EXT_blend_subtract]", contextCapabilities.GL_EXT_blend_subtract); - qw2.b("gl_caps[EXT_draw_instanced]", contextCapabilities.GL_EXT_draw_instanced); - qw2.b("gl_caps[EXT_framebuffer_multisample]", contextCapabilities.GL_EXT_framebuffer_multisample); - qw2.b("gl_caps[EXT_framebuffer_object]", contextCapabilities.GL_EXT_framebuffer_object); - qw2.b("gl_caps[EXT_framebuffer_sRGB]", contextCapabilities.GL_EXT_framebuffer_sRGB); - qw2.b("gl_caps[EXT_geometry_shader4]", contextCapabilities.GL_EXT_geometry_shader4); - qw2.b("gl_caps[EXT_gpu_program_parameters]", contextCapabilities.GL_EXT_gpu_program_parameters); - qw2.b("gl_caps[EXT_gpu_shader4]", contextCapabilities.GL_EXT_gpu_shader4); - qw2.b("gl_caps[EXT_multi_draw_arrays]", contextCapabilities.GL_EXT_multi_draw_arrays); - qw2.b("gl_caps[EXT_packed_depth_stencil]", contextCapabilities.GL_EXT_packed_depth_stencil); - qw2.b("gl_caps[EXT_paletted_texture]", contextCapabilities.GL_EXT_paletted_texture); - qw2.b("gl_caps[EXT_rescale_normal]", contextCapabilities.GL_EXT_rescale_normal); - qw2.b("gl_caps[EXT_separate_shader_objects]", contextCapabilities.GL_EXT_separate_shader_objects); - qw2.b("gl_caps[EXT_shader_image_load_store]", contextCapabilities.GL_EXT_shader_image_load_store); - qw2.b("gl_caps[EXT_shadow_funcs]", contextCapabilities.GL_EXT_shadow_funcs); - qw2.b("gl_caps[EXT_shared_texture_palette]", contextCapabilities.GL_EXT_shared_texture_palette); - qw2.b("gl_caps[EXT_stencil_clear_tag]", contextCapabilities.GL_EXT_stencil_clear_tag); - qw2.b("gl_caps[EXT_stencil_two_side]", contextCapabilities.GL_EXT_stencil_two_side); - qw2.b("gl_caps[EXT_stencil_wrap]", contextCapabilities.GL_EXT_stencil_wrap); - qw2.b("gl_caps[EXT_texture_3d]", contextCapabilities.GL_EXT_texture_3d); - qw2.b("gl_caps[EXT_texture_array]", contextCapabilities.GL_EXT_texture_array); - qw2.b("gl_caps[EXT_texture_buffer_object]", contextCapabilities.GL_EXT_texture_buffer_object); - qw2.b("gl_caps[EXT_texture_integer]", contextCapabilities.GL_EXT_texture_integer); - qw2.b("gl_caps[EXT_texture_lod_bias]", contextCapabilities.GL_EXT_texture_lod_bias); - qw2.b("gl_caps[EXT_texture_sRGB]", contextCapabilities.GL_EXT_texture_sRGB); - qw2.b("gl_caps[EXT_vertex_shader]", contextCapabilities.GL_EXT_vertex_shader); - qw2.b("gl_caps[EXT_vertex_weighting]", contextCapabilities.GL_EXT_vertex_weighting); - qw2.b("gl_caps[gl_max_vertex_uniforms]", bnf.v(35658)); - bnf.L(); - qw2.b("gl_caps[gl_max_fragment_uniforms]", bnf.v(35657)); - bnf.L(); - qw2.b("gl_caps[gl_max_vertex_attribs]", bnf.v(34921)); - bnf.L(); - qw2.b("gl_caps[gl_max_vertex_texture_image_units]", bnf.v(35660)); - bnf.L(); - qw2.b("gl_caps[gl_max_texture_image_units]", bnf.v(34930)); - bnf.L(); - qw2.b("gl_caps[gl_max_array_texture_layers]", bnf.v(35071)); - bnf.L(); - qw2.b("gl_max_texture_size", bcc.B()); - } - - public static int B() { - for (int i2 = 16384; i2 > 0; i2 >>= 1) { - bnf.a(32868, 0, 6408, i2, i2, 0, 6408, 5121, null); - int n2 = bnf.c(32868, 0, 4096); - if (n2 == 0) continue; - return i2; - } - return -1; - } - - @Override - public boolean Z() { - return this.u.r; - } - - public void a(bku bku2) { - this.R = bku2; - } - - public bku C() { - return this.R; - } - - public boolean D() { - return this.az; - } - - public boolean E() { - return this.az && this.al != null; - } - - public byl F() { - return this.al; - } - - public static void G() { - if (T == null) { - return; - } - byl byl2 = T.F(); - if (byl2 != null) { - byl2.u(); - } - } - - public qw H() { - return this.ab; - } - - public static long I() { - return Sys.getTime() * 1000 / Sys.getTimerResolution(); - } - - public boolean J() { - return this.V; - } - - public bcj K() { - return this.ag; - } - - public PropertyMap L() { - if (this.Q.isEmpty()) { - GameProfile gameProfile = this.X().fillProfileProperties(this.ag.e(), false); - this.Q.putAll((Multimap)gameProfile.getProperties()); - } - return this.Q; - } - - public Proxy M() { - return this.ap; - } - - public bvf N() { - return this.S; - } - - public bwd O() { - return this.aB; - } - - public bwh P() { - return this.aF; - } - - public bwn Q() { - return this.aG; - } - - public bvd R() { - return this.aK; - } - - public boolean S() { - return this.aw; - } - - public boolean T() { - return this.ah; - } - - public byv U() { - return this.aL; - } - - public bys.a V() { - if (this.h != null) { - if (this.h.l.s instanceof asw) { - return bys.a.e; - } - if (this.h.l.s instanceof ata) { - if (this.r.j().d()) { - return bys.a.f; - } - return bys.a.g; - } - if (this.h.bJ.d && this.h.bJ.c) { - return bys.a.c; - } - return bys.a.b; - } - return bys.a.a; - } - - public void W() { - int n2; - int n3 = n2 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); - if (n2 == 0 || Keyboard.isRepeatEvent()) { - return; - } - if (this.m instanceof bfo && ((bfo)this.m).g > bcc.I() - 20) { - return; - } - if (Keyboard.getEventKeyState()) { - if (n2 == this.u.aj.j()) { - this.r(); - } else if (n2 == this.u.ag.j()) { - this.r.d().a(bcg.a(this.w, this.d, this.e, this.aJ)); - } - } - } - - public MinecraftSessionService X() { - return this.aO; - } - - public bwk Y() { - return this.aP; - } - - public rr aa() { - return this.af; - } - - public void a(rr rr2) { - this.af = rr2; - this.o.a(rr2); - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - public ListenableFuture a(Callable callable) { - Validate.notNull(callable); - if (!this.aE()) { - ListenableFutureTask listenableFutureTask = ListenableFutureTask.create(callable); - Queue queue = this.aQ; - synchronized (queue) { - this.aQ.add((ListenableFutureTask)listenableFutureTask); - } - return listenableFutureTask; - } - try { - return Futures.immediateFuture(callable.call()); - } - catch (Exception err) { - return Futures.immediateFailedCheckedFuture((Exception)err); - } - } - - @Override - public ListenableFuture a(Runnable runnable) { - Validate.notNull((Object)runnable); - return this.a(Executors.callable(runnable)); - } - - @Override - public boolean aE() { - return Thread.currentThread() == this.aS; - } - - public bnz ab() { - return this.aU; - } - - public brj ac() { - return this.ac; - } - - public brw ad() { - return this.ad; - } - - public bnh ae() { - return this.ae; - } - - public static int af() { - return ar; - } - - public oc ag() { - return this.z; - } - - public static Map ah() { - HashMap hashMap = Maps.newHashMap(); - hashMap.put("X-Minecraft-Username", bcc.z().K().c()); - hashMap.put("X-Minecraft-UUID", bcc.z().K().b()); - hashMap.put("X-Minecraft-Version", "1.9.2"); - return hashMap; - } - - public boolean ai() { - return this.Z; - } - - public void a(boolean bl2) { - this.Z = bl2; - } - - public pb aj() { - return this.U; - } - - public float ak() { - return this.timer.c; - } - - public bcl al() { - return this.aH; - } - -} diff --git a/src/bcz.java b/src/bcz.java deleted file mode 100644 index a3490e3..0000000 --- a/src/bcz.java +++ /dev/null @@ -1,257 +0,0 @@ -// GuiOverlayDebug - -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * com.google.common.base.Strings - * com.google.common.collect.ImmutableMap - * com.google.common.collect.ImmutableSet - * com.google.common.collect.Lists - * org.lwjgl.opengl.Display - */ -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import net.minecraft.client.ClientBrandRetriever; -import org.lwjgl.opengl.Display; - -public class bcz -extends bcs { - private final bcc a; - private final bcq f; - - public bcz(bcc bcc2) { - this.a = bcc2; - this.f = bcc2.k; - } - - public void a(bcu bcu2) { - this.a.B.a("debug"); - bnf.G(); - this.a(); - this.b(bcu2); - bnf.H(); - if (this.a.u.at) { - this.e(); - } - this.a.B.b(); - } - - private boolean d() { - return this.a.h.cX() || this.a.u.v; - } - - protected void a() { - List list = this.b(); - list.add(""); - list.add("Debug: Pie [shift]: " + (this.a.u.as ? "visible" : "hidden") + " FPS [alt]: " + (this.a.u.at ? "visible" : "hidden")); - list.add("For help: press F3 + Q"); - for (int i2 = 0; i2 < list.size(); ++i2) { - String string = list.get(i2); - if (Strings.isNullOrEmpty((String)string)) continue; - int n2 = this.f.a; - int n3 = this.f.a(string); - int n4 = 2; - int n5 = 2 + n2 * i2; - bcz.a(1, n5 - 1, 2 + n3 + 1, n5 + n2 - 1, -1873784752); - this.f.a(string, 2, n5, 14737632); - } - } - - protected void b(bcu bcu2) { - List list = this.c(); - for (int i2 = 0; i2 < list.size(); ++i2) { - String string = list.get(i2); - if (Strings.isNullOrEmpty((String)string)) continue; - int n2 = this.f.a; - int n3 = this.f.a(string); - int n4 = bcu2.a() - 2 - n3; - int n5 = 2 + n2 * i2; - bcz.a(n4 - 1, n5 - 1, n4 + n3 + 1, n5 + n2 - 1, -1873784752); - this.f.a(string, n4, n5, 14737632); - } - } - - protected List b() { - Object object; - cj cj2 = new cj(this.a.aa().p, this.a.aa().bl().b, this.a.aa().r); - if (this.d()) { - return Lists.newArrayList(new String[]{"Minecraft 1.9.2 (" + this.a.c() + "/" + ClientBrandRetriever.getClientModName() + ")", this.a.D, this.a.g.f(), this.a.g.h(), "P: " + this.a.j.b() + ". T: " + this.a.f.F(), this.a.f.G(), "", String.format("Chunk-relative: %d %d %d", cj2.p() & 15, cj2.q() & 15, cj2.r() & 15)}); - } - rr rr2 = this.a.aa(); - cq cq2 = rr2.bi(); - String string = "Invalid"; - switch (cq2) { - case c: { - string = "Towards negative Z"; - break; - } - case d: { - string = "Towards positive Z"; - break; - } - case e: { - string = "Towards negative X"; - break; - } - case f: { - string = "Towards positive X"; - } - } - Object[] arrobject = new String[11]; - arrobject[0] = "Minecraft 1.9.2 (" + this.a.c() + "/" + ClientBrandRetriever.getClientModName() + ("release".equalsIgnoreCase(this.a.d()) ? "" : new StringBuilder().append("/").append(this.a.d()).toString()) + ")"; - arrobject[1] = this.a.D; - arrobject[2] = this.a.g.f(); - arrobject[3] = this.a.g.h(); - arrobject[4] = "P: " + this.a.j.b() + ". T: " + this.a.f.F(); - arrobject[5] = this.a.f.G(); - arrobject[6] = ""; - arrobject[7] = String.format("XYZ: %.3f / %.5f / %.3f", this.a.aa().p, this.a.aa().bl().b, this.a.aa().r); - arrobject[8] = String.format("Block: %d %d %d", cj2.p(), cj2.q(), cj2.r()); - arrobject[9] = String.format("Chunk: %d %d %d in %d %d %d", cj2.p() & 15, cj2.q() & 15, cj2.r() & 15, cj2.p() >> 4, cj2.q() >> 4, cj2.r() >> 4); - arrobject[10] = String.format("Facing: %s (%s) (%.1f / %.1f)", cq2, string, Float.valueOf(on.g(rr2.v)), Float.valueOf(on.g(rr2.w))); - ArrayList arrayList = Lists.newArrayList((Object[])arrobject); - if (this.a.f != null) { - ase ase1 = this.a.f.f(cj2); - if (!this.a.f.e(cj2)) { - arrayList.add("Outside of world..."); - } else if (!ase1.f()) { - lr lr2; - arrayList.add("Biome: " + ase1.a(cj2, this.a.f.A()).l()); - arrayList.add("Light: " + ase1.a(cj2, 0) + " (" + ase1.a(ahz.a, cj2) + " sky, " + ase1.a(ahz.b, cj2) + " block)"); - ql ql2 = this.a.f.D(cj2); - if (this.a.D() && this.a.F() != null && (lr2 = this.a.F().al().a(this.a.h.bc())) != null) { - ql2 = lr2.l.D(new cj(lr2)); - } - arrayList.add(String.format("Local Difficulty: %.2f // %.2f (Day %d)", Float.valueOf(ql2.b()), Float.valueOf(ql2.c()), this.a.f.Q() / 24000)); - } else { - arrayList.add("Waiting for chunk..."); - } - } - if (this.a.o != null && this.a.o.a()) { - arrayList.add("Shader: " + this.a.o.f().b()); - } - if (this.a.t != null && this.a.t.a == Namepipe.bbf_a.b && this.a.t.a() != null) { - cj object1 = this.a.t.a(); - arrayList.add(String.format("Looking at: %d %d %d", object1.p(), object1.q(), object1.r())); - } - return arrayList; - } - - protected > List c() { - long l2 = Runtime.getRuntime().maxMemory(); - long l3 = Runtime.getRuntime().totalMemory(); - long l4 = Runtime.getRuntime().freeMemory(); - long l5 = l3 - l4; - Object[] arrobject = new String[12]; - Object[] arrobject2 = new Object[2]; - arrobject2[0] = System.getProperty("java.version"); - arrobject2[1] = this.a.S() ? 64 : 32; - arrobject[0] = String.format("Java: %s %dbit", arrobject2); - arrobject[1] = String.format("Mem: % 2d%% %03d/%03dMB", l5 * 100 / l2, bcz.a(l5), bcz.a(l2)); - arrobject[2] = String.format("Allocated: % 2d%% %03dMB", l3 * 100 / l2, bcz.a(l3)); - arrobject[3] = ""; - arrobject[4] = String.format("CPU: %s", bze.k()); - arrobject[5] = ""; - arrobject[6] = String.format("Display: %dx%d (%s)", Display.getWidth(), Display.getHeight(), bnf.u(7936)); - arrobject[7] = bnf.u(7937); - arrobject[8] = bnf.u(7938); - - // Cubitick : add some tick info - arrobject[ 9] = (""); - arrobject[10] = ("Server tick : " + (a.D() ? a.F().ap() : "Unreachable")); - arrobject[11] = ("Client tick : " + a.tickcounter); - - ArrayList arrayList = Lists.newArrayList((Object[])arrobject); - if (this.d()) { - return arrayList; - } - if (this.a.t != null && this.a.t.a == Namepipe.bbf_a.b && this.a.t.a() != null) { - cj cj2 = this.a.t.a(); - arc arc2 = this.a.f.o(cj2); - if (this.a.f.L() != ahy.g) { - arc2 = arc2.b((ahx)this.a.f, cj2); - } - arrayList.add(""); - arrayList.add(String.valueOf(ajt.h.b(arc2.t()))); - for (Map.Entry entry : arc2.s().entrySet()) { - arr arr2 = (arr)entry.getKey(); - Comparable comparable = (Comparable)entry.getValue(); - String string = arr2.a(comparable); - if (comparable == Boolean.TRUE) { - string = (Object)((Object)a.k) + string; - } else if (comparable == Boolean.FALSE) { - string = (Object)((Object)a.m) + string; - } - arrayList.add(arr2.a() + ": " + string); - } - } - return arrayList; - } - - private void e() { - bnf.j(); - oc oc2 = this.a.ag(); - int n2 = oc2.a(); - int n3 = oc2.b(); - long[] arrl = oc2.c(); - bcu bcu2 = new bcu(this.a); - int n4 = n2; - int n5 = 0; - bcz.a(0, bcu2.b() - 60, 240, bcu2.b(), -1873784752); - while (n4 != n3) { - int n6 = oc2.a(arrl[n4], 30); - int n7 = this.c(on.a(n6, 0, 60), 0, 30, 60); - this.b(n5, bcu2.b(), bcu2.b() - n6, n7); - ++n5; - n4 = oc2.b(n4 + 1); - } - bcz.a(1, bcu2.b() - 30 + 1, 14, bcu2.b() - 30 + 10, -1873784752); - this.f.a("60", 2, bcu2.b() - 30 + 2, 14737632); - this.a(0, 239, bcu2.b() - 30, -1); - bcz.a(1, bcu2.b() - 60 + 1, 14, bcu2.b() - 60 + 10, -1873784752); - this.f.a("30", 2, bcu2.b() - 60 + 2, 14737632); - this.a(0, 239, bcu2.b() - 60, -1); - this.a(0, 239, bcu2.b() - 1, -1); - this.b(0, bcu2.b() - 60, bcu2.b(), -1); - this.b(239, bcu2.b() - 60, bcu2.b(), -1); - if (this.a.u.g <= 120) { - this.a(0, 239, bcu2.b() - 60 + this.a.u.g / 2, -16711681); - } - bnf.k(); - } - - private int c(int n2, int n3, int n4, int n5) { - if (n2 < n4) { - return this.a(-16711936, -256, (float)n2 / (float)n4); - } - return this.a(-256, -65536, (float)(n2 - n4) / (float)(n5 - n4)); - } - - private int a(int n2, int n3, float f2) { - int n4 = n2 >> 24 & 255; - int n5 = n2 >> 16 & 255; - int n6 = n2 >> 8 & 255; - int n7 = n2 & 255; - int n8 = n3 >> 24 & 255; - int n9 = n3 >> 16 & 255; - int n10 = n3 >> 8 & 255; - int n11 = n3 & 255; - int n12 = on.a((int)((float)n4 + (float)(n8 - n4) * f2), 0, 255); - int n13 = on.a((int)((float)n5 + (float)(n9 - n5) * f2), 0, 255); - int n14 = on.a((int)((float)n6 + (float)(n10 - n6) * f2), 0, 255); - int n15 = on.a((int)((float)n7 + (float)(n11 - n7) * f2), 0, 255); - return n12 << 24 | n13 << 16 | n14 << 8 | n15; - } - - private static long a(long l2) { - return l2 / 1024 / 1024; - } - -} diff --git a/src/beb.java b/src/beb.java deleted file mode 100644 index d136a53..0000000 --- a/src/beb.java +++ /dev/null @@ -1,201 +0,0 @@ -// GuiChat - -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * org.apache.logging.log4j.LogManager - * org.apache.logging.log4j.Logger - * org.lwjgl.input.Keyboard - * org.lwjgl.input.Mouse - */ -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; - -public class beb -extends bey -implements bfd { - private static final Logger f = LogManager.getLogger(); - private String g = ""; - private int h = -1; - private bfe i; - protected bda a; - private String r = ""; - - public beb() { - } - - public beb(String string) { - this.r = string; - } - - @Override - public void b() { - Keyboard.enableRepeatEvents((boolean)true); - this.h = this.j.r.d().c().size(); - this.a = new bda(0, this.q, 4, this.m - 12, this.l - 4, 12); - this.a.f(100); - this.a.a(false); - this.a.b(true); - this.a.a(this.r); - this.a.d(false); - this.i = new a(this.a); - } - - @Override - public void m() { - Keyboard.enableRepeatEvents((boolean)false); - this.j.r.d().d(); - } - - @Override - public void e() { - this.a.a(); - } - - @Override - protected void a(char c2, int n2) { - this.i.d(); - if (n2 == 15) { - this.i.a(); - } else { - this.i.c(); - } - if (n2 == 1) { - this.j.a((bey)null); - } else if (n2 == 28 || n2 == 156) { - String string = this.a.b().trim(); - if (!string.isEmpty()) { - this.f(string); - - // Cubitick: interrupt the server's sleep so it can process the chat - if(!Cubitick.synctick) - { - MinecraftServer.interruptTickSleep(); - } - } - this.j.a((bey)null); - } else if (n2 == 200) { - this.b(-1); - } else if (n2 == 208) { - this.b(1); - } else if (n2 == 201) { - this.j.r.d().b(this.j.r.d().i() - 1); - } else if (n2 == 209) { - this.j.r.d().b(- this.j.r.d().i() + 1); - } else { - this.a.a(c2, n2); - } - } - - @Override - public void k() { - super.k(); - int n2 = Mouse.getEventDWheel(); - if (n2 != 0) { - if (n2 > 1) { - n2 = 1; - } - if (n2 < -1) { - n2 = -1; - } - if (!beb.r()) { - n2 *= 7; - } - this.j.r.d().b(n2); - } - } - - @Override - protected void a(int n2, int n3, int n4) { - eu eu2; - if (n4 == 0 && this.a(eu2 = this.j.r.d().a(Mouse.getX(), Mouse.getY()))) { - return; - } - this.a.a(n2, n3, n4); - super.a(n2, n3, n4); - } - - @Override - protected void a(String string, boolean bl2) { - if (bl2) { - this.a.a(string); - } else { - this.a.b(string); - } - } - - public void b(int n2) { - int n3 = this.h + n2; - int n4 = this.j.r.d().c().size(); - if ((n3 = on.a(n3, 0, n4)) == this.h) { - return; - } - if (n3 == n4) { - this.h = n4; - this.a.a(this.g); - return; - } - if (this.h == n4) { - this.g = this.a.b(); - } - this.a.a(this.j.r.d().c().get(n3)); - this.h = n3; - } - - @Override - public void a(int n2, int n3, float f2) { - beb.a(2, this.m - 14, this.l - 2, this.m - 2, Integer.MIN_VALUE); - this.a.g(); - eu eu2 = this.j.r.d().a(Mouse.getX(), Mouse.getY()); - if (eu2 != null && eu2.b().i() != null) { - this.a(eu2, n2, n3); - } - super.a(n2, n3, f2); - } - - @Override - public boolean d() { - return false; - } - - @Override - public /* varargs */ void a(String ... arrstring) { - this.i.a(arrstring); - } - - public static class a - extends bfe { - private bcc g = bcc.z(); - - public a(bda bda2) { - super(bda2, false); - } - - @Override - public void a() { - super.a(); - if (this.f.size() > 1) { - StringBuilder stringBuilder = new StringBuilder(); - for (String string : this.f) { - if (stringBuilder.length() > 0) { - stringBuilder.append(", "); - } - stringBuilder.append(string); - } - this.g.r.d().a(new fa(stringBuilder.toString()), 1); - } - } - - @Override - public cj b() { - cj cj2 = null; - if (this.g.t != null && this.g.t.a == Namepipe.bbf_a.b) { - cj2 = this.g.t.a(); - } - return cj2; - } - } -} diff --git a/src/bes.java b/src/bes.java deleted file mode 100644 index 4ac366d..0000000 --- a/src/bes.java +++ /dev/null @@ -1,155 +0,0 @@ -// GuiOptions - -/* - * Decompiled with CFR 0_115. - */ -import java.util.List; - -public class bes -extends bey -implements bed { - private static final bce.a[] f = new bce.a[]{Namepipe.bce_a.c}; - private final bey g; - private final bce h; - private bcw i; - private bdh r; - protected String a = "Options"; - - public bes(bey bey2, bce bce2) { - this.g = bey2; - this.h = bce2; - } - - @Override - public void b() { - int n2 = 0; - this.a = bwl.a("options.title", new Object[0]); - for (bce.a a2 : f) { - if (a2.a()) { - this.n.add(new bdo(a2.c(), this.l / 2 - 155 + n2 % 2 * 160, this.m / 6 - 12 + 24 * (n2 >> 1), a2)); - } else { - bdj bdj2 = new bdj(a2.c(), this.l / 2 - 155 + n2 % 2 * 160, this.m / 6 - 12 + 24 * (n2 >> 1), a2, this.h.c(a2)); - this.n.add(bdj2); - } - ++n2; - } - if (this.j.f != null) { - qk qk2 = this.j.f.ae(); - this.i = new bcw(108, this.l / 2 - 155 + n2 % 2 * 160, this.m / 6 - 12 + 24 * (n2 >> 1), 150, 20, this.a(qk2)); - this.n.add(this.i); - if (this.j.E() && !this.j.f.T().s()) { - this.i.a(this.i.b() - 20); - this.r = new bdh(109, this.i.h + this.i.b(), this.i.i); - this.n.add(this.r); - this.r.b(this.j.f.T().y()); - this.r.l = !this.r.c(); - this.i.l = !this.r.c(); - } else { - this.i.l = false; - } - } else { - this.n.add(new bdj(Namepipe.bce_a.L.c(), this.l / 2 - 155 + n2 % 2 * 160, this.m / 6 - 12 + 24 * (n2 >> 1), Namepipe.bce_a.L, this.h.c(Namepipe.bce_a.L))); - } - this.n.add(new bcw(110, this.l / 2 - 155, this.m / 6 + 48 - 6, 150, 20, bwl.a("options.skinCustomisation", new Object[0]))); - this.n.add(new bcw(106, this.l / 2 + 5, this.m / 6 + 48 - 6, 150, 20, bwl.a("options.sounds", new Object[0]))); - this.n.add(new bcw(101, this.l / 2 - 155, this.m / 6 + 72 - 6, 150, 20, bwl.a("options.video", new Object[0]))); - this.n.add(new bcw(100, this.l / 2 + 5, this.m / 6 + 72 - 6, 150, 20, bwl.a("options.controls", new Object[0]))); - this.n.add(new bcw(102, this.l / 2 - 155, this.m / 6 + 96 - 6, 150, 20, bwl.a("options.language", new Object[0]))); - this.n.add(new bcw(103, this.l / 2 + 5, this.m / 6 + 96 - 6, 150, 20, bwl.a("options.chat.title", new Object[0]))); - this.n.add(new bcw(105, this.l / 2 - 155, this.m / 6 + 120 - 6, 150, 20, bwl.a("options.resourcepack", new Object[0]))); - this.n.add(new bcw(104, this.l / 2 + 5, this.m / 6 + 120 - 6, 150, 20, bwl.a("options.snooper.view", new Object[0]))); - this.n.add(new bcw(200, this.l / 2 - 100, this.m / 6 + 168, bwl.a("gui.done", new Object[0]))); - - // PacketAnalysis - bcw serverPacketButton = new bcw(136, this.l / 2 - 155, this.m / 6 + 24 - 6, 150, 20, bwl.a("Server Packet Options...", new Object[0])); - this.n.add(serverPacketButton); - } - - public String a(qk qk2) { - fa fa2 = new fa(""); - fa2.a(new fb("options.difficulty", new Object[0])); - fa2.a(": "); - fa2.a(new fb(qk2.b(), new Object[0])); - return fa2.d(); - } - - @Override - public void a(boolean bl2, int n2) { - this.j.a(this); - if (n2 == 109 && bl2 && this.j.f != null) { - this.j.f.T().e(true); - this.r.b(true); - this.r.l = false; - this.i.l = false; - } - } - - @Override - protected void a(bcw bcw2) { - if (!bcw2.l) { - return; - } - if (bcw2.k < 100 && bcw2 instanceof bdj) { - bce.a a2 = ((bdj)bcw2).c(); - this.h.a(a2, 1); - bcw2.j = this.h.c(Namepipe.bce_a.a(bcw2.k)); - } - if (bcw2.k == 108) { - this.j.f.T().a(qk.a(this.j.f.ae().a() + 1)); - this.i.j = this.a(this.j.f.ae()); - } - if (bcw2.k == 109) { - this.j.a(new bee(this, new fb("difficulty.lock.title", new Object[0]).d(), new fb("difficulty.lock.question", new fb(this.j.f.T().x().b(), new Object[0])).d(), 109)); - } - if (bcw2.k == 110) { - this.j.u.b(); - this.j.a(new bfa(this)); - } - if (bcw2.k == 101) { - this.j.u.b(); - this.j.a(new bfg(this, this.h)); - } - if (bcw2.k == 100) { - this.j.u.b(); - this.j.a(new bfo(this, this.h)); - } - if (bcw2.k == 102) { - this.j.u.b(); - this.j.a(new beq(this, this.h, this.j.Q())); - } - if (bcw2.k == 103) { - this.j.u.b(); - this.j.a(new bea(this, this.h)); - } - if (bcw2.k == 104) { - this.j.u.b(); - this.j.a(new bfb(this, this.h)); - } - if (bcw2.k == 200) { - this.j.u.b(); - this.j.a(this.g); - } - if (bcw2.k == 105) { - this.j.u.b(); - this.j.a(new bgv(this)); - } - if (bcw2.k == 106) { - this.j.u.b(); - this.j.a(new bfc(this, this.h)); - } - - // PacketAnalysis - if(bcw2.k == 136) - { - this.j.u.b(); - this.j.a(new GuiServerPackets(this, this.h)); - } - } - - @Override - public void a(int n2, int n3, float f2) { - this.c(); - this.a(this.q, this.a, this.l / 2, 15, 16777215); - super.a(n2, n3, f2); - } -} diff --git a/src/bkp.java b/src/bkp.java deleted file mode 100644 index 1c698e1..0000000 --- a/src/bkp.java +++ /dev/null @@ -1,1814 +0,0 @@ -// NetHandlerPlayClient - -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * com.google.common.collect.Maps - * com.google.common.util.concurrent.FutureCallback - * com.google.common.util.concurrent.Futures - * com.google.common.util.concurrent.ListenableFuture - * com.mojang.authlib.GameProfile - * io.netty.buffer.ByteBuf - * io.netty.buffer.Unpooled - * org.apache.logging.log4j.LogManager - * org.apache.logging.log4j.Logger - */ -import com.google.common.collect.Maps; -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.mojang.authlib.GameProfile; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.UUID; -import net.minecraft.client.ClientBrandRetriever; -import net.minecraft.realms.DisconnectedRealmsScreen; -import net.minecraft.realms.RealmsScreen; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class bkp -implements fi { - private static final Logger b = LogManager.getLogger(); - private final ek c; - private final GameProfile d; - private final bey e; - private bcc f; - private bkr g; - private boolean h; - private final Map i = Maps.newHashMap(); - public int a = 20; - private boolean j = false; - private final Random k = new Random(); - - public bkp(bcc bcc2, bey bey2, ek ek2, GameProfile gameProfile) { - this.f = bcc2; - this.e = bey2; - this.c = ek2; - this.d = gameProfile; - } - - public void b() { - this.g = null; - } - - @Override - public void a(gs packetIn) { - fh.a(packetIn, this, this.f); - this.f.c = new bkq(this.f, this); - this.g = new bkr(this, new ahw(0, packetIn.c(), false, packetIn.b(), packetIn.g()), packetIn.d(), packetIn.e(), this.f.B); - this.f.u.ao = packetIn.e(); - this.f.a(this.g); - this.f.h.am = packetIn.d(); - this.f.a(new bex(this)); - this.f.h.f(packetIn.a()); - this.a = packetIn.f(); - this.f.h.m(packetIn.h()); - this.f.c.a(packetIn.c()); - this.f.u.c(); - this.c.a(new iq("MC|Brand", new em(Unpooled.buffer()).a(ClientBrandRetriever.getClientModName()))); - - // Packet Analysis - if(ServerPacketData.enabled) - ServerPacketData.display_S23( - packetIn.a(), - packetIn.c().a(), - packetIn.d(), - packetIn.e().ordinal(), - packetIn.f(), - packetIn.g().c(), // getWorldTypeName()? - packetIn.h()); - } - - @Override - public void a(fj packetIn) { - rr[] arrrr; - fh.a(packetIn, this, this.f); - double d2 = packetIn.c(); - double d3 = packetIn.d(); - double d4 = packetIn.e(); - rr rr2 = null; - if (packetIn.k() == 10) { - rr2 = aah.a(this.g, d2, d3, d4, aah.a.a(packetIn.l())); - } else if (packetIn.k() == 90) { - rr rr1 = this.g.a(packetIn.l()); - if (rr1 instanceof zj) { - rr2 = new xw(this.g, d2, d3, d4, (zj)rr1); - } - packetIn.d(0); - } else if (packetIn.k() == 60) { - rr2 = new aad(this.g, d2, d3, d4); - } else if (packetIn.k() == 91) { - rr2 = new zx(this.g, d2, d3, d4); - } else if (packetIn.k() == 61) { - rr2 = new zw(this.g, d2, d3, d4); - } else if (packetIn.k() == 71) { - rr2 = new xs(this.g, new cj(d2, d3, d4), cq.b(packetIn.l())); - packetIn.d(0); - } else if (packetIn.k() == 77) { - rr2 = new xt(this.g, new cj(on.c(d2), on.c(d3), on.c(d4))); - packetIn.d(0); - } else if (packetIn.k() == 65) { - rr2 = new aaa(this.g, d2, d3, d4); - } else if (packetIn.k() == 72) { - rr2 = new zo(this.g, d2, d3, d4); - } else if (packetIn.k() == 76) { - rr2 = new zq(this.g, d2, d3, d4, null); - } else if (packetIn.k() == 63) { - rr2 = new zr(this.g, d2, d3, d4, (double)packetIn.f() / 8000.0, (double)packetIn.g() / 8000.0, (double)packetIn.h() / 8000.0); - packetIn.d(0); - } else if (packetIn.k() == 93) { - rr2 = new zn(this.g, d2, d3, d4, (double)packetIn.f() / 8000.0, (double)packetIn.g() / 8000.0, (double)packetIn.h() / 8000.0); - packetIn.d(0); - } else if (packetIn.k() == 64) { - rr2 = new zv(this.g, d2, d3, d4, (double)packetIn.f() / 8000.0, (double)packetIn.g() / 8000.0, (double)packetIn.h() / 8000.0); - packetIn.d(0); - } else if (packetIn.k() == 66) { - rr2 = new aae(this.g, d2, d3, d4, (double)packetIn.f() / 8000.0, (double)packetIn.g() / 8000.0, (double)packetIn.h() / 8000.0); - packetIn.d(0); - } else if (packetIn.k() == 67) { - rr2 = new zu(this.g, d2, d3, d4, (double)packetIn.f() / 8000.0, (double)packetIn.g() / 8000.0, (double)packetIn.h() / 8000.0); - packetIn.d(0); - } else if (packetIn.k() == 62) { - rr2 = new zz(this.g, d2, d3, d4); - } else if (packetIn.k() == 73) { - rr2 = new aac(this.g, d2, d3, d4, null); - packetIn.d(0); - } else if (packetIn.k() == 75) { - rr2 = new aab(this.g, d2, d3, d4); - packetIn.d(0); - } else if (packetIn.k() == 1) { - rr2 = new aag(this.g, d2, d3, d4); - } else if (packetIn.k() == 50) { - rr2 = new ye(this.g, d2, d3, d4, null); - } else if (packetIn.k() == 78) { - rr2 = new xq(this.g, d2, d3, d4); - } else if (packetIn.k() == 51) { - rr2 = new wt(this.g, d2, d3, d4); - } else if (packetIn.k() == 2) { - rr2 = new yd(this.g, d2, d3, d4); - } else if (packetIn.k() == 70) { - rr2 = new yc(this.g, d2, d3, d4, ajt.c(packetIn.l() & 65535)); - packetIn.d(0); - } else if (packetIn.k() == 3) { - rr2 = new rp(this.g, d2, d3, d4); - } - if (rr2 != null) { - lm.a(rr2, d2, d3, d4); - rr2.w = (float)(packetIn.i() * 360) / 256.0f; - rr2.v = (float)(packetIn.j() * 360) / 256.0f; - arrrr = rr2.aR(); - if (arrrr != null) { - int n2 = packetIn.a() - rr2.O(); - for (int i2 = 0; i2 < arrrr.length; ++i2) { - arrrr[i2].f(arrrr[i2].O() + n2); - } - } - rr2.f(packetIn.a()); - rr2.a(packetIn.b()); - this.g.a(packetIn.a(), rr2); - if (packetIn.l() > 0) { - rr rr3; - if ((packetIn.k() == 60 || packetIn.k() == 91) && (rr3 = this.g.a(packetIn.l() - 1)) instanceof sa && rr2 instanceof zm) { - ((zm)rr2).e = rr3; - } - rr2.i((double)packetIn.f() / 8000.0, (double)packetIn.g() / 8000.0, (double)packetIn.h() / 8000.0); - } - } - - if(ServerPacketData.enabled) - { - float rotationPitch = (float)(packetIn.i() * 360) / 256.0F; - float rotationYaw = (float)(packetIn.j() * 360) / 256.0F; - double velX = (double)packetIn.f() / 8000.0D; - double velY = (double)packetIn.g() / 8000.0D; - double velZ = (double)packetIn.h() / 8000.0D; - ServerPacketData.display_S00(packetIn.a(), null, packetIn.k(), d2, d3, d4, rotationYaw, rotationPitch, packetIn.l(), velX, velY, velZ); - } - } - - @Override - public void a(fk packetIn) { - fh.a(packetIn, this, this.f); - double d2 = packetIn.b(); - double d3 = packetIn.c(); - double d4 = packetIn.d(); - rx rx2 = new rx(this.g, d2, d3, d4, packetIn.e()); - lm.a(rx2, d2, d3, d4); - rx2.v = 0.0f; - rx2.w = 0.0f; - rx2.f(packetIn.a()); - this.g.a(packetIn.a(), rx2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S01( - packetIn.a(), - packetIn.b()/32.0D, - packetIn.c()/32.0D, - packetIn.d()/32.0D, - packetIn.e()); - } - - @Override - public void a(fl packetIn) { - fh.a(packetIn, this, this.f); - double d2 = packetIn.b(); - double d3 = packetIn.c(); - double d4 = packetIn.d(); - ya ya2 = null; - if (packetIn.e() == 1) { - ya2 = new ya(this.g, d2, d3, d4, false); - } - if (ya2 != null) { - lm.a(ya2, d2, d3, d4); - ya2.v = 0.0f; - ya2.w = 0.0f; - ya2.f(packetIn.a()); - this.g.d(ya2); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS02(packetIn.a(), packetIn.e(), d2, d3, d4); - } - - @Override - public void a(fn packetIn) { - fh.a(packetIn, this, this.f); - xu xu2 = new xu(this.g, packetIn.c(), packetIn.d(), packetIn.e()); - xu2.a(packetIn.b()); - this.g.a(packetIn.a(), xu2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S04(packetIn.a(), null, packetIn.e(), packetIn.c(), packetIn.d().name()); - } - - @Override - public void a(hn packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.a()); - if (rr2 == null) { - return; - } - rr2.i((double)packetIn.b() / 8000.0, (double)packetIn.c() / 8000.0, (double)packetIn.d() / 8000.0); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S3B( - packetIn.a(), - (double)packetIn.b() / 8000.0D, - (double)packetIn.c() / 8000.0D, - (double)packetIn.d() / 8000.0D); - } - - @Override - public void a(hl packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.b()); - if (rr2 != null && packetIn.a() != null) { - rr2.R().a(packetIn.a()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S39(packetIn.b(), null); - } - - @Override - public void a(fo packetIn) { - fh.a(packetIn, this, this.f); - double d2 = packetIn.d(); - double d3 = packetIn.e(); - double d4 = packetIn.f(); - float f2 = (float)(packetIn.g() * 360) / 256.0f; - float f3 = (float)(packetIn.h() * 360) / 256.0f; - bmr bmr2 = new bmr(this.f.f, this.a(packetIn.c()).a()); - bmr2.m = bmr2.M = d2; - bmr2.n = bmr2.N = d3; - bmr2.o = bmr2.O = d4; - lm.a(bmr2, d2, d3, d4); - bmr2.a(d2, d3, d4, f2, f3); - this.g.a(packetIn.b(), bmr2); - List list = packetIn.a(); - if (list != null) { - bmr2.R().a(list); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S05(packetIn.b(), packetIn.c(), d2, d3, d4, f2, f3, packetIn.a()); - } - - @Override - public void a(ic packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.a()); - if (rr2 == null) { - return; - } - double d2 = packetIn.b(); - double d3 = packetIn.c(); - double d4 = packetIn.d(); - lm.a(rr2, d2, d3, d4); - if (!rr2.bx()) { - float f2 = (float)(packetIn.e() * 360) / 256.0f; - float f3 = (float)(packetIn.f() * 360) / 256.0f; - if (Math.abs(rr2.p - d2) >= 0.03125 || Math.abs(rr2.q - d3) >= 0.015625 || Math.abs(rr2.r - d4) >= 0.03125) { - rr2.a(d2, d3, d4, f2, f3, 3, true); - } else { - rr2.a(rr2.p, rr2.q, rr2.r, f2, f3, 0, true); - } - rr2.z = packetIn.g(); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S4A(packetIn.a(), d2, d3, d4, f2, f3, rr2.z); - } - else if(ServerPacketData.enabled) - { - ServerPacketData.display_S4A(-1, 0, 0, 0, 0F, 0F, false); - } - } - - @Override - public void a(hj packetIn) { - fh.a(packetIn, this, this.f); - if (zi.e(packetIn.a())) { - this.f.h.br.d = packetIn.a(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S37(packetIn.a()); - } - - @Override - public void a(gu packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = packetIn.a(this.g); - if (rr2 == null) { - return; - } - rr2.ae += (long)packetIn.a(); - rr2.af += (long)packetIn.b(); - rr2.ag += (long)packetIn.c(); - double d2 = (double)rr2.ae / 4096.0; - double d3 = (double)rr2.af / 4096.0; - double d4 = (double)rr2.ag / 4096.0; - - float f2 = 0F, f3 = 0F; - if (!rr2.bx()) { - f2 = packetIn.f() ? (float)(packetIn.d() * 360) / 256.0f : rr2.v; - f3 = packetIn.f() ? (float)(packetIn.e() * 360) / 256.0f : rr2.w; - rr2.a(d2, d3, d4, f2, f3, 3, false); - rr2.z = packetIn.g(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - { - if(packetIn instanceof gu.c) // Rotation - ServerPacketData.display_S26( - rr2.O(), - f2, f3, - ((gu.c)packetIn).g); - else if(packetIn instanceof gu.a) // Movement - ServerPacketData.display_S25( - rr2.O(), - d2, d3, d4, ((gu.a)packetIn).g); - else if(packetIn instanceof gu.b) // Both - ServerPacketData.display_S27( - rr2.O(), - d2, d3, d4, - f2, f3, ((gu.b)packetIn).g); - else - ServerPacketData.display_S28(rr2.O()); - } - } - - @Override - public void a(hg packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = packetIn.a(this.g); - if (rr2 == null) { - return; - } - float f2 = (float)(packetIn.a() * 360) / 256.0f; - rr2.h(f2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S34(rr2.O(), f2); - } - - @Override - public void a(hc packetIn) { - fh.a(packetIn, this, this.f); - - // PacketAnalysis - // Display the content before destroying the entities - if(ServerPacketData.enabled) - ServerPacketData.display_S30(packetIn.a().length, packetIn.a()); - - for (int i2 = 0; i2 < packetIn.a().length; ++i2) { - this.g.e(packetIn.a()[i2]); - } - } - - @Override - public void a(ha packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - double d2 = packetIn.a(); - double d3 = packetIn.b(); - double d4 = packetIn.c(); - float f2 = packetIn.d(); - float f3 = packetIn.e(); - if (packetIn.g().contains((Object)ha.a.a)) { - d2 += bmq2.p; - } else { - bmq2.s = 0.0; - } - if (packetIn.g().contains((Object)ha.a.b)) { - d3 += bmq2.q; - } else { - bmq2.t = 0.0; - } - if (packetIn.g().contains((Object)ha.a.c)) { - d4 += bmq2.r; - } else { - bmq2.u = 0.0; - } - if (packetIn.g().contains((Object)ha.a.e)) { - f3 += bmq2.w; - } - if (packetIn.g().contains((Object)ha.a.d)) { - f2 += bmq2.v; - } - bmq2.a(d2, d3, d4, f2, f3); - this.c.a(new ih(packetIn.f())); - this.c.a(new it.b(bmq2.p, bmq2.bl().b, bmq2.r, bmq2.v, bmq2.w, false)); - if (!this.h) { - this.f.h.m = this.f.h.p; - this.f.h.n = this.f.h.q; - this.f.h.o = this.f.h.r; - this.h = true; - this.f.a((bey)null); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S2E( - d2, d3, d4, f2, f3, - packetIn.g().toString(), null - ); - } - - @Override - public void a(fz packetIn) { - fh.a(packetIn, this, this.f); - for (fz.a a2 : packetIn.a()) { - this.g.b(a2.a(), a2.c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S10(packetIn.a()); - } - - @Override - public void a(gp packetIn) { - fh.a(packetIn, this, this.f); - if (packetIn.e()) { - this.g.b(packetIn.b(), packetIn.c(), true); - } - this.g.a(packetIn.b() << 4, 0, packetIn.c() << 4, (packetIn.b() << 4) + 15, 256, (packetIn.c() << 4) + 15); - ase ase2 = this.g.a(packetIn.b(), packetIn.c()); - ase2.a(packetIn.a(), packetIn.d(), packetIn.e()); - this.g.b(packetIn.b() << 4, 0, packetIn.c() << 4, (packetIn.b() << 4) + 15, 256, (packetIn.c() << 4) + 15); - if (!packetIn.e() || !(this.g.s instanceof asx)) { - ase2.m(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S20( - packetIn.b(), packetIn.c(), - packetIn.e(), packetIn.d(), - 0, null, null); - } - - @Override - public void a(gm packetIn) { - fh.a(packetIn, this, this.f); - this.g.b(packetIn.a(), packetIn.b(), false); - - // UNLISTED PACKET: Unload Chunk - // PacketAnalysis - - } - - @Override - public void a(fu packetIn) { - fh.a(packetIn, this, this.f); - this.g.b(packetIn.b(), packetIn.a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S0B(packetIn.b(), packetIn.a()); - } - - @Override - public void a(gj packetIn) { - this.c.a(packetIn.a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S1A(packetIn.a()); - } - - @Override - public void a(eu eu2) { // onDisconnect(IChatComponent reason) - this.f.a((bkr)null); - if (this.e != null) { - if (this.e instanceof bdw) { - this.f.a(new DisconnectedRealmsScreen(((bdw)this.e).a(), "disconnect.lost", eu2).getProxy()); - } else { - this.f.a(new bem(this.e, "disconnect.lost", eu2)); - } - } else { - this.f.a(new bem(new bgo(new bff()), "disconnect.lost", eu2)); - } - } - - public void a(ff ff2) { // addToSendQueue(Packet p_147297_1_) - this.c.a(ff2); - } - - @Override - public void a(ib packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.a()); - sa sa2 = (sa)this.g.a(packetIn.b()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S49(packetIn.b(), packetIn.a()); - - if (sa2 == null) { - sa2 = this.f.h; - } - if (rr2 != null) { - if (rr2 instanceof rx) { - this.g.a(rr2.p, rr2.q, rr2.r, ng.bi, nh.h, 0.2f, ((this.k.nextFloat() - this.k.nextFloat()) * 0.7f + 1.0f) * 2.0f, false); - } else { - this.g.a(rr2.p, rr2.q, rr2.r, ng.cV, nh.h, 0.2f, ((this.k.nextFloat() - this.k.nextFloat()) * 0.7f + 1.0f) * 2.0f, false); - } - this.f.j.a(new blp(this.g, rr2, sa2, 0.5f)); - this.g.e(packetIn.a()); - } - } - - @Override - public void a(fy packetIn) { - fh.a(packetIn, this, this.f); - if (packetIn.c() == 2) { - this.f.r.a(packetIn.a(), false); - } else { - this.f.r.d().a(packetIn.a()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S0F(packetIn.a(), packetIn.c()); - } - - @Override - public void a(fp packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.a()); - if (rr2 == null) { - return; - } - if (packetIn.b() == 0) { - sa sa2 = (sa)rr2; - sa2.a(qm.a); - } else if (packetIn.b() == 3) { - sa sa3 = (sa)rr2; - sa3.a(qm.b); - } else if (packetIn.b() == 1) { - rr2.aD(); - } else if (packetIn.b() == 2) { - zj zj2 = (zj)rr2; - zj2.a(false, false, false); - } else if (packetIn.b() == 4) { - this.f.j.a(rr2, cy.j); - } else if (packetIn.b() == 5) { - this.f.j.a(rr2, cy.k); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S06(packetIn.a(), packetIn.b()); - } - - @Override - public void a(hb packetIn) { - fh.a(packetIn, this, this.f); - packetIn.a(this.g).a(packetIn.a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S2F(packetIn.a(this.g), packetIn.a()); - } - - @Override - public void a(fm packetIn) { - fh.a(packetIn, this, this.f); - double d2 = packetIn.e(); - double d3 = packetIn.f(); - double d4 = packetIn.g(); - float f2 = (float)(packetIn.k() * 360) / 256.0f; - float f3 = (float)(packetIn.l() * 360) / 256.0f; - sa sa2 = (sa)rt.a(packetIn.d(), (aht)this.f.f); - lm.a(sa2, d2, d3, d4); - sa2.aM = sa2.aO = (float)(packetIn.m() * 360) / 256.0f; - rr[] arrrr = sa2.aR(); - if (arrrr != null) { - int n2 = packetIn.b() - sa2.O(); - for (int i2 = 0; i2 < arrrr.length; ++i2) { - arrrr[i2].f(arrrr[i2].O() + n2); - } - } - sa2.f(packetIn.b()); - sa2.a(packetIn.c()); - sa2.a(d2, d3, d4, f2, f3); - sa2.s = (float)packetIn.h() / 8000.0f; - sa2.t = (float)packetIn.i() / 8000.0f; - sa2.u = (float)packetIn.j() / 8000.0f; - this.g.a(packetIn.b(), sa2); - List list = packetIn.a(); - if (list != null) { - sa2.R().a(list); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - { - float velX = (float)packetIn.h() / 8000.0f; - float velY = (float)packetIn.i() / 8000.0f; - float velZ = (float)packetIn.j() / 8000.0f; - float headRot = (float)(packetIn.m() * 360) / 256.0f; - - ServerPacketData.display_S03( - packetIn.b(), packetIn.c(), packetIn.d(), - d2, d3, d4, f2, f3, headRot, velX, velY, velZ, packetIn.a()); - } - } - - @Override - public void a(hw packetIn) { - fh.a(packetIn, this, this.f); - this.f.f.a(packetIn.a()); - this.f.f.b(packetIn.b()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S44(packetIn.a(), packetIn.b()); - } - - @Override - public void a(hv packetIn) { - fh.a(packetIn, this, this.f); - this.f.h.a(packetIn.a(), true); - this.f.f.T().a(packetIn.a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S43(packetIn.a()); - } - - @Override - public void a(hs packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.b()); - if (rr2 == null) { - b.warn("Received passengers for unknown entity"); - return; - } - boolean bl2 = rr2.y(this.f.h); - rr2.az(); - for (int n2 : packetIn.a()) { - rr rr3 = this.g.a(n2); - if (rr3 == null) { - b.warn("Received unknown passenger for " + rr2); - continue; - } - rr3.a(rr2, true); - if (rr3 != this.f.h || bl2) continue; - this.f.r.a(bwl.a("mount.onboard", bce.c(this.f.u.V.j())), false); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S40(packetIn.b(), packetIn.a()); - } - - @Override - public void a(hm packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.a()); - rr rr3 = this.g.a(packetIn.b()); - if (rr2 instanceof sb) { - if (rr3 != null) { - ((sb)rr2).b(rr3, false); - } else { - ((sb)rr2).a(false, false); // leashing - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S3A(packetIn.a(), packetIn.b()); - } - - @Override - public void a(gk packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = packetIn.a(this.g); - if (rr2 != null) { - if (packetIn.a() == 21) { - this.f.U().a(new bxz((yo)rr2)); - } else { - rr2.a(packetIn.a()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S1B(rr2.O(), packetIn.a()); - } - else if(ServerPacketData.enabled) - { - ServerPacketData.display_S1B(-1, -1); - } - } - - @Override - public void a(hq packetIn) { - fh.a(packetIn, this, this.f); - this.f.h.p(packetIn.a()); - this.f.h.cS().a(packetIn.b()); - this.f.h.cS().b(packetIn.c()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S3E( - packetIn.a(), - packetIn.b(), - packetIn.c()); - } - - @Override - public void a(hp packetIn) { - fh.a(packetIn, this, this.f); - this.f.h.a(packetIn.a(), packetIn.b(), packetIn.c()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S3D(packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(hf packetIn) { - fh.a(packetIn, this, this.f); - if (packetIn.a() != this.f.h.am) { - this.h = false; - bbm bbm2 = this.g.ad(); - this.g = new bkr(this, new ahw(0, packetIn.c(), false, this.f.f.T().s(), packetIn.d()), packetIn.a(), packetIn.b(), this.f.B); - this.g.a(bbm2); - this.f.a(this.g); - this.f.h.am = packetIn.a(); - this.f.a(new bex(this)); - } - this.f.a(packetIn.a()); - this.f.c.a(packetIn.c()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S33( - packetIn.a(), - packetIn.b().ordinal(), - packetIn.c().a(), - packetIn.d().a()); - } - - @Override - public void a(gl packetIn) { - fh.a(packetIn, this, this.f); - ahp ahp2 = new ahp(this.f.f, null, packetIn.d(), packetIn.e(), packetIn.f(), packetIn.g(), packetIn.h()); - ahp2.a(true); - this.f.h.s += (double)packetIn.a(); - this.f.h.t += (double)packetIn.b(); - this.f.h.u += (double)packetIn.c(); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S1C( - packetIn.d(), packetIn.e(), packetIn.f(), - packetIn.g(), packetIn.h(), - packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(gc packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - if ("minecraft:container".equals(packetIn.b())) { - bmq2.a(new qv(packetIn.c(), packetIn.d())); - bmq2.bt.d = packetIn.a(); - } else if ("minecraft:villager".equals(packetIn.b())) { - bmq2.a(new zc(bmq2, packetIn.c())); - bmq2.bt.d = packetIn.a(); - } else if ("EntityHorse".equals(packetIn.b())) { - rr rr2 = this.g.a(packetIn.e()); - if (rr2 instanceof wk) { - bmq2.a((wk)rr2, new aav(packetIn.c(), packetIn.d())); - bmq2.bt.d = packetIn.a(); - } - } else if (!packetIn.f()) { - bmq2.a(new bms(packetIn.b(), packetIn.c())); - bmq2.bt.d = packetIn.a(); - } else { - bmt bmt2 = new bmt(packetIn.b(), packetIn.c(), packetIn.d()); - bmq2.a((qg)bmt2); - bmq2.bt.d = packetIn.a(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S13( - packetIn.a(), // id - packetIn.b(), // type - packetIn.c(), // title - packetIn.d(), // slotNum - packetIn.e() // entityID - ); - } - - @Override - public void a(gf packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - if (packetIn.a() == -1) { - bmq2.br.e(packetIn.c()); - } else if (packetIn.a() == -2) { - bmq2.br.a(packetIn.b(), packetIn.c()); - } else { - Object object; - boolean bl2 = false; - if (this.f.m instanceof bfz) { - bfz object1 = (bfz)this.f.m; - boolean bl3 = bl2 = object1.f() != acq.m.a(); - } - if (packetIn.a() == 0 && packetIn.b() >= 36 && packetIn.b() < 45) { - adq object1 = bmq2.bs.a(packetIn.b()).d(); - if (packetIn.c() != null && (object1 == null || object1.b < packetIn.c().b)) { - packetIn.c().c = 5; - } - bmq2.bs.a(packetIn.b(), packetIn.c()); - } else if (!(packetIn.a() != bmq2.bt.d || packetIn.a() == 0 && bl2)) { - bmq2.bt.a(packetIn.b(), packetIn.c()); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S16(packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(ga packetIn) { - fh.a(packetIn, this, this.f); - aau aau2 = null; - bmq bmq2 = this.f.h; - if (packetIn.a() == 0) { - aau2 = bmq2.bs; - } else if (packetIn.a() == bmq2.bt.d) { - aau2 = bmq2.bt; - } - if (aau2 != null && !packetIn.c()) { - this.a(new im(packetIn.a(), packetIn.b(), true)); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S11(packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(gd packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - if (packetIn.a() == 0) { - bmq2.bs.a(packetIn.b()); - } else if (packetIn.a() == bmq2.bt.d) { - bmq2.bt.a(packetIn.b()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S14(packetIn.a(), packetIn.b()); - } - - @Override - public void a(gw packetIn) { - fh.a(packetIn, this, this.f); - apv apv2 = this.g.r(packetIn.a()); - if (!(apv2 instanceof aqn)) { - apv2 = new aqn(); - apv2.a(this.g); - apv2.a(packetIn.a()); - } - this.f.h.a((aqn)apv2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S2A(packetIn.a()); - } - - @Override - public void a(hy packetIn) { - apv apv2; - fh.a(packetIn, this, this.f); - boolean bl2 = false; - if (this.f.f.e(packetIn.a()) && (apv2 = this.f.f.r(packetIn.a())) instanceof aqn) { - aqn aqn2 = (aqn)apv2; - if (aqn2.b()) { - System.arraycopy(packetIn.b(), 0, aqn2.a, 0, 4); - aqn2.v_(); - } - bl2 = true; - } - if (!bl2 && this.f.h != null) { - b.debug("Unable to locate sign at " + packetIn.a().p() + ", " + packetIn.a().q() + ", " + packetIn.a().r()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S46(packetIn.a(), packetIn.b()); - } - - @Override - public void a(fs packetIn) { - fh.a(packetIn, this, this.f); - if (this.f.f.e(packetIn.a())) { - boolean bl2; - apv apv2 = this.f.f.r(packetIn.a()); - int n2 = packetIn.b(); - boolean bl3 = bl2 = n2 == 2 && apv2 instanceof apy; - if (n2 == 1 && apv2 instanceof aqk || bl2 || n2 == 3 && apv2 instanceof apu || n2 == 4 && apv2 instanceof aqo || n2 == 5 && apv2 instanceof aqf || n2 == 6 && apv2 instanceof apt || n2 == 7 && apv2 instanceof aqp || n2 == 8 && apv2 instanceof aqq) { - apv2.a(packetIn.c()); - } - if (bl2 && this.f.m instanceof bfv) { - ((bfv)this.f.m).a(); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S09(packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(ge packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - if (bmq2.bt != null && bmq2.bt.d == packetIn.a()) { - bmq2.bt.b(packetIn.b(), packetIn.c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S15(packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(ho packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.b()); - if (rr2 != null) { - rr2.a(packetIn.c(), packetIn.a()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S3C( - packetIn.b(), - packetIn.c().name(), - packetIn.a()); - } - - @Override - public void a(gb packetIn) { - fh.a(packetIn, this, this.f); - this.f.h.B(); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S12(); - } - - @Override - public void a(ft packetIn) { - fh.a(packetIn, this, this.f); - this.f.f.c(packetIn.a(), packetIn.d(), packetIn.b(), packetIn.c()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S0A(packetIn.a(), packetIn.d(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(fr packetIn) { - fh.a(packetIn, this, this.f); - this.f.f.c(packetIn.a(), packetIn.b(), packetIn.c()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S08(packetIn.a(), packetIn.b(), packetIn.c()); - } - - @Override - public void a(gn packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - int n2 = packetIn.a(); - float f2 = packetIn.b(); - int n3 = on.d(f2 + 0.5f); - if (n2 >= 0 && n2 < gn.a.length && gn.a[n2] != null) { - bmq2.b(new fb(gn.a[n2], new Object[0])); - } - if (n2 == 1) { - this.g.T().b(true); - this.g.k(0.0f); - } else if (n2 == 2) { - this.g.T().b(false); - this.g.k(1.0f); - } else if (n2 == 3) { - this.f.c.a(ahw.a.a(n3)); - } else if (n2 == 4) { - if (n3 == 0) { - this.f.h.d.a(new ik(ik.a.a)); - this.f.a(new bex(this)); - } else if (n3 == 1) { - this.f.a(new bfh()); - } - } else if (n2 == 5) { - bce bce2 = this.f.u; - if (f2 == 0.0f) { - this.f.a(new bek()); - } else if (f2 == 101.0f) { - this.f.r.d().a(new fb("demo.help.movement", bce.c(bce2.Q.j()), bce.c(bce2.R.j()), bce.c(bce2.S.j()), bce.c(bce2.T.j()))); - } else if (f2 == 102.0f) { - this.f.r.d().a(new fb("demo.help.jump", bce.c(bce2.U.j()))); - } else if (f2 == 103.0f) { - this.f.r.d().a(new fb("demo.help.inventory", bce.c(bce2.X.j()))); - } - } else if (n2 == 6) { - this.g.a(bmq2, bmq2.p, bmq2.q + (double)bmq2.bn(), bmq2.r, ng.u, nh.h, 0.18f, 0.45f); - } else if (n2 == 7) { - this.g.k(f2); - } else if (n2 == 8) { - this.g.i(f2); - } else if (n2 == 10) { - this.g.a(cy.P, bmq2.p, bmq2.q, bmq2.r, 0.0, 0.0, 0.0, new int[0]); - this.g.a(bmq2, bmq2.p, bmq2.q, bmq2.r, ng.aF, nh.f, 1.0f, 1.0f); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S1E(n2, f2); - } - - @Override - public void a(gt packetIn) { - fh.a(packetIn, this, this.f); - ayy ayy2 = adw.a(packetIn.a(), this.f.f); - packetIn.a(ayy2); - this.f.o.k().a(ayy2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S24(packetIn.a()); - } - - @Override - public void a(gq packetIn) { - fh.a(packetIn, this, this.f); - if (packetIn.a()) { - this.f.f.a(packetIn.b(), packetIn.d(), packetIn.c()); - } else { - this.f.f.b(packetIn.b(), packetIn.d(), packetIn.c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S21(packetIn.b(), packetIn.d(), packetIn.c(), packetIn.a()); - } - - @Override - public void a(fq packetIn) { - fh.a(packetIn, this, this.f); - boolean bl2 = false; - for (Map.Entry entry : packetIn.a().entrySet()) { - np np2 = entry.getKey(); - int n2 = entry.getValue(); - if (np2.d() && n2 > 0) { - if (this.j && this.f.h.G().a(np2) == 0) { - nj nj2 = (nj)np2; - this.f.q.a(nj2); - if (np2 == nk.f) { - this.f.u.I = false; - this.f.u.b(); - } - } - bl2 = true; - } - this.f.h.G().a(this.f.h, np2, n2); - } - if (!this.j && !bl2 && this.f.u.I) { - this.f.q.b(nk.f); - } - this.j = true; - if (this.f.m instanceof bfl) { - ((bfl)((Object)this.f.m)).a(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S07(); - } - - @Override - public void a(ie packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.b()); - if (!(rr2 instanceof sa)) { - return; - } - rk rk2 = rk.a(packetIn.c()); - if (rk2 == null) { - return; - } - rl rl2 = new rl(rk2, packetIn.e(), packetIn.d(), packetIn.g(), packetIn.f()); - rl2.b(packetIn.a()); - ((sa)rr2).c(rl2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S4C( - packetIn.b(), rk2.a(), - packetIn.e(), packetIn.d(), packetIn.g(), - packetIn.f()); - } - - // CombatEvent is only used for "deathScreen.title" - @Override - public void a(gy packetIn) { - rr rr2; - fh.a(packetIn, this, this.f); - if (packetIn.a == Namepipe.gy_a.c && (rr2 = this.g.a(packetIn.b)) == this.f.h) { - this.f.a(new bej(packetIn.e)); // bej : - GuiDeathScreen - - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S2C( - packetIn.a.name(), // event - packetIn.b, // entityID - packetIn.e // message - ); - } - - @Override - public void a(fw packetIn) { - fh.a(packetIn, this, this.f); - this.f.f.T().a(packetIn.b()); - this.f.f.T().e(packetIn.a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S0D(packetIn.b().ordinal(), packetIn.a()); - } - - @Override - public void a(hi packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = packetIn.a(this.g); - if (rr2 != null) { - this.f.a(rr2); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S36(rr2.O()); - } - - @Override - public void a(hh packetIn) { - fh.a(packetIn, this, this.f); - packetIn.a(this.g.aj()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S35(); - } - - @Override - public void a(hx packetIn) { - fh.a(packetIn, this, this.f); - hx.a a2 = packetIn.a(); - String string = null; - String string2 = null; - String string3 = packetIn.b() != null ? packetIn.b().d() : ""; - switch (a2) { - case a: { - string = string3; - break; - } - case b: { - string2 = string3; - break; - } - case e: { - this.f.r.a("", "", -1, -1, -1); - this.f.r.a(); - return; - } - } - this.f.r.a(string, string2, packetIn.c(), packetIn.d(), packetIn.e()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S45(a2.name(), string, string2, packetIn.c(), packetIn.d(), packetIn.e()); - } - - @Override - public void a(ia packetIn) { - this.f.r.h().b(packetIn.a().d().isEmpty() ? null : packetIn.a()); - this.f.r.h().a(packetIn.b().d().isEmpty() ? null : packetIn.b()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S48(packetIn.a(), packetIn.b()); - } - - @Override - public void a(hd packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = packetIn.a(this.g); - if (rr2 instanceof sa) { - ((sa)rr2).c(packetIn.a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S31(rr2.O(), packetIn.a().a()); - } - } - - @Override - public void a(gz packetIn) { - fh.a(packetIn, this, this.f); - - // PacketAnalysis - String actions = ""; - String uuids = ""; - - for (gz.b b2 : packetIn.a()) { - - // PacketAnalysis - actions += packetIn.b().name() + "\n"; - uuids += b2.a().getId() + "\n"; - - if (packetIn.b() == gz.a.e) { - this.i.remove(b2.a().getId()); - continue; - } - bks bks2 = this.i.get(b2.a().getId()); - if (packetIn.b() == gz.a.a) { - bks2 = new bks(b2); - this.i.put(bks2.a().getId(), bks2); - } - if (bks2 == null) continue; - switch (packetIn.b()) { - case a: { - bks2.a(b2.c()); - bks2.a(b2.b()); - break; - } - case b: { - bks2.a(b2.c()); - break; - } - case c: { - bks2.a(b2.b()); - break; - } - case d: { - bks2.a(b2.d()); - } - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S2D(uuids.split("\n"), actions.split("\n")); - } - - @Override - public void a(go packetIn) { - this.a(new is(packetIn.a())); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1F(packetIn.a()); - } - - @Override - public void a(gx packetIn) { - fh.a(packetIn, this, this.f); - bmq bmq2 = this.f.h; - bmq2.bJ.b = packetIn.b(); - bmq2.bJ.d = packetIn.d(); - bmq2.bJ.a = packetIn.a(); - bmq2.bJ.c = packetIn.c(); - bmq2.bJ.a(packetIn.e()); - bmq2.bJ.b(packetIn.f()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S2B( - packetIn.b(), packetIn.d(), - packetIn.a(), packetIn.c(), - packetIn.e(), packetIn.f() - ); - } - - @Override - public void a(fx packetIn) { - fh.a(packetIn, this, this.f); - String[] arrstring = packetIn.a(); - if (this.f.m instanceof bfd) { - ((bfd)((Object)this.f.m)).a(arrstring); - } - - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S0E(packetIn.a()); - } - - @Override - public void a(hz packetIn) { - fh.a(packetIn, this, this.f); - this.f.f.a(this.f.h, packetIn.c(), packetIn.d(), packetIn.e(), packetIn.a(), packetIn.b(), packetIn.f(), packetIn.g()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S19(packetIn.c(), packetIn.d(), packetIn.e(), packetIn.a().a().toString(), packetIn.b().name(), packetIn.f(), packetIn.g()); - } - - @Override - public void a(gi packetIn) { - fh.a(packetIn, this, this.f); - this.f.U().a(new byc(new kk(packetIn.a()), packetIn.b(), packetIn.f(), packetIn.g(), false, 0, byg.a.b, (float)packetIn.c(), (float)packetIn.d(), (float)packetIn.e())); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S47( - packetIn.c(), packetIn.d(), packetIn.e(), - packetIn.a(), packetIn.b().name(), - packetIn.f(), packetIn.g()); - } - - @Override - public void a(he packetIn) { - String string; - final String string2 = packetIn.a(); - if (!this.a(string2, string = packetIn.b())) { - return; - } - if (string2.startsWith("level://")) { - File file = new File(this.f.w, "saves"); - String string3 = string2.substring("level://".length()); - File file2 = new File(file, string3); - if (file2.isFile()) { - this.c.a(new ja(string, ja.a.d)); - Futures.addCallback(this.f.P().a(file2), this.b(string)); - } else { - this.c.a(new ja(string, ja.a.c)); - } - return; - } - if (this.f.C() != null && this.f.C().b() == Namepipe.bku_a.a) { - this.c.a(new ja(string, ja.a.d)); - Futures.addCallback(this.f.P().a(string2, string), this.b(string)); - } else if (this.f.C() == null || this.f.C().b() == Namepipe.bku_a.c) { - this.f.a(new Runnable(){ - - @Override - public void run() { - bkp.this.f.a(new bee(new bed(){ - - @Override - public void a(boolean bl2, int n2) { - bkp.this.f = bcc.z(); - if (bl2) { - if (bkp.this.f.C() != null) { - bkp.this.f.C().a(Namepipe.bku_a.a); - } - bkp.this.c.a(new ja(string, ja.a.d)); - Futures.addCallback(bkp.this.f.P().a(string2, string), (FutureCallback)bkp.this.b(string)); - } else { - if (bkp.this.f.C() != null) { - bkp.this.f.C().a(Namepipe.bku_a.b); - } - bkp.this.c.a(new ja(string, ja.a.b)); - } - bkv.b(bkp.this.f.C()); - bkp.this.f.a((bey)null); - } - }, bwl.a("multiplayer.texturePrompt.line1", new Object[0]), bwl.a("multiplayer.texturePrompt.line2", new Object[0]), 0)); - } - - }); - } else { - this.c.a(new ja(string, ja.a.b)); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S32(packetIn.a(), packetIn.b()); - } - - private boolean a(String string, String string2) { - try { - URI uRI = new URI(string.replace(' ', '+')); - String string3 = uRI.getScheme(); - boolean bl2 = "level".equals(string3); - if (!("http".equals(string3) || "https".equals(string3) || bl2)) { - throw new URISyntaxException(string, "Wrong protocol"); - } - if (bl2 && (string.contains("..") || !string.endsWith("/resources.zip"))) { - throw new URISyntaxException(string, "Invalid levelstorage resourcepack path"); - } - } - catch (URISyntaxException err) { - this.c.a(new ja(string2, ja.a.c)); - return false; - } - return true; - } - - private FutureCallback b(final String string) { - return new FutureCallback(){ - - public void onSuccess(Object object) { - bkp.this.c.a(new ja(string, ja.a.a)); - } - - public void onFailure(Throwable throwable) { - bkp.this.c.a(new ja(string, ja.a.c)); - } - }; - } - - @Override - public void a(fv packetIn) { - fh.a(packetIn, this, this.f); - this.f.r.j().a(packetIn); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S0C( - packetIn.a(), packetIn.b().name(), - packetIn.c(), packetIn.d(), - packetIn.e().name(), packetIn.f().name(), - packetIn.g(), packetIn.h(), packetIn.i() - ); - } - - @Override - public void a(gg packetIn) { - fh.a(packetIn, this, this.f); - if (packetIn.b() == 0) { - this.f.h.da().b(packetIn.a()); - } else { - this.f.h.da().a(packetIn.a(), packetIn.b()); - } - - // Set Cooldown - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S17(packetIn.a().a(), packetIn.b()); - } - - @Override - public void a(gv packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.f.h.bw(); - if (rr2 != this.f.h && rr2.bx()) { - rr2.a(packetIn.a(), packetIn.b(), packetIn.c(), packetIn.d(), packetIn.e()); - this.c.a(new iu(rr2)); - } - - // Vehicle Move (clientbound) - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S29(packetIn.a(), packetIn.b(), packetIn.c(), packetIn.d(), packetIn.e()); - } - - /* - * WARNING - Removed try catching itself - possible behaviour change. - */ - @Override - public void a(gh packetIn) { - block13 : { - fh.a(packetIn, this, this.f); - if ("MC|TrList".equals(packetIn.a())) { - em em2 = packetIn.b(); - try { - int n2 = em2.readInt(); - bey bey2 = this.f.m; - if (bey2 != null && bey2 instanceof bgi && n2 == this.f.h.bt.d) { - ahf ahf2 = ((bgi)bey2).a(); - ahh ahh2 = ahh.b(em2); - ahf2.a(ahh2); - } - break block13; - } - catch (IOException err) { - b.error("Couldn't load trade info", (Throwable)err); - } - finally { - em2.release(); - } - } - if ("MC|Brand".equals(packetIn.a())) { - this.f.h.h(packetIn.b().e(32767)); - } else if ("MC|BOpen".equals(packetIn.a())) { - adq adq2; - qm qm2 = (qm)((Object)packetIn.b().a(qm.class)); - adq adq3 = adq2 = qm2 == qm.b ? this.f.h.cc() : this.f.h.cb(); - if (adq2 != null && adq2.b() == ads.bX) { - this.f.a(new bft(this.f.h, adq2, false)); - } - } else if ("MC|DebugPath".equals(packetIn.a())) { - em em3 = packetIn.b(); - int n3 = em3.readInt(); - float f2 = em3.readFloat(); - ayo ayo2 = ayo.b(em3); - this.f.p.a.a(n3, ayo2, f2); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S18(packetIn.a()); - } - - @Override - public void a(hr packetIn) { - fh.a(packetIn, this, this.f); - bbm bbm2 = this.g.ad(); - if (packetIn.c() == 0) { - bbi bbi2 = bbm2.a(packetIn.a(), bbs.b); - bbi2.a(packetIn.b()); - bbi2.a(packetIn.d()); - } else { - bbi bbi3 = bbm2.b(packetIn.a()); - if (packetIn.c() == 1) { - bbm2.k(bbi3); - } else if (packetIn.c() == 2) { - bbi3.a(packetIn.b()); - bbi3.a(packetIn.d()); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S3F( - packetIn.b(), // name - packetIn.a(), // type - packetIn.c(), // mode - packetIn.d().name() // renderType - ); - } - - @Override - public void a(hu packetIn) { - fh.a(packetIn, this, this.f); - bbm bbm2 = this.g.ad(); - bbi bbi2 = bbm2.b(packetIn.b()); - if (packetIn.d() == hu.a.a) { - bbk bbk2 = bbm2.c(packetIn.a(), bbi2); - bbk2.c(packetIn.c()); - } else if (packetIn.d() == hu.a.b) { - if (os.b(packetIn.b())) { - bbm2.d(packetIn.a(), null); - } else if (bbi2 != null) { - bbm2.d(packetIn.a(), bbi2); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S42( - packetIn.a(), // score name - packetIn.b(), // objective name - packetIn.d().name(), // action - packetIn.c() // score value - ); - } - - @Override - public void a(hk packetIn) { - fh.a(packetIn, this, this.f); - bbm bbm2 = this.g.ad(); - if (packetIn.b().isEmpty()) { - bbm2.a(packetIn.a(), null); - } else { - bbi bbi2 = bbm2.b(packetIn.b()); - bbm2.a(packetIn.a(), bbi2); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S38(packetIn.a(), packetIn.b()); - } - - @Override - public void a(ht packetIn) { - bbj bbj2; - fh.a(packetIn, this, this.f); - bbm bbm2 = this.g.ad(); - if (packetIn.f() == 0) { - bbj2 = bbm2.e(packetIn.a()); - } else { - bbj2 = bbm2.d(packetIn.a()); - } - - if (packetIn.f() == 0 || packetIn.f() == 2) { - bbo.a a2; - bbj2.a(packetIn.b()); - bbj2.b(packetIn.c()); - bbj2.c(packetIn.d()); - bbj2.a(Namepipe.a.a(packetIn.h())); - bbj2.a(packetIn.g()); - bbo.b b2 = bbo.b.a(packetIn.i()); - if (b2 != null) { - bbj2.a(b2); - } - if ((a2 = bbo.a.a(packetIn.j())) != null) { - bbj2.a(a2); - } - } - if (packetIn.f() == 0 || packetIn.f() == 3) { - for (String object : packetIn.e()) { - bbm2.a(object, packetIn.a()); - } - } - if (packetIn.f() == 4) { - for (String string : packetIn.e()) { - bbm2.a(string, bbj2); - } - } - if (packetIn.f() == 1) { - bbm2.d(bbj2); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S41( - packetIn.f(), // mode - packetIn.j(), // team name - - packetIn.b(), // team display name - packetIn.c(), // prefix - packetIn.d(), // suffix - packetIn.h(), // chat formatting - packetIn.g(), // friendly fire - packetIn.i(), // name tag visibility - - packetIn.e() // player names - ); - } - - @Override - public void a(gr packetIn) { - fh.a(packetIn, this, this.f); - if (packetIn.j() == 0) { - double d2 = packetIn.i() * packetIn.f(); - double d3 = packetIn.i() * packetIn.g(); - double d4 = packetIn.i() * packetIn.h(); - try { - this.g.a(packetIn.a(), packetIn.b(), packetIn.c(), packetIn.d(), packetIn.e(), d2, d3, d4, packetIn.k()); - } - catch (Throwable err) { - b.warn("Could not spawn particle effect " + (Object)((Object)packetIn.a())); - } - } else { - for (int i2 = 0; i2 < packetIn.j(); ++i2) { - double d5 = this.k.nextGaussian() * (double)packetIn.f(); - double d6 = this.k.nextGaussian() * (double)packetIn.g(); - double d7 = this.k.nextGaussian() * (double)packetIn.h(); - double d8 = this.k.nextGaussian() * (double)packetIn.i(); - double d9 = this.k.nextGaussian() * (double)packetIn.i(); - double d10 = this.k.nextGaussian() * (double)packetIn.i(); - try { - this.g.a(packetIn.a(), packetIn.b(), packetIn.c() + d5, packetIn.d() + d6, packetIn.e() + d7, d8, d9, d10, packetIn.k()); - continue; - } - catch (Throwable err) { - b.warn("Could not spawn particle effect " + (Object)((Object)packetIn.a())); - return; - } - } - } - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S22( - packetIn.a().name(), // type - packetIn.j(), // count - packetIn.b(), // long distance - packetIn.c(), packetIn.d(), packetIn.e(), // position - packetIn.f(), packetIn.g(), packetIn.h(), // offset - packetIn.i() // offset scale - ); - } - - @Override - public void a(id packetIn) { - fh.a(packetIn, this, this.f); - rr rr2 = this.g.a(packetIn.a()); - if (rr2 == null) { - return; - } - if (!(rr2 instanceof sa)) { - throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + rr2 + ")"); - } - sp sp2 = ((sa)rr2).bZ(); - for (id.a a2 : packetIn.b()) { - sm sm2 = sp2.a(a2.a()); - if (sm2 == null) { - sm2 = sp2.b(new ss(null, a2.a(), 0.0, Double.MIN_NORMAL, Double.MAX_VALUE)); - } - sm2.a(a2.b()); - sm2.d(); - for (sn sn2 : a2.c()) { - sm2.b(sn2); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.display_S4B(packetIn.a(), packetIn.b()); - } - - public ek a() { - return this.c; - } - - public Collection d() { - return this.i.values(); - } - - public bks a(UUID uUID) { - return this.i.get(uUID); - } - - public bks a(String string) { - for (bks bks2 : this.i.values()) { - if (!bks2.a().getName().equals(string)) continue; - return bks2; - } - return null; - } - - public GameProfile e() { - return this.d; - } - -} diff --git a/src/bnd.java b/src/bnd.java deleted file mode 100644 index 17d943a..0000000 --- a/src/bnd.java +++ /dev/null @@ -1,1629 +0,0 @@ -// EntityRenderer - -/* - * Decompiled with CFR 0_115. - * - * Could not load the following classes: - * com.google.common.base.Predicate - * com.google.common.base.Predicates - * com.google.gson.JsonSyntaxException - * org.apache.logging.log4j.LogManager - * org.apache.logging.log4j.Logger - * org.lwjgl.input.Mouse - * org.lwjgl.opengl.ContextCapabilities - * org.lwjgl.opengl.Display - * org.lwjgl.opengl.GLContext - * org.lwjgl.util.glu.Project - */ -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.gson.JsonSyntaxException; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.awt.image.ImageObserver; -import java.awt.image.RenderedImage; -import java.io.File; -import java.io.IOException; -import java.nio.Buffer; -import java.nio.FloatBuffer; -import java.util.List; -import java.util.Random; -import java.util.concurrent.Callable; -import javax.imageio.ImageIO; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.ContextCapabilities; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.GLContext; -import org.lwjgl.util.glu.Project; - -public class bnd -implements bwe { - private static final Logger e = LogManager.getLogger(); - private static final kk f = new kk("textures/environment/rain.png"); - private static final kk g = new kk("textures/environment/snow.png"); - public static boolean a; - public static int b; - private bcc h; - private final bwd i; - private Random j = new Random(); - private float k; - public final bnh c; - private final bct l; - private int m; - private rr n; - private oq o = new oq(); - private oq p = new oq(); - private float q = 4.0f; - private float r = 4.0f; - private float s; - private float t; - private float u; - private float v; - private float w; - private float x; - private float y; - private float z; - private float A; - private boolean B; - private boolean C = true; - private boolean D = true; - private long E; - private long F = bcc.I(); - private long G; - private final buu H; - private final int[] I; - private final kk J; - private boolean K; - private float L; - private float M; - private int N; - private float[] O = new float[1024]; - private float[] P = new float[1024]; - private FloatBuffer Q = bcb.h(16); - private float R; - private float S; - private float T; - private float U; - private float V; - private int W = 0; - private boolean X = false; - private double Y = 1.0; - private double Z; - private double aa; - private bum ab; - private static final kk[] ac; - public static final int d; - private int ad = d; - private boolean ae = false; - private int af = 0; - - public bnd(bcc bcc2, bwd bwd2) { - this.h = bcc2; - this.i = bwd2; - this.c = bcc2.ae(); - this.l = new bct(bcc2.N()); - this.H = new buu(16, 16); - this.J = bcc2.N().a("lightMap", this.H); - this.I = this.H.e(); - this.ab = null; - for (int i2 = 0; i2 < 32; ++i2) { - for (int i3 = 0; i3 < 32; ++i3) { - float f2 = i3 - 16; - float f3 = i2 - 16; - float f4 = on.c(f2 * f2 + f3 * f3); - this.O[i2 << 5 | i3] = (- f3) / f4; - this.P[i2 << 5 | i3] = f2 / f4; - } - } - } - - public boolean a() { - return bze.O && this.ab != null; - } - - public void b() { - if (this.ab != null) { - this.ab.a(); - } - this.ab = null; - this.ad = d; - } - - public void c() { - this.ae = !this.ae; - } - - public void a(rr rr2) { - if (!bze.O) { - return; - } - if (this.ab != null) { - this.ab.a(); - } - this.ab = null; - if (rr2 instanceof yi) { - this.a(new kk("shaders/post/creeper.json")); - } else if (rr2 instanceof yy) { - this.a(new kk("shaders/post/spider.json")); - } else if (rr2 instanceof yj) { - this.a(new kk("shaders/post/invert.json")); - } - } - - private void a(kk kk2) { - try { - this.ab = new bum(this.h.N(), this.i, this.h.b(), kk2); - this.ab.a(this.h.d, this.h.e); - this.ae = true; - } - catch (IOException err) { - e.warn("Failed to load shader: " + kk2, (Throwable)err); - this.ad = d; - this.ae = false; - } - catch (JsonSyntaxException err) { - e.warn("Failed to load shader: " + kk2, (Throwable)err); - this.ad = d; - this.ae = false; - } - } - - @Override - public void a(bwd bwd2) { - if (this.ab != null) { - this.ab.a(); - } - this.ab = null; - if (this.ad != d) { - this.a(ac[this.ad]); - } else { - this.a(this.h.aa()); - } - } - - public void e() { - float f2; - float f3; - if (bze.O && bup.b() == null) { - bup.a(); - } - this.l(); - this.m(); - this.U = this.V; - this.r = this.q; - if (this.h.u.av) { - f2 = this.h.u.a * 0.6f + 0.2f; - f3 = f2 * f2 * f2 * 8.0f; - this.u = this.o.a(this.s, 0.05f * f3); - this.v = this.p.a(this.t, 0.05f * f3); - this.w = 0.0f; - this.s = 0.0f; - this.t = 0.0f; - } else { - this.u = 0.0f; - this.v = 0.0f; - this.o.a(); - this.p.a(); - } - if (this.h.aa() == null) { - this.h.a(this.h.h); - } - f2 = this.h.f.n(new cj(this.h.aa())); - f3 = (float)this.h.u.c / 32.0f; - float f4 = f2 * (1.0f - f3) + f3; - this.V += (f4 - this.V) * 0.1f; - ++this.m; - this.c.a(); - this.p(); - this.A = this.z; - if (this.h.r.j().e()) { - this.z += 0.05f; - if (this.z > 1.0f) { - this.z = 1.0f; - } - } else if (this.z > 0.0f) { - this.z -= 0.0125f; - } - } - - public bum f() { - return this.ab; - } - - public void a(int n2, int n3) { - if (!bze.O) { - return; - } - if (this.ab != null) { - this.ab.a(n2, n3); - } - this.h.g.a(n2, n3); - } - - public void a(float f2) { - rr rr2 = this.h.aa(); - if (rr2 == null) { - return; - } - if (this.h.f == null) { - return; - } - this.h.B.a("pick"); - this.h.i = null; - double d2 = this.h.c.d(); - this.h.t = rr2.a(d2, f2); - double d3 = d2; - bbg bbg2 = rr2.g(f2); - boolean bl2 = false; - int n2 = 3; - if (this.h.c.i()) { - d2 = 6.0; - d3 = 6.0; - } else { - if (d3 > 3.0) { - bl2 = true; - } - d2 = d3; - } - if (this.h.t != null) { - d3 = this.h.t.c.f(bbg2); - } - bbg bbg3 = rr2.f(f2); - bbg bbg4 = bbg2.b(bbg3.b * d2, bbg3.c * d2, bbg3.d * d2); - this.n = null; - bbg bbg5 = null; - float f3 = 1.0f; - List list = this.h.f.a(rr2, rr2.bl().a(bbg3.b * d2, bbg3.c * d2, bbg3.d * d2).b((double)f3, f3, f3), Predicates.and(rv.e, (Predicate)new Predicate(){ - - public boolean a(rr rr2) { - return rr2 != null && rr2.ap(); - } - - public /* synthetic */ boolean apply(rr object) { - return this.a((rr)object); - } - })); - double d4 = d3; - for (int i2 = 0; i2 < list.size(); ++i2) { - double d5; - rr rr3 = list.get(i2); - bbe bbe2 = rr3.bl().g(rr3.aA()); - bbf bbf2 = bbe2.a(bbg2, bbg4); - if (bbe2.a(bbg2)) { - if (d4 < 0.0) continue; - this.n = rr3; - bbg5 = bbf2 == null ? bbg2 : bbf2.c; - d4 = 0.0; - continue; - } - if (bbf2 == null || (d5 = bbg2.f(bbf2.c)) >= d4 && d4 != 0.0) continue; - if (rr3.bw() == rr2.bw()) { - if (d4 != 0.0) continue; - this.n = rr3; - bbg5 = bbf2.c; - continue; - } - this.n = rr3; - bbg5 = bbf2.c; - d4 = d5; - } - if (this.n != null && bl2 && bbg2.f(bbg5) > 3.0) { - this.n = null; - this.h.t = new bbf(Namepipe.bbf_a.a, bbg5, null, new cj(bbg5)); - } - if (this.n != null && (d4 < d3 || this.h.t == null)) { - this.h.t = new bbf(this.n, bbg5); - if (this.n instanceof sa || this.n instanceof xs) { - this.h.i = this.n; - } - } - this.h.B.b(); - } - - private void l() { - float f2 = 1.0f; - if (this.h.aa() instanceof bmn) { - bmn bmn2 = (bmn)this.h.aa(); - f2 = bmn2.x(); - } - this.y = this.x; - this.x += (f2 - this.x) * 0.5f; - if (this.x > 1.5f) { - this.x = 1.5f; - } - if (this.x < 0.1f) { - this.x = 0.1f; - } - } - - private float a(float f2, boolean bl2) { - arc arc2; - if (this.X) { - return 90.0f; - } - rr rr2 = this.h.aa(); - float f3 = 70.0f; - if (bl2) { - f3 = this.h.u.ax; - f3 *= this.y + (this.x - this.y) * f2; - } - if (rr2 instanceof sa && ((sa)rr2).bQ() <= 0.0f) { - float f4 = (float)((sa)rr2).aA + f2; - f3 /= (1.0f - 500.0f / (f4 + 500.0f)) * 2.0f + 1.0f; - } - if ((arc2 = bbx.a(this.h.f, rr2, f2)).a() == axd.h) { - f3 = f3 * 60.0f / 70.0f; - } - return f3; - } - - private void d(float f2) { - if (this.h.aa() instanceof sa) { - float f3; - sa sa2 = (sa)this.h.aa(); - float f4 = (float)sa2.ax - f2; - if (sa2.bQ() <= 0.0f) { - f3 = (float)sa2.aA + f2; - bnf.b(40.0f - 8000.0f / (f3 + 200.0f), 0.0f, 0.0f, 1.0f); - } - if (f4 < 0.0f) { - return; - } - f4 /= (float)sa2.ay; - f4 = on.a(f4 * f4 * f4 * f4 * 3.1415927f); - f3 = sa2.az; - bnf.b(- f3, 0.0f, 1.0f, 0.0f); - bnf.b((- f4) * 14.0f, 0.0f, 0.0f, 1.0f); - bnf.b(f3, 0.0f, 1.0f, 0.0f); - } - } - - private void e(float f2) { - if (!(this.h.aa() instanceof zj)) { - return; - } - zj zj2 = (zj)this.h.aa(); - float f3 = zj2.J - zj2.I; - // Cubitick ! brackets around expression - float f4 = - (zj2.J + f3 * f2); - float f5 = zj2.bw + (zj2.bx - zj2.bw) * f2; - float f6 = zj2.aI + (zj2.aJ - zj2.aI) * f2; - bnf.c(on.a(f4 * 3.1415927f) * f5 * 0.5f, - Math.abs(on.b(f4 * 3.1415927f) * f5), 0.0f); - bnf.b(on.a(f4 * 3.1415927f) * f5 * 3.0f, 0.0f, 0.0f, 1.0f); - bnf.b(Math.abs(on.b(f4 * 3.1415927f - 0.2f) * f5) * 5.0f, 1.0f, 0.0f, 0.0f); - bnf.b(f6, 1.0f, 0.0f, 0.0f); - } - - private void f(float f2) { - Object object; - rr rr2 = this.h.aa(); - float f3 = rr2.bn(); - double d2 = rr2.m + (rr2.p - rr2.m) * (double)f2; - double d3 = rr2.n + (rr2.q - rr2.n) * (double)f2 + (double)f3; - double d4 = rr2.o + (rr2.r - rr2.o) * (double)f2; - if (rr2 instanceof sa && ((sa)rr2).cl()) { - f3 = (float)((double)f3 + 1.0); - bnf.c(0.0f, 0.3f, 0.0f); - if (!this.h.u.aw) { - object = new cj(rr2); - arc arc2 = this.h.f.o((cj)object); - ajt ajt2 = arc2.t(); - if (ajt2 == aju.C) { - int n2 = ((cq)arc2.c(ajr.D)).b(); - bnf.b((float)(n2 * 90), 0.0f, 1.0f, 0.0f); - } - bnf.b(rr2.x + (rr2.v - rr2.x) * f2 + 180.0f, 0.0f, -1.0f, 0.0f); - bnf.b(rr2.y + (rr2.w - rr2.y) * f2, -1.0f, 0.0f, 0.0f); - } - } else if (this.h.u.aq > 0) { - double d5 = this.r + (this.q - this.r) * f2; - if (this.h.u.aw) { - bnf.c(0.0f, 0.0f, (float)(- d5)); - } else { - float f4 = rr2.v; - float f5 = rr2.w; - if (this.h.u.aq == 2) { - f5 += 180.0f; - } - double d6 = (double)((- on.a(f4 * 0.017453292f)) * on.b(f5 * 0.017453292f)) * d5; - double d7 = (double)(on.b(f4 * 0.017453292f) * on.b(f5 * 0.017453292f)) * d5; - double d8 = (double)(- on.a(f5 * 0.017453292f)) * d5; - for (int i2 = 0; i2 < 8; ++i2) { - bbf bbf2; - double d9; - float f6 = (i2 & 1) * 2 - 1; - float f7 = (i2 >> 1 & 1) * 2 - 1; - float f8 = (i2 >> 2 & 1) * 2 - 1; - if ((bbf2 = this.h.f.a(new bbg(d2 + (double)(f6 *= 0.1f), d3 + (double)(f7 *= 0.1f), d4 + (double)(f8 *= 0.1f)), new bbg(d2 - d6 + (double)f6 + (double)f8, d3 - d8 + (double)f7, d4 - d7 + (double)f8))) == null || (d9 = bbf2.c.f(new bbg(d2, d3, d4))) >= d5) continue; - d5 = d9; - } - if (this.h.u.aq == 2) { - bnf.b(180.0f, 0.0f, 1.0f, 0.0f); - } - bnf.b(rr2.w - f5, 1.0f, 0.0f, 0.0f); - bnf.b(rr2.v - f4, 0.0f, 1.0f, 0.0f); - bnf.c(0.0f, 0.0f, (float)(- d5)); - bnf.b(f4 - rr2.v, 0.0f, 1.0f, 0.0f); - bnf.b(f5 - rr2.w, 1.0f, 0.0f, 0.0f); - } - } else { - bnf.c(0.0f, 0.0f, 0.05f); - } - if (!this.h.u.aw) { - bnf.b(rr2.y + (rr2.w - rr2.y) * f2, 1.0f, 0.0f, 0.0f); - if (rr2 instanceof vw) { - vw object1 = (vw)rr2; - bnf.b(object1.aP + (object1.aO - object1.aP) * f2 + 180.0f, 0.0f, 1.0f, 0.0f); - } else { - bnf.b(rr2.x + (rr2.v - rr2.x) * f2 + 180.0f, 0.0f, 1.0f, 0.0f); - } - } - bnf.c(0.0f, - f3, 0.0f); - d2 = rr2.m + (rr2.p - rr2.m) * (double)f2; - d3 = rr2.n + (rr2.q - rr2.n) * (double)f2 + (double)f3; - d4 = rr2.o + (rr2.r - rr2.o) * (double)f2; - this.B = this.h.g.a(d2, d3, d4, f2); - } - - private void a(float f2, int n2) { - float f3; - this.k = this.h.u.c * 16; - bnf.n(5889); - bnf.F(); - float f4 = 0.07f; - if (this.h.u.e) { - bnf.c((float)(- n2 * 2 - 1) * f4, 0.0f, 0.0f); - } - if (this.Y != 1.0) { - bnf.c((float)this.Z, (float)(- this.aa), 0.0f); - bnf.a(this.Y, this.Y, 1.0); - } - Project.gluPerspective((float)this.a(f2, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * on.a)); - bnf.n(5888); - bnf.F(); - if (this.h.u.e) { - bnf.c((float)(n2 * 2 - 1) * 0.1f, 0.0f, 0.0f); - } - this.d(f2); - if (this.h.u.d) { - this.e(f2); - } - if ((f3 = this.h.h.bV + (this.h.h.bU - this.h.h.bV) * f2) > 0.0f) { - int n3 = 20; - if (this.h.h.a(rm.i)) { - n3 = 7; - } - float f5 = 5.0f / (f3 * f3 + 5.0f) - f3 * 0.04f; - f5 *= f5; - bnf.b(((float)this.m + f2) * (float)n3, 0.0f, 1.0f, 1.0f); - bnf.b(1.0f / f5, 1.0f, 1.0f); - bnf.b((- (float)this.m + f2) * (float)n3, 0.0f, 1.0f, 1.0f); - } - this.f(f2); - if (this.X) { - switch (this.W) { - case 0: { - bnf.b(90.0f, 0.0f, 1.0f, 0.0f); - break; - } - case 1: { - bnf.b(180.0f, 0.0f, 1.0f, 0.0f); - break; - } - case 2: { - bnf.b(-90.0f, 0.0f, 1.0f, 0.0f); - break; - } - case 3: { - bnf.b(90.0f, 1.0f, 0.0f, 0.0f); - break; - } - case 4: { - bnf.b(-90.0f, 1.0f, 0.0f, 0.0f); - } - } - } - } - - private void b(float f2, int n2) { - boolean bl2; - if (this.X) { - return; - } - bnf.n(5889); - bnf.F(); - float f3 = 0.07f; - if (this.h.u.e) { - bnf.c((float)(- n2 * 2 - 1) * f3, 0.0f, 0.0f); - } - Project.gluPerspective((float)this.a(f2, false), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * 2.0f)); - bnf.n(5888); - bnf.F(); - if (this.h.u.e) { - bnf.c((float)(n2 * 2 - 1) * 0.1f, 0.0f, 0.0f); - } - bnf.G(); - this.d(f2); - if (this.h.u.d) { - this.e(f2); - } - boolean bl3 = bl2 = this.h.aa() instanceof sa && ((sa)this.h.aa()).cl(); - if (!(this.h.u.aq != 0 || bl2 || this.h.u.ap || this.h.c.a())) { - this.i(); - this.c.a(f2); - this.h(); - } - bnf.H(); - if (this.h.u.aq == 0 && !bl2) { - this.c.b(f2); - this.d(f2); - } - if (this.h.u.d) { - this.e(f2); - } - } - - public void h() { - bnf.g(bze.r); - bnf.z(); - bnf.g(bze.q); - } - - public void i() { - bnf.g(bze.r); - bnf.n(5890); - bnf.F(); - float f2 = 0.00390625f; - bnf.b(f2, f2, f2); - bnf.c(8.0f, 8.0f, 8.0f); - bnf.n(5888); - this.h.N().a(this.J); - bnf.b(3553, 10241, 9729); - bnf.b(3553, 10240, 9729); - bnf.b(3553, 10242, 10496); - bnf.b(3553, 10243, 10496); - bnf.c(1.0f, 1.0f, 1.0f, 1.0f); - bnf.y(); - bnf.g(bze.q); - } - - private void m() { - this.M = (float)((double)this.M + (Math.random() - Math.random()) * Math.random() * Math.random()); - this.M = (float)((double)this.M * 0.9); - this.L += this.M - this.L; - this.K = true; - } - - private void g(float f2) { - if (!this.K) { - return; - } - this.h.B.a("lightTex"); - bkr bkr2 = this.h.f; - if (bkr2 == null) { - return; - } - float f3 = bkr2.b(1.0f); - float f4 = f3 * 0.95f + 0.05f; - for (int i2 = 0; i2 < 256; ++i2) { - float f5; - float f6; - float f7 = bkr2.s.n()[i2 / 16] * f4; - float f8 = bkr2.s.n()[i2 % 16] * (this.L * 0.1f + 1.5f); - if (bkr2.ag() > 0) { - f7 = bkr2.s.n()[i2 / 16]; - } - float f9 = f7 * (f3 * 0.65f + 0.35f); - float f10 = f7 * (f3 * 0.65f + 0.35f); - float f11 = f7; - float f12 = f8; - float f13 = f8 * ((f8 * 0.6f + 0.4f) * 0.6f + 0.4f); - float f14 = f8 * (f8 * f8 * 0.6f + 0.4f); - float f15 = f9 + f12; - float f16 = f10 + f13; - float f17 = f11 + f14; - f15 = f15 * 0.96f + 0.03f; - f16 = f16 * 0.96f + 0.03f; - f17 = f17 * 0.96f + 0.03f; - if (this.z > 0.0f) { - f6 = this.A + (this.z - this.A) * f2; - f15 = f15 * (1.0f - f6) + f15 * 0.7f * f6; - f16 = f16 * (1.0f - f6) + f16 * 0.6f * f6; - f17 = f17 * (1.0f - f6) + f17 * 0.6f * f6; - } - if (bkr2.s.p().a() == 1) { - f15 = 0.22f + f12 * 0.75f; - f16 = 0.28f + f13 * 0.75f; - f17 = 0.25f + f14 * 0.75f; - } - if (this.h.h.a(rm.p)) { - f6 = this.a(this.h.h, f2); - f5 = 1.0f / f15; - if (f5 > 1.0f / f16) { - f5 = 1.0f / f16; - } - if (f5 > 1.0f / f17) { - f5 = 1.0f / f17; - } - f15 = f15 * (1.0f - f6) + f15 * f5 * f6; - f16 = f16 * (1.0f - f6) + f16 * f5 * f6; - f17 = f17 * (1.0f - f6) + f17 * f5 * f6; - } - if (f15 > 1.0f) { - f15 = 1.0f; - } - if (f16 > 1.0f) { - f16 = 1.0f; - } - if (f17 > 1.0f) { - f17 = 1.0f; - } - f6 = this.h.u.ay; - f5 = 1.0f - f15; - float f18 = 1.0f - f16; - float f19 = 1.0f - f17; - f5 = 1.0f - f5 * f5 * f5 * f5; - f18 = 1.0f - f18 * f18 * f18 * f18; - f19 = 1.0f - f19 * f19 * f19 * f19; - f15 = f15 * (1.0f - f6) + f5 * f6; - f16 = f16 * (1.0f - f6) + f18 * f6; - f17 = f17 * (1.0f - f6) + f19 * f6; - f15 = f15 * 0.96f + 0.03f; - f16 = f16 * 0.96f + 0.03f; - f17 = f17 * 0.96f + 0.03f; - if (f15 > 1.0f) { - f15 = 1.0f; - } - if (f16 > 1.0f) { - f16 = 1.0f; - } - if (f17 > 1.0f) { - f17 = 1.0f; - } - if (f15 < 0.0f) { - f15 = 0.0f; - } - if (f16 < 0.0f) { - f16 = 0.0f; - } - if (f17 < 0.0f) { - f17 = 0.0f; - } - int n2 = 255; - int n3 = (int)(f15 * 255.0f); - int n4 = (int)(f16 * 255.0f); - int n5 = (int)(f17 * 255.0f); - this.I[i2] = n2 << 24 | n3 << 16 | n4 << 8 | n5; - } - this.H.d(); - this.K = false; - this.h.B.b(); - } - - private float a(sa sa2, float f2) { - int n2 = sa2.b(rm.p).b(); - if (n2 > 200) { - return 1.0f; - } - return 0.7f + on.a(((float)n2 - f2) * 3.1415927f * 0.2f) * 0.3f; - } - - public void a(float f2, long l2) { - boolean bl2 = Display.isActive(); - if (bl2 || !this.h.u.y || this.h.u.z && Mouse.isButtonDown((int)1)) { - this.F = bcc.I(); - } else if (bcc.I() - this.F > 500) { - this.h.q(); - } - this.h.B.a("mouse"); - if (bl2 && bcc.a && this.h.x && !Mouse.isInsideWindow()) { - Mouse.setGrabbed((boolean)false); - Mouse.setCursorPosition((int)(Display.getWidth() / 2), (int)(Display.getHeight() / 2 - 20)); - Mouse.setGrabbed((boolean)true); - } - if (this.h.x && bl2) { - this.h.v.c(); - float f3 = this.h.u.a * 0.6f + 0.2f; - float f4 = f3 * f3 * f3 * 8.0f; - float f5 = (float)this.h.v.a * f4; - float f6 = (float)this.h.v.b * f4; - byte n21 = 1; - if (this.h.u.b) { - n21 = -1; - } - if (this.h.u.av) { - this.s += f5; - this.t += f6; - float f7 = f2 - this.w; - this.w = f2; - f5 = this.u * f7; - f6 = this.v * f7; - this.h.h.c(f5, f6 * (float)n21); - } else { - this.s = 0.0f; - this.t = 0.0f; - this.h.h.c(f5, f6 * (float)n21); - } - } - this.h.B.b(); - if (this.h.s) { - return; - } - a = this.h.u.e; - final bcu bcu2 = new bcu(this.h); - int n3 = bcu2.a(); - int n4 = bcu2.b(); - final int n5 = Mouse.getX() * n3 / this.h.d; - final int n2 = n4 - Mouse.getY() * n4 / this.h.e - 1; - int n6 = this.h.u.g; - if (this.h.f != null) { - this.h.B.a("level"); - int n7 = Math.min(bcc.af(), n6); - n7 = Math.max(n7, 60); - long l3 = System.nanoTime() - l2; - long l4 = Math.max((long)(1000000000 / n7 / 4) - l3, 0); - this.b(f2, System.nanoTime() + l4); - if (this.h.E() && this.E < bcc.I() - 1000) { - this.E = bcc.I(); - if (!this.h.F().y()) { - this.n(); - } - } - if (bze.O) { - this.h.g.c(); - if (this.ab != null && this.ae) { - bnf.n(5890); - bnf.G(); - bnf.F(); - this.ab.a(f2); - bnf.H(); - } - this.h.b().a(true); - } - this.G = System.nanoTime(); - this.h.B.c("gui"); - if (!this.h.u.ap || this.h.m != null) { - bnf.a(516, 0.1f); - this.h.r.a(f2); - } - this.h.B.b(); - } else { - bnf.b(0, 0, this.h.d, this.h.e); - bnf.n(5889); - bnf.F(); - bnf.n(5888); - bnf.F(); - this.j(); - this.G = System.nanoTime(); - } - if (this.h.m != null) { - bnf.m(256); - try { - this.h.m.a(n5, n2, f2); - } - catch (Throwable err) { - b b2 = Namepipe.b.a(err, "Rendering screen"); - c c2 = b2.a("Screen render details"); - c2.a("Screen name", new Callable(){ - - public String a() throws Exception { - return bnd.a((bnd)bnd.this).m.getClass().getCanonicalName(); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - c2.a("Mouse location", new Callable(){ - - public String a() throws Exception { - return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", n5, n2, Mouse.getX(), Mouse.getY()); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - c2.a("Screen size", new Callable(){ - - public String a() throws Exception { - return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", bcu2.a(), bcu2.b(), bnd.a((bnd)bnd.this).d, bnd.a((bnd)bnd.this).e, bcu2.e()); - } - - @Override - public String call() throws Exception { - return this.a(); - } - }); - throw new e(b2); - } - } - } - - private void n() { - if (this.h.g.g() > 10 && this.h.g.n() && !this.h.F().y()) { - BufferedImage bufferedImage = bcg.a(this.h.d, this.h.e, this.h.b()); - int n2 = bufferedImage.getWidth(); - int n3 = bufferedImage.getHeight(); - int n4 = 0; - int n5 = 0; - if (n2 > n3) { - n4 = (n2 - n3) / 2; - n2 = n3; - } else { - n5 = (n3 - n2) / 2; - n3 = n2; - } - try { - BufferedImage bufferedImage2 = new BufferedImage(64, 64, 1); - Graphics2D graphics2D = bufferedImage2.createGraphics(); - graphics2D.drawImage(bufferedImage, 0, 0, 64, 64, n4, n5, n4 + n2, n5 + n2, null); - graphics2D.dispose(); - ImageIO.write((RenderedImage)bufferedImage2, "png", this.h.F().z()); - } - catch (IOException err) { - e.warn("Couldn't save auto screenshot", (Throwable)err); - } - } - } - - public void b(float f2) { - this.j(); - } - - private boolean o() { - boolean bl2; - if (!this.D) { - return false; - } - rr rr2 = this.h.aa(); - boolean bl3 = bl2 = rr2 instanceof zj && !this.h.u.ap; - if (bl2 && !((zj)rr2).bJ.e) { - adq adq2 = ((zj)rr2).cb(); - if (this.h.t != null && this.h.t.a == Namepipe.bbf_a.b) { - cj cj2 = this.h.t.a(); - ajt ajt2 = this.h.f.o(cj2).t(); - bl2 = this.h.c.l() == ahw.a.e ? ajt2.m() && this.h.f.r(cj2) instanceof qg : adq2 != null && (adq2.a(ajt2) || adq2.b(ajt2)); - } - } - return bl2; - } - - public void b(float f2, long l2) { - this.g(f2); - if (this.h.aa() == null) { - this.h.a(this.h.h); - } - this.a(f2); - bnf.k(); - bnf.e(); - bnf.a(516, 0.5f); - this.h.B.a("center"); - - // Cubitick - if(h.timer.c < 0 || h.timer.c >= 1) - h.timer.c = 0; - if(h.timerWorld.c < 0 || h.timerWorld.c >= 1) - h.timerWorld.c = 0; - - if(this.h.u.e) - { - b = 0; - bnf.a(false, true, true, false); - if(Cubitick.synctick) this.a(0, f2, l2); - else this.a_Async(0, h.timer.c, h.timerWorld.c, l2); - b = 1; - bnf.a(true, false, false, false); - if(Cubitick.synctick) this.a(1, f2, l2); - else this.a_Async(1, h.timer.c, h.timerWorld.c, l2); - bnf.a(true, true, true, false); - } - else - { - if(Cubitick.synctick) this.a(2, f2, l2); - else this.a_Async(2, h.timer.c, h.timerWorld.c, l2); - } - - this.h.B.b(); - } - - - private void a_Async(int n2, float ptick, float wtick, long l2) - { - bnl bnl2 = this.h.g; - blv blv2 = this.h.j; - boolean bl2 = this.o(); - bnf.q(); - this.h.B.c("clear"); - bnf.b(0, 0, this.h.d, this.h.e); - this.h(ptick); - bnf.m(16640); - this.h.B.c("camera"); - this.a(ptick, n2); - bbx.a(this.h.h, this.h.u.aq == 2); - this.h.B.c("frustum"); - bqk.a(); - this.h.B.c("culling"); - bql bql2 = new bql(); - rr rr2 = this.h.aa(); - double d2 = rr2.M + (rr2.p - rr2.M) * (double)ptick; - double d3 = rr2.N + (rr2.q - rr2.N) * (double)ptick; - double d4 = rr2.O + (rr2.r - rr2.O) * (double)ptick; - bql2.a(d2, d3, d4); - - // Cubitick: save lastTickPos of the player so that it can be temporarily altered later on - double lx = rr2.M; - double ly = rr2.N; - double lz = rr2.O; - - if (this.h.u.c >= 4) { - this.a(-1, ptick); - this.h.B.c("sky"); - bnf.n(5889); - bnf.F(); - Project.gluPerspective((float)this.a(ptick, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * 2.0f)); - bnf.n(5888); - bnl2.a(ptick, n2); - bnf.n(5889); - bnf.F(); - Project.gluPerspective((float)this.a(ptick, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * on.a)); - bnf.n(5888); - } - this.a(0, ptick); - bnf.j(7425); - if (rr2.q + (double)rr2.bn() < 128.0) { - this.a(bnl2, ptick, n2); - } - this.h.B.c("prepareterrain"); - this.a(0, ptick); - this.h.N().a(bvd.g); - bca.a(); - this.h.B.c("terrain_setup"); - bnl2.a(rr2, ptick, bql2, this.af++, this.h.h.y()); - if (n2 == 0 || n2 == 2) { - this.h.B.c("updatechunks"); - this.h.g.a(l2); - } - this.h.B.c("terrain"); - bnf.n(5888); - bnf.G(); - bnf.d(); - bnl2.a(ahm.a, (double)ptick, n2, rr2); - bnf.e(); - bnl2.a(ahm.b, (double)ptick, n2, rr2); - this.h.N().b(bvd.g).b(false, false); - bnl2.a(ahm.c, (double)ptick, n2, rr2); - this.h.N().b(bvd.g).a(); - bnf.j(7424); - bnf.a(516, 0.1f); - if (!this.X) { - bnf.n(5888); - bnf.H(); - bnf.G(); - bca.b(); - this.h.B.c("entities"); - - // Cubitick - rr2.M = rr2.p - (rr2.p-lx)*(1.0-ptick)/(1.0-wtick); - rr2.N = rr2.q - (rr2.q-ly)*(1.0-ptick)/(1.0-wtick); - rr2.O = rr2.r - (rr2.r-lz)*(1.0-ptick)/(1.0-wtick); - - bnl2.a(rr2, bql2, wtick); - - rr2.M = lx; - rr2.N = ly; - rr2.O = lz; - - bca.a(); - this.h(); - } - bnf.n(5888); - bnf.H(); - if (bl2 && this.h.t != null && !rr2.a(axd.h)) { - zj zj2 = (zj)rr2; - bnf.d(); - this.h.B.c("outline"); - bnl2.a(zj2, this.h.t, 0, ptick); - bnf.e(); - } - - // Cubitick - rr2.M = rr2.p - (rr2.p-lx)*(1.0-ptick)/(1.0-wtick); - rr2.N = rr2.q - (rr2.q-ly)*(1.0-ptick)/(1.0-wtick); - rr2.O = rr2.r - (rr2.r-lz)*(1.0-ptick)/(1.0-wtick); - - this.h.B.c("destroyProgress"); - bnf.m(); - bnf.a(bnf.r.l, bnf.l.e, bnf.r.e, bnf.l.n); - this.h.N().b(bvd.g).b(false, false); - bnl2.a(bnr.a(), bnr.a().c(), rr2, wtick); - this.h.N().b(bvd.g).a(); - bnf.l(); - if (!this.X) { - this.i(); - this.h.B.c("litParticles"); - blv2.b(rr2, wtick); - bca.a(); - this.a(0, wtick); - this.h.B.c("particles"); - blv2.a(rr2, wtick); - this.h(); - } - bnf.a(false); - bnf.q(); - this.h.B.c("weather"); - this.c(wtick); - - // Cubitick - rr2.M = lx; - rr2.N = ly; - rr2.O = lz; - - bnf.a(true); - bnl2.a(rr2, ptick); - bnf.l(); - bnf.q(); - bnf.a(bnf.r.l, bnf.l.j, bnf.r.e, bnf.l.n); - bnf.a(516, 0.1f); - this.a(0, ptick); - bnf.m(); - bnf.a(false); - this.h.N().a(bvd.g); - bnf.j(7425); - this.h.B.c("translucent"); - bnl2.a(ahm.d, (double)ptick, n2, rr2); - bnf.j(7424); - bnf.a(true); - bnf.q(); - bnf.l(); - bnf.p(); - if (rr2.q + (double)rr2.bn() >= 128.0) { - this.h.B.c("aboveClouds"); - this.a(bnl2, ptick, n2); - } - this.h.B.c("hand"); - if (this.C) { - bnf.m(256); - this.b(ptick, n2); - } - } - - private void a(int n2, float f2, long l2) { - bnl bnl2 = this.h.g; - blv blv2 = this.h.j; - boolean bl2 = this.o(); - bnf.q(); - this.h.B.c("clear"); - bnf.b(0, 0, this.h.d, this.h.e); - this.h(f2); - bnf.m(16640); - this.h.B.c("camera"); - this.a(f2, n2); - bbx.a(this.h.h, this.h.u.aq == 2); - this.h.B.c("frustum"); - bqk.a(); - this.h.B.c("culling"); - bql bql2 = new bql(); - rr rr2 = this.h.aa(); - double d2 = rr2.M + (rr2.p - rr2.M) * (double)f2; - double d3 = rr2.N + (rr2.q - rr2.N) * (double)f2; - double d4 = rr2.O + (rr2.r - rr2.O) * (double)f2; - bql2.a(d2, d3, d4); - if (this.h.u.c >= 4) { - this.a(-1, f2); - this.h.B.c("sky"); - bnf.n(5889); - bnf.F(); - Project.gluPerspective((float)this.a(f2, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * 2.0f)); - bnf.n(5888); - bnl2.a(f2, n2); - bnf.n(5889); - bnf.F(); - Project.gluPerspective((float)this.a(f2, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * on.a)); - bnf.n(5888); - } - this.a(0, f2); - bnf.j(7425); - if (rr2.q + (double)rr2.bn() < 128.0) { - this.a(bnl2, f2, n2); - } - this.h.B.c("prepareterrain"); - this.a(0, f2); - this.h.N().a(bvd.g); - bca.a(); - this.h.B.c("terrain_setup"); - bnl2.a(rr2, f2, bql2, this.af++, this.h.h.y()); - if (n2 == 0 || n2 == 2) { - this.h.B.c("updatechunks"); - this.h.g.a(l2); - } - this.h.B.c("terrain"); - bnf.n(5888); - bnf.G(); - bnf.d(); - bnl2.a(ahm.a, (double)f2, n2, rr2); - bnf.e(); - bnl2.a(ahm.b, (double)f2, n2, rr2); - this.h.N().b(bvd.g).b(false, false); - bnl2.a(ahm.c, (double)f2, n2, rr2); - this.h.N().b(bvd.g).a(); - bnf.j(7424); - bnf.a(516, 0.1f); - if (!this.X) { - bnf.n(5888); - bnf.H(); - bnf.G(); - bca.b(); - this.h.B.c("entities"); - bnl2.a(rr2, bql2, f2); - bca.a(); - this.h(); - } - bnf.n(5888); - bnf.H(); - if (bl2 && this.h.t != null && !rr2.a(axd.h)) { - zj zj2 = (zj)rr2; - bnf.d(); - this.h.B.c("outline"); - bnl2.a(zj2, this.h.t, 0, f2); - bnf.e(); - } - this.h.B.c("destroyProgress"); - bnf.m(); - bnf.a(bnf.r.l, bnf.l.e, bnf.r.e, bnf.l.n); - this.h.N().b(bvd.g).b(false, false); - bnl2.a(bnr.a(), bnr.a().c(), rr2, f2); - this.h.N().b(bvd.g).a(); - bnf.l(); - if (!this.X) { - this.i(); - this.h.B.c("litParticles"); - blv2.b(rr2, f2); - bca.a(); - this.a(0, f2); - this.h.B.c("particles"); - blv2.a(rr2, f2); - this.h(); - } - bnf.a(false); - bnf.q(); - this.h.B.c("weather"); - this.c(f2); - bnf.a(true); - bnl2.a(rr2, f2); - bnf.l(); - bnf.q(); - bnf.a(bnf.r.l, bnf.l.j, bnf.r.e, bnf.l.n); - bnf.a(516, 0.1f); - this.a(0, f2); - bnf.m(); - bnf.a(false); - this.h.N().a(bvd.g); - bnf.j(7425); - this.h.B.c("translucent"); - bnl2.a(ahm.d, (double)f2, n2, rr2); - bnf.j(7424); - bnf.a(true); - bnf.q(); - bnf.l(); - bnf.p(); - if (rr2.q + (double)rr2.bn() >= 128.0) { - this.h.B.c("aboveClouds"); - this.a(bnl2, f2, n2); - } - this.h.B.c("hand"); - if (this.C) { - bnf.m(256); - this.b(f2, n2); - } - } - - private void a(bnl bnl2, float f2, int n2) { - if (this.h.u.e() != 0) { - this.h.B.c("clouds"); - bnf.n(5889); - bnf.F(); - Project.gluPerspective((float)this.a(f2, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * 4.0f)); - bnf.n(5888); - bnf.G(); - this.a(0, f2); - bnl2.b(f2, n2); - bnf.p(); - bnf.H(); - bnf.n(5889); - bnf.F(); - Project.gluPerspective((float)this.a(f2, true), (float)((float)this.h.d / (float)this.h.e), (float)0.05f, (float)(this.k * on.a)); - bnf.n(5888); - } - } - - private void p() { - float f2 = this.h.f.j(1.0f); - if (!this.h.u.i) { - f2 /= 2.0f; - } - if (f2 == 0.0f) { - return; - } - this.j.setSeed((long)this.m * 312987231); - rr rr2 = this.h.aa(); - bkr bkr2 = this.h.f; - cj cj2 = new cj(rr2); - int n2 = 10; - double d2 = 0.0; - double d3 = 0.0; - double d4 = 0.0; - int n3 = 0; - int n4 = (int)(100.0f * f2 * f2); - if (this.h.u.aB == 1) { - n4 >>= 1; - } else if (this.h.u.aB == 2) { - n4 = 0; - } - for (int i2 = 0; i2 < n4; ++i2) { - cj cj3 = bkr2.p(cj2.a(this.j.nextInt(n2) - this.j.nextInt(n2), 0, this.j.nextInt(n2) - this.j.nextInt(n2))); - aig aig2 = bkr2.b(cj3); - cj cj4 = cj3.b(); - arc arc2 = bkr2.o(cj4); - if (cj3.q() > cj2.q() + n2 || cj3.q() < cj2.q() - n2 || !aig2.d() || aig2.a(cj3) < 0.15f) continue; - double d5 = this.j.nextDouble(); - double d6 = this.j.nextDouble(); - bbe bbe2 = arc2.c((ahx)bkr2, cj4); - if (arc2.a() == axd.i) { - this.h.f.a(cy.l, (double)cj3.p() + d5, (double)((float)cj3.q() + 0.1f) - bbe2.b, (double)cj3.r() + d6, 0.0, 0.0, 0.0, new int[0]); - continue; - } - if (arc2.a() == axd.a) continue; - if (this.j.nextInt(++n3) == 0) { - d2 = (double)cj4.p() + d5; - d3 = (double)((float)cj4.q() + 0.1f) + bbe2.e - 1.0; - d4 = (double)cj4.r() + d6; - } - this.h.f.a(cy.N, (double)cj4.p() + d5, (double)((float)cj4.q() + 0.1f) + bbe2.e, (double)cj4.r() + d6, 0.0, 0.0, 0.0, new int[0]); - } - if (n3 > 0 && this.j.nextInt(3) < this.N++) { - this.N = 0; - if (d3 > (double)(cj2.q() + 1) && bkr2.p(cj2).q() > on.d((float)cj2.q())) { - this.h.f.a(d2, d3, d4, ng.gz, nh.d, 0.1f, 0.5f, false); - } else { - this.h.f.a(d2, d3, d4, ng.gy, nh.d, 0.2f, 1.0f, false); - } - } - } - - protected void c(float f2) { - float f3 = this.h.f.j(f2); - if (f3 <= 0.0f) { - return; - } - this.i(); - rr rr2 = this.h.aa(); - bkr bkr2 = this.h.f; - int n2 = on.c(rr2.p); - int n3 = on.c(rr2.q); - int n4 = on.c(rr2.r); - bnr bnr2 = bnr.a(); - bmw bmw2 = bnr2.c(); - bnf.r(); - bnf.a(0.0f, 1.0f, 0.0f); - bnf.m(); - bnf.a(bnf.r.l, bnf.l.j, bnf.r.e, bnf.l.n); - bnf.a(516, 0.1f); - double d2 = rr2.M + (rr2.p - rr2.M) * (double)f2; - double d3 = rr2.N + (rr2.q - rr2.N) * (double)f2; - double d4 = rr2.O + (rr2.r - rr2.O) * (double)f2; - int n5 = on.c(d3); - int n6 = 5; - if (this.h.u.i) { - n6 = 10; - } - int n7 = -1; - float f4 = (float)this.m + f2; - bmw2.c(- d2, - d3, - d4); - bnf.c(1.0f, 1.0f, 1.0f, 1.0f); - cj.a a2 = new cj.a(); - for (int i2 = n4 - n6; i2 <= n4 + n6; ++i2) { - for (int i3 = n2 - n6; i3 <= n2 + n6; ++i3) { - double d5; - double d6; - double d7; - int n8; - int n9 = (i2 - n4 + 16) * 32 + i3 - n2 + 16; - double d8 = (double)this.O[n9] * 0.5; - double d9 = (double)this.P[n9] * 0.5; - a2.c(i3, 0, i2); - aig aig2 = bkr2.b(a2); - if (!aig2.d() && !aig2.c()) continue; - int n10 = bkr2.p(a2).q(); - int n11 = n3 - n6; - int n12 = n3 + n6; - if (n11 < n10) { - n11 = n10; - } - if (n12 < n10) { - n12 = n10; - } - if ((n8 = n10) < n5) { - n8 = n5; - } - if (n11 == n12) continue; - this.j.setSeed(i3 * i3 * 3121 + i3 * 45238971 ^ i2 * i2 * 418711 + i2 * 13761); - a2.c(i3, n11, i2); - float f5 = aig2.a(a2); - if (bkr2.A().a(f5, n10) >= 0.15f) { - if (n7 != 0) { - if (n7 >= 0) { - bnr2.b(); - } - n7 = 0; - this.h.N().a(f); - bmw2.a(7, bvm.d); - } - d5 = (- (double)(this.m + i3 * i3 * 3121 + i3 * 45238971 + i2 * i2 * 418711 + i2 * 13761 & 31) + (double)f2) / 32.0 * (3.0 + this.j.nextDouble()); - d7 = (double)((float)i3 + 0.5f) - rr2.p; - d6 = (double)((float)i2 + 0.5f) - rr2.r; - float f6 = on.a(d7 * d7 + d6 * d6) / (float)n6; - float f7 = ((1.0f - f6 * f6) * 0.5f + 0.5f) * f3; - a2.c(i3, n8, i2); - int n13 = bkr2.b((cj)a2, 0); - int n14 = n13 >> 16 & 65535; - int n15 = n13 & 65535; - bmw2.b((double)i3 - d8 + 0.5, (double)n12, (double)i2 - d9 + 0.5).a(0.0, (double)n11 * 0.25 + d5).a(1.0f, 1.0f, 1.0f, f7).a(n14, n15).d(); - bmw2.b((double)i3 + d8 + 0.5, (double)n12, (double)i2 + d9 + 0.5).a(1.0, (double)n11 * 0.25 + d5).a(1.0f, 1.0f, 1.0f, f7).a(n14, n15).d(); - bmw2.b((double)i3 + d8 + 0.5, (double)n11, (double)i2 + d9 + 0.5).a(1.0, (double)n12 * 0.25 + d5).a(1.0f, 1.0f, 1.0f, f7).a(n14, n15).d(); - bmw2.b((double)i3 - d8 + 0.5, (double)n11, (double)i2 - d9 + 0.5).a(0.0, (double)n12 * 0.25 + d5).a(1.0f, 1.0f, 1.0f, f7).a(n14, n15).d(); - continue; - } - if (n7 != 1) { - if (n7 >= 0) { - bnr2.b(); - } - n7 = 1; - this.h.N().a(g); - bmw2.a(7, bvm.d); - } - d5 = (- (float)(this.m & 511) + f2) / 512.0f; - d7 = this.j.nextDouble() + (double)f4 * 0.01 * (double)((float)this.j.nextGaussian()); - d6 = this.j.nextDouble() + (double)(f4 * (float)this.j.nextGaussian()) * 0.001; - double d10 = (double)((float)i3 + 0.5f) - rr2.p; - double d11 = (double)((float)i2 + 0.5f) - rr2.r; - float f8 = on.a(d10 * d10 + d11 * d11) / (float)n6; - float f9 = ((1.0f - f8 * f8) * 0.3f + 0.5f) * f3; - a2.c(i3, n8, i2); - int n16 = (bkr2.b((cj)a2, 0) * 3 + 15728880) / 4; - int n17 = n16 >> 16 & 65535; - int n18 = n16 & 65535; - bmw2.b((double)i3 - d8 + 0.5, (double)n12, (double)i2 - d9 + 0.5).a(0.0 + d7, (double)n11 * 0.25 + d5 + d6).a(1.0f, 1.0f, 1.0f, f9).a(n17, n18).d(); - bmw2.b((double)i3 + d8 + 0.5, (double)n12, (double)i2 + d9 + 0.5).a(1.0 + d7, (double)n11 * 0.25 + d5 + d6).a(1.0f, 1.0f, 1.0f, f9).a(n17, n18).d(); - bmw2.b((double)i3 + d8 + 0.5, (double)n11, (double)i2 + d9 + 0.5).a(1.0 + d7, (double)n12 * 0.25 + d5 + d6).a(1.0f, 1.0f, 1.0f, f9).a(n17, n18).d(); - bmw2.b((double)i3 - d8 + 0.5, (double)n11, (double)i2 - d9 + 0.5).a(0.0 + d7, (double)n12 * 0.25 + d5 + d6).a(1.0f, 1.0f, 1.0f, f9).a(n17, n18).d(); - } - } - if (n7 >= 0) { - bnr2.b(); - } - bmw2.c(0.0, 0.0, 0.0); - bnf.q(); - bnf.l(); - bnf.a(516, 0.1f); - this.h(); - } - - public void j() { - bcu bcu2 = new bcu(this.h); - bnf.m(256); - bnf.n(5889); - bnf.F(); - bnf.a(0.0, bcu2.c(), bcu2.d(), 0.0, 1000.0, 3000.0); - bnf.n(5888); - bnf.F(); - bnf.c(0.0f, 0.0f, -2000.0f); - } - - private void h(float f2) { - float f3; - Object object; - float f4; - float f5; - bkr bkr2 = this.h.f; - rr rr2 = this.h.aa(); - float f6 = 0.25f + 0.75f * (float)this.h.u.c / 32.0f; - f6 = 1.0f - (float)Math.pow(f6, 0.25); - bbg bbg2 = bkr2.a(this.h.aa(), f2); - float f7 = (float)bbg2.b; - float f8 = (float)bbg2.c; - float f9 = (float)bbg2.d; - bbg bbg3 = bkr2.f(f2); - this.R = (float)bbg3.b; - this.S = (float)bbg3.c; - this.T = (float)bbg3.d; - if (this.h.u.c >= 4) { - float[] arrf; - double d2 = -1.0; - object = on.a(bkr2.d(f2)) > 0.0f ? new bbg(d2, 0.0, 0.0) : new bbg(1.0, 0.0, 0.0); - f5 = (float)rr2.f(f2).b((bbg)object); - if (f5 < 0.0f) { - f5 = 0.0f; - } - if (f5 > 0.0f && (arrf = bkr2.s.a(bkr2.c(f2), f2)) != null) { - this.R = this.R * (1.0f - f5) + arrf[0] * (f5 *= arrf[3]); - this.S = this.S * (1.0f - f5) + arrf[1] * f5; - this.T = this.T * (1.0f - f5) + arrf[2] * f5; - } - } - this.R += (f7 - this.R) * f6; - this.S += (f8 - this.S) * f6; - this.T += (f9 - this.T) * f6; - float f10 = bkr2.j(f2); - if (f10 > 0.0f) { - f3 = 1.0f - f10 * 0.5f; - float f11 = 1.0f - f10 * 0.4f; - this.R *= f3; - this.S *= f3; - this.T *= f11; - } - if ((f3 = bkr2.h(f2)) > 0.0f) { - float f12 = 1.0f - f3 * 0.5f; - this.R *= f12; - this.S *= f12; - this.T *= f12; - } - arc object1 = bbx.a(this.h.f, rr2, f2); - if (this.B) { - bbg bbg4 = bkr2.e(f2); - this.R = (float)bbg4.b; - this.S = (float)bbg4.c; - this.T = (float)bbg4.d; - } else if (object1.a() == axd.h) { - f5 = 0.0f; - if (rr2 instanceof sa) { - f5 = (float)ago.c((sa)rr2) * 0.2f; - if (((sa)rr2).a(rm.m)) { - f5 = f5 * 0.3f + 0.6f; - } - } - this.R = 0.02f + f5; - this.S = 0.02f + f5; - this.T = 0.2f + f5; - } else if (object1.a() == axd.i) { - this.R = 0.6f; - this.S = 0.1f; - this.T = 0.0f; - } - float f13 = this.U + (this.V - this.U) * f2; - this.R *= f13; - this.S *= f13; - this.T *= f13; - double d3 = (rr2.N + (rr2.q - rr2.N) * (double)f2) * bkr2.s.j(); - if (rr2 instanceof sa && ((sa)rr2).a(rm.o)) { - int n2 = ((sa)rr2).b(rm.o).b(); - d3 = n2 < 20 ? (d3 *= (double)(1.0f - (float)n2 / 20.0f)) : 0.0; - } - if (d3 < 1.0) { - if (d3 < 0.0) { - d3 = 0.0; - } - d3 *= d3; - this.R = (float)((double)this.R * d3); - this.S = (float)((double)this.S * d3); - this.T = (float)((double)this.T * d3); - } - if (this.z > 0.0f) { - float f14 = this.A + (this.z - this.A) * f2; - this.R = this.R * (1.0f - f14) + this.R * 0.7f * f14; - this.S = this.S * (1.0f - f14) + this.S * 0.6f * f14; - this.T = this.T * (1.0f - f14) + this.T * 0.6f * f14; - } - if (rr2 instanceof sa && ((sa)rr2).a(rm.p)) { - float f15 = this.a((sa)rr2, f2); - f4 = 1.0f / this.R; - if (f4 > 1.0f / this.S) { - f4 = 1.0f / this.S; - } - if (f4 > 1.0f / this.T) { - f4 = 1.0f / this.T; - } - this.R = this.R * (1.0f - f15) + this.R * f4 * f15; - this.S = this.S * (1.0f - f15) + this.S * f4 * f15; - this.T = this.T * (1.0f - f15) + this.T * f4 * f15; - } - if (this.h.u.e) { - float f16 = (this.R * 30.0f + this.S * 59.0f + this.T * 11.0f) / 100.0f; - f4 = (this.R * 30.0f + this.S * 70.0f) / 100.0f; - float f17 = (this.R * 30.0f + this.T * 70.0f) / 100.0f; - this.R = f16; - this.S = f4; - this.T = f17; - } - bnf.a(this.R, this.S, this.T, 0.0f); - } - - private void a(int n2, float f2) { - rr rr2 = this.h.aa(); - bnf.b(2918, this.a(this.R, this.S, this.T, 1.0f)); - bnf.a(0.0f, -1.0f, 0.0f); - bnf.c(1.0f, 1.0f, 1.0f, 1.0f); - arc arc2 = bbx.a(this.h.f, rr2, f2); - if (rr2 instanceof sa && ((sa)rr2).a(rm.o)) { - float f3 = 5.0f; - int n3 = ((sa)rr2).b(rm.o).b(); - if (n3 < 20) { - f3 = 5.0f + (this.k - 5.0f) * (1.0f - (float)n3 / 20.0f); - } - bnf.a(bnf.m.a); - if (n2 == -1) { - bnf.b(0.0f); - bnf.c(f3 * 0.8f); - } else { - bnf.b(f3 * 0.25f); - bnf.c(f3); - } - if (GLContext.getCapabilities().GL_NV_fog_distance) { - bnf.c(34138, 34139); - } - } else if (this.B) { - bnf.a(bnf.m.b); - bnf.a(0.1f); - } else if (arc2.a() == axd.h) { - bnf.a(bnf.m.b); - if (rr2 instanceof sa) { - if (((sa)rr2).a(rm.m)) { - bnf.a(0.01f); - } else { - bnf.a(0.1f - (float)ago.c((sa)rr2) * 0.03f); - } - } else { - bnf.a(0.1f); - } - } else if (arc2.a() == axd.i) { - bnf.a(bnf.m.b); - bnf.a(2.0f); - } else { - float f4 = this.k; - bnf.a(bnf.m.a); - if (n2 == -1) { - bnf.b(0.0f); - bnf.c(f4); - } else { - bnf.b(f4 * 0.75f); - bnf.c(f4); - } - if (GLContext.getCapabilities().GL_NV_fog_distance) { - bnf.c(34138, 34139); - } - if (this.h.f.s.b((int)rr2.p, (int)rr2.r) || this.h.r.j().f()) { - bnf.b(f4 * 0.05f); - bnf.c(Math.min(f4, 192.0f) * 0.5f); - } - } - bnf.h(); - bnf.o(); - bnf.a(1028, 4608); - } - - private FloatBuffer a(float f2, float f3, float f4, float f5) { - this.Q.clear(); - this.Q.put(f2).put(f3).put(f4).put(f5); - this.Q.flip(); - return this.Q; - } - - public bct k() { - return this.l; - } - - static /* synthetic */ bcc a(bnd bnd2) { - return bnd2.h; - } - - static { - ac = new kk[]{new kk("shaders/post/notch.json"), new kk("shaders/post/fxaa.json"), new kk("shaders/post/art.json"), new kk("shaders/post/bumpy.json"), new kk("shaders/post/blobs2.json"), new kk("shaders/post/pencil.json"), new kk("shaders/post/color_convolve.json"), new kk("shaders/post/deconverge.json"), new kk("shaders/post/flip.json"), new kk("shaders/post/invert.json"), new kk("shaders/post/ntsc.json"), new kk("shaders/post/outline.json"), new kk("shaders/post/phosphor.json"), new kk("shaders/post/scan_pincushion.json"), new kk("shaders/post/sobel.json"), new kk("shaders/post/bits.json"), new kk("shaders/post/desaturate.json"), new kk("shaders/post/green.json"), new kk("shaders/post/blur.json"), new kk("shaders/post/wobble.json"), new kk("shaders/post/blobs.json"), new kk("shaders/post/antialias.json"), new kk("shaders/post/creeper.json"), new kk("shaders/post/spider.json")}; - d = ac.length; - } - -} diff --git a/src/Cubitick.java b/src/minecraft/cubimod/Cubitick.java similarity index 73% rename from src/Cubitick.java rename to src/minecraft/cubimod/Cubitick.java index 3d966f2..d0d54f9 100644 --- a/src/Cubitick.java +++ b/src/minecraft/cubimod/Cubitick.java @@ -1,18 +1,23 @@ +package cubimod; + import java.io.IOException; import java.net.URL; -import java.util.Arrays; import java.util.Scanner; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Timer; +import net.minecraft.util.text.TextComponentString; + public class Cubitick { - public static Cubitick instance; + public static Cubitick instance = new Cubitick(); public static boolean initialised = false; private String author = "Cubitect"; private String name = "Cubitick"; - private String versionName = "[1.9.2]v1.5.1"; + private String versionName = "[1.10]v1.5.2"; private String versionType = "main"; - private String mcVersion = "1.9"; + private String mcVersion = "1.10"; private String mcType = "release"; public static final float tickrate = 20F; @@ -22,10 +27,6 @@ public class Cubitick public Cubitick() { - System.out.println("[" + name + "] Initializing..."); - - instance = this; - ServerPacketData.init(); initialised = false; } @@ -80,18 +81,18 @@ public static void setTickWorld(float rate) private static void setTimerWorld(float rate) { - bcc mc = bcc.z(); - float elapsedPartialTicks = mc.timerWorld.e; - int elapsedTicks = mc.timerWorld.b; - float renderPartialTicks = mc.timerWorld.c; + Minecraft mc = Minecraft.getMinecraft(); + float elapsedPartialTicks = mc.timerWorld.elapsedPartialTicks; + int elapsedTicks = mc.timerWorld.elapsedTicks; + float renderPartialTicks = mc.timerWorld.renderPartialTicks; - mc.timerWorld = new bci(rate); + mc.timerWorld = new Timer(rate); - mc.timerWorld.e = elapsedPartialTicks; - mc.timerWorld.b = elapsedTicks; - mc.timerWorld.c = renderPartialTicks; + mc.timerWorld.elapsedPartialTicks = elapsedPartialTicks; + mc.timerWorld.elapsedTicks = elapsedTicks; + mc.timerWorld.renderPartialTicks = renderPartialTicks; - mc.timer = new bci(tickrate); + mc.timer = new Timer(tickrate); } public static float getTickms() @@ -102,7 +103,7 @@ public static float getTickms() public static void playerChat(String str) { - if(bcc.z().h == null) return; - bcc.z().h.b(new fa(str)); + if(Minecraft.getMinecraft().thePlayer == null) return; + Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString(str)); } } diff --git a/src/minecraft/cubimod/command/CommandRerender.java b/src/minecraft/cubimod/command/CommandRerender.java new file mode 100644 index 0000000..2918cf6 --- /dev/null +++ b/src/minecraft/cubimod/command/CommandRerender.java @@ -0,0 +1,59 @@ +package cubimod.command; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockProperties; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; + +public class CommandRerender extends CommandBase +{ + public String getCommandName() + { + return "rerender"; + } + + public int getRequiredPermissionLevel() + { + return 0; + } + + public String getCommandUsage(ICommandSender sender) + { + return "/rerender [fromX fromY fromZ toX toY toZ]\n§7Marks a region to be rendered again (without reloading)\n§7Specifying no arguments will also reload and do the same as F3+A"; + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException + { + processCommand(sender, args); + } + + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if(args.length == 0) { + Minecraft.getMinecraft().scheduledReload = true; + } + else if(args.length <= 5) { + notifyCommandListener(sender, this, "§cUsage:\n§c"+getCommandUsage(sender)); + return; + } else { + BlockPos pos1 = parseBlockPos(sender, args, 0, false); + BlockPos pos2 = parseBlockPos(sender, args, 3, false); + + BlockPos from = new BlockPos(Math.min(pos1.getX(), pos2.getX()), Math.min(pos1.getY(), pos2.getY()), Math.min(pos1.getZ(), pos2.getZ())); + BlockPos to = new BlockPos(Math.max(pos1.getX(), pos2.getX()), Math.max(pos1.getY(), pos2.getY()), Math.max(pos1.getZ(), pos2.getZ())); + sender.getEntityWorld().markBlockRangeForRenderUpdate(from, to); + } + } + + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} \ No newline at end of file diff --git a/src/minecraft/cubimod/command/CommandTickSync.java b/src/minecraft/cubimod/command/CommandTickSync.java new file mode 100644 index 0000000..b9caeed --- /dev/null +++ b/src/minecraft/cubimod/command/CommandTickSync.java @@ -0,0 +1,57 @@ +package cubimod.command; + +import java.util.List; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import cubimod.Cubitick; + +public class CommandTickSync extends CommandBase +{ + public String getCommandName() + { + return "ticksync"; + } + + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender sender) + { + return "/ticksync [true/false]"; + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException + { + processCommand(sender, args); + } + + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if(args.length < 1) { + notifyCommandListener(sender, this, (Cubitick.synctick) ? "Tickrate is currently synchronised" : "Tickrate is currently desynchronised"); + return; + } else { + if(args[0].equals("true") || args[0].equals("on")) { + Cubitick.synctick = true; + notifyCommandListener(sender, this, "Tickrate is now synchronised"); + } else if(args[0].equals("false") || args[0].equals("off")) { + Cubitick.synctick = false; + notifyCommandListener(sender, this, "Tickrate is now desynchronised"); + } else { + notifyCommandListener(sender, this, "Tickrate synchronisation can only be true/on or false/off"); + } + } + } + + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/cubimod/command/CommandTickrate.java b/src/minecraft/cubimod/command/CommandTickrate.java new file mode 100644 index 0000000..05b4890 --- /dev/null +++ b/src/minecraft/cubimod/command/CommandTickrate.java @@ -0,0 +1,57 @@ +package cubimod.command; + +import java.util.List; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import cubimod.Cubitick; + +public class CommandTickrate extends CommandBase +{ + public String getCommandName() + { + return "tickrate"; + } + + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender sender) + { + return "/tickrate [rate]"; + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException + { + processCommand(sender, args); + } + + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if(args.length < 1) { + notifyCommandListener(sender, this, "Tickrate is " + Cubitick.tickrateWorld + " ticks per second"); + return; + } else { + float tickspeed = (float)parseDouble(args[0], 0); + if(tickspeed >= 0) { + Cubitick.setTickWorld(tickspeed); + notifyCommandListener(sender, this, "Tickrate set to " + tickspeed); + } else { + notifyCommandListener(sender, this, "Tickrate should be a non-negative floating point number"); + return; + } + } + } + + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} + diff --git a/src/minecraft/net/minecraft/client/Minecraft.java b/src/minecraft/net/minecraft/client/Minecraft.java new file mode 100644 index 0000000..d02c7a8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/Minecraft.java @@ -0,0 +1,3742 @@ +package net.minecraft.client; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.Proxy; +import java.net.SocketAddress; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.text.DecimalFormat; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Queue; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; + +import javax.annotation.Nullable; +import javax.imageio.ImageIO; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.audio.MusicTicker; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiControls; +import net.minecraft.client.gui.GuiGameOver; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.gui.GuiIngameMenu; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiMemoryErrorScreen; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.client.gui.GuiNewChat; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiScreenWorking; +import net.minecraft.client.gui.GuiSleepMP; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.achievement.GuiAchievement; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.client.main.GameConfiguration; +import net.minecraft.client.multiplayer.GuiConnecting; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.network.NetHandlerLoginClient; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.particle.ParticleManager; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.ModelManager; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.client.renderer.color.ItemColors; +import net.minecraft.client.renderer.debug.DebugRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.DefaultResourcePack; +import net.minecraft.client.resources.FoliageColorReloadListener; +import net.minecraft.client.resources.GrassColorReloadListener; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.LanguageManager; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.client.resources.SimpleReloadableResourceManager; +import net.minecraft.client.resources.SkinManager; +import net.minecraft.client.resources.data.AnimationMetadataSection; +import net.minecraft.client.resources.data.AnimationMetadataSectionSerializer; +import net.minecraft.client.resources.data.FontMetadataSection; +import net.minecraft.client.resources.data.FontMetadataSectionSerializer; +import net.minecraft.client.resources.data.LanguageMetadataSection; +import net.minecraft.client.resources.data.LanguageMetadataSectionSerializer; +import net.minecraft.client.resources.data.MetadataSerializer; +import net.minecraft.client.resources.data.PackMetadataSection; +import net.minecraft.client.resources.data.PackMetadataSectionSerializer; +import net.minecraft.client.resources.data.TextureMetadataSection; +import net.minecraft.client.resources.data.TextureMetadataSectionSerializer; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.crash.ICrashReportDetail; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Bootstrap; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMonsterPlacer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.CPacketLoginStart; +import net.minecraft.network.play.client.CPacketClientStatus; +import net.minecraft.network.play.client.CPacketPlayerDigging; +import net.minecraft.profiler.ISnooperInfo; +import net.minecraft.profiler.Profiler; +import net.minecraft.profiler.Snooper; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.server.management.PlayerProfileCache; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.IStatStringFormat; +import net.minecraft.stats.StatisticsManager; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.FrameTimer; +import net.minecraft.util.IThreadListener; +import net.minecraft.util.MinecraftError; +import net.minecraft.util.MouseHelper; +import net.minecraft.util.MovementInputFromOptions; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.ScreenShotHelper; +import net.minecraft.util.Session; +import net.minecraft.util.Timer; +import net.minecraft.util.Util; +import net.minecraft.util.datafix.DataFixer; +import net.minecraft.util.datafix.DataFixesManager; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.WorldProviderEnd; +import net.minecraft.world.WorldProviderHell; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.chunk.storage.AnvilSaveConverter; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +import org.apache.commons.io.Charsets; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.ContextCapabilities; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.opengl.OpenGLException; +import org.lwjgl.opengl.PixelFormat; +import org.lwjgl.util.glu.GLU; + +import com.google.common.collect.Lists; +import com.google.common.collect.Queues; +import com.google.common.collect.Sets; +import com.google.common.hash.Hashing; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListenableFutureTask; +import com.mojang.authlib.AuthenticationService; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfileRepository; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + +import cubimod.Cubitick; + +public class Minecraft implements IThreadListener, ISnooperInfo +{ + private static final Logger LOGGER = LogManager.getLogger(); + private static final ResourceLocation LOCATION_MOJANG_PNG = new ResourceLocation("textures/gui/title/mojang.png"); + public static final boolean IS_RUNNING_ON_MAC = Util.getOSType() == Util.EnumOS.OSX; + + /** A 10MiB preallocation to ensure the heap is reasonably sized. */ + public static byte[] memoryReserve = new byte[10485760]; + private static final List MAC_DISPLAY_MODES = Lists.newArrayList(new DisplayMode[] {new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)}); + private final File fileResourcepacks; + private final PropertyMap twitchDetails; + + /** The player's GameProfile properties */ + private final PropertyMap profileProperties; + private ServerData currentServerData; + + /** The RenderEngine instance used by Minecraft */ + private TextureManager renderEngine; + + /** + * Set to 'this' in Minecraft constructor; used by some settings get methods + */ + private static Minecraft theMinecraft; + private final DataFixer dataFixer; + @Nullable + public PlayerControllerMP playerController; + private boolean fullscreen; + private final boolean enableGLErrorChecking = true; + private boolean hasCrashed; + + /** Instance of CrashReport. */ + private CrashReport crashReporter; + public int displayWidth; + public int displayHeight; + + /** True if the player is connected to a realms server */ + private boolean connectedToRealms; + // Cubitick: make timer public + public Timer timerWorld = new Timer(Cubitick.tickrateWorld); + public Timer timer = new Timer(Cubitick.tickrate); + public long tickcounter = 0; + public boolean scheduledReload = false; + + /** Instance of PlayerUsageSnooper. */ + private final Snooper usageSnooper = new Snooper("client", this, MinecraftServer.getCurrentTimeMillis()); + public WorldClient theWorld; + public RenderGlobal renderGlobal; + private RenderManager renderManager; + private RenderItem renderItem; + private ItemRenderer itemRenderer; + public EntityPlayerSP thePlayer; + @Nullable + private Entity renderViewEntity; + public Entity pointedEntity; + public ParticleManager effectRenderer; + private final Session session; + private boolean isGamePaused; + + /** The font renderer used for displaying and measuring text */ + public FontRenderer fontRendererObj; + public FontRenderer standardGalacticFontRenderer; + @Nullable + + /** The GuiScreen that's being displayed at the moment. */ + public GuiScreen currentScreen; + public LoadingScreenRenderer loadingScreen; + public EntityRenderer entityRenderer; + public DebugRenderer debugRenderer; + + /** Mouse left click counter */ + private int leftClickCounter; + + /** Display width */ + private final int tempDisplayWidth; + + /** Display height */ + private final int tempDisplayHeight; + @Nullable + + /** Instance of IntegratedServer. */ + private IntegratedServer theIntegratedServer; + + /** Gui achievement */ + public GuiAchievement guiAchievement; + public GuiIngame ingameGUI; + + /** Skip render world */ + public boolean skipRenderWorld; + + /** The ray trace hit that the mouse is over. */ + public RayTraceResult objectMouseOver; + + /** The game settings that currently hold effect. */ + public GameSettings gameSettings; + + /** Mouse helper instance. */ + public MouseHelper mouseHelper; + public final File mcDataDir; + private final File fileAssets; + private final String launchedVersion; + private final String versionType; + private final Proxy proxy; + private ISaveFormat saveLoader; + + /** + * This is set to fpsCounter every debug screen update, and is shown on the debug screen. It's also sent as part of + * the usage snooping. + */ + private static int debugFPS; + + /** + * When you place a block, it's set to 6, decremented once per tick, when it's 0, you can place another block. + */ + private int rightClickDelayTimer; + private String serverName; + private int serverPort; + + /** + * Does the actual gameplay have focus. If so then mouse and keys will effect the player instead of menus. + */ + public boolean inGameHasFocus; + long systemTime = getSystemTime(); + + /** Join player counter */ + private int joinPlayerCounter; + + /** The FrameTimer's instance */ + public final FrameTimer frameTimer = new FrameTimer(); + + /** Time in nanoseconds of when the class is loaded */ + long startNanoTime = System.nanoTime(); + private final boolean jvm64bit; + private final boolean isDemo; + @Nullable + private NetworkManager myNetworkManager; + private boolean integratedServerIsRunning; + + /** The profiler instance */ + public final Profiler mcProfiler = new Profiler(); + + /** + * Keeps track of how long the debug crash keycombo (F3+C) has been pressed for, in order to crash after 10 seconds. + */ + private long debugCrashKeyPressTime = -1L; + private IReloadableResourceManager mcResourceManager; + private final MetadataSerializer metadataSerializer_ = new MetadataSerializer(); + private final List defaultResourcePacks = Lists.newArrayList(); + private final DefaultResourcePack mcDefaultResourcePack; + private ResourcePackRepository mcResourcePackRepository; + private LanguageManager mcLanguageManager; + private BlockColors blockColors; + private ItemColors itemColors; + private Framebuffer framebufferMc; + private TextureMap textureMapBlocks; + private SoundHandler mcSoundHandler; + private MusicTicker mcMusicTicker; + private ResourceLocation mojangLogo; + private final MinecraftSessionService sessionService; + private SkinManager skinManager; + private final Queue < FutureTask> scheduledTasks = Queues. < FutureTask> newArrayDeque(); + private final Thread mcThread = Thread.currentThread(); + private ModelManager modelManager; + + /** + * The BlockRenderDispatcher instance that will be used based off gamesettings + */ + private BlockRendererDispatcher blockRenderDispatcher; + + /** + * Set to true to keep the game loop running. Set to false by shutdown() to allow the game loop to exit cleanly. + */ + volatile boolean running = true; + + /** String that shows the debug information */ + public String debug = ""; + public boolean renderChunksMany = true; + + /** Approximate time (in ms) of last update to debug string */ + private long debugUpdateTime = getSystemTime(); + + /** holds the current fps */ + private int fpsCounter; + private boolean actionKeyF3; + long prevFrameTime = -1L; + + /** Profiler currently displayed in the debug screen pie chart */ + private String debugProfilerName = "root"; + + public Minecraft(GameConfiguration gameConfig) + { + theMinecraft = this; + this.mcDataDir = gameConfig.folderInfo.mcDataDir; + this.fileAssets = gameConfig.folderInfo.assetsDir; + this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir; + this.launchedVersion = gameConfig.gameInfo.version; + this.versionType = gameConfig.gameInfo.versionType; + this.twitchDetails = gameConfig.userInfo.userProperties; + this.profileProperties = gameConfig.userInfo.profileProperties; + this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex()); + this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy; + this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.session = gameConfig.userInfo.session; + LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()}); + LOGGER.debug("(Session ID is {})", new Object[] {this.session.getSessionID()}); + this.isDemo = gameConfig.gameInfo.isDemo; + this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; + this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; + this.tempDisplayWidth = gameConfig.displayInfo.width; + this.tempDisplayHeight = gameConfig.displayInfo.height; + this.fullscreen = gameConfig.displayInfo.fullscreen; + this.jvm64bit = isJvm64bit(); + this.theIntegratedServer = null; + + if (gameConfig.serverInfo.serverName != null) + { + this.serverName = gameConfig.serverInfo.serverName; + this.serverPort = gameConfig.serverInfo.serverPort; + } + + ImageIO.setUseCache(false); + Bootstrap.register(); + this.dataFixer = DataFixesManager.createFixer(); + } + + public void run() + { + this.running = true; + + try + { + this.startGame(); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Initializing game"); + crashreport.makeCategory("Initialization"); + this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(crashreport)); + return; + } + + while (true) + { + try + { + while (this.running) + { + if (!this.hasCrashed || this.crashReporter == null) + { + try + { + this.runGameLoop(); + } + catch (OutOfMemoryError var10) + { + this.freeMemory(); + this.displayGuiScreen(new GuiMemoryErrorScreen()); + System.gc(); + } + } + else + { + this.displayCrashReport(this.crashReporter); + } + } + } + catch (MinecraftError var12) + { + break; + } + catch (ReportedException reportedexception) + { + this.addGraphicsAndWorldToCrashReport(reportedexception.getCrashReport()); + this.freeMemory(); + LOGGER.fatal((String)"Reported exception thrown!", (Throwable)reportedexception); + this.displayCrashReport(reportedexception.getCrashReport()); + break; + } + catch (Throwable throwable1) + { + CrashReport crashreport1 = this.addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", throwable1)); + this.freeMemory(); + LOGGER.fatal("Unreported exception thrown!", throwable1); + this.displayCrashReport(crashreport1); + break; + } + finally + { + this.shutdownMinecraftApplet(); + } + + return; + } + } + + /** + * Starts the game: initializes the canvas, the title, the settings, etcetera. + */ + private void startGame() throws LWJGLException, IOException + { + this.gameSettings = new GameSettings(this, this.mcDataDir); + this.defaultResourcePacks.add(this.mcDefaultResourcePack); + this.startTimerHackThread(); + + if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) + { + this.displayWidth = this.gameSettings.overrideWidth; + this.displayHeight = this.gameSettings.overrideHeight; + } + + LOGGER.info("LWJGL Version: {}", new Object[] {Sys.getVersion()}); + this.setWindowIcon(); + this.setInitialDisplayMode(); + this.createDisplay(); + OpenGlHelper.initializeTextures(); + this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true); + this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); + this.registerMetadataSerializers(); + this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, "server-resource-packs"), this.mcDefaultResourcePack, this.metadataSerializer_, this.gameSettings); + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); + this.refreshResources(); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); + this.drawSplashScreen(this.renderEngine); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.dataFixer); + this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings); + this.mcResourceManager.registerReloadListener(this.mcSoundHandler); + this.mcMusicTicker = new MusicTicker(this); + this.fontRendererObj = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false); + + if (this.gameSettings.language != null) + { + this.fontRendererObj.setUnicodeFlag(this.isUnicode()); + this.fontRendererObj.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional()); + } + + this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii_sga.png"), this.renderEngine, false); + this.mcResourceManager.registerReloadListener(this.fontRendererObj); + this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer); + this.mcResourceManager.registerReloadListener(new GrassColorReloadListener()); + this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener()); + AchievementList.OPEN_INVENTORY.setStatStringFormatter(new IStatStringFormat() + { + public String formatString(String str) + { + try + { + return String.format(str, new Object[] {GameSettings.getKeyDisplayString(Minecraft.this.gameSettings.keyBindInventory.getKeyCode())}); + } + catch (Exception exception) + { + return "Error: " + exception.getLocalizedMessage(); + } + } + }); + this.mouseHelper = new MouseHelper(); + this.checkGLError("Pre startup"); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7425); + GlStateManager.clearDepth(1.0D); + GlStateManager.enableDepth(); + GlStateManager.depthFunc(515); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.cullFace(GlStateManager.CullFace.BACK); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); + this.textureMapBlocks = new TextureMap("textures"); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.LOCATION_BLOCKS_TEXTURE, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); + this.modelManager = new ModelManager(this.textureMapBlocks); + this.mcResourceManager.registerReloadListener(this.modelManager); + this.blockColors = BlockColors.init(); + this.itemColors = ItemColors.init(this.blockColors); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager, this.itemColors); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + this.itemRenderer = new ItemRenderer(this); + this.mcResourceManager.registerReloadListener(this.renderItem); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.blockColors); + this.mcResourceManager.registerReloadListener(this.blockRenderDispatcher); + this.renderGlobal = new RenderGlobal(this); + this.mcResourceManager.registerReloadListener(this.renderGlobal); + this.guiAchievement = new GuiAchievement(this); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new ParticleManager(this.theWorld, this.renderEngine); + this.checkGLError("Post startup"); + this.ingameGUI = new GuiIngame(this); + + if (this.serverName != null) + { + this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + + this.renderEngine.deleteTexture(this.mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + this.debugRenderer = new DebugRenderer(this); + + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); + } + + try + { + Display.setVSyncEnabled(this.gameSettings.enableVsync); + } + catch (OpenGLException var2) + { + this.gameSettings.enableVsync = false; + this.gameSettings.saveOptions(); + } + + this.renderGlobal.makeEntityOutlineShader(); + } + + private void registerMetadataSerializers() + { + this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class); + } + + private void createDisplay() throws LWJGLException + { + Display.setResizable(true); + Display.setTitle("Minecraft 1.10"); + + try + { + Display.create((new PixelFormat()).withDepthBits(24)); + } + catch (LWJGLException lwjglexception) + { + LOGGER.error((String)"Couldn\'t set pixel format", (Throwable)lwjglexception); + + try + { + Thread.sleep(1000L); + } + catch (InterruptedException var3) + { + ; + } + + if (this.fullscreen) + { + this.updateDisplayMode(); + } + + Display.create(); + } + } + + private void setInitialDisplayMode() throws LWJGLException + { + if (this.fullscreen) + { + Display.setFullscreen(true); + DisplayMode displaymode = Display.getDisplayMode(); + this.displayWidth = Math.max(1, displaymode.getWidth()); + this.displayHeight = Math.max(1, displaymode.getHeight()); + } + else + { + Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight)); + } + } + + private void setWindowIcon() + { + Util.EnumOS util$enumos = Util.getOSType(); + + if (util$enumos != Util.EnumOS.OSX) + { + InputStream inputstream = null; + InputStream inputstream1 = null; + + try + { + inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png")); + inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png")); + + if (inputstream != null && inputstream1 != null) + { + Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)}); + } + } + catch (IOException ioexception) + { + LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception); + } + finally + { + IOUtils.closeQuietly(inputstream); + IOUtils.closeQuietly(inputstream1); + } + } + } + + private static boolean isJvm64bit() + { + String[] astring = new String[] {"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"}; + + for (String s : astring) + { + String s1 = System.getProperty(s); + + if (s1 != null && s1.contains("64")) + { + return true; + } + } + + return false; + } + + public Framebuffer getFramebuffer() + { + return this.framebufferMc; + } + + public String getVersion() + { + return this.launchedVersion; + } + + public String getVersionType() + { + return this.versionType; + } + + private void startTimerHackThread() + { + Thread thread = new Thread("Timer hack thread") + { + public void run() + { + while (Minecraft.this.running) + { + try + { + Thread.sleep(2147483647L); + } + catch (InterruptedException var2) + { + ; + } + } + } + }; + thread.setDaemon(true); + thread.start(); + } + + public void crashed(CrashReport crash) + { + this.hasCrashed = true; + this.crashReporter = crash; + } + + /** + * Wrapper around displayCrashReportInternal + */ + public void displayCrashReport(CrashReport crashReportIn) + { + File file1 = new File(getMinecraft().mcDataDir, "crash-reports"); + File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); + Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); + + if (crashReportIn.getFile() != null) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); + System.exit(-1); + } + else if (crashReportIn.saveToFile(file2)) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); + System.exit(-1); + } + else + { + Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); + System.exit(-2); + } + } + + public boolean isUnicode() + { + return this.mcLanguageManager.isCurrentLocaleUnicode() || this.gameSettings.forceUnicodeFont; + } + + public void refreshResources() + { + List list = Lists.newArrayList(this.defaultResourcePacks); + + if (this.theIntegratedServer != null) + { + this.theIntegratedServer.reloadLootTables(); + } + + for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries()) + { + list.add(resourcepackrepository$entry.getResourcePack()); + } + + if (this.mcResourcePackRepository.getResourcePackInstance() != null) + { + list.add(this.mcResourcePackRepository.getResourcePackInstance()); + } + + try + { + this.mcResourceManager.reloadResources(list); + } + catch (RuntimeException runtimeexception) + { + LOGGER.info((String)"Caught error stitching, removing all assigned resourcepacks", (Throwable)runtimeexception); + list.clear(); + list.addAll(this.defaultResourcePacks); + this.mcResourcePackRepository.setRepositories(Collections.emptyList()); + this.mcResourceManager.reloadResources(list); + this.gameSettings.resourcePacks.clear(); + this.gameSettings.incompatibleResourcePacks.clear(); + this.gameSettings.saveOptions(); + } + + this.mcLanguageManager.parseLanguageMetadata(list); + + if (this.renderGlobal != null) + { + this.renderGlobal.loadRenderers(); + } + } + + private ByteBuffer readImageToBuffer(InputStream imageStream) throws IOException + { + BufferedImage bufferedimage = ImageIO.read(imageStream); + int[] aint = bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), (int[])null, 0, bufferedimage.getWidth()); + ByteBuffer bytebuffer = ByteBuffer.allocate(4 * aint.length); + + for (int i : aint) + { + bytebuffer.putInt(i << 8 | i >> 24 & 255); + } + + bytebuffer.flip(); + return bytebuffer; + } + + private void updateDisplayMode() throws LWJGLException + { + Set set = Sets.newHashSet(); + Collections.addAll(set, Display.getAvailableDisplayModes()); + DisplayMode displaymode = Display.getDesktopDisplayMode(); + + if (!set.contains(displaymode) && Util.getOSType() == Util.EnumOS.OSX) + { + label53: + + for (DisplayMode displaymode1 : MAC_DISPLAY_MODES) + { + boolean flag = true; + + for (DisplayMode displaymode2 : set) + { + if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() && displaymode2.getHeight() == displaymode1.getHeight()) + { + flag = false; + break; + } + } + + if (!flag) + { + Iterator iterator = set.iterator(); + DisplayMode displaymode3; + + while (true) + { + if (!iterator.hasNext()) + { + continue label53; + } + + displaymode3 = (DisplayMode)iterator.next(); + + if (displaymode3.getBitsPerPixel() == 32 && displaymode3.getWidth() == displaymode1.getWidth() / 2 && displaymode3.getHeight() == displaymode1.getHeight() / 2) + { + break; + } + } + + displaymode = displaymode3; + } + } + } + + Display.setDisplayMode(displaymode); + this.displayWidth = displaymode.getWidth(); + this.displayHeight = displaymode.getHeight(); + } + + private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException + { + ScaledResolution scaledresolution = new ScaledResolution(this); + int i = scaledresolution.getScaleFactor(); + Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true); + framebuffer.bindFramebuffer(false); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GlStateManager.disableDepth(); + GlStateManager.enableTexture2D(); + InputStream inputstream = null; + + try + { + inputstream = this.mcDefaultResourcePack.getInputStream(LOCATION_MOJANG_PNG); + this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream))); + textureManagerInstance.bindTexture(this.mojangLogo); + } + catch (IOException ioexception) + { + LOGGER.error("Unable to load logo: {}", new Object[] {LOCATION_MOJANG_PNG, ioexception}); + } + finally + { + IOUtils.closeQuietly(inputstream); + } + + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getBuffer(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + vertexbuffer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + vertexbuffer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + vertexbuffer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + tessellator.draw(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + int j = 256; + int k = 256; + this.draw((scaledresolution.getScaledWidth() - 256) / 2, (scaledresolution.getScaledHeight() - 256) / 2, 0, 0, 256, 256, 255, 255, 255, 255); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + framebuffer.unbindFramebuffer(); + framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + this.updateDisplay(); + } + + /** + * Draw with the WorldRenderer + */ + public void draw(int posX, int posY, int texU, int texV, int width, int height, int red, int green, int blue, int alpha) + { + VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + float f = 0.00390625F; + float f1 = 0.00390625F; + vertexbuffer.pos((double)posX, (double)(posY + height), 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex(); + vertexbuffer.pos((double)(posX + width), (double)(posY + height), 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex(); + vertexbuffer.pos((double)(posX + width), (double)posY, 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex(); + vertexbuffer.pos((double)posX, (double)posY, 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex(); + Tessellator.getInstance().draw(); + } + + /** + * Returns the save loader that is currently being used + */ + public ISaveFormat getSaveLoader() + { + return this.saveLoader; + } + + /** + * Sets the argument GuiScreen as the main (topmost visible) screen. + */ + public void displayGuiScreen(@Nullable GuiScreen guiScreenIn) + { + if (this.currentScreen != null) + { + this.currentScreen.onGuiClosed(); + } + + if (guiScreenIn == null && this.theWorld == null) + { + guiScreenIn = new GuiMainMenu(); + } + else if (guiScreenIn == null && this.thePlayer.getHealth() <= 0.0F) + { + guiScreenIn = new GuiGameOver((ITextComponent)null); + } + + if (guiScreenIn instanceof GuiMainMenu || guiScreenIn instanceof GuiMultiplayer) + { + this.gameSettings.showDebugInfo = false; + this.ingameGUI.getChatGUI().clearChatMessages(); + } + + this.currentScreen = (GuiScreen)guiScreenIn; + + if (guiScreenIn != null) + { + this.setIngameNotInFocus(); + KeyBinding.unPressAllKeys(); + + while (Mouse.next()) + { + ; + } + + while (Keyboard.next()) + { + ; + } + + ScaledResolution scaledresolution = new ScaledResolution(this); + int i = scaledresolution.getScaledWidth(); + int j = scaledresolution.getScaledHeight(); + ((GuiScreen)guiScreenIn).setWorldAndResolution(this, i, j); + this.skipRenderWorld = false; + } + else + { + this.mcSoundHandler.resumeSounds(); + this.setIngameFocus(); + } + } + + /** + * Checks for an OpenGL error. If there is one, prints the error ID and error string. + */ + private void checkGLError(String message) + { + int i = GlStateManager.glGetError(); + + if (i != 0) + { + String s = GLU.gluErrorString(i); + LOGGER.error("########## GL ERROR ##########"); + LOGGER.error("@ {}", new Object[] {message}); + LOGGER.error("{}: {}", new Object[] {Integer.valueOf(i), s}); + } + } + + /** + * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the + * application (or web page) is exited. + */ + public void shutdownMinecraftApplet() + { + try + { + LOGGER.info("Stopping!"); + + try + { + this.loadWorld((WorldClient)null); + } + catch (Throwable var5) + { + ; + } + + this.mcSoundHandler.unloadSounds(); + } + finally + { + Display.destroy(); + + if (!this.hasCrashed) + { + System.exit(0); + } + } + + System.gc(); + } + + /** + * Called repeatedly from run() + */ + private void runGameLoop() throws IOException + { + long i = System.nanoTime(); + this.mcProfiler.startSection("root"); + + if (Display.isCreated() && Display.isCloseRequested()) + { + this.shutdown(); + } + + if (this.isGamePaused && this.theWorld != null) + { + float f = this.timer.renderPartialTicks; + this.timer.updateTimer(); + this.timer.renderPartialTicks = f; + + // Cubitick + float rptw = this.timerWorld.renderPartialTicks; + this.timerWorld.updateTimer(); + this.timerWorld.renderPartialTicks = rptw; + } + else + { + this.timer.updateTimer(); + + // Cubitick + this.timerWorld.updateTimer(); + } + + this.mcProfiler.startSection("scheduledExecutables"); + + synchronized (this.scheduledTasks) + { + while (!this.scheduledTasks.isEmpty()) + { + Util.runTask((FutureTask)this.scheduledTasks.poll(), LOGGER); + } + } + + // Cubitick : reset tickrates upon loading a new world + if(this.theWorld == null && Cubitick.tickrateWorld != Cubitick.tickrate) + { + Cubitick.setTickWorld(Cubitick.tickrate); + Cubitick.synctick = false; + } + else if(this.theWorld != null) + { + // Cubitick : World init + if(!Cubitick.initialised && tickcounter > 100) Cubitick.instance.checkVersion(); + } + + this.mcProfiler.endSection(); + long l = System.nanoTime(); + this.mcProfiler.startSection("tick"); + + // Cubitick + if(Cubitick.synctick) + { + // original runTick() call (with added tickcounter increment) + for (int var3 = 0; var3 < this.timerWorld.elapsedTicks; ++var3) + { + if(!this.isGamePaused) this.tickcounter++; + this.runTick(); + } + } + else + { + int worldTicks = this.timerWorld.elapsedTicks; + int playerTicks = this.timer.elapsedTicks; + + while(worldTicks > 0 && playerTicks > 0) + { + if(!this.isGamePaused) this.tickcounter++; + this.runTick(); + worldTicks--; playerTicks--; + } + + while(playerTicks > 0) + { + this.runTickPlayer(); + playerTicks--; + } + + while(worldTicks > 0) + { + if(!this.isGamePaused) this.tickcounter++; + this.runTickWorld(); + worldTicks--; + } + } + + this.mcProfiler.endStartSection("preRenderErrors"); + long i1 = System.nanoTime() - l; + this.checkGLError("Pre render"); + this.mcProfiler.endStartSection("sound"); + this.mcSoundHandler.setListener(this.thePlayer, this.timer.renderPartialTicks); + this.mcProfiler.endSection(); + this.mcProfiler.startSection("render"); + GlStateManager.pushMatrix(); + GlStateManager.clear(16640); + this.framebufferMc.bindFramebuffer(true); + this.mcProfiler.startSection("display"); + GlStateManager.enableTexture2D(); + this.mcProfiler.endSection(); + + if (!this.skipRenderWorld) + { + this.mcProfiler.endStartSection("gameRenderer"); + + // Cubitick: use the world timer (only relevant for ticksync) + this.entityRenderer.updateCameraAndRender(this.timerWorld.renderPartialTicks, System.nanoTime()); + this.mcProfiler.endSection(); + } + + this.mcProfiler.endSection(); + + if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart && !this.gameSettings.hideGUI) + { + if (!this.mcProfiler.profilingEnabled) + { + this.mcProfiler.clearProfiling(); + } + + this.mcProfiler.profilingEnabled = true; + this.displayDebugInfo(i1); + } + else + { + this.mcProfiler.profilingEnabled = false; + this.prevFrameTime = System.nanoTime(); + } + + this.guiAchievement.updateAchievementWindow(); + this.framebufferMc.unbindFramebuffer(); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + this.framebufferMc.framebufferRender(this.displayWidth, this.displayHeight); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + this.entityRenderer.renderStreamIndicator(this.timer.renderPartialTicks); + GlStateManager.popMatrix(); + this.mcProfiler.startSection("root"); + this.updateDisplay(); + Thread.yield(); + this.checkGLError("Post render"); + ++this.fpsCounter; + this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic(); + long k = System.nanoTime(); + this.frameTimer.addFrame(k - this.startNanoTime); + this.startNanoTime = k; + + while (getSystemTime() >= this.debugUpdateTime + 1000L) + { + debugFPS = this.fpsCounter; + this.debug = String.format("%d fps (%d chunk update%s) T: %s%s%s%s%s", new Object[] {Integer.valueOf(debugFPS), Integer.valueOf(RenderChunk.renderChunksUpdated), RenderChunk.renderChunksUpdated == 1 ? "" : "s", (float)this.gameSettings.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() ? "inf" : Integer.valueOf(this.gameSettings.limitFramerate), this.gameSettings.enableVsync ? " vsync" : "", this.gameSettings.fancyGraphics ? "" : " fast", this.gameSettings.clouds == 0 ? "" : (this.gameSettings.clouds == 1 ? " fast-clouds" : " fancy-clouds"), OpenGlHelper.useVbo() ? " vbo" : ""}); + RenderChunk.renderChunksUpdated = 0; + this.debugUpdateTime += 1000L; + this.fpsCounter = 0; + this.usageSnooper.addMemoryStatsToSnooper(); + + if (!this.usageSnooper.isSnooperRunning()) + { + this.usageSnooper.startSnooper(); + } + } + + if (this.isFramerateLimitBelowMax()) + { + this.mcProfiler.startSection("fpslimit_wait"); + Display.sync(this.getLimitFramerate()); + this.mcProfiler.endSection(); + } + + this.mcProfiler.endSection(); + } + + public void updateDisplay() + { + this.mcProfiler.startSection("display_update"); + Display.update(); + this.mcProfiler.endSection(); + this.checkWindowResize(); + } + + protected void checkWindowResize() + { + if (!this.fullscreen && Display.wasResized()) + { + int i = this.displayWidth; + int j = this.displayHeight; + this.displayWidth = Display.getWidth(); + this.displayHeight = Display.getHeight(); + + if (this.displayWidth != i || this.displayHeight != j) + { + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + + this.resize(this.displayWidth, this.displayHeight); + } + } + } + + public int getLimitFramerate() + { + return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate; + } + + public boolean isFramerateLimitBelowMax() + { + return (float)this.getLimitFramerate() < GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); + } + + public void freeMemory() + { + try + { + memoryReserve = new byte[0]; + this.renderGlobal.deleteAllDisplayLists(); + } + catch (Throwable var3) + { + ; + } + + try + { + System.gc(); + this.loadWorld((WorldClient)null); + } + catch (Throwable var2) + { + ; + } + + System.gc(); + } + + /** + * Update debugProfilerName in response to number keys in debug screen + */ + private void updateDebugProfilerName(int keyCount) + { + List list = this.mcProfiler.getProfilingData(this.debugProfilerName); + + if (list != null && !list.isEmpty()) + { + Profiler.Result profiler$result = (Profiler.Result)list.remove(0); + + if (keyCount == 0) + { + if (!profiler$result.profilerName.isEmpty()) + { + int i = this.debugProfilerName.lastIndexOf(46); + + if (i >= 0) + { + this.debugProfilerName = this.debugProfilerName.substring(0, i); + } + } + } + else + { + --keyCount; + + if (keyCount < list.size() && !"unspecified".equals(((Profiler.Result)list.get(keyCount)).profilerName)) + { + if (!this.debugProfilerName.isEmpty()) + { + this.debugProfilerName = this.debugProfilerName + "."; + } + + this.debugProfilerName = this.debugProfilerName + ((Profiler.Result)list.get(keyCount)).profilerName; + } + } + } + } + + /** + * Parameter appears to be unused + */ + private void displayDebugInfo(long elapsedTicksTime) + { + if (this.mcProfiler.profilingEnabled) + { + List list = this.mcProfiler.getProfilingData(this.debugProfilerName); + Profiler.Result profiler$result = (Profiler.Result)list.remove(0); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.enableColorMaterial(); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)this.displayWidth, (double)this.displayHeight, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.glLineWidth(1.0F); + GlStateManager.disableTexture2D(); + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getBuffer(); + int i = 160; + int j = this.displayWidth - 160 - 10; + int k = this.displayHeight - 320; + GlStateManager.enableBlend(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + vertexbuffer.pos((double)((float)j - 176.0F), (double)((float)k - 96.0F - 16.0F), 0.0D).color(200, 0, 0, 0).endVertex(); + vertexbuffer.pos((double)((float)j - 176.0F), (double)(k + 320), 0.0D).color(200, 0, 0, 0).endVertex(); + vertexbuffer.pos((double)((float)j + 176.0F), (double)(k + 320), 0.0D).color(200, 0, 0, 0).endVertex(); + vertexbuffer.pos((double)((float)j + 176.0F), (double)((float)k - 96.0F - 16.0F), 0.0D).color(200, 0, 0, 0).endVertex(); + tessellator.draw(); + GlStateManager.disableBlend(); + double d0 = 0.0D; + + for (int l = 0; l < list.size(); ++l) + { + Profiler.Result profiler$result1 = (Profiler.Result)list.get(l); + int i1 = MathHelper.floor_double(profiler$result1.usePercentage / 4.0D) + 1; + vertexbuffer.begin(6, DefaultVertexFormats.POSITION_COLOR); + int j1 = profiler$result1.getColor(); + int k1 = j1 >> 16 & 255; + int l1 = j1 >> 8 & 255; + int i2 = j1 & 255; + vertexbuffer.pos((double)j, (double)k, 0.0D).color(k1, l1, i2, 255).endVertex(); + + for (int j2 = i1; j2 >= 0; --j2) + { + float f = (float)((d0 + profiler$result1.usePercentage * (double)j2 / (double)i1) * (Math.PI * 2D) / 100.0D); + float f1 = MathHelper.sin(f) * 160.0F; + float f2 = MathHelper.cos(f) * 160.0F * 0.5F; + vertexbuffer.pos((double)((float)j + f1), (double)((float)k - f2), 0.0D).color(k1, l1, i2, 255).endVertex(); + } + + tessellator.draw(); + vertexbuffer.begin(5, DefaultVertexFormats.POSITION_COLOR); + + for (int i3 = i1; i3 >= 0; --i3) + { + float f3 = (float)((d0 + profiler$result1.usePercentage * (double)i3 / (double)i1) * (Math.PI * 2D) / 100.0D); + float f4 = MathHelper.sin(f3) * 160.0F; + float f5 = MathHelper.cos(f3) * 160.0F * 0.5F; + vertexbuffer.pos((double)((float)j + f4), (double)((float)k - f5), 0.0D).color(k1 >> 1, l1 >> 1, i2 >> 1, 255).endVertex(); + vertexbuffer.pos((double)((float)j + f4), (double)((float)k - f5 + 10.0F), 0.0D).color(k1 >> 1, l1 >> 1, i2 >> 1, 255).endVertex(); + } + + tessellator.draw(); + d0 += profiler$result1.usePercentage; + } + + DecimalFormat decimalformat = new DecimalFormat("##0.00"); + GlStateManager.enableTexture2D(); + String s = ""; + + if (!"unspecified".equals(profiler$result.profilerName)) + { + s = s + "[0] "; + } + + if (profiler$result.profilerName.isEmpty()) + { + s = s + "ROOT "; + } + else + { + s = s + profiler$result.profilerName + ' '; + } + + int l2 = 16777215; + this.fontRendererObj.drawStringWithShadow(s, (float)(j - 160), (float)(k - 80 - 16), 16777215); + s = decimalformat.format(profiler$result.totalUsePercentage) + "%"; + this.fontRendererObj.drawStringWithShadow(s, (float)(j + 160 - this.fontRendererObj.getStringWidth(s)), (float)(k - 80 - 16), 16777215); + + for (int k2 = 0; k2 < list.size(); ++k2) + { + Profiler.Result profiler$result2 = (Profiler.Result)list.get(k2); + StringBuilder stringbuilder = new StringBuilder(); + + if ("unspecified".equals(profiler$result2.profilerName)) + { + stringbuilder.append("[?] "); + } + else + { + stringbuilder.append("[").append(k2 + 1).append("] "); + } + + String s1 = stringbuilder.append(profiler$result2.profilerName).toString(); + this.fontRendererObj.drawStringWithShadow(s1, (float)(j - 160), (float)(k + 80 + k2 * 8 + 20), profiler$result2.getColor()); + s1 = decimalformat.format(profiler$result2.usePercentage) + "%"; + this.fontRendererObj.drawStringWithShadow(s1, (float)(j + 160 - 50 - this.fontRendererObj.getStringWidth(s1)), (float)(k + 80 + k2 * 8 + 20), profiler$result2.getColor()); + s1 = decimalformat.format(profiler$result2.totalUsePercentage) + "%"; + this.fontRendererObj.drawStringWithShadow(s1, (float)(j + 160 - this.fontRendererObj.getStringWidth(s1)), (float)(k + 80 + k2 * 8 + 20), profiler$result2.getColor()); + } + } + } + + /** + * Called when the window is closing. Sets 'running' to false which allows the game loop to exit cleanly. + */ + public void shutdown() + { + this.running = false; + } + + /** + * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen + * currently displayed + */ + public void setIngameFocus() + { + if (Display.isActive()) + { + if (!this.inGameHasFocus) + { + if (!IS_RUNNING_ON_MAC) + { + KeyBinding.updateKeyBindState(); + } + + this.inGameHasFocus = true; + this.mouseHelper.grabMouseCursor(); + this.displayGuiScreen((GuiScreen)null); + this.leftClickCounter = 10000; + } + } + } + + /** + * Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor. + */ + public void setIngameNotInFocus() + { + if (this.inGameHasFocus) + { + this.inGameHasFocus = false; + this.mouseHelper.ungrabMouseCursor(); + } + } + + /** + * Displays the ingame menu + */ + public void displayInGameMenu() + { + if (this.currentScreen == null) + { + this.displayGuiScreen(new GuiIngameMenu()); + + if (this.isSingleplayer() && !this.theIntegratedServer.getPublic()) + { + this.mcSoundHandler.pauseSounds(); + } + } + } + + private void sendClickBlockToController(boolean leftClick) + { + if (!leftClick) + { + this.leftClickCounter = 0; + } + + if (this.leftClickCounter <= 0 && !this.thePlayer.isHandActive()) + { + if (leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) + { + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (this.theWorld.getBlockState(blockpos).getMaterial() != Material.AIR && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) + { + this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); + this.thePlayer.swingArm(EnumHand.MAIN_HAND); + } + } + else + { + this.playerController.resetBlockRemoving(); + } + } + } + + private void clickMouse() + { + if (this.leftClickCounter <= 0) + { + if (this.objectMouseOver == null) + { + LOGGER.error("Null returned as \'hitResult\', this shouldn\'t happen!"); + + if (this.playerController.isNotCreative()) + { + this.leftClickCounter = 10; + } + } + else if (!this.thePlayer.isRowingBoat()) + { + switch (this.objectMouseOver.typeOfHit) + { + case ENTITY: + this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit); + break; + + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (this.theWorld.getBlockState(blockpos).getMaterial() != Material.AIR) + { + this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit); + break; + } + + case MISS: + if (this.playerController.isNotCreative()) + { + this.leftClickCounter = 10; + } + + this.thePlayer.resetCooldown(); + } + + this.thePlayer.swingArm(EnumHand.MAIN_HAND); + } + } + } + + @SuppressWarnings("incomplete-switch") + + /** + * Called when user clicked he's mouse right button (place) + */ + private void rightClickMouse() + { + if (!this.playerController.getIsHittingBlock()) + { + this.rightClickDelayTimer = 4; + + if (!this.thePlayer.isRowingBoat()) + { + for (EnumHand enumhand : EnumHand.values()) + { + ItemStack itemstack = this.thePlayer.getHeldItem(enumhand); + + if (this.objectMouseOver == null) + { + LOGGER.warn("Null returned as \'hitResult\', this shouldn\'t happen!"); + } + else + { + switch (this.objectMouseOver.typeOfHit) + { + case ENTITY: + if (this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit, this.objectMouseOver, this.thePlayer.getHeldItem(enumhand), enumhand) == EnumActionResult.SUCCESS) + { + return; + } + + if (this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit, this.thePlayer.getHeldItem(enumhand), enumhand) == EnumActionResult.SUCCESS) + { + return; + } + + break; + + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (this.theWorld.getBlockState(blockpos).getMaterial() != Material.AIR) + { + int i = itemstack != null ? itemstack.stackSize : 0; + EnumActionResult enumactionresult = this.playerController.processRightClickBlock(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec, enumhand); + + if (enumactionresult == EnumActionResult.SUCCESS) + { + this.thePlayer.swingArm(enumhand); + + if (itemstack != null) + { + if (itemstack.stackSize == 0) + { + this.thePlayer.setHeldItem(enumhand, (ItemStack)null); + } + else if (itemstack.stackSize != i || this.playerController.isInCreativeMode()) + { + this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand); + } + } + + return; + } + } + } + } + + ItemStack itemstack1 = this.thePlayer.getHeldItem(enumhand); + + if (itemstack1 != null && this.playerController.processRightClick(this.thePlayer, this.theWorld, itemstack1, enumhand) == EnumActionResult.SUCCESS) + { + this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand); + return; + } + } + } + } + } + + /** + * Toggles fullscreen mode. + */ + public void toggleFullscreen() + { + try + { + this.fullscreen = !this.fullscreen; + this.gameSettings.fullScreen = this.fullscreen; + + if (this.fullscreen) + { + this.updateDisplayMode(); + this.displayWidth = Display.getDisplayMode().getWidth(); + this.displayHeight = Display.getDisplayMode().getHeight(); + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + else + { + Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight)); + this.displayWidth = this.tempDisplayWidth; + this.displayHeight = this.tempDisplayHeight; + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + + if (this.currentScreen != null) + { + this.resize(this.displayWidth, this.displayHeight); + } + else + { + this.updateFramebufferSize(); + } + + Display.setFullscreen(this.fullscreen); + Display.setVSyncEnabled(this.gameSettings.enableVsync); + this.updateDisplay(); + } + catch (Exception exception) + { + LOGGER.error((String)"Couldn\'t toggle fullscreen", (Throwable)exception); + } + } + + /** + * Called to resize the current screen. + */ + private void resize(int width, int height) + { + this.displayWidth = Math.max(1, width); + this.displayHeight = Math.max(1, height); + + if (this.currentScreen != null) + { + ScaledResolution scaledresolution = new ScaledResolution(this); + this.currentScreen.onResize(this, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight()); + } + + this.loadingScreen = new LoadingScreenRenderer(this); + this.updateFramebufferSize(); + } + + private void updateFramebufferSize() + { + this.framebufferMc.createBindFramebuffer(this.displayWidth, this.displayHeight); + + if (this.entityRenderer != null) + { + this.entityRenderer.updateShaderGroupSize(this.displayWidth, this.displayHeight); + } + } + + /** + * Return the musicTicker's instance + */ + public MusicTicker getMusicTicker() + { + return this.mcMusicTicker; + } + + /** + * Runs the current tick. + */ + + // Cubitick : split runTick() into runTickPlayer() and runTickWorld() + public void runTickPlayer() throws IOException + { + if (this.rightClickDelayTimer > 0) + { + --this.rightClickDelayTimer; + } + + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) + { + this.ingameGUI.updateTick(); + } + + this.mcProfiler.endSection(); + this.entityRenderer.getMouseOver(1.0F); + this.mcProfiler.startSection("gameMode"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.playerController.updateController(); + } + + this.mcProfiler.endStartSection("textures"); + + if (!this.isGamePaused) + { + this.renderEngine.tick(); + } + + if (this.currentScreen == null && this.thePlayer != null) + { + if (this.thePlayer.getHealth() <= 0.0F && !(this.currentScreen instanceof GuiGameOver)) + { + this.displayGuiScreen((GuiScreen)null); + } + else if (this.thePlayer.isPlayerSleeping() && this.theWorld != null) + { + this.displayGuiScreen(new GuiSleepMP()); + } + } + else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping()) + { + this.displayGuiScreen((GuiScreen)null); + } + + if (this.currentScreen != null) + { + this.leftClickCounter = 10000; + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.handleInput(); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Updating screen events"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Affected screen"); + crashreportcategory.func_189529_a("Screen name", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.currentScreen.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport); + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.updateScreen(); + } + catch (Throwable throwable) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Ticking screen"); + CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Affected screen"); + crashreportcategory1.func_189529_a("Screen name", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.currentScreen.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport1); + } + } + } + + if (this.currentScreen == null || this.currentScreen.allowUserInput) + { + this.mcProfiler.endStartSection("mouse"); + this.runTickMouse(); + + if (this.leftClickCounter > 0) + { + --this.leftClickCounter; + } + + this.mcProfiler.endStartSection("keyboard"); + this.runTickKeyboard(); + } + + if(this.theWorld != null) + { + // Cubitick + if(!this.isGamePaused) this.theWorld.updateEntity(thePlayer); + + if (this.thePlayer != null) + { + ++this.joinPlayerCounter; + + if (this.joinPlayerCounter == 30) + { + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); + } + } + + this.mcProfiler.endStartSection("gameRenderer"); + + if (!this.isGamePaused) + { + this.entityRenderer.updateRenderer(); + } + + this.mcProfiler.endStartSection("levelRenderer"); + } + + // PacketAnalysis: rerender + if(scheduledReload){ + this.renderGlobal.loadRenderers(); + scheduledReload = false; + } + + if (!this.isGamePaused) + { + this.mcMusicTicker.update(); + this.mcSoundHandler.update(); + } + } + + public void runTickWorld() + { + CrashReport var2; + CrashReportCategory var3; + + if (this.theWorld != null) + { + if (this.thePlayer != null) + { + ++this.joinPlayerCounter; + + if (this.joinPlayerCounter == 30) + { + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); + } + } + + this.mcProfiler.endStartSection("gameRenderer"); + + if (!this.isGamePaused) + { + //this.entityRenderer.updateRenderer(); + } + + this.mcProfiler.endStartSection("levelRenderer"); + + if (!this.isGamePaused) + { + this.renderGlobal.updateClouds(); + } + + this.mcProfiler.endStartSection("level"); + + if (!this.isGamePaused) + { + if (this.theWorld.getLastLightningBolt() > 0) + { + this.theWorld.setLastLightningBolt(this.theWorld.getLastLightningBolt() - 1); + } + + // Cubitick 1.5.1+: temporarily remove player from entity list instead of modding World.java + this.theWorld.loadedEntityList.remove(this.thePlayer); + this.theWorld.updateEntities(); + this.theWorld.loadedEntityList.add(this.thePlayer); + } + } + else if (this.entityRenderer.isShaderActive()) + { + this.entityRenderer.stopUseShader(); + } + + if (!this.isGamePaused) + { + this.mcMusicTicker.update(); + this.mcSoundHandler.update(); + } + + if (this.theWorld != null) + { + if (!this.isGamePaused) + { + this.theWorld.setAllowedSpawnTypes(this.theWorld.getDifficulty() != EnumDifficulty.PEACEFUL, true); + + try + { + this.theWorld.tick(); + } + catch (Throwable throwable2) + { + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable2, "Exception in world tick"); + + if (this.theWorld == null) + { + CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Affected level"); + crashreportcategory2.addCrashSection("Problem", "Level is null!"); + } + else + { + this.theWorld.addWorldInfoToCrashReport(crashreport2); + } + + throw new ReportedException(crashreport2); + } + } + + this.mcProfiler.endStartSection("animateTick"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ)); + } + + this.mcProfiler.endStartSection("particles"); + + if (!this.isGamePaused) + { + this.effectRenderer.updateEffects(); + } + } + else if (this.myNetworkManager != null) + { + this.mcProfiler.endStartSection("pendingConnection"); + this.myNetworkManager.processReceivedPackets(); + } + + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + /** + * Runs the current tick; i.e. original runTick() + */ + public void runTick() throws IOException + { + if (this.rightClickDelayTimer > 0) + { + --this.rightClickDelayTimer; + } + + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) + { + this.ingameGUI.updateTick(); + } + + this.mcProfiler.endSection(); + this.entityRenderer.getMouseOver(1.0F); + this.mcProfiler.startSection("gameMode"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.playerController.updateController(); + } + + this.mcProfiler.endStartSection("textures"); + + if (!this.isGamePaused) + { + this.renderEngine.tick(); + } + + if (this.currentScreen == null && this.thePlayer != null) + { + if (this.thePlayer.getHealth() <= 0.0F && !(this.currentScreen instanceof GuiGameOver)) + { + this.displayGuiScreen((GuiScreen)null); + } + else if (this.thePlayer.isPlayerSleeping() && this.theWorld != null) + { + this.displayGuiScreen(new GuiSleepMP()); + } + } + else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping()) + { + this.displayGuiScreen((GuiScreen)null); + } + + if (this.currentScreen != null) + { + this.leftClickCounter = 10000; + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.handleInput(); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Updating screen events"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Affected screen"); + crashreportcategory.func_189529_a("Screen name", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.currentScreen.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport); + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.updateScreen(); + } + catch (Throwable throwable) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Ticking screen"); + CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Affected screen"); + crashreportcategory1.func_189529_a("Screen name", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.currentScreen.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport1); + } + } + } + + if (this.currentScreen == null || this.currentScreen.allowUserInput) + { + this.mcProfiler.endStartSection("mouse"); + this.runTickMouse(); + + if (this.leftClickCounter > 0) + { + --this.leftClickCounter; + } + + this.mcProfiler.endStartSection("keyboard"); + this.runTickKeyboard(); + } + + if (this.theWorld != null) + { + if (this.thePlayer != null) + { + ++this.joinPlayerCounter; + + if (this.joinPlayerCounter == 30) + { + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); + } + } + + this.mcProfiler.endStartSection("gameRenderer"); + + if (!this.isGamePaused) + { + this.entityRenderer.updateRenderer(); + } + + this.mcProfiler.endStartSection("levelRenderer"); + + if (!this.isGamePaused) + { + this.renderGlobal.updateClouds(); + } + + this.mcProfiler.endStartSection("level"); + + if (!this.isGamePaused) + { + if (this.theWorld.getLastLightningBolt() > 0) + { + this.theWorld.setLastLightningBolt(this.theWorld.getLastLightningBolt() - 1); + } + + this.theWorld.updateEntities(); + } + } + else if (this.entityRenderer.isShaderActive()) + { + this.entityRenderer.stopUseShader(); + } + + if (!this.isGamePaused) + { + this.mcMusicTicker.update(); + this.mcSoundHandler.update(); + } + + if (this.theWorld != null) + { + if (!this.isGamePaused) + { + this.theWorld.setAllowedSpawnTypes(this.theWorld.getDifficulty() != EnumDifficulty.PEACEFUL, true); + + try + { + this.theWorld.tick(); + } + catch (Throwable throwable2) + { + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable2, "Exception in world tick"); + + if (this.theWorld == null) + { + CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Affected level"); + crashreportcategory2.addCrashSection("Problem", "Level is null!"); + } + else + { + this.theWorld.addWorldInfoToCrashReport(crashreport2); + } + + throw new ReportedException(crashreport2); + } + } + + this.mcProfiler.endStartSection("animateTick"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ)); + } + + this.mcProfiler.endStartSection("particles"); + + if (!this.isGamePaused) + { + this.effectRenderer.updateEffects(); + } + } + else if (this.myNetworkManager != null) + { + this.mcProfiler.endStartSection("pendingConnection"); + this.myNetworkManager.processReceivedPackets(); + } + + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + private void runTickKeyboard() throws IOException + { + while (Keyboard.next()) + { + int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); + + if (this.debugCrashKeyPressTime > 0L) + { + if (getSystemTime() - this.debugCrashKeyPressTime >= 6000L) + { + throw new ReportedException(new CrashReport("Manually triggered debug crash", new Throwable())); + } + + if (!Keyboard.isKeyDown(46) || !Keyboard.isKeyDown(61)) + { + this.debugCrashKeyPressTime = -1L; + } + } + else if (Keyboard.isKeyDown(46) && Keyboard.isKeyDown(61)) + { + this.actionKeyF3 = true; + this.debugCrashKeyPressTime = getSystemTime(); + } + + this.dispatchKeypresses(); + + if (this.currentScreen != null) + { + this.currentScreen.handleKeyboardInput(); + } + + boolean flag = Keyboard.getEventKeyState(); + + if (flag) + { + if (i == 62 && this.entityRenderer != null) + { + this.entityRenderer.switchUseShader(); + } + + boolean flag1 = false; + + if (this.currentScreen == null) + { + if (i == 1) + { + this.displayInGameMenu(); + } + + flag1 = Keyboard.isKeyDown(61) && this.processKeyF3(i); + this.actionKeyF3 |= flag1; + + if (i == 59) + { + this.gameSettings.hideGUI = !this.gameSettings.hideGUI; + } + } + + if (flag1) + { + KeyBinding.setKeyBindState(i, false); + } + else + { + KeyBinding.setKeyBindState(i, true); + KeyBinding.onTick(i); + } + + if (this.gameSettings.showDebugProfilerChart) + { + if (i == 11) + { + this.updateDebugProfilerName(0); + } + + for (int j = 0; j < 9; ++j) + { + if (i == 2 + j) + { + this.updateDebugProfilerName(j + 1); + } + } + } + } + else + { + KeyBinding.setKeyBindState(i, false); + + if (i == 61) + { + if (this.actionKeyF3) + { + this.actionKeyF3 = false; + } + else + { + this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo; + this.gameSettings.showDebugProfilerChart = this.gameSettings.showDebugInfo && GuiScreen.isShiftKeyDown(); + this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown(); + } + } + } + } + + this.processKeyBinds(); + } + + private boolean processKeyF3(int p_184122_1_) + { + if (p_184122_1_ == 30) + { + this.renderGlobal.loadRenderers(); + this.debugChatMessage("Reloading all chunks", new Object[0]); + return true; + } + else if (p_184122_1_ == 48) + { + boolean flag1 = !this.renderManager.isDebugBoundingBox(); + this.renderManager.setDebugBoundingBox(flag1); + this.debugChatMessage("Hitboxes: {0}", new Object[] {flag1 ? "shown" : "hidden"}); + return true; + } + else if (p_184122_1_ == 32) + { + if (this.ingameGUI != null) + { + this.ingameGUI.getChatGUI().clearChatMessages(); + } + + return true; + } + else if (p_184122_1_ == 33) + { + this.gameSettings.setOptionValue(GameSettings.Options.RENDER_DISTANCE, GuiScreen.isShiftKeyDown() ? -1 : 1); + this.debugChatMessage("RenderDistance: {0}", new Object[] {Integer.valueOf(this.gameSettings.renderDistanceChunks)}); + return true; + } + else if (p_184122_1_ == 34) + { + boolean flag = this.debugRenderer.func_190075_b(); + this.debugChatMessage("Chunk borders: {0}", new Object[] {flag ? "shown" : "hidden"}); + return true; + } + else if (p_184122_1_ == 35) + { + this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips; + this.debugChatMessage("Advanced tooltips: {0}", new Object[] {this.gameSettings.advancedItemTooltips ? "shown" : "hidden"}); + this.gameSettings.saveOptions(); + return true; + } + else if (p_184122_1_ == 49) + { + if (!this.thePlayer.canCommandSenderUseCommand(2, "")) + { + this.debugChatMessage("Unable to switch gamemode, no permission", new Object[0]); + } + else if (this.thePlayer.isCreative()) + { + this.thePlayer.sendChatMessage("/gamemode spectator"); + } + else if (this.thePlayer.isSpectator()) + { + this.thePlayer.sendChatMessage("/gamemode creative"); + } + + return true; + } + else if (p_184122_1_ == 25) + { + this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus; + this.gameSettings.saveOptions(); + this.debugChatMessage("PauseOnLostFocus: {0}", new Object[] {this.gameSettings.pauseOnLostFocus ? "enabled" : "disabled"}); + return true; + } + else if (p_184122_1_ == 16) + { + this.debugChatMessage("Keybindings:", new Object[0]); + GuiNewChat guinewchat = this.ingameGUI.getChatGUI(); + guinewchat.printChatMessage(new TextComponentString("F3 + A = Reload chunks")); + guinewchat.printChatMessage(new TextComponentString("F3 + B = Show hitboxes")); + guinewchat.printChatMessage(new TextComponentString("F3 + D = Clear chat")); + guinewchat.printChatMessage(new TextComponentString("F3 + F = Cycle renderdistance (Shift to inverse)")); + guinewchat.printChatMessage(new TextComponentString("F3 + G = Show chunk boundaries")); + guinewchat.printChatMessage(new TextComponentString("F3 + H = Advanced tooltips")); + guinewchat.printChatMessage(new TextComponentString("F3 + N = Cycle creative <-> spectator")); + guinewchat.printChatMessage(new TextComponentString("F3 + P = Pause on lost focus")); + guinewchat.printChatMessage(new TextComponentString("F3 + Q = Show this list")); + guinewchat.printChatMessage(new TextComponentString("F3 + T = Reload resourcepacks")); + return true; + } + else if (p_184122_1_ == 20) + { + this.refreshResources(); + this.debugChatMessage("Reloaded resourcepacks", new Object[0]); + return true; + } + else + { + return false; + } + } + + private void processKeyBinds() + { + for (; this.gameSettings.keyBindTogglePerspective.isPressed(); this.renderGlobal.setDisplayListEntitiesDirty()) + { + ++this.gameSettings.thirdPersonView; + + if (this.gameSettings.thirdPersonView > 2) + { + this.gameSettings.thirdPersonView = 0; + } + + if (this.gameSettings.thirdPersonView == 0) + { + this.entityRenderer.loadEntityShader(this.getRenderViewEntity()); + } + else if (this.gameSettings.thirdPersonView == 1) + { + this.entityRenderer.loadEntityShader((Entity)null); + } + } + + while (this.gameSettings.keyBindSmoothCamera.isPressed()) + { + this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; + } + + for (int i = 0; i < 9; ++i) + { + if (this.gameSettings.keyBindsHotbar[i].isPressed()) + { + if (this.thePlayer.isSpectator()) + { + this.ingameGUI.getSpectatorGui().onHotbarSelected(i); + } + else + { + this.thePlayer.inventory.currentItem = i; + } + } + } + + while (this.gameSettings.keyBindInventory.isPressed()) + { + this.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.OPEN_INVENTORY_ACHIEVEMENT)); + + if (this.playerController.isRidingHorse()) + { + this.thePlayer.sendHorseInventory(); + } + else + { + this.displayGuiScreen(new GuiInventory(this.thePlayer)); + } + } + + while (this.gameSettings.keyBindSwapHands.isPressed()) + { + if (!this.thePlayer.isSpectator()) + { + this.getConnection().sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.SWAP_HELD_ITEMS, BlockPos.ORIGIN, EnumFacing.DOWN)); + } + } + + while (this.gameSettings.keyBindDrop.isPressed()) + { + if (!this.thePlayer.isSpectator()) + { + this.thePlayer.dropItem(GuiScreen.isCtrlKeyDown()); + } + } + + boolean flag = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN; + + if (flag) + { + while (this.gameSettings.keyBindChat.isPressed()) + { + this.displayGuiScreen(new GuiChat()); + } + + if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed()) + { + this.displayGuiScreen(new GuiChat("/")); + } + } + + if (this.thePlayer.isHandActive()) + { + if (!this.gameSettings.keyBindUseItem.isKeyDown()) + { + this.playerController.onStoppedUsingItem(this.thePlayer); + } + + label472: + + while (true) + { + if (!this.gameSettings.keyBindAttack.isPressed()) + { + while (this.gameSettings.keyBindUseItem.isPressed()) + { + ; + } + + while (true) + { + if (this.gameSettings.keyBindPickBlock.isPressed()) + { + continue; + } + + break label472; + } + } + } + } + else + { + while (this.gameSettings.keyBindAttack.isPressed()) + { + this.clickMouse(); + } + + while (this.gameSettings.keyBindUseItem.isPressed()) + { + this.rightClickMouse(); + } + + while (this.gameSettings.keyBindPickBlock.isPressed()) + { + this.middleClickMouse(); + } + } + + if (this.gameSettings.keyBindUseItem.isKeyDown() && this.rightClickDelayTimer == 0 && !this.thePlayer.isHandActive()) + { + this.rightClickMouse(); + } + + this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.isKeyDown() && this.inGameHasFocus); + } + + private void runTickMouse() throws IOException + { + while (Mouse.next()) + { + int i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + + if (Mouse.getEventButtonState()) + { + if (this.thePlayer.isSpectator() && i == 2) + { + this.ingameGUI.getSpectatorGui().onMiddleClick(); + } + else + { + KeyBinding.onTick(i - 100); + } + } + + long j = getSystemTime() - this.systemTime; + + // Cubitick: tickrate fix to mouse wheel input + if (j <= (long)Math.max(200F*(Cubitick.tickrate/Cubitick.tickrateWorld), 200L)) + { + int k = Mouse.getEventDWheel(); + + if (k != 0) + { + if (this.thePlayer.isSpectator()) + { + k = k < 0 ? -1 : 1; + + if (this.ingameGUI.getSpectatorGui().isMenuActive()) + { + this.ingameGUI.getSpectatorGui().onMouseScroll(-k); + } + else + { + float f = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float)k * 0.005F, 0.0F, 0.2F); + this.thePlayer.capabilities.setFlySpeed(f); + } + } + else + { + this.thePlayer.inventory.changeCurrentItem(k); + } + } + + if (this.currentScreen == null) + { + if (!this.inGameHasFocus && Mouse.getEventButtonState()) + { + this.setIngameFocus(); + } + } + else if (this.currentScreen != null) + { + this.currentScreen.handleMouseInput(); + } + } + } + } + + private void debugChatMessage(String p_184120_1_, Object... p_184120_2_) + { + this.ingameGUI.getChatGUI().printChatMessage((new TextComponentString("")).appendSibling((new TextComponentString("[Debug]: ")).setStyle((new Style()).setColor(TextFormatting.YELLOW).setBold(Boolean.valueOf(true)))).appendText(MessageFormat.format(p_184120_1_, p_184120_2_))); + } + + /** + * Arguments: World foldername, World ingame name, WorldSettings + */ + public void launchIntegratedServer(String folderName, String worldName, @Nullable WorldSettings worldSettingsIn) + { + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + + if (worldinfo == null && worldSettingsIn != null) + { + worldinfo = new WorldInfo(worldSettingsIn, folderName); + isavehandler.saveWorldInfo(worldinfo); + } + + if (worldSettingsIn == null) + { + worldSettingsIn = new WorldSettings(worldinfo); + } + + try + { + YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString()); + MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); + GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); + PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(this.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName())); + TileEntitySkull.setProfileCache(playerprofilecache); + TileEntitySkull.setSessionService(minecraftsessionservice); + PlayerProfileCache.setOnlineMode(false); + this.theIntegratedServer = new IntegratedServer(this, folderName, worldName, worldSettingsIn, yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache); + this.theIntegratedServer.startServerThread(); + this.integratedServerIsRunning = true; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Starting integrated server"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Starting integrated server"); + crashreportcategory.addCrashSection("Level ID", folderName); + crashreportcategory.addCrashSection("Level Name", worldName); + throw new ReportedException(crashreport); + } + + this.loadingScreen.displaySavingString(I18n.format("menu.loadingLevel", new Object[0])); + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { + String s = this.theIntegratedServer.getUserMessage(); + + if (s != null) + { + this.loadingScreen.displayLoadingString(I18n.format(s, new Object[0])); + } + else + { + this.loadingScreen.displayLoadingString(""); + } + + try + { + Thread.sleep(200L); + } + catch (InterruptedException var10) + { + ; + } + } + + this.displayGuiScreen(new GuiScreenWorking()); + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); + networkmanager.sendPacket(new C00Handshake(210, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); + networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile())); + this.myNetworkManager = networkmanager; + } + + /** + * unloads the current world first + */ + public void loadWorld(WorldClient worldClientIn) + { + this.loadWorld(worldClientIn, ""); + } + + /** + * par2Str is displayed on the loading screen to the user unloads the current world first + */ + public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) + { + if (worldClientIn == null) + { + NetHandlerPlayClient nethandlerplayclient = this.getConnection(); + + if (nethandlerplayclient != null) + { + nethandlerplayclient.cleanup(); + } + + if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) + { + this.theIntegratedServer.initiateShutdown(); + } + + this.theIntegratedServer = null; + this.guiAchievement.clearAchievements(); + this.entityRenderer.getMapItemRenderer().clearLoadedMaps(); + this.playerController = null; + } + + this.renderViewEntity = null; + this.myNetworkManager = null; + + if (this.loadingScreen != null) + { + this.loadingScreen.resetProgressAndMessage(loadingMessage); + this.loadingScreen.displayLoadingString(""); + } + + if (worldClientIn == null && this.theWorld != null) + { + this.mcResourcePackRepository.clearResourcePack(); + this.ingameGUI.resetPlayersOverlayFooterHeader(); + this.setServerData((ServerData)null); + this.integratedServerIsRunning = false; + } + + this.mcSoundHandler.stopSounds(); + this.theWorld = worldClientIn; + + if (this.renderGlobal != null) + { + this.renderGlobal.setWorldAndLoadRenderers(worldClientIn); + } + + if (this.effectRenderer != null) + { + this.effectRenderer.clearEffects(worldClientIn); + } + + TileEntityRendererDispatcher.instance.setWorld(worldClientIn); + + if (worldClientIn != null) + { + if (!this.integratedServerIsRunning) + { + AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString()); + MinecraftSessionService minecraftsessionservice = authenticationservice.createMinecraftSessionService(); + GameProfileRepository gameprofilerepository = authenticationservice.createProfileRepository(); + PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(this.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName())); + TileEntitySkull.setProfileCache(playerprofilecache); + TileEntitySkull.setSessionService(minecraftsessionservice); + PlayerProfileCache.setOnlineMode(false); + } + + if (this.thePlayer == null) + { + this.thePlayer = this.playerController.createClientPlayer(worldClientIn, new StatisticsManager()); + this.playerController.flipPlayer(this.thePlayer); + } + + this.thePlayer.preparePlayerToSpawn(); + worldClientIn.spawnEntityInWorld(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.playerController.setPlayerCapabilities(this.thePlayer); + this.renderViewEntity = this.thePlayer; + } + else + { + this.saveLoader.flushCache(); + this.thePlayer = null; + } + + System.gc(); + this.systemTime = 0L; + } + + public void setDimensionAndSpawnPlayer(int dimension) + { + this.theWorld.setInitialSpawnLocation(); + this.theWorld.removeAllEntities(); + int i = 0; + String s = null; + + if (this.thePlayer != null) + { + i = this.thePlayer.getEntityId(); + this.theWorld.removeEntity(this.thePlayer); + s = this.thePlayer.getServerBrand(); + } + + this.renderViewEntity = null; + EntityPlayerSP entityplayersp = this.thePlayer; + this.thePlayer = this.playerController.createClientPlayer(this.theWorld, this.thePlayer == null ? new StatisticsManager() : this.thePlayer.getStatFileWriter()); + this.thePlayer.getDataManager().setEntryValues(entityplayersp.getDataManager().getAll()); + this.thePlayer.dimension = dimension; + this.renderViewEntity = this.thePlayer; + this.thePlayer.preparePlayerToSpawn(); + this.thePlayer.setServerBrand(s); + this.theWorld.spawnEntityInWorld(this.thePlayer); + this.playerController.flipPlayer(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.thePlayer.setEntityId(i); + this.playerController.setPlayerCapabilities(this.thePlayer); + this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug()); + + if (this.currentScreen instanceof GuiGameOver) + { + this.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Gets whether this is a demo or not. + */ + public final boolean isDemo() + { + return this.isDemo; + } + + @Nullable + public NetHandlerPlayClient getConnection() + { + return this.thePlayer == null ? null : this.thePlayer.connection; + } + + public static boolean isGuiEnabled() + { + return theMinecraft == null || !theMinecraft.gameSettings.hideGUI; + } + + public static boolean isFancyGraphicsEnabled() + { + return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics; + } + + /** + * Returns if ambient occlusion is enabled + */ + public static boolean isAmbientOcclusionEnabled() + { + return theMinecraft != null && theMinecraft.gameSettings.ambientOcclusion != 0; + } + + /** + * Called when user clicked he's mouse middle button (pick block) + */ + private void middleClickMouse() + { + if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; + TileEntity tileentity = null; + ItemStack itemstack; + + if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) + { + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + IBlockState iblockstate = this.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (iblockstate.getMaterial() == Material.AIR) + { + return; + } + + itemstack = block.getItem(this.theWorld, blockpos, iblockstate); + + if (itemstack == null) + { + return; + } + + if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity()) + { + tileentity = this.theWorld.getTileEntity(blockpos); + } + } + else + { + if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag) + { + return; + } + + if (this.objectMouseOver.entityHit instanceof EntityPainting) + { + itemstack = new ItemStack(Items.PAINTING); + } + else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) + { + itemstack = new ItemStack(Items.LEAD); + } + else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) + { + EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; + ItemStack itemstack1 = entityitemframe.getDisplayedItem(); + + if (itemstack1 == null) + { + itemstack = new ItemStack(Items.ITEM_FRAME); + } + else + { + itemstack = ItemStack.copyItemStack(itemstack1); + } + } + else if (this.objectMouseOver.entityHit instanceof EntityMinecart) + { + EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; + Item item; + + switch (entityminecart.getType()) + { + case FURNACE: + item = Items.FURNACE_MINECART; + break; + + case CHEST: + item = Items.CHEST_MINECART; + break; + + case TNT: + item = Items.TNT_MINECART; + break; + + case HOPPER: + item = Items.HOPPER_MINECART; + break; + + case COMMAND_BLOCK: + item = Items.COMMAND_BLOCK_MINECART; + break; + + default: + item = Items.MINECART; + } + + itemstack = new ItemStack(item); + } + else if (this.objectMouseOver.entityHit instanceof EntityBoat) + { + itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).getItemBoat()); + } + else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) + { + itemstack = new ItemStack(Items.ARMOR_STAND); + } + else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal) + { + itemstack = new ItemStack(Items.END_CRYSTAL); + } + else + { + String s = EntityList.getEntityString(this.objectMouseOver.entityHit); + + if (!EntityList.ENTITY_EGGS.containsKey(s)) + { + return; + } + + itemstack = new ItemStack(Items.SPAWN_EGG); + ItemMonsterPlacer.applyEntityIdToItemStack(itemstack, s); + } + } + + if (itemstack.getItem() == null) + { + String s1 = ""; + + if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) + { + s1 = ((ResourceLocation)Block.REGISTRY.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString(); + } + else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY) + { + s1 = EntityList.getEntityString(this.objectMouseOver.entityHit); + } + + LOGGER.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s1}); + } + else + { + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + + if (tileentity != null) + { + this.storeTEInStack(itemstack, tileentity); + } + + int i = inventoryplayer.getSlotFor(itemstack); + + if (flag) + { + inventoryplayer.setPickedItemStack(itemstack); + this.playerController.sendSlotPacket(this.thePlayer.getHeldItem(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem); + } + else if (i != -1) + { + if (InventoryPlayer.isHotbar(i)) + { + inventoryplayer.currentItem = i; + } + else + { + this.playerController.pickItem(i); + } + } + } + } + } + + private ItemStack storeTEInStack(ItemStack stack, TileEntity te) + { + NBTTagCompound nbttagcompound = te.func_189515_b(new NBTTagCompound()); + + if (stack.getItem() == Items.SKULL && nbttagcompound.hasKey("Owner")) + { + NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("Owner"); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + nbttagcompound3.setTag("SkullOwner", nbttagcompound2); + stack.setTagCompound(nbttagcompound3); + return stack; + } + else + { + stack.setTagInfo("BlockEntityTag", nbttagcompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + nbttaglist.appendTag(new NBTTagString("(+NBT)")); + nbttagcompound1.setTag("Lore", nbttaglist); + stack.setTagInfo("display", nbttagcompound1); + return stack; + } + } + + /** + * adds core server Info (GL version , Texture pack, isModded, type), and the worldInfo to the crash report + */ + public CrashReport addGraphicsAndWorldToCrashReport(CrashReport theCrash) + { + theCrash.getCategory().func_189529_a("Launched Version", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.launchedVersion; + } + }); + theCrash.getCategory().func_189529_a("LWJGL", new ICrashReportDetail() + { + public String call() + { + return Sys.getVersion(); + } + }); + theCrash.getCategory().func_189529_a("OpenGL", new ICrashReportDetail() + { + public String call() + { + return GlStateManager.glGetString(7937) + " GL version " + GlStateManager.glGetString(7938) + ", " + GlStateManager.glGetString(7936); + } + }); + theCrash.getCategory().func_189529_a("GL Caps", new ICrashReportDetail() + { + public String call() + { + return OpenGlHelper.getLogText(); + } + }); + theCrash.getCategory().func_189529_a("Using VBOs", new ICrashReportDetail() + { + public String call() + { + return Minecraft.this.gameSettings.useVbo ? "Yes" : "No"; + } + }); + theCrash.getCategory().func_189529_a("Is Modded", new ICrashReportDetail() + { + public String call() throws Exception + { + String s = ClientBrandRetriever.getClientModName(); + return !"vanilla".equals(s) ? "Definitely; Client brand changed to \'" + s + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and client brand is untouched."); + } + }); + theCrash.getCategory().func_189529_a("Type", new ICrashReportDetail() + { + public String call() throws Exception + { + return "Client (map_client.txt)"; + } + }); + theCrash.getCategory().func_189529_a("Resource Packs", new ICrashReportDetail() + { + public String call() throws Exception + { + StringBuilder stringbuilder = new StringBuilder(); + + for (String s : Minecraft.this.gameSettings.resourcePacks) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append(", "); + } + + stringbuilder.append(s); + + if (Minecraft.this.gameSettings.incompatibleResourcePacks.contains(s)) + { + stringbuilder.append(" (incompatible)"); + } + } + + return stringbuilder.toString(); + } + }); + theCrash.getCategory().func_189529_a("Current Language", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.mcLanguageManager.getCurrentLanguage().toString(); + } + }); + theCrash.getCategory().func_189529_a("Profiler Position", new ICrashReportDetail() + { + public String call() throws Exception + { + return Minecraft.this.mcProfiler.profilingEnabled ? Minecraft.this.mcProfiler.getNameOfLastSection() : "N/A (disabled)"; + } + }); + theCrash.getCategory().func_189529_a("CPU", new ICrashReportDetail() + { + public String call() + { + return OpenGlHelper.getCpu(); + } + }); + + if (this.theWorld != null) + { + this.theWorld.addWorldInfoToCrashReport(theCrash); + } + + return theCrash; + } + + /** + * Return the singleton Minecraft instance for the game + */ + public static Minecraft getMinecraft() + { + return theMinecraft; + } + + public ListenableFuture scheduleResourcesRefresh() + { + return this.addScheduledTask(new Runnable() + { + public void run() + { + Minecraft.this.refreshResources(); + } + }); + } + + public void addServerStatsToSnooper(Snooper playerSnooper) + { + playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS)); + playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync)); + playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency())); + playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed"); + playerSnooper.addClientStat("run_time", Long.valueOf((MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L)); + playerSnooper.addClientStat("current_action", this.getCurrentAction()); + playerSnooper.addClientStat("language", this.gameSettings.language == null ? "en_US" : this.gameSettings.language); + String s = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big"; + playerSnooper.addClientStat("endianness", s); + playerSnooper.addClientStat("subtitles", Boolean.valueOf(this.gameSettings.showSubtitles)); + playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size())); + int i = 0; + + for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries()) + { + playerSnooper.addClientStat("resource_pack[" + i++ + "]", resourcepackrepository$entry.getResourcePackName()); + } + + if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null) + { + playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID()); + } + } + + /** + * Return the current action's name + */ + private String getCurrentAction() + { + return this.theIntegratedServer != null ? (this.theIntegratedServer.getPublic() ? "hosting_lan" : "singleplayer") : (this.currentServerData != null ? (this.currentServerData.isOnLAN() ? "playing_lan" : "multiplayer") : "out_of_game"); + } + + public void addServerTypeToSnooper(Snooper playerSnooper) + { + playerSnooper.addStatToSnooper("opengl_version", GlStateManager.glGetString(7938)); + playerSnooper.addStatToSnooper("opengl_vendor", GlStateManager.glGetString(7936)); + playerSnooper.addStatToSnooper("client_brand", ClientBrandRetriever.getClientModName()); + playerSnooper.addStatToSnooper("launched_version", this.launchedVersion); + ContextCapabilities contextcapabilities = GLContext.getCapabilities(); + playerSnooper.addStatToSnooper("gl_caps[ARB_arrays_of_arrays]", Boolean.valueOf(contextcapabilities.GL_ARB_arrays_of_arrays)); + playerSnooper.addStatToSnooper("gl_caps[ARB_base_instance]", Boolean.valueOf(contextcapabilities.GL_ARB_base_instance)); + playerSnooper.addStatToSnooper("gl_caps[ARB_blend_func_extended]", Boolean.valueOf(contextcapabilities.GL_ARB_blend_func_extended)); + playerSnooper.addStatToSnooper("gl_caps[ARB_clear_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_clear_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_color_buffer_float]", Boolean.valueOf(contextcapabilities.GL_ARB_color_buffer_float)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compatibility]", Boolean.valueOf(contextcapabilities.GL_ARB_compatibility)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compressed_texture_pixel_storage]", Boolean.valueOf(contextcapabilities.GL_ARB_compressed_texture_pixel_storage)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_compute_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_buffer)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_image)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_buffer_float)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_compute_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_buffer)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_image)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_buffer_float)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_clamp]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_clamp)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_texture]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_texture)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_buffers)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers_blend]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_buffers_blend)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_elements_base_vertex]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_elements_base_vertex)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_indirect]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_indirect)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_instanced]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_instanced)); + playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_attrib_location]", Boolean.valueOf(contextcapabilities.GL_ARB_explicit_attrib_location)); + playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_uniform_location]", Boolean.valueOf(contextcapabilities.GL_ARB_explicit_uniform_location)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_layer_viewport]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_layer_viewport)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_program)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program_shadow]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_program_shadow)); + playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_framebuffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_sRGB]", Boolean.valueOf(contextcapabilities.GL_ARB_framebuffer_sRGB)); + playerSnooper.addStatToSnooper("gl_caps[ARB_geometry_shader4]", Boolean.valueOf(contextcapabilities.GL_ARB_geometry_shader4)); + playerSnooper.addStatToSnooper("gl_caps[ARB_gpu_shader5]", Boolean.valueOf(contextcapabilities.GL_ARB_gpu_shader5)); + playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_pixel]", Boolean.valueOf(contextcapabilities.GL_ARB_half_float_pixel)); + playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_vertex]", Boolean.valueOf(contextcapabilities.GL_ARB_half_float_vertex)); + playerSnooper.addStatToSnooper("gl_caps[ARB_instanced_arrays]", Boolean.valueOf(contextcapabilities.GL_ARB_instanced_arrays)); + playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_alignment]", Boolean.valueOf(contextcapabilities.GL_ARB_map_buffer_alignment)); + playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_range]", Boolean.valueOf(contextcapabilities.GL_ARB_map_buffer_range)); + playerSnooper.addStatToSnooper("gl_caps[ARB_multisample]", Boolean.valueOf(contextcapabilities.GL_ARB_multisample)); + playerSnooper.addStatToSnooper("gl_caps[ARB_multitexture]", Boolean.valueOf(contextcapabilities.GL_ARB_multitexture)); + playerSnooper.addStatToSnooper("gl_caps[ARB_occlusion_query2]", Boolean.valueOf(contextcapabilities.GL_ARB_occlusion_query2)); + playerSnooper.addStatToSnooper("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_pixel_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_seamless_cube_map]", Boolean.valueOf(contextcapabilities.GL_ARB_seamless_cube_map)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shader_objects]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_objects)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shader_stencil_export]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_stencil_export)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shader_texture_lod]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_texture_lod)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shadow]", Boolean.valueOf(contextcapabilities.GL_ARB_shadow)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shadow_ambient]", Boolean.valueOf(contextcapabilities.GL_ARB_shadow_ambient)); + playerSnooper.addStatToSnooper("gl_caps[ARB_stencil_texturing]", Boolean.valueOf(contextcapabilities.GL_ARB_stencil_texturing)); + playerSnooper.addStatToSnooper("gl_caps[ARB_sync]", Boolean.valueOf(contextcapabilities.GL_ARB_sync)); + playerSnooper.addStatToSnooper("gl_caps[ARB_tessellation_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_tessellation_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_border_clamp]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_border_clamp)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_cube_map)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map_array]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_cube_map_array)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_non_power_of_two)); + playerSnooper.addStatToSnooper("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_uniform_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_blend]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_blend)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_program]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_program)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_shader)); + playerSnooper.addStatToSnooper("gl_caps[EXT_bindable_uniform]", Boolean.valueOf(contextcapabilities.GL_EXT_bindable_uniform)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_equation_separate]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_equation_separate)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_func_separate]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_func_separate)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_minmax]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_minmax)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_subtract]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_subtract)); + playerSnooper.addStatToSnooper("gl_caps[EXT_draw_instanced]", Boolean.valueOf(contextcapabilities.GL_EXT_draw_instanced)); + playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_multisample]", Boolean.valueOf(contextcapabilities.GL_EXT_framebuffer_multisample)); + playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_object]", Boolean.valueOf(contextcapabilities.GL_EXT_framebuffer_object)); + playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_sRGB]", Boolean.valueOf(contextcapabilities.GL_EXT_framebuffer_sRGB)); + playerSnooper.addStatToSnooper("gl_caps[EXT_geometry_shader4]", Boolean.valueOf(contextcapabilities.GL_EXT_geometry_shader4)); + playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_program_parameters]", Boolean.valueOf(contextcapabilities.GL_EXT_gpu_program_parameters)); + playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_shader4]", Boolean.valueOf(contextcapabilities.GL_EXT_gpu_shader4)); + playerSnooper.addStatToSnooper("gl_caps[EXT_multi_draw_arrays]", Boolean.valueOf(contextcapabilities.GL_EXT_multi_draw_arrays)); + playerSnooper.addStatToSnooper("gl_caps[EXT_packed_depth_stencil]", Boolean.valueOf(contextcapabilities.GL_EXT_packed_depth_stencil)); + playerSnooper.addStatToSnooper("gl_caps[EXT_paletted_texture]", Boolean.valueOf(contextcapabilities.GL_EXT_paletted_texture)); + playerSnooper.addStatToSnooper("gl_caps[EXT_rescale_normal]", Boolean.valueOf(contextcapabilities.GL_EXT_rescale_normal)); + playerSnooper.addStatToSnooper("gl_caps[EXT_separate_shader_objects]", Boolean.valueOf(contextcapabilities.GL_EXT_separate_shader_objects)); + playerSnooper.addStatToSnooper("gl_caps[EXT_shader_image_load_store]", Boolean.valueOf(contextcapabilities.GL_EXT_shader_image_load_store)); + playerSnooper.addStatToSnooper("gl_caps[EXT_shadow_funcs]", Boolean.valueOf(contextcapabilities.GL_EXT_shadow_funcs)); + playerSnooper.addStatToSnooper("gl_caps[EXT_shared_texture_palette]", Boolean.valueOf(contextcapabilities.GL_EXT_shared_texture_palette)); + playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_clear_tag]", Boolean.valueOf(contextcapabilities.GL_EXT_stencil_clear_tag)); + playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_two_side]", Boolean.valueOf(contextcapabilities.GL_EXT_stencil_two_side)); + playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_wrap]", Boolean.valueOf(contextcapabilities.GL_EXT_stencil_wrap)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_3d]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_3d)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_array]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_array)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_buffer_object]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_integer]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_integer)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_lod_bias]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_lod_bias)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_sRGB]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_sRGB)); + playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_shader]", Boolean.valueOf(contextcapabilities.GL_EXT_vertex_shader)); + playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_weighting]", Boolean.valueOf(contextcapabilities.GL_EXT_vertex_weighting)); + playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GlStateManager.glGetInteger(35658))); + GlStateManager.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GlStateManager.glGetInteger(35657))); + GlStateManager.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_attribs]", Integer.valueOf(GlStateManager.glGetInteger(34921))); + GlStateManager.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_texture_image_units]", Integer.valueOf(GlStateManager.glGetInteger(35660))); + GlStateManager.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GlStateManager.glGetInteger(34930))); + GlStateManager.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_array_texture_layers]", Integer.valueOf(GlStateManager.glGetInteger(35071))); + GlStateManager.glGetError(); + playerSnooper.addStatToSnooper("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); + GameProfile gameprofile = this.session.getProfile(); + + if (gameprofile != null && gameprofile.getId() != null) + { + playerSnooper.addStatToSnooper("uuid", Hashing.sha1().hashBytes(gameprofile.getId().toString().getBytes(Charsets.ISO_8859_1)).toString()); + } + } + + /** + * Used in the usage snooper. + */ + public static int getGLMaximumTextureSize() + { + for (int i = 16384; i > 0; i >>= 1) + { + GlStateManager.glTexImage2D(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); + int j = GlStateManager.glGetTexLevelParameteri(32868, 0, 4096); + + if (j != 0) + { + return i; + } + } + + return -1; + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return this.gameSettings.snooperEnabled; + } + + /** + * Set the current ServerData instance. + */ + public void setServerData(ServerData serverDataIn) + { + this.currentServerData = serverDataIn; + } + + @Nullable + public ServerData getCurrentServerData() + { + return this.currentServerData; + } + + public boolean isIntegratedServerRunning() + { + return this.integratedServerIsRunning; + } + + /** + * Returns true if there is only one player playing, and the current server is the integrated one. + */ + public boolean isSingleplayer() + { + return this.integratedServerIsRunning && this.theIntegratedServer != null; + } + + @Nullable + + /** + * Returns the currently running integrated server + */ + public IntegratedServer getIntegratedServer() + { + return this.theIntegratedServer; + } + + public static void stopIntegratedServer() + { + if (theMinecraft != null) + { + IntegratedServer integratedserver = theMinecraft.getIntegratedServer(); + + if (integratedserver != null) + { + integratedserver.stopServer(); + } + } + } + + /** + * Returns the PlayerUsageSnooper instance. + */ + public Snooper getPlayerUsageSnooper() + { + return this.usageSnooper; + } + + /** + * Gets the system time in milliseconds. + */ + public static long getSystemTime() + { + return Sys.getTime() * 1000L / Sys.getTimerResolution(); + } + + /** + * Returns whether we're in full screen or not. + */ + public boolean isFullScreen() + { + return this.fullscreen; + } + + public Session getSession() + { + return this.session; + } + + /** + * Return the player's GameProfile properties + */ + public PropertyMap getProfileProperties() + { + if (this.profileProperties.isEmpty()) + { + GameProfile gameprofile = this.getSessionService().fillProfileProperties(this.session.getProfile(), false); + this.profileProperties.putAll(gameprofile.getProperties()); + } + + return this.profileProperties; + } + + public Proxy getProxy() + { + return this.proxy; + } + + public TextureManager getTextureManager() + { + return this.renderEngine; + } + + public IResourceManager getResourceManager() + { + return this.mcResourceManager; + } + + public ResourcePackRepository getResourcePackRepository() + { + return this.mcResourcePackRepository; + } + + public LanguageManager getLanguageManager() + { + return this.mcLanguageManager; + } + + public TextureMap getTextureMapBlocks() + { + return this.textureMapBlocks; + } + + public boolean isJava64bit() + { + return this.jvm64bit; + } + + public boolean isGamePaused() + { + return this.isGamePaused; + } + + public SoundHandler getSoundHandler() + { + return this.mcSoundHandler; + } + + public MusicTicker.MusicType getAmbientMusicType() + { + return this.thePlayer != null ? (this.thePlayer.worldObj.provider instanceof WorldProviderHell ? MusicTicker.MusicType.NETHER : (this.thePlayer.worldObj.provider instanceof WorldProviderEnd ? (this.ingameGUI.getBossOverlay().shouldPlayEndBossMusic() ? MusicTicker.MusicType.END_BOSS : MusicTicker.MusicType.END) : (this.thePlayer.capabilities.isCreativeMode && this.thePlayer.capabilities.allowFlying ? MusicTicker.MusicType.CREATIVE : MusicTicker.MusicType.GAME))) : MusicTicker.MusicType.MENU; + } + + public void dispatchKeypresses() + { + int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); + + if (i != 0 && !Keyboard.isRepeatEvent()) + { + if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L) + { + if (Keyboard.getEventKeyState()) + { + if (i == this.gameSettings.keyBindFullscreen.getKeyCode()) + { + this.toggleFullscreen(); + } + else if (i == this.gameSettings.keyBindScreenshot.getKeyCode()) + { + this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc)); + } + } + } + } + } + + public MinecraftSessionService getSessionService() + { + return this.sessionService; + } + + public SkinManager getSkinManager() + { + return this.skinManager; + } + + @Nullable + public Entity getRenderViewEntity() + { + return this.renderViewEntity; + } + + public void setRenderViewEntity(Entity viewingEntity) + { + this.renderViewEntity = viewingEntity; + this.entityRenderer.loadEntityShader(viewingEntity); + } + + public ListenableFuture addScheduledTask(Callable callableToSchedule) + { + Validate.notNull(callableToSchedule); + + if (this.isCallingFromMinecraftThread()) + { + try + { + return Futures.immediateFuture(callableToSchedule.call()); + } + catch (Exception exception) + { + return Futures.immediateFailedCheckedFuture(exception); + } + } + else + { + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callableToSchedule); + + synchronized (this.scheduledTasks) + { + this.scheduledTasks.add(listenablefuturetask); + return listenablefuturetask; + } + } + } + + public ListenableFuture addScheduledTask(Runnable runnableToSchedule) + { + Validate.notNull(runnableToSchedule); + return this.addScheduledTask(Executors.callable(runnableToSchedule)); + } + + public boolean isCallingFromMinecraftThread() + { + return Thread.currentThread() == this.mcThread; + } + + public BlockRendererDispatcher getBlockRendererDispatcher() + { + return this.blockRenderDispatcher; + } + + public RenderManager getRenderManager() + { + return this.renderManager; + } + + public RenderItem getRenderItem() + { + return this.renderItem; + } + + public ItemRenderer getItemRenderer() + { + return this.itemRenderer; + } + + public static int getDebugFPS() + { + return debugFPS; + } + + /** + * Return the FrameTimer's instance + */ + public FrameTimer getFrameTimer() + { + return this.frameTimer; + } + + /** + * Return true if the player is connected to a realms server + */ + public boolean isConnectedToRealms() + { + return this.connectedToRealms; + } + + /** + * Set if the player is connected to a realms server + */ + public void setConnectedToRealms(boolean isConnected) + { + this.connectedToRealms = isConnected; + } + + public DataFixer getDataFixer() + { + return this.dataFixer; + } + + public float getRenderPartialTicks() + { + return this.timer.renderPartialTicks; + } + + public BlockColors getBlockColors() + { + return this.blockColors; + } + + public boolean func_189648_am() + { + return this.thePlayer != null && this.thePlayer.hasReducedDebug() || this.gameSettings.reducedDebugInfo; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiChat.java b/src/minecraft/net/minecraft/client/gui/GuiChat.java new file mode 100644 index 0000000..79bbd26 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiChat.java @@ -0,0 +1,320 @@ +package net.minecraft.client.gui; + +import java.io.IOException; + +import javax.annotation.Nullable; + +import net.minecraft.client.Minecraft; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ITabCompleter; +import net.minecraft.util.TabCompleter; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import cubimod.Cubitick; + +public class GuiChat extends GuiScreen implements ITabCompleter +{ + private static final Logger LOGGER = LogManager.getLogger(); + private String historyBuffer = ""; + + /** + * keeps position of which chat message you will select when you press up, (does not increase for duplicated + * messages sent immediately after each other) + */ + private int sentHistoryCursor = -1; + private TabCompleter tabCompleter; + + /** Chat entry field */ + protected GuiTextField inputField; + + /** + * is the text that appears when you press the chat key and the input box appears pre-filled + */ + private String defaultInputFieldText = ""; + + public GuiChat() + { + } + + public GuiChat(String defaultText) + { + this.defaultInputFieldText = defaultText; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); + this.inputField = new GuiTextField(0, this.fontRendererObj, 4, this.height - 12, this.width - 4, 12); + this.inputField.setMaxStringLength(100); + this.inputField.setEnableBackgroundDrawing(false); + this.inputField.setFocused(true); + this.inputField.setText(this.defaultInputFieldText); + this.inputField.setCanLoseFocus(false); + this.tabCompleter = new GuiChat.ChatTabCompleter(this.inputField); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + this.mc.ingameGUI.getChatGUI().resetScroll(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.inputField.updateCursorCounter(); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + this.tabCompleter.resetRequested(); + + if (keyCode == 15) + { + this.tabCompleter.complete(); + } + else + { + this.tabCompleter.resetDidComplete(); + } + + if (keyCode == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (keyCode != 28 && keyCode != 156) + { + if (keyCode == 200) + { + this.getSentHistory(-1); + } + else if (keyCode == 208) + { + this.getSentHistory(1); + } + else if (keyCode == 201) + { + this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().getLineCount() - 1); + } + else if (keyCode == 209) + { + this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().getLineCount() + 1); + } + else + { + this.inputField.textboxKeyTyped(typedChar, keyCode); + } + } + else + { + String s = this.inputField.getText().trim(); + + if (!s.isEmpty()) + { + this.sendChatMessage(s); + + // Cubitick: interrupt the server's sleep so it can process the chat + if(!Cubitick.synctick) + { + MinecraftServer.interruptTickSleep(); + } + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + int i = Mouse.getEventDWheel(); + + if (i != 0) + { + if (i > 1) + { + i = 1; + } + + if (i < -1) + { + i = -1; + } + + if (!isShiftKeyDown()) + { + i *= 7; + } + + this.mc.ingameGUI.getChatGUI().scroll(i); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + if (mouseButton == 0) + { + ITextComponent itextcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); + + if (itextcomponent != null && this.handleComponentClick(itextcomponent)) + { + return; + } + } + + this.inputField.mouseClicked(mouseX, mouseY, mouseButton); + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Sets the text of the chat + */ + protected void setText(String newChatText, boolean shouldOverwrite) + { + if (shouldOverwrite) + { + this.inputField.setText(newChatText); + } + else + { + this.inputField.writeText(newChatText); + } + } + + /** + * input is relative and is applied directly to the sentHistoryCursor so -1 is the previous message, 1 is the next + * message from the current cursor position + */ + public void getSentHistory(int msgPos) + { + int i = this.sentHistoryCursor + msgPos; + int j = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); + i = MathHelper.clamp_int(i, 0, j); + + if (i != this.sentHistoryCursor) + { + if (i == j) + { + this.sentHistoryCursor = j; + this.inputField.setText(this.historyBuffer); + } + else + { + if (this.sentHistoryCursor == j) + { + this.historyBuffer = this.inputField.getText(); + } + + this.inputField.setText((String)this.mc.ingameGUI.getChatGUI().getSentMessages().get(i)); + this.sentHistoryCursor = i; + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE); + this.inputField.drawTextBox(); + ITextComponent itextcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); + + if (itextcomponent != null && itextcomponent.getStyle().getHoverEvent() != null) + { + this.handleComponentHover(itextcomponent, mouseX, mouseY); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } + + /** + * Sets the list of tab completions, as long as they were previously requested. + */ + public void setCompletions(String... newCompletions) + { + this.tabCompleter.setCompletions(newCompletions); + } + + public static class ChatTabCompleter extends TabCompleter + { + private final Minecraft clientInstance = Minecraft.getMinecraft(); + + public ChatTabCompleter(GuiTextField p_i46749_1_) + { + super(p_i46749_1_, false); + } + + public void complete() + { + super.complete(); + + if (this.completions.size() > 1) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (String s : this.completions) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append(", "); + } + + stringbuilder.append(s); + } + + this.clientInstance.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new TextComponentString(stringbuilder.toString()), 1); + } + } + + @Nullable + public BlockPos getTargetBlockPos() + { + BlockPos blockpos = null; + + if (this.clientInstance.objectMouseOver != null && this.clientInstance.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) + { + blockpos = this.clientInstance.objectMouseOver.getBlockPos(); + } + + return blockpos; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java b/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java new file mode 100644 index 0000000..d158ae3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java @@ -0,0 +1,304 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Strings; +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.FrameTimer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.Chunk; +import org.lwjgl.opengl.Display; + +public class GuiOverlayDebug extends Gui +{ + private final Minecraft mc; + private final FontRenderer fontRenderer; + + public GuiOverlayDebug(Minecraft mc) + { + this.mc = mc; + this.fontRenderer = mc.fontRendererObj; + } + + public void renderDebugInfo(ScaledResolution scaledResolutionIn) + { + this.mc.mcProfiler.startSection("debug"); + GlStateManager.pushMatrix(); + this.renderDebugInfoLeft(); + this.renderDebugInfoRight(scaledResolutionIn); + GlStateManager.popMatrix(); + + if (this.mc.gameSettings.showLagometer) + { + this.renderLagometer(); + } + + this.mc.mcProfiler.endSection(); + } + + protected void renderDebugInfoLeft() + { + List list = this.call(); + list.add(""); + list.add("Debug: Pie [shift]: " + (this.mc.gameSettings.showDebugProfilerChart ? "visible" : "hidden") + " FPS [alt]: " + (this.mc.gameSettings.showLagometer ? "visible" : "hidden")); + list.add("For help: press F3 + Q"); + + for (int i = 0; i < list.size(); ++i) + { + String s = (String)list.get(i); + + if (!Strings.isNullOrEmpty(s)) + { + int j = this.fontRenderer.FONT_HEIGHT; + int k = this.fontRenderer.getStringWidth(s); + int l = 2; + int i1 = 2 + j * i; + drawRect(1, i1 - 1, 2 + k + 1, i1 + j - 1, -1873784752); + this.fontRenderer.drawString(s, 2, i1, 14737632); + } + } + } + + protected void renderDebugInfoRight(ScaledResolution scaledRes) + { + List list = this.getDebugInfoRight(); + + for (int i = 0; i < list.size(); ++i) + { + String s = (String)list.get(i); + + if (!Strings.isNullOrEmpty(s)) + { + int j = this.fontRenderer.FONT_HEIGHT; + int k = this.fontRenderer.getStringWidth(s); + int l = scaledRes.getScaledWidth() - 2 - k; + int i1 = 2 + j * i; + drawRect(l - 1, i1 - 1, l + k + 1, i1 + j - 1, -1873784752); + this.fontRenderer.drawString(s, l, i1, 14737632); + } + } + } + + @SuppressWarnings("incomplete-switch") + protected List call() + { + BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); + + if (this.mc.func_189648_am()) + { + return Lists.newArrayList(new String[] {"Minecraft 1.10 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + EnumFacing enumfacing = entity.getHorizontalFacing(); + String s = "Invalid"; + + switch (enumfacing) + { + case NORTH: + s = "Towards negative Z"; + break; + + case SOUTH: + s = "Towards positive Z"; + break; + + case WEST: + s = "Towards negative X"; + break; + + case EAST: + s = "Towards positive X"; + } + + List list = Lists.newArrayList(new String[] {"Minecraft 1.10 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ("release".equalsIgnoreCase(this.mc.getVersionType()) ? "" : "/" + this.mc.getVersionType()) + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("XYZ: %.3f / %.5f / %.3f", new Object[]{Double.valueOf(this.mc.getRenderViewEntity().posX), Double.valueOf(this.mc.getRenderViewEntity().getEntityBoundingBox().minY), Double.valueOf(this.mc.getRenderViewEntity().posZ)}), String.format("Block: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}), String.format("Chunk: %d %d %d in %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15), Integer.valueOf(blockpos.getX() >> 4), Integer.valueOf(blockpos.getY() >> 4), Integer.valueOf(blockpos.getZ() >> 4)}), String.format("Facing: %s (%s) (%.1f / %.1f)", new Object[]{enumfacing, s, Float.valueOf(MathHelper.wrapDegrees(entity.rotationYaw)), Float.valueOf(MathHelper.wrapDegrees(entity.rotationPitch))})}); + + if (this.mc.theWorld != null) + { + Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(blockpos); + + if (this.mc.theWorld.isBlockLoaded(blockpos) && blockpos.getY() >= 0 && blockpos.getY() < 256) + { + if (!chunk.isEmpty()) + { + list.add("Biome: " + chunk.getBiome(blockpos, this.mc.theWorld.getBiomeProvider()).getBiomeName()); + list.add("Light: " + chunk.getLightSubtracted(blockpos, 0) + " (" + chunk.getLightFor(EnumSkyBlock.SKY, blockpos) + " sky, " + chunk.getLightFor(EnumSkyBlock.BLOCK, blockpos) + " block)"); + DifficultyInstance difficultyinstance = this.mc.theWorld.getDifficultyForLocation(blockpos); + + if (this.mc.isIntegratedServerRunning() && this.mc.getIntegratedServer() != null) + { + EntityPlayerMP entityplayermp = this.mc.getIntegratedServer().getPlayerList().getPlayerByUUID(this.mc.thePlayer.getUniqueID()); + + if (entityplayermp != null) + { + difficultyinstance = entityplayermp.worldObj.getDifficultyForLocation(new BlockPos(entityplayermp)); + } + } + + list.add(String.format("Local Difficulty: %.2f // %.2f (Day %d)", new Object[] {Float.valueOf(difficultyinstance.getAdditionalDifficulty()), Float.valueOf(difficultyinstance.getClampedAdditionalDifficulty()), Long.valueOf(this.mc.theWorld.getWorldTime() / 24000L)})); + } + else + { + list.add("Waiting for chunk..."); + } + } + else + { + list.add("Outside of world..."); + } + } + + if (this.mc.entityRenderer != null && this.mc.entityRenderer.isShaderActive()) + { + list.add("Shader: " + this.mc.entityRenderer.getShaderGroup().getShaderGroupName()); + } + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && this.mc.objectMouseOver.getBlockPos() != null) + { + BlockPos blockpos1 = this.mc.objectMouseOver.getBlockPos(); + list.add(String.format("Looking at: %d %d %d", new Object[] {Integer.valueOf(blockpos1.getX()), Integer.valueOf(blockpos1.getY()), Integer.valueOf(blockpos1.getZ())})); + } + + return list; + } + } + + protected > List getDebugInfoRight() + { + long i = Runtime.getRuntime().maxMemory(); + long j = Runtime.getRuntime().totalMemory(); + long k = Runtime.getRuntime().freeMemory(); + long l = j - k; + List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.glGetString(7936)}), GlStateManager.glGetString(7937), GlStateManager.glGetString(7938)}); + + // Cubitick : add some tick info + list.add(""); + list.add("Server tick : " + (mc.isIntegratedServerRunning() ? mc.getIntegratedServer().getTickCounter() : "Unreachable")); + list.add("Client tick : " + mc.tickcounter); + + + if (this.mc.func_189648_am()) + { + return list; + } + else + { + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && this.mc.objectMouseOver.getBlockPos() != null) + { + BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + + if (this.mc.theWorld.getWorldType() != WorldType.DEBUG_WORLD) + { + iblockstate = iblockstate.getActualState(this.mc.theWorld, blockpos); + } + + list.add(""); + list.add(String.valueOf(Block.REGISTRY.getNameForObject(iblockstate.getBlock()))); + + for (Entry < IProperty, Comparable> entry : iblockstate.getProperties().entrySet()) + { + IProperty iproperty = (IProperty)entry.getKey(); + T t = (T)entry.getValue(); + String s = iproperty.getName(t); + + if (Boolean.TRUE.equals(t)) + { + s = TextFormatting.GREEN + s; + } + else if (Boolean.FALSE.equals(t)) + { + s = TextFormatting.RED + s; + } + + list.add(iproperty.getName() + ": " + s); + } + } + + return list; + } + } + + private void renderLagometer() + { + GlStateManager.disableDepth(); + FrameTimer frametimer = this.mc.getFrameTimer(); + int i = frametimer.getLastIndex(); + int j = frametimer.getIndex(); + long[] along = frametimer.getFrames(); + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int k = i; + int l = 0; + drawRect(0, scaledresolution.getScaledHeight() - 60, 240, scaledresolution.getScaledHeight(), -1873784752); + + while (k != j) + { + int i1 = frametimer.getLagometerValue(along[k], 30); + int j1 = this.getFrameColor(MathHelper.clamp_int(i1, 0, 60), 0, 30, 60); + this.drawVerticalLine(l, scaledresolution.getScaledHeight(), scaledresolution.getScaledHeight() - i1, j1); + ++l; + k = frametimer.parseIndex(k + 1); + } + + drawRect(1, scaledresolution.getScaledHeight() - 30 + 1, 14, scaledresolution.getScaledHeight() - 30 + 10, -1873784752); + this.fontRenderer.drawString("60", 2, scaledresolution.getScaledHeight() - 30 + 2, 14737632); + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 30, -1); + drawRect(1, scaledresolution.getScaledHeight() - 60 + 1, 14, scaledresolution.getScaledHeight() - 60 + 10, -1873784752); + this.fontRenderer.drawString("30", 2, scaledresolution.getScaledHeight() - 60 + 2, 14737632); + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 60, -1); + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 1, -1); + this.drawVerticalLine(0, scaledresolution.getScaledHeight() - 60, scaledresolution.getScaledHeight(), -1); + this.drawVerticalLine(239, scaledresolution.getScaledHeight() - 60, scaledresolution.getScaledHeight(), -1); + + if (this.mc.gameSettings.limitFramerate <= 120) + { + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 60 + this.mc.gameSettings.limitFramerate / 2, -16711681); + } + + GlStateManager.enableDepth(); + } + + private int getFrameColor(int p_181552_1_, int p_181552_2_, int p_181552_3_, int p_181552_4_) + { + return p_181552_1_ < p_181552_3_ ? this.blendColors(-16711936, -256, (float)p_181552_1_ / (float)p_181552_3_) : this.blendColors(-256, -65536, (float)(p_181552_1_ - p_181552_3_) / (float)(p_181552_4_ - p_181552_3_)); + } + + private int blendColors(int p_181553_1_, int p_181553_2_, float p_181553_3_) + { + int i = p_181553_1_ >> 24 & 255; + int j = p_181553_1_ >> 16 & 255; + int k = p_181553_1_ >> 8 & 255; + int l = p_181553_1_ & 255; + int i1 = p_181553_2_ >> 24 & 255; + int j1 = p_181553_2_ >> 16 & 255; + int k1 = p_181553_2_ >> 8 & 255; + int l1 = p_181553_2_ & 255; + int i2 = MathHelper.clamp_int((int)((float)i + (float)(i1 - i) * p_181553_3_), 0, 255); + int j2 = MathHelper.clamp_int((int)((float)j + (float)(j1 - j) * p_181553_3_), 0, 255); + int k2 = MathHelper.clamp_int((int)((float)k + (float)(k1 - k) * p_181553_3_), 0, 255); + int l2 = MathHelper.clamp_int((int)((float)l + (float)(l1 - l) * p_181553_3_), 0, 255); + return i2 << 24 | j2 << 16 | k2 << 8 | l2; + } + + private static long bytesToMb(long bytes) + { + return bytes / 1024L / 1024L; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java b/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java new file mode 100644 index 0000000..c41ce25 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java @@ -0,0 +1,2293 @@ +package net.minecraft.client.renderer; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.gson.JsonSyntaxException; + +import cubimod.Cubitick; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.File; +import java.io.IOException; +import java.nio.FloatBuffer; +import java.util.List; +import java.util.Random; + +import javax.annotation.Nullable; +import javax.imageio.ImageIO; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.MapItemRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.particle.ParticleManager; +import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.shader.ShaderGroup; +import net.minecraft.client.shader.ShaderLinkHelper; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.crash.ICrashReportDetail; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MouseFilter; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.ScreenShotHelper; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.GameType; +import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.Project; + +public class EntityRenderer implements IResourceManagerReloadListener +{ + private static final Logger LOGGER = LogManager.getLogger(); + private static final ResourceLocation RAIN_TEXTURES = new ResourceLocation("textures/environment/rain.png"); + private static final ResourceLocation SNOW_TEXTURES = new ResourceLocation("textures/environment/snow.png"); + public static boolean anaglyphEnable; + + /** Anaglyph field (0=R, 1=GB) */ + public static int anaglyphField; + + /** A reference to the Minecraft object. */ + private final Minecraft mc; + private final IResourceManager resourceManager; + private final Random random = new Random(); + private float farPlaneDistance; + public final ItemRenderer itemRenderer; + private final MapItemRenderer theMapItemRenderer; + + /** Entity renderer update count */ + private int rendererUpdateCount; + + /** Pointed entity */ + private Entity pointedEntity; + private final MouseFilter mouseFilterXAxis = new MouseFilter(); + private final MouseFilter mouseFilterYAxis = new MouseFilter(); + private final float thirdPersonDistance = 4.0F; + + /** Previous third person distance */ + private float thirdPersonDistancePrev = 4.0F; + + /** Smooth cam yaw */ + private float smoothCamYaw; + + /** Smooth cam pitch */ + private float smoothCamPitch; + + /** Smooth cam filter X */ + private float smoothCamFilterX; + + /** Smooth cam filter Y */ + private float smoothCamFilterY; + + /** Smooth cam partial ticks */ + private float smoothCamPartialTicks; + + /** FOV modifier hand */ + private float fovModifierHand; + + /** FOV modifier hand prev */ + private float fovModifierHandPrev; + private float bossColorModifier; + private float bossColorModifierPrev; + + /** Cloud fog mode */ + private boolean cloudFog; + private boolean renderHand = true; + private boolean drawBlockOutline = true; + private long timeWorldIcon; + + /** Previous frame time in milliseconds */ + private long prevFrameTime = Minecraft.getSystemTime(); + + /** End time of last render (ns) */ + private long renderEndNanoTime; + + /** + * The texture id of the blocklight/skylight texture used for lighting effects + */ + private final DynamicTexture lightmapTexture; + + /** + * Colors computed in updateLightmap() and loaded into the lightmap emptyTexture + */ + private final int[] lightmapColors; + private final ResourceLocation locationLightMap; + + /** + * Is set, updateCameraAndRender() calls updateLightmap(); set by updateTorchFlicker() + */ + private boolean lightmapUpdateNeeded; + + /** Torch flicker X */ + private float torchFlickerX; + private float torchFlickerDX; + + /** Rain sound counter */ + private int rainSoundCounter; + private final float[] rainXCoords = new float[1024]; + private final float[] rainYCoords = new float[1024]; + + /** Fog color buffer */ + private final FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16); + private float fogColorRed; + private float fogColorGreen; + private float fogColorBlue; + + /** Fog color 2 */ + private float fogColor2; + + /** Fog color 1 */ + private float fogColor1; + private int debugViewDirection; + private boolean debugView; + private double cameraZoom = 1.0D; + private double cameraYaw; + private double cameraPitch; + private ShaderGroup theShaderGroup; + private static final ResourceLocation[] SHADERS_TEXTURES = new ResourceLocation[] {new ResourceLocation("shaders/post/notch.json"), new ResourceLocation("shaders/post/fxaa.json"), new ResourceLocation("shaders/post/art.json"), new ResourceLocation("shaders/post/bumpy.json"), new ResourceLocation("shaders/post/blobs2.json"), new ResourceLocation("shaders/post/pencil.json"), new ResourceLocation("shaders/post/color_convolve.json"), new ResourceLocation("shaders/post/deconverge.json"), new ResourceLocation("shaders/post/flip.json"), new ResourceLocation("shaders/post/invert.json"), new ResourceLocation("shaders/post/ntsc.json"), new ResourceLocation("shaders/post/outline.json"), new ResourceLocation("shaders/post/phosphor.json"), new ResourceLocation("shaders/post/scan_pincushion.json"), new ResourceLocation("shaders/post/sobel.json"), new ResourceLocation("shaders/post/bits.json"), new ResourceLocation("shaders/post/desaturate.json"), new ResourceLocation("shaders/post/green.json"), new ResourceLocation("shaders/post/blur.json"), new ResourceLocation("shaders/post/wobble.json"), new ResourceLocation("shaders/post/blobs.json"), new ResourceLocation("shaders/post/antialias.json"), new ResourceLocation("shaders/post/creeper.json"), new ResourceLocation("shaders/post/spider.json")}; + public static final int SHADER_COUNT = SHADERS_TEXTURES.length; + private int shaderIndex; + private boolean useShader; + private int frameCount; + + public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) + { + this.shaderIndex = SHADER_COUNT; + this.mc = mcIn; + this.resourceManager = resourceManagerIn; + this.itemRenderer = mcIn.getItemRenderer(); + this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager()); + this.lightmapTexture = new DynamicTexture(16, 16); + this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture); + this.lightmapColors = this.lightmapTexture.getTextureData(); + this.theShaderGroup = null; + + for (int i = 0; i < 32; ++i) + { + for (int j = 0; j < 32; ++j) + { + float f = (float)(j - 16); + float f1 = (float)(i - 16); + float f2 = MathHelper.sqrt_float(f * f + f1 * f1); + this.rainXCoords[i << 5 | j] = -f1 / f2; + this.rainYCoords[i << 5 | j] = f / f2; + } + } + } + + public boolean isShaderActive() + { + return OpenGlHelper.shadersSupported && this.theShaderGroup != null; + } + + public void stopUseShader() + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + this.shaderIndex = SHADER_COUNT; + } + + public void switchUseShader() + { + this.useShader = !this.useShader; + } + + /** + * What shader to use when spectating this entity + */ + public void loadEntityShader(Entity entityIn) + { + if (OpenGlHelper.shadersSupported) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + + if (entityIn instanceof EntityCreeper) + { + this.loadShader(new ResourceLocation("shaders/post/creeper.json")); + } + else if (entityIn instanceof EntitySpider) + { + this.loadShader(new ResourceLocation("shaders/post/spider.json")); + } + else if (entityIn instanceof EntityEnderman) + { + this.loadShader(new ResourceLocation("shaders/post/invert.json")); + } + } + } + + private void loadShader(ResourceLocation resourceLocationIn) + { + try + { + this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); + this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); + this.useShader = true; + } + catch (IOException ioexception) + { + LOGGER.warn("Failed to load shader: {}", new Object[] {resourceLocationIn, ioexception}); + this.shaderIndex = SHADER_COUNT; + this.useShader = false; + } + catch (JsonSyntaxException jsonsyntaxexception) + { + LOGGER.warn("Failed to load shader: {}", new Object[] {resourceLocationIn, jsonsyntaxexception}); + this.shaderIndex = SHADER_COUNT; + this.useShader = false; + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + + if (this.shaderIndex == SHADER_COUNT) + { + this.loadEntityShader(this.mc.getRenderViewEntity()); + } + else + { + this.loadShader(SHADERS_TEXTURES[this.shaderIndex]); + } + } + + /** + * Updates the entity renderer + */ + public void updateRenderer() + { + if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null) + { + ShaderLinkHelper.setNewStaticShaderLinkHelper(); + } + + this.updateFovModifierHand(); + this.updateTorchFlicker(); + this.fogColor2 = this.fogColor1; + this.thirdPersonDistancePrev = 4.0F; + + if (this.mc.gameSettings.smoothCamera) + { + float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1); + this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1); + this.smoothCamPartialTicks = 0.0F; + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + } + else + { + this.smoothCamFilterX = 0.0F; + this.smoothCamFilterY = 0.0F; + this.mouseFilterXAxis.reset(); + this.mouseFilterYAxis.reset(); + } + + if (this.mc.getRenderViewEntity() == null) + { + this.mc.setRenderViewEntity(this.mc.thePlayer); + } + + float f3 = this.mc.theWorld.getLightBrightness(new BlockPos(this.mc.getRenderViewEntity())); + float f4 = (float)this.mc.gameSettings.renderDistanceChunks / 32.0F; + float f2 = f3 * (1.0F - f4) + f4; + this.fogColor1 += (f2 - this.fogColor1) * 0.1F; + ++this.rendererUpdateCount; + this.itemRenderer.updateEquippedItem(); + this.addRainParticles(); + this.bossColorModifierPrev = this.bossColorModifier; + + if (this.mc.ingameGUI.getBossOverlay().shouldDarkenSky()) + { + this.bossColorModifier += 0.05F; + + if (this.bossColorModifier > 1.0F) + { + this.bossColorModifier = 1.0F; + } + } + else if (this.bossColorModifier > 0.0F) + { + this.bossColorModifier -= 0.0125F; + } + } + + public ShaderGroup getShaderGroup() + { + return this.theShaderGroup; + } + + public void updateShaderGroupSize(int width, int height) + { + if (OpenGlHelper.shadersSupported) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.createBindFramebuffers(width, height); + } + + this.mc.renderGlobal.createBindEntityOutlineFbs(width, height); + } + } + + /** + * Gets the block or object that is being moused over. + */ + public void getMouseOver(float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + + if (entity != null) + { + if (this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("pick"); + this.mc.pointedEntity = null; + double d0 = (double)this.mc.playerController.getBlockReachDistance(); + this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks); + Vec3d vec3d = entity.getPositionEyes(partialTicks); + boolean flag = false; + int i = 3; + double d1 = d0; + + if (this.mc.playerController.extendedReach()) + { + d1 = 6.0D; + d0 = d1; + } + else + { + if (d0 > 3.0D) + { + flag = true; + } + } + + if (this.mc.objectMouseOver != null) + { + d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3d); + } + + Vec3d vec3d1 = entity.getLook(partialTicks); + Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0); + this.pointedEntity = null; + Vec3d vec3d3 = null; + float f = 1.0F; + List list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec3d1.xCoord * d0, vec3d1.yCoord * d0, vec3d1.zCoord * d0).expand(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate() + { + public boolean apply(@Nullable Entity p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.canBeCollidedWith(); + } + })); + double d2 = d1; + + for (int j = 0; j < list.size(); ++j) + { + Entity entity1 = (Entity)list.get(j); + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz((double)entity1.getCollisionBorderSize()); + RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2); + + if (axisalignedbb.isVecInside(vec3d)) + { + if (d2 >= 0.0D) + { + this.pointedEntity = entity1; + vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec; + d2 = 0.0D; + } + } + else if (raytraceresult != null) + { + double d3 = vec3d.distanceTo(raytraceresult.hitVec); + + if (d3 < d2 || d2 == 0.0D) + { + if (entity1.getLowestRidingEntity() == entity.getLowestRidingEntity()) + { + if (d2 == 0.0D) + { + this.pointedEntity = entity1; + vec3d3 = raytraceresult.hitVec; + } + } + else + { + this.pointedEntity = entity1; + vec3d3 = raytraceresult.hitVec; + d2 = d3; + } + } + } + } + + if (this.pointedEntity != null && flag && vec3d.distanceTo(vec3d3) > 3.0D) + { + this.pointedEntity = null; + this.mc.objectMouseOver = new RayTraceResult(RayTraceResult.Type.MISS, vec3d3, (EnumFacing)null, new BlockPos(vec3d3)); + } + + if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) + { + this.mc.objectMouseOver = new RayTraceResult(this.pointedEntity, vec3d3); + + if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) + { + this.mc.pointedEntity = this.pointedEntity; + } + } + + this.mc.mcProfiler.endSection(); + } + } + } + + /** + * Update FOV modifier hand + */ + private void updateFovModifierHand() + { + float f = 1.0F; + + if (this.mc.getRenderViewEntity() instanceof AbstractClientPlayer) + { + AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer)this.mc.getRenderViewEntity(); + f = abstractclientplayer.getFovModifier(); + } + + this.fovModifierHandPrev = this.fovModifierHand; + this.fovModifierHand += (f - this.fovModifierHand) * 0.5F; + + if (this.fovModifierHand > 1.5F) + { + this.fovModifierHand = 1.5F; + } + + if (this.fovModifierHand < 0.1F) + { + this.fovModifierHand = 0.1F; + } + } + + /** + * Changes the field of view of the player depending on if they are underwater or not + */ + private float getFOVModifier(float partialTicks, boolean useFOVSetting) + { + if (this.debugView) + { + return 90.0F; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + float f = 70.0F; + + if (useFOVSetting) + { + f = this.mc.gameSettings.fovSetting; + f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks); + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F) + { + float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks; + f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; + } + + IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (iblockstate.getMaterial() == Material.WATER) + { + f = f * 60.0F / 70.0F; + } + + return f; + } + } + + private void hurtCameraEffect(float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)this.mc.getRenderViewEntity(); + float f = (float)entitylivingbase.hurtTime - partialTicks; + + if (entitylivingbase.getHealth() <= 0.0F) + { + float f1 = (float)entitylivingbase.deathTime + partialTicks; + GlStateManager.rotate(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F); + } + + if (f < 0.0F) + { + return; + } + + f = f / (float)entitylivingbase.maxHurtTime; + f = MathHelper.sin(f * f * f * f * (float)Math.PI); + float f2 = entitylivingbase.attackedAtYaw; + GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-f * 14.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f2, 0.0F, 1.0F, 0.0F); + } + } + + /** + * Updates the bobbing render effect of the player. + */ + private void setupViewBobbing(float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity(); + float f = entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified; + float f1 = -(entityplayer.distanceWalkedModified + f * partialTicks); + float f2 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * partialTicks; + float f3 = entityplayer.prevCameraPitch + (entityplayer.cameraPitch - entityplayer.prevCameraPitch) * partialTicks; + GlStateManager.translate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 0.5F, -Math.abs(MathHelper.cos(f1 * (float)Math.PI) * f2), 0.0F); + GlStateManager.rotate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 3.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(Math.abs(MathHelper.cos(f1 * (float)Math.PI - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3, 1.0F, 0.0F, 0.0F); + } + } + + /** + * sets up player's eye (or camera in third person mode) + */ + private void orientCamera(float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + float f = entity.getEyeHeight(); + double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + (double)f; + double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPlayerSleeping()) + { + f = (float)((double)f + 1.0D); + GlStateManager.translate(0.0F, 0.3F, 0.0F); + + if (!this.mc.gameSettings.debugCamEnable) + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (block == Blocks.BED) + { + int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); + GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); + } + + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); + } + } + else if (this.mc.gameSettings.thirdPersonView > 0) + { + double d3 = (double)(this.thirdPersonDistancePrev + (4.0F - this.thirdPersonDistancePrev) * partialTicks); + + if (this.mc.gameSettings.debugCamEnable) + { + GlStateManager.translate(0.0F, 0.0F, (float)(-d3)); + } + else + { + float f1 = entity.rotationYaw; + float f2 = entity.rotationPitch; + + if (this.mc.gameSettings.thirdPersonView == 2) + { + f2 += 180.0F; + } + + double d4 = (double)(-MathHelper.sin(f1 * 0.017453292F) * MathHelper.cos(f2 * 0.017453292F)) * d3; + double d5 = (double)(MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f2 * 0.017453292F)) * d3; + double d6 = (double)(-MathHelper.sin(f2 * 0.017453292F)) * d3; + + for (int i = 0; i < 8; ++i) + { + float f3 = (float)((i & 1) * 2 - 1); + float f4 = (float)((i >> 1 & 1) * 2 - 1); + float f5 = (float)((i >> 2 & 1) * 2 - 1); + f3 = f3 * 0.1F; + f4 = f4 * 0.1F; + f5 = f5 * 0.1F; + RayTraceResult raytraceresult = this.mc.theWorld.rayTraceBlocks(new Vec3d(d0 + (double)f3, d1 + (double)f4, d2 + (double)f5), new Vec3d(d0 - d4 + (double)f3 + (double)f5, d1 - d6 + (double)f4, d2 - d5 + (double)f5)); + + if (raytraceresult != null) + { + double d7 = raytraceresult.hitVec.distanceTo(new Vec3d(d0, d1, d2)); + + if (d7 < d3) + { + d3 = d7; + } + } + } + + if (this.mc.gameSettings.thirdPersonView == 2) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.rotate(entity.rotationPitch - f2, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(entity.rotationYaw - f1, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.0F, (float)(-d3)); + GlStateManager.rotate(f1 - entity.rotationYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f2 - entity.rotationPitch, 1.0F, 0.0F, 0.0F); + } + } + else + { + GlStateManager.translate(0.0F, 0.0F, 0.05F); + } + + if (!this.mc.gameSettings.debugCamEnable) + { + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 1.0F, 0.0F, 0.0F); + + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; + GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + } + else + { + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + } + } + + GlStateManager.translate(0.0F, -f, 0.0F); + d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + (double)f; + d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + this.cloudFog = this.mc.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks); + } + + /** + * sets up projection, view effects, camera position/rotation + */ + private void setupCameraTransform(float partialTicks, int pass) + { + this.farPlaneDistance = (float)(this.mc.gameSettings.renderDistanceChunks * 16); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + float f = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(-(pass * 2 - 1)) * 0.07F, 0.0F, 0.0F); + } + + if (this.cameraZoom != 1.0D) + { + GlStateManager.translate((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F); + GlStateManager.scale(this.cameraZoom, this.cameraZoom, 1.0D); + } + + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(pass * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + this.hurtCameraEffect(partialTicks); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(partialTicks); + } + + float f1 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * partialTicks; + + if (f1 > 0.0F) + { + int i = 20; + + if (this.mc.thePlayer.isPotionActive(MobEffects.NAUSEA)) + { + i = 7; + } + + float f2 = 5.0F / (f1 * f1 + 5.0F) - f1 * 0.04F; + f2 = f2 * f2; + GlStateManager.rotate(((float)this.rendererUpdateCount + partialTicks) * (float)i, 0.0F, 1.0F, 1.0F); + GlStateManager.scale(1.0F / f2, 1.0F, 1.0F); + GlStateManager.rotate(-((float)this.rendererUpdateCount + partialTicks) * (float)i, 0.0F, 1.0F, 1.0F); + } + + this.orientCamera(partialTicks); + + if (this.debugView) + { + switch (this.debugViewDirection) + { + case 0: + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + break; + + case 1: + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + break; + + case 2: + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + break; + + case 3: + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + break; + + case 4: + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + } + } + } + + /** + * Render player hand + */ + private void renderHand(float partialTicks, int pass) + { + if (!this.debugView) + { + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + float f = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(-(pass * 2 - 1)) * 0.07F, 0.0F, 0.0F); + } + + Project.gluPerspective(this.getFOVModifier(partialTicks, false), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(pass * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + GlStateManager.pushMatrix(); + this.hurtCameraEffect(partialTicks); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(partialTicks); + } + + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + + if (this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator()) + { + this.enableLightmap(); + this.itemRenderer.renderItemInFirstPerson(partialTicks); + this.disableLightmap(); + } + + GlStateManager.popMatrix(); + + if (this.mc.gameSettings.thirdPersonView == 0 && !flag) + { + this.itemRenderer.renderOverlays(partialTicks); + this.hurtCameraEffect(partialTicks); + } + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(partialTicks); + } + } + } + + public void disableLightmap() + { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + public void enableLightmap() + { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = 0.00390625F; + GlStateManager.scale(0.00390625F, 0.00390625F, 0.00390625F); + GlStateManager.translate(8.0F, 8.0F, 8.0F); + GlStateManager.matrixMode(5888); + this.mc.getTextureManager().bindTexture(this.locationLightMap); + GlStateManager.glTexParameteri(3553, 10241, 9729); + GlStateManager.glTexParameteri(3553, 10240, 9729); + GlStateManager.glTexParameteri(3553, 10242, 10496); + GlStateManager.glTexParameteri(3553, 10243, 10496); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + /** + * Recompute a random value that is applied to block color in updateLightmap() + */ + private void updateTorchFlicker() + { + this.torchFlickerDX = (float)((double)this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random()); + this.torchFlickerDX = (float)((double)this.torchFlickerDX * 0.9D); + this.torchFlickerX += this.torchFlickerDX - this.torchFlickerX; + this.lightmapUpdateNeeded = true; + } + + private void updateLightmap(float partialTicks) + { + if (this.lightmapUpdateNeeded) + { + this.mc.mcProfiler.startSection("lightTex"); + World world = this.mc.theWorld; + + if (world != null) + { + float f = world.getSunBrightness(1.0F); + float f1 = f * 0.95F + 0.05F; + + for (int i = 0; i < 256; ++i) + { + float f2 = world.provider.getLightBrightnessTable()[i / 16] * f1; + float f3 = world.provider.getLightBrightnessTable()[i % 16] * (this.torchFlickerX * 0.1F + 1.5F); + + if (world.getLastLightningBolt() > 0) + { + f2 = world.provider.getLightBrightnessTable()[i / 16]; + } + + float f4 = f2 * (f * 0.65F + 0.35F); + float f5 = f2 * (f * 0.65F + 0.35F); + float f6 = f3 * ((f3 * 0.6F + 0.4F) * 0.6F + 0.4F); + float f7 = f3 * (f3 * f3 * 0.6F + 0.4F); + float f8 = f4 + f3; + float f9 = f5 + f6; + float f10 = f2 + f7; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + + if (this.bossColorModifier > 0.0F) + { + float f11 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; + f8 = f8 * (1.0F - f11) + f8 * 0.7F * f11; + f9 = f9 * (1.0F - f11) + f9 * 0.6F * f11; + f10 = f10 * (1.0F - f11) + f10 * 0.6F * f11; + } + + if (world.provider.getDimensionType().getId() == 1) + { + f8 = 0.22F + f3 * 0.75F; + f9 = 0.28F + f6 * 0.75F; + f10 = 0.25F + f7 * 0.75F; + } + + if (this.mc.thePlayer.isPotionActive(MobEffects.NIGHT_VISION)) + { + float f15 = this.getNightVisionBrightness(this.mc.thePlayer, partialTicks); + float f12 = 1.0F / f8; + + if (f12 > 1.0F / f9) + { + f12 = 1.0F / f9; + } + + if (f12 > 1.0F / f10) + { + f12 = 1.0F / f10; + } + + f8 = f8 * (1.0F - f15) + f8 * f12 * f15; + f9 = f9 * (1.0F - f15) + f9 * f12 * f15; + f10 = f10 * (1.0F - f15) + f10 * f12 * f15; + } + + if (f8 > 1.0F) + { + f8 = 1.0F; + } + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + if (f10 > 1.0F) + { + f10 = 1.0F; + } + + float f16 = this.mc.gameSettings.gammaSetting; + float f17 = 1.0F - f8; + float f13 = 1.0F - f9; + float f14 = 1.0F - f10; + f17 = 1.0F - f17 * f17 * f17 * f17; + f13 = 1.0F - f13 * f13 * f13 * f13; + f14 = 1.0F - f14 * f14 * f14 * f14; + f8 = f8 * (1.0F - f16) + f17 * f16; + f9 = f9 * (1.0F - f16) + f13 * f16; + f10 = f10 * (1.0F - f16) + f14 * f16; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + + if (f8 > 1.0F) + { + f8 = 1.0F; + } + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + if (f10 > 1.0F) + { + f10 = 1.0F; + } + + if (f8 < 0.0F) + { + f8 = 0.0F; + } + + if (f9 < 0.0F) + { + f9 = 0.0F; + } + + if (f10 < 0.0F) + { + f10 = 0.0F; + } + + int j = 255; + int k = (int)(f8 * 255.0F); + int l = (int)(f9 * 255.0F); + int i1 = (int)(f10 * 255.0F); + this.lightmapColors[i] = -16777216 | k << 16 | l << 8 | i1; + } + + this.lightmapTexture.updateDynamicTexture(); + this.lightmapUpdateNeeded = false; + this.mc.mcProfiler.endSection(); + } + } + } + + private float getNightVisionBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks) + { + int i = entitylivingbaseIn.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration(); + return i > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F; + } + + public void updateCameraAndRender(float partialTicks, long nanoTime) + { + boolean flag = Display.isActive(); + + if (!flag && this.mc.gameSettings.pauseOnLostFocus && (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1))) + { + if (Minecraft.getSystemTime() - this.prevFrameTime > 500L) + { + this.mc.displayInGameMenu(); + } + } + else + { + this.prevFrameTime = Minecraft.getSystemTime(); + } + + this.mc.mcProfiler.startSection("mouse"); + + if (flag && Minecraft.IS_RUNNING_ON_MAC && this.mc.inGameHasFocus && !Mouse.isInsideWindow()) + { + Mouse.setGrabbed(false); + Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2 - 20); + Mouse.setGrabbed(true); + } + + if (this.mc.inGameHasFocus && flag) + { + this.mc.mouseHelper.mouseXYChange(); + float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + float f2 = (float)this.mc.mouseHelper.deltaX * f1; + float f3 = (float)this.mc.mouseHelper.deltaY * f1; + int i = 1; + + if (this.mc.gameSettings.invertMouse) + { + i = -1; + } + + if (this.mc.gameSettings.smoothCamera) + { + this.smoothCamYaw += f2; + this.smoothCamPitch += f3; + float f4 = partialTicks - this.smoothCamPartialTicks; + this.smoothCamPartialTicks = partialTicks; + f2 = this.smoothCamFilterX * f4; + f3 = this.smoothCamFilterY * f4; + this.mc.thePlayer.setAngles(f2, f3 * (float)i); + } + else + { + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + this.mc.thePlayer.setAngles(f2, f3 * (float)i); + } + } + + this.mc.mcProfiler.endSection(); + + if (!this.mc.skipRenderWorld) + { + anaglyphEnable = this.mc.gameSettings.anaglyph; + final ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int i1 = scaledresolution.getScaledWidth(); + int j1 = scaledresolution.getScaledHeight(); + final int k1 = Mouse.getX() * i1 / this.mc.displayWidth; + final int l1 = j1 - Mouse.getY() * j1 / this.mc.displayHeight - 1; + int i2 = this.mc.gameSettings.limitFramerate; + + if (this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("level"); + int j = Math.min(Minecraft.getDebugFPS(), i2); + j = Math.max(j, 60); + long k = System.nanoTime() - nanoTime; + long l = Math.max((long)(1000000000 / j / 4) - k, 0L); + this.renderWorld(partialTicks, System.nanoTime() + l); + + if (this.mc.isSingleplayer() && this.timeWorldIcon < Minecraft.getSystemTime() - 1000L) + { + this.timeWorldIcon = Minecraft.getSystemTime(); + + if (!this.mc.getIntegratedServer().isWorldIconSet()) + { + this.createWorldIcon(); + } + } + + if (OpenGlHelper.shadersSupported) + { + this.mc.renderGlobal.renderEntityOutlineFramebuffer(); + + if (this.theShaderGroup != null && this.useShader) + { + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + this.theShaderGroup.loadShaderGroup(partialTicks); + GlStateManager.popMatrix(); + } + + this.mc.getFramebuffer().bindFramebuffer(true); + } + + this.renderEndNanoTime = System.nanoTime(); + this.mc.mcProfiler.endStartSection("gui"); + + if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) + { + GlStateManager.alphaFunc(516, 0.1F); + this.mc.ingameGUI.renderGameOverlay(partialTicks); + } + + this.mc.mcProfiler.endSection(); + } + else + { + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.setupOverlayRendering(); + this.renderEndNanoTime = System.nanoTime(); + } + + if (this.mc.currentScreen != null) + { + GlStateManager.clear(256); + + try + { + this.mc.currentScreen.drawScreen(k1, l1, partialTicks); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering screen"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Screen render details"); + crashreportcategory.func_189529_a("Screen name", new ICrashReportDetail() + { + public String call() throws Exception + { + return EntityRenderer.this.mc.currentScreen.getClass().getCanonicalName(); + } + }); + crashreportcategory.func_189529_a("Mouse location", new ICrashReportDetail() + { + public String call() throws Exception + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", new Object[] {Integer.valueOf(k1), Integer.valueOf(l1), Integer.valueOf(Mouse.getX()), Integer.valueOf(Mouse.getY())}); + } + }); + crashreportcategory.func_189529_a("Screen size", new ICrashReportDetail() + { + public String call() throws Exception + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", new Object[] {Integer.valueOf(scaledresolution.getScaledWidth()), Integer.valueOf(scaledresolution.getScaledHeight()), Integer.valueOf(EntityRenderer.this.mc.displayWidth), Integer.valueOf(EntityRenderer.this.mc.displayHeight), Integer.valueOf(scaledresolution.getScaleFactor())}); + } + }); + throw new ReportedException(crashreport); + } + } + } + } + + private void createWorldIcon() + { + if (this.mc.renderGlobal.getRenderedChunks() > 10 && this.mc.renderGlobal.hasNoChunkUpdates() && !this.mc.getIntegratedServer().isWorldIconSet()) + { + BufferedImage bufferedimage = ScreenShotHelper.createScreenshot(this.mc.displayWidth, this.mc.displayHeight, this.mc.getFramebuffer()); + int i = bufferedimage.getWidth(); + int j = bufferedimage.getHeight(); + int k = 0; + int l = 0; + + if (i > j) + { + k = (i - j) / 2; + i = j; + } + else + { + l = (j - i) / 2; + } + + try + { + BufferedImage bufferedimage1 = new BufferedImage(64, 64, 1); + Graphics graphics = bufferedimage1.createGraphics(); + graphics.drawImage(bufferedimage, 0, 0, 64, 64, k, l, k + i, l + i, (ImageObserver)null); + graphics.dispose(); + ImageIO.write(bufferedimage1, "png", (File)this.mc.getIntegratedServer().getWorldIconFile()); + } + catch (IOException ioexception) + { + LOGGER.warn((String)"Couldn\'t save auto screenshot", (Throwable)ioexception); + } + } + } + + public void renderStreamIndicator(float partialTicks) + { + this.setupOverlayRendering(); + } + + private boolean isDrawBlockOutline() + { + if (!this.drawBlockOutline) + { + return false; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI; + + if (flag && !((EntityPlayer)entity).capabilities.allowEdit) + { + ItemStack itemstack = ((EntityPlayer)entity).getHeldItemMainhand(); + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) + { + BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); + Block block = this.mc.theWorld.getBlockState(blockpos).getBlock(); + + if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR) + { + flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; + } + else + { + flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block)); + } + } + } + + return flag; + } + } + + public void renderWorld(float partialTicks, long finishTimeNano) + { + this.updateLightmap(partialTicks); + + if (this.mc.getRenderViewEntity() == null) + { + this.mc.setRenderViewEntity(this.mc.thePlayer); + } + + this.getMouseOver(partialTicks); + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.5F); + this.mc.mcProfiler.startSection("center"); + + // Cubitick + if(mc.timer.renderPartialTicks < 0 || mc.timer.renderPartialTicks >= 1) + mc.timer.renderPartialTicks = 0; + if(mc.timerWorld.renderPartialTicks < 0 || mc.timerWorld.renderPartialTicks >= 1) + mc.timerWorld.renderPartialTicks = 0; + + if (this.mc.gameSettings.anaglyph) + { + anaglyphField = 0; + GlStateManager.colorMask(false, true, true, false); + if(Cubitick.synctick) this.renderWorldPass(0, partialTicks, finishTimeNano); + else this.renderWorldPass_Async(0, mc.timer.renderPartialTicks, mc.timerWorld.renderPartialTicks, finishTimeNano); + anaglyphField = 1; + GlStateManager.colorMask(true, false, false, false); + if(Cubitick.synctick) this.renderWorldPass(1, partialTicks, finishTimeNano); + else this.renderWorldPass_Async(1, mc.timer.renderPartialTicks, mc.timerWorld.renderPartialTicks, finishTimeNano); + GlStateManager.colorMask(true, true, true, false); + } + else + { + if(Cubitick.synctick) this.renderWorldPass(2, partialTicks, finishTimeNano); + else this.renderWorldPass_Async(2, mc.timer.renderPartialTicks, mc.timerWorld.renderPartialTicks, finishTimeNano); + } + + this.mc.mcProfiler.endSection(); + } + + private void renderWorldPass(int pass, float partialTicks, long finishTimeNano) + { + RenderGlobal renderglobal = this.mc.renderGlobal; + ParticleManager particlemanager = this.mc.effectRenderer; + boolean flag = this.isDrawBlockOutline(); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("clear"); + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + this.updateFogColor(partialTicks); + GlStateManager.clear(16640); + this.mc.mcProfiler.endStartSection("camera"); + this.setupCameraTransform(partialTicks, pass); + ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); + this.mc.mcProfiler.endStartSection("frustum"); + ClippingHelperImpl.getInstance(); + this.mc.mcProfiler.endStartSection("culling"); + ICamera icamera = new Frustum(); + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + icamera.setPosition(d0, d1, d2); + + if (this.mc.gameSettings.renderDistanceChunks >= 4) + { + this.setupFog(-1, partialTicks); + this.mc.mcProfiler.endStartSection("sky"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + GlStateManager.matrixMode(5888); + renderglobal.renderSky(partialTicks, pass); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2); + GlStateManager.matrixMode(5888); + } + + this.setupFog(0, partialTicks); + GlStateManager.shadeModel(7425); + + if (entity.posY + (double)entity.getEyeHeight() < 128.0D) + { + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + + this.mc.mcProfiler.endStartSection("prepareterrain"); + this.setupFog(0, partialTicks); + this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + RenderHelper.disableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("terrain_setup"); + renderglobal.setupTerrain(entity, (double)partialTicks, icamera, this.frameCount++, this.mc.thePlayer.isSpectator()); + + if (pass == 0 || pass == 2) + { + this.mc.mcProfiler.endStartSection("updatechunks"); + this.mc.renderGlobal.updateChunks(finishTimeNano); + } + + this.mc.mcProfiler.endStartSection("terrain"); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.disableAlpha(); + renderglobal.renderBlockLayer(BlockRenderLayer.SOLID, (double)partialTicks, pass, entity); + GlStateManager.enableAlpha(); + renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT_MIPPED, (double)partialTicks, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); + renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT, (double)partialTicks, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); + GlStateManager.shadeModel(7424); + GlStateManager.alphaFunc(516, 0.1F); + + if (!this.debugView) + { + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + renderglobal.renderEntities(entity, icamera, partialTicks); + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + } + + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + + if (flag && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.WATER)) + { + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } + + if (this.mc.debugRenderer.func_190074_a()) + { + this.mc.debugRenderer.func_190073_a(partialTicks, finishTimeNano); + } + + this.mc.mcProfiler.endStartSection("destroyProgress"); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); + renderglobal.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getBuffer(), entity, partialTicks); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); + GlStateManager.disableBlend(); + + if (!this.debugView) + { + this.enableLightmap(); + this.mc.mcProfiler.endStartSection("litParticles"); + particlemanager.renderLitParticles(entity, partialTicks); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, partialTicks); + this.mc.mcProfiler.endStartSection("particles"); + particlemanager.renderParticles(entity, partialTicks); + this.disableLightmap(); + } + + GlStateManager.depthMask(false); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("weather"); + this.renderRainSnow(partialTicks); + GlStateManager.depthMask(true); + renderglobal.renderWorldBorder(entity, partialTicks); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.alphaFunc(516, 0.1F); + this.setupFog(0, partialTicks); + GlStateManager.enableBlend(); + GlStateManager.depthMask(false); + this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double)partialTicks, pass, entity); + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.disableFog(); + + if (entity.posY + (double)entity.getEyeHeight() >= 128.0D) + { + this.mc.mcProfiler.endStartSection("aboveClouds"); + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + + this.mc.mcProfiler.endStartSection("hand"); + + if (this.renderHand) + { + GlStateManager.clear(256); + this.renderHand(partialTicks, pass); + } + } + + private void renderWorldPass_Async(int pass, float ptick, float wtick, long finishTimeNano) + { + RenderGlobal renderglobal = this.mc.renderGlobal; + ParticleManager particlemanager = this.mc.effectRenderer; + boolean flag = this.isDrawBlockOutline(); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("clear"); + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + this.updateFogColor(ptick); + GlStateManager.clear(16640); + this.mc.mcProfiler.endStartSection("camera"); + this.setupCameraTransform(ptick, pass); + ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); + this.mc.mcProfiler.endStartSection("frustum"); + ClippingHelperImpl.getInstance(); + this.mc.mcProfiler.endStartSection("culling"); + ICamera icamera = new Frustum(); + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)ptick; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)ptick; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)ptick; + icamera.setPosition(d0, d1, d2); + + // Cubitick: save lastTickPos of the player so that it can be temporarily altered later on + double lx = entity.lastTickPosX; + double ly = entity.lastTickPosY; + double lz = entity.lastTickPosZ; + // apparent entity position within tick + double ax = entity.posX - (entity.posX-lx)*(1.0-ptick)/(1.0-wtick); + double ay = entity.posY - (entity.posY-ly)*(1.0-ptick)/(1.0-wtick); + double az = entity.posZ - (entity.posZ-lz)*(1.0-ptick)/(1.0-wtick); + + if (this.mc.gameSettings.renderDistanceChunks >= 4) + { + this.setupFog(-1, ptick); + this.mc.mcProfiler.endStartSection("sky"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(ptick, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + GlStateManager.matrixMode(5888); + renderglobal.renderSky(ptick, pass); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(ptick, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2); + GlStateManager.matrixMode(5888); + } + + this.setupFog(0, ptick); + GlStateManager.shadeModel(7425); + + if (entity.posY + (double)entity.getEyeHeight() < 128.0D) + { + this.renderCloudsCheck(renderglobal, ptick, pass); + } + + this.mc.mcProfiler.endStartSection("prepareterrain"); + this.setupFog(0, ptick); + this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + RenderHelper.disableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("terrain_setup"); + renderglobal.setupTerrain(entity, (double)ptick, icamera, this.frameCount++, this.mc.thePlayer.isSpectator()); + + if (pass == 0 || pass == 2) + { + this.mc.mcProfiler.endStartSection("updatechunks"); + this.mc.renderGlobal.updateChunks(finishTimeNano); + } + + this.mc.mcProfiler.endStartSection("terrain"); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.disableAlpha(); + renderglobal.renderBlockLayer(BlockRenderLayer.SOLID, (double)ptick, pass, entity); + GlStateManager.enableAlpha(); + renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT_MIPPED, (double)ptick, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); + renderglobal.renderBlockLayer(BlockRenderLayer.CUTOUT, (double)ptick, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); + GlStateManager.shadeModel(7424); + GlStateManager.alphaFunc(516, 0.1F); + + if (!this.debugView) + { + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + + // Cubitick + entity.lastTickPosX = ax; + entity.lastTickPosY = ay; + entity.lastTickPosZ = az; + + renderglobal.renderEntities(entity, icamera, wtick); + + entity.lastTickPosX = lx; + entity.lastTickPosY = ly; + entity.lastTickPosZ = lz; + + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + } + + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + + if (flag && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.WATER)) + { + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, ptick); + GlStateManager.enableAlpha(); + } + + if (this.mc.debugRenderer.func_190074_a()) + { + this.mc.debugRenderer.func_190073_a(ptick, finishTimeNano); + } + + // Cubitick + entity.lastTickPosX = ax; + entity.lastTickPosY = ay; + entity.lastTickPosZ = az; + + this.mc.mcProfiler.endStartSection("destroyProgress"); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); + renderglobal.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getBuffer(), entity, ptick); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); + GlStateManager.disableBlend(); + + if (!this.debugView) + { + this.enableLightmap(); + this.mc.mcProfiler.endStartSection("litParticles"); + particlemanager.renderLitParticles(entity, wtick); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, wtick); + this.mc.mcProfiler.endStartSection("particles"); + particlemanager.renderParticles(entity, wtick); + this.disableLightmap(); + } + + GlStateManager.depthMask(false); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("weather"); + this.renderRainSnow(wtick); + GlStateManager.depthMask(true); + renderglobal.renderWorldBorder(entity, wtick); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.alphaFunc(516, 0.1F); + this.setupFog(0, wtick); + GlStateManager.enableBlend(); + GlStateManager.depthMask(false); + this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + GlStateManager.shadeModel(7425); + + // Cubitick + entity.lastTickPosX = lx; + entity.lastTickPosY = ly; + entity.lastTickPosZ = lz; + + this.mc.mcProfiler.endStartSection("translucent"); + renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double)ptick, pass, entity); + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.disableFog(); + + if (entity.posY + (double)entity.getEyeHeight() >= 128.0D) + { + this.mc.mcProfiler.endStartSection("aboveClouds"); + this.renderCloudsCheck(renderglobal, ptick, pass); + } + + this.mc.mcProfiler.endStartSection("hand"); + + if (this.renderHand) + { + GlStateManager.clear(256); + this.renderHand(ptick, pass); + } + } + + private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass) + { + if (this.mc.gameSettings.shouldRenderClouds() != 0) + { + this.mc.mcProfiler.endStartSection("clouds"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + this.setupFog(0, partialTicks); + renderGlobalIn.renderClouds(partialTicks, pass); + GlStateManager.disableFog(); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.SQRT_2); + GlStateManager.matrixMode(5888); + } + } + + private void addRainParticles() + { + float f = this.mc.theWorld.getRainStrength(1.0F); + + if (!this.mc.gameSettings.fancyGraphics) + { + f /= 2.0F; + } + + if (f != 0.0F) + { + this.random.setSeed((long)this.rendererUpdateCount * 312987231L); + Entity entity = this.mc.getRenderViewEntity(); + World world = this.mc.theWorld; + BlockPos blockpos = new BlockPos(entity); + int i = 10; + double d0 = 0.0D; + double d1 = 0.0D; + double d2 = 0.0D; + int j = 0; + int k = (int)(100.0F * f * f); + + if (this.mc.gameSettings.particleSetting == 1) + { + k >>= 1; + } + else if (this.mc.gameSettings.particleSetting == 2) + { + k = 0; + } + + for (int l = 0; l < k; ++l) + { + BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.nextInt(10) - this.random.nextInt(10), 0, this.random.nextInt(10) - this.random.nextInt(10))); + Biome biome = world.getBiomeGenForCoords(blockpos1); + BlockPos blockpos2 = blockpos1.down(); + IBlockState iblockstate = world.getBlockState(blockpos2); + + if (blockpos1.getY() <= blockpos.getY() + 10 && blockpos1.getY() >= blockpos.getY() - 10 && biome.canRain() && biome.getFloatTemperature(blockpos1) >= 0.15F) + { + double d3 = this.random.nextDouble(); + double d4 = this.random.nextDouble(); + AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(world, blockpos2); + + if (iblockstate.getMaterial() != Material.LAVA && iblockstate.getBlock() != Blocks.field_189877_df) + { + if (iblockstate.getMaterial() != Material.AIR) + { + ++j; + + if (this.random.nextInt(j) == 0) + { + d0 = (double)blockpos2.getX() + d3; + d1 = (double)((float)blockpos2.getY() + 0.1F) + axisalignedbb.maxY - 1.0D; + d2 = (double)blockpos2.getZ() + d4; + } + + this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + axisalignedbb.maxY, (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + else + { + this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - axisalignedbb.minY, (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + if (j > 0 && this.random.nextInt(3) < this.rainSoundCounter++) + { + this.rainSoundCounter = 0; + + if (d1 > (double)(blockpos.getY() + 1) && world.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY())) + { + this.mc.theWorld.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN_ABOVE, SoundCategory.WEATHER, 0.1F, 0.5F, false); + } + else + { + this.mc.theWorld.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN, SoundCategory.WEATHER, 0.2F, 1.0F, false); + } + } + } + } + + /** + * Render rain and snow + */ + protected void renderRainSnow(float partialTicks) + { + float f = this.mc.theWorld.getRainStrength(partialTicks); + + if (f > 0.0F) + { + this.enableLightmap(); + Entity entity = this.mc.getRenderViewEntity(); + World world = this.mc.theWorld; + int i = MathHelper.floor_double(entity.posX); + int j = MathHelper.floor_double(entity.posY); + int k = MathHelper.floor_double(entity.posZ); + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getBuffer(); + GlStateManager.disableCull(); + GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.alphaFunc(516, 0.1F); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + int l = MathHelper.floor_double(d1); + int i1 = 5; + + if (this.mc.gameSettings.fancyGraphics) + { + i1 = 10; + } + + int j1 = -1; + float f1 = (float)this.rendererUpdateCount + partialTicks; + vertexbuffer.setTranslation(-d0, -d1, -d2); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = k - i1; k1 <= k + i1; ++k1) + { + for (int l1 = i - i1; l1 <= i + i1; ++l1) + { + int i2 = (k1 - k + 16) * 32 + l1 - i + 16; + double d3 = (double)this.rainXCoords[i2] * 0.5D; + double d4 = (double)this.rainYCoords[i2] * 0.5D; + blockpos$mutableblockpos.set(l1, 0, k1); + Biome biome = world.getBiomeGenForCoords(blockpos$mutableblockpos); + + if (biome.canRain() || biome.getEnableSnow()) + { + int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY(); + int k2 = j - i1; + int l2 = j + i1; + + if (k2 < j2) + { + k2 = j2; + } + + if (l2 < j2) + { + l2 = j2; + } + + int i3 = j2; + + if (j2 < l) + { + i3 = l; + } + + if (k2 != l2) + { + this.random.setSeed((long)(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761)); + blockpos$mutableblockpos.set(l1, k2, k1); + float f2 = biome.getFloatTemperature(blockpos$mutableblockpos); + + if (world.getBiomeProvider().getTemperatureAtHeight(f2, j2) >= 0.15F) + { + if (j1 != 0) + { + if (j1 >= 0) + { + tessellator.draw(); + } + + j1 = 0; + this.mc.getTextureManager().bindTexture(RAIN_TEXTURES); + vertexbuffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + } + + double d5 = -((double)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.nextDouble()); + double d6 = (double)((float)l1 + 0.5F) - entity.posX; + double d7 = (double)((float)k1 + 0.5F) - entity.posZ; + float f3 = MathHelper.sqrt_double(d6 * d6 + d7 * d7) / (float)i1; + float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f; + blockpos$mutableblockpos.set(l1, i3, k1); + int j3 = world.getCombinedLight(blockpos$mutableblockpos, 0); + int k3 = j3 >> 16 & 65535; + int l3 = j3 & 65535; + vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); + vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); + vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); + vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); + } + else + { + if (j1 != 1) + { + if (j1 >= 0) + { + tessellator.draw(); + } + + j1 = 1; + this.mc.getTextureManager().bindTexture(SNOW_TEXTURES); + vertexbuffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + } + + double d8 = (double)(-((float)(this.rendererUpdateCount & 511) + partialTicks) / 512.0F); + double d9 = this.random.nextDouble() + (double)f1 * 0.01D * (double)((float)this.random.nextGaussian()); + double d10 = this.random.nextDouble() + (double)(f1 * (float)this.random.nextGaussian()) * 0.001D; + double d11 = (double)((float)l1 + 0.5F) - entity.posX; + double d12 = (double)((float)k1 + 0.5F) - entity.posZ; + float f6 = MathHelper.sqrt_double(d11 * d11 + d12 * d12) / (float)i1; + float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f; + blockpos$mutableblockpos.set(l1, i3, k1); + int i4 = (world.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4; + int j4 = i4 >> 16 & 65535; + int k4 = i4 & 65535; + vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); + vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); + vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); + vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); + } + } + } + } + } + + if (j1 >= 0) + { + tessellator.draw(); + } + + vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.alphaFunc(516, 0.1F); + this.disableLightmap(); + } + } + + /** + * Setup orthogonal projection for rendering GUI screen overlays + */ + public void setupOverlayRendering() + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + } + + /** + * calculates fog and calls glClearColor + */ + private void updateFogColor(float partialTicks) + { + World world = this.mc.theWorld; + Entity entity = this.mc.getRenderViewEntity(); + float f = 0.25F + 0.75F * (float)this.mc.gameSettings.renderDistanceChunks / 32.0F; + f = 1.0F - (float)Math.pow((double)f, 0.25D); + Vec3d vec3d = world.getSkyColor(this.mc.getRenderViewEntity(), partialTicks); + float f1 = (float)vec3d.xCoord; + float f2 = (float)vec3d.yCoord; + float f3 = (float)vec3d.zCoord; + Vec3d vec3d1 = world.getFogColor(partialTicks); + this.fogColorRed = (float)vec3d1.xCoord; + this.fogColorGreen = (float)vec3d1.yCoord; + this.fogColorBlue = (float)vec3d1.zCoord; + + if (this.mc.gameSettings.renderDistanceChunks >= 4) + { + double d0 = MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) > 0.0F ? -1.0D : 1.0D; + Vec3d vec3d2 = new Vec3d(d0, 0.0D, 0.0D); + float f5 = (float)entity.getLook(partialTicks).dotProduct(vec3d2); + + if (f5 < 0.0F) + { + f5 = 0.0F; + } + + if (f5 > 0.0F) + { + float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks); + + if (afloat != null) + { + f5 = f5 * afloat[3]; + this.fogColorRed = this.fogColorRed * (1.0F - f5) + afloat[0] * f5; + this.fogColorGreen = this.fogColorGreen * (1.0F - f5) + afloat[1] * f5; + this.fogColorBlue = this.fogColorBlue * (1.0F - f5) + afloat[2] * f5; + } + } + } + + this.fogColorRed += (f1 - this.fogColorRed) * f; + this.fogColorGreen += (f2 - this.fogColorGreen) * f; + this.fogColorBlue += (f3 - this.fogColorBlue) * f; + float f8 = world.getRainStrength(partialTicks); + + if (f8 > 0.0F) + { + float f4 = 1.0F - f8 * 0.5F; + float f10 = 1.0F - f8 * 0.4F; + this.fogColorRed *= f4; + this.fogColorGreen *= f4; + this.fogColorBlue *= f10; + } + + float f9 = world.getThunderStrength(partialTicks); + + if (f9 > 0.0F) + { + float f11 = 1.0F - f9 * 0.5F; + this.fogColorRed *= f11; + this.fogColorGreen *= f11; + this.fogColorBlue *= f11; + } + + IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (this.cloudFog) + { + Vec3d vec3d3 = world.getCloudColour(partialTicks); + this.fogColorRed = (float)vec3d3.xCoord; + this.fogColorGreen = (float)vec3d3.yCoord; + this.fogColorBlue = (float)vec3d3.zCoord; + } + else if (iblockstate.getMaterial() == Material.WATER) + { + float f12 = 0.0F; + + if (entity instanceof EntityLivingBase) + { + f12 = (float)EnchantmentHelper.getRespirationModifier((EntityLivingBase)entity) * 0.2F; + + if (((EntityLivingBase)entity).isPotionActive(MobEffects.WATER_BREATHING)) + { + f12 = f12 * 0.3F + 0.6F; + } + } + + this.fogColorRed = 0.02F + f12; + this.fogColorGreen = 0.02F + f12; + this.fogColorBlue = 0.2F + f12; + } + else if (iblockstate.getMaterial() == Material.LAVA) + { + this.fogColorRed = 0.6F; + this.fogColorGreen = 0.1F; + this.fogColorBlue = 0.0F; + } + + float f13 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * partialTicks; + this.fogColorRed *= f13; + this.fogColorGreen *= f13; + this.fogColorBlue *= f13; + double d1 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks) * world.provider.getVoidFogYFactor(); + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS)) + { + int i = ((EntityLivingBase)entity).getActivePotionEffect(MobEffects.BLINDNESS).getDuration(); + + if (i < 20) + { + d1 *= (double)(1.0F - (float)i / 20.0F); + } + else + { + d1 = 0.0D; + } + } + + if (d1 < 1.0D) + { + if (d1 < 0.0D) + { + d1 = 0.0D; + } + + d1 = d1 * d1; + this.fogColorRed = (float)((double)this.fogColorRed * d1); + this.fogColorGreen = (float)((double)this.fogColorGreen * d1); + this.fogColorBlue = (float)((double)this.fogColorBlue * d1); + } + + if (this.bossColorModifier > 0.0F) + { + float f14 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; + this.fogColorRed = this.fogColorRed * (1.0F - f14) + this.fogColorRed * 0.7F * f14; + this.fogColorGreen = this.fogColorGreen * (1.0F - f14) + this.fogColorGreen * 0.6F * f14; + this.fogColorBlue = this.fogColorBlue * (1.0F - f14) + this.fogColorBlue * 0.6F * f14; + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.NIGHT_VISION)) + { + float f15 = this.getNightVisionBrightness((EntityLivingBase)entity, partialTicks); + float f6 = 1.0F / this.fogColorRed; + + if (f6 > 1.0F / this.fogColorGreen) + { + f6 = 1.0F / this.fogColorGreen; + } + + if (f6 > 1.0F / this.fogColorBlue) + { + f6 = 1.0F / this.fogColorBlue; + } + + this.fogColorRed = this.fogColorRed * (1.0F - f15) + this.fogColorRed * f6 * f15; + this.fogColorGreen = this.fogColorGreen * (1.0F - f15) + this.fogColorGreen * f6 * f15; + this.fogColorBlue = this.fogColorBlue * (1.0F - f15) + this.fogColorBlue * f6 * f15; + } + + if (this.mc.gameSettings.anaglyph) + { + float f16 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F; + float f17 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F; + float f7 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F; + this.fogColorRed = f16; + this.fogColorGreen = f17; + this.fogColorBlue = f7; + } + + GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + + /** + * Sets up the fog to be rendered. If the arg passed in is -1 the fog starts at 0 and goes to 80% of far plane + * distance and is used for sky rendering. + */ + private void setupFog(int startCoords, float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + GlStateManager.glFog(2918, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); + GlStateManager.glNormal3f(0.0F, -1.0F, 0.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(MobEffects.BLINDNESS)) + { + float f1 = 5.0F; + int i = ((EntityLivingBase)entity).getActivePotionEffect(MobEffects.BLINDNESS).getDuration(); + + if (i < 20) + { + f1 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)i / 20.0F); + } + + GlStateManager.setFog(GlStateManager.FogMode.LINEAR); + + if (startCoords == -1) + { + GlStateManager.setFogStart(0.0F); + GlStateManager.setFogEnd(f1 * 0.8F); + } + else + { + GlStateManager.setFogStart(f1 * 0.25F); + GlStateManager.setFogEnd(f1); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + GlStateManager.glFogi(34138, 34139); + } + } + else if (this.cloudFog) + { + GlStateManager.setFog(GlStateManager.FogMode.EXP); + GlStateManager.setFogDensity(0.1F); + } + else if (iblockstate.getMaterial() == Material.WATER) + { + GlStateManager.setFog(GlStateManager.FogMode.EXP); + + if (entity instanceof EntityLivingBase) + { + if (((EntityLivingBase)entity).isPotionActive(MobEffects.WATER_BREATHING)) + { + GlStateManager.setFogDensity(0.01F); + } + else + { + GlStateManager.setFogDensity(0.1F - (float)EnchantmentHelper.getRespirationModifier((EntityLivingBase)entity) * 0.03F); + } + } + else + { + GlStateManager.setFogDensity(0.1F); + } + } + else if (iblockstate.getMaterial() == Material.LAVA) + { + GlStateManager.setFog(GlStateManager.FogMode.EXP); + GlStateManager.setFogDensity(2.0F); + } + else + { + float f = this.farPlaneDistance; + GlStateManager.setFog(GlStateManager.FogMode.LINEAR); + + if (startCoords == -1) + { + GlStateManager.setFogStart(0.0F); + GlStateManager.setFogEnd(f); + } + else + { + GlStateManager.setFogStart(f * 0.75F); + GlStateManager.setFogEnd(f); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + GlStateManager.glFogi(34138, 34139); + } + + if (this.mc.theWorld.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ) || this.mc.ingameGUI.getBossOverlay().shouldCreateFog()) + { + GlStateManager.setFogStart(f * 0.05F); + GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); + } + } + + GlStateManager.enableColorMaterial(); + GlStateManager.enableFog(); + GlStateManager.colorMaterial(1028, 4608); + } + + /** + * Update and return fogColorBuffer with the RGBA values passed as arguments + */ + private FloatBuffer setFogColorBuffer(float red, float green, float blue, float alpha) + { + this.fogColorBuffer.clear(); + this.fogColorBuffer.put(red).put(green).put(blue).put(alpha); + this.fogColorBuffer.flip(); + return this.fogColorBuffer; + } + + public MapItemRenderer getMapItemRenderer() + { + return this.theMapItemRenderer; + } + + public static void func_189692_a(FontRenderer p_189692_0_, String p_189692_1_, float p_189692_2_, float p_189692_3_, float p_189692_4_, int p_189692_5_, float p_189692_6_, float p_189692_7_, boolean p_189692_8_, boolean p_189692_9_) + { + GlStateManager.pushMatrix(); + GlStateManager.translate(p_189692_2_, p_189692_3_, p_189692_4_); + GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-p_189692_6_, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate((float)(p_189692_8_ ? -1 : 1) * p_189692_7_, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-0.025F, -0.025F, 0.025F); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + + if (!p_189692_9_) + { + GlStateManager.disableDepth(); + } + + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + int i = p_189692_0_.getStringWidth(p_189692_1_) / 2; + GlStateManager.disableTexture2D(); + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getBuffer(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + vertexbuffer.pos((double)(-i - 1), (double)(-1 + p_189692_5_), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + vertexbuffer.pos((double)(-i - 1), (double)(8 + p_189692_5_), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + vertexbuffer.pos((double)(i + 1), (double)(8 + p_189692_5_), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + vertexbuffer.pos((double)(i + 1), (double)(-1 + p_189692_5_), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + + if (!p_189692_9_) + { + p_189692_0_.drawString(p_189692_1_, -p_189692_0_.getStringWidth(p_189692_1_) / 2, p_189692_5_, 553648127); + GlStateManager.enableDepth(); + } + + GlStateManager.depthMask(true); + p_189692_0_.drawString(p_189692_1_, -p_189692_0_.getStringWidth(p_189692_1_) / 2, p_189692_5_, p_189692_9_ ? 553648127 : -1); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } +} diff --git a/src/minecraft/net/minecraft/command/ServerCommandManager.java b/src/minecraft/net/minecraft/command/ServerCommandManager.java new file mode 100644 index 0000000..1e06f4a --- /dev/null +++ b/src/minecraft/net/minecraft/command/ServerCommandManager.java @@ -0,0 +1,180 @@ +package net.minecraft.command; + +import net.minecraft.command.server.CommandAchievement; +import net.minecraft.command.server.CommandBanIp; +import net.minecraft.command.server.CommandBanPlayer; +import net.minecraft.command.server.CommandBroadcast; +import net.minecraft.command.server.CommandDeOp; +import net.minecraft.command.server.CommandEmote; +import net.minecraft.command.server.CommandListBans; +import net.minecraft.command.server.CommandListPlayers; +import net.minecraft.command.server.CommandMessage; +import net.minecraft.command.server.CommandMessageRaw; +import net.minecraft.command.server.CommandOp; +import net.minecraft.command.server.CommandPardonIp; +import net.minecraft.command.server.CommandPardonPlayer; +import net.minecraft.command.server.CommandPublishLocalServer; +import net.minecraft.command.server.CommandSaveAll; +import net.minecraft.command.server.CommandSaveOff; +import net.minecraft.command.server.CommandSaveOn; +import net.minecraft.command.server.CommandScoreboard; +import net.minecraft.command.server.CommandSetBlock; +import net.minecraft.command.server.CommandSetDefaultSpawnpoint; +import net.minecraft.command.server.CommandStop; +import net.minecraft.command.server.CommandSummon; +import net.minecraft.command.server.CommandTeleport; +import net.minecraft.command.server.CommandTestFor; +import net.minecraft.command.server.CommandTestForBlock; +import net.minecraft.command.server.CommandWhitelist; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.rcon.RConConsoleSource; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.CommandBlockBaseLogic; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; +import cubimod.command.CommandRerender; +import cubimod.command.CommandTickSync; +import cubimod.command.CommandTickrate; + +public class ServerCommandManager extends CommandHandler implements ICommandListener +{ + private final MinecraftServer server; + + public ServerCommandManager(MinecraftServer serverIn) + { + this.server = serverIn; + this.registerCommand(new CommandTime()); + this.registerCommand(new CommandGameMode()); + this.registerCommand(new CommandDifficulty()); + this.registerCommand(new CommandDefaultGameMode()); + this.registerCommand(new CommandKill()); + this.registerCommand(new CommandToggleDownfall()); + this.registerCommand(new CommandWeather()); + this.registerCommand(new CommandXP()); + this.registerCommand(new CommandTP()); + this.registerCommand(new CommandTeleport()); + this.registerCommand(new CommandGive()); + this.registerCommand(new CommandReplaceItem()); + this.registerCommand(new CommandStats()); + this.registerCommand(new CommandEffect()); + this.registerCommand(new CommandEnchant()); + this.registerCommand(new CommandParticle()); + this.registerCommand(new CommandEmote()); + this.registerCommand(new CommandShowSeed()); + this.registerCommand(new CommandHelp()); + this.registerCommand(new CommandDebug()); + this.registerCommand(new CommandMessage()); + this.registerCommand(new CommandBroadcast()); + this.registerCommand(new CommandSetSpawnpoint()); + this.registerCommand(new CommandSetDefaultSpawnpoint()); + this.registerCommand(new CommandGameRule()); + this.registerCommand(new CommandClearInventory()); + this.registerCommand(new CommandTestFor()); + this.registerCommand(new CommandSpreadPlayers()); + this.registerCommand(new CommandPlaySound()); + this.registerCommand(new CommandScoreboard()); + this.registerCommand(new CommandExecuteAt()); + this.registerCommand(new CommandTrigger()); + this.registerCommand(new CommandAchievement()); + this.registerCommand(new CommandSummon()); + this.registerCommand(new CommandSetBlock()); + this.registerCommand(new CommandFill()); + this.registerCommand(new CommandClone()); + this.registerCommand(new CommandCompare()); + this.registerCommand(new CommandBlockData()); + this.registerCommand(new CommandTestForBlock()); + this.registerCommand(new CommandMessageRaw()); + this.registerCommand(new CommandWorldBorder()); + this.registerCommand(new CommandTitle()); + this.registerCommand(new CommandEntityData()); + this.registerCommand(new CommandStopSound()); + + // Cubitick + this.registerCommand(new CommandTickrate()); + this.registerCommand(new CommandTickSync()); + this.registerCommand(new CommandRerender()); + + if (serverIn.isDedicatedServer()) + { + this.registerCommand(new CommandOp()); + this.registerCommand(new CommandDeOp()); + this.registerCommand(new CommandStop()); + this.registerCommand(new CommandSaveAll()); + this.registerCommand(new CommandSaveOff()); + this.registerCommand(new CommandSaveOn()); + this.registerCommand(new CommandBanIp()); + this.registerCommand(new CommandPardonIp()); + this.registerCommand(new CommandBanPlayer()); + this.registerCommand(new CommandListBans()); + this.registerCommand(new CommandPardonPlayer()); + this.registerCommand(new CommandServerKick()); + this.registerCommand(new CommandListPlayers()); + this.registerCommand(new CommandWhitelist()); + this.registerCommand(new CommandSetPlayerTimeout()); + } + else + { + this.registerCommand(new CommandPublishLocalServer()); + } + + CommandBase.setCommandListener(this); + } + + /** + * Send an informative message to the server operators + */ + public void notifyListener(ICommandSender sender, ICommand command, int flags, String translationKey, Object... translationArgs) + { + boolean flag = true; + MinecraftServer minecraftserver = this.server; + + if (!sender.sendCommandFeedback()) + { + flag = false; + } + + ITextComponent itextcomponent = new TextComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new TextComponentTranslation(translationKey, translationArgs)}); + itextcomponent.getStyle().setColor(TextFormatting.GRAY); + itextcomponent.getStyle().setItalic(Boolean.valueOf(true)); + + if (flag) + { + for (EntityPlayer entityplayer : minecraftserver.getPlayerList().getPlayerList()) + { + if (entityplayer != sender && minecraftserver.getPlayerList().canSendCommands(entityplayer.getGameProfile()) && command.checkPermission(this.server, sender)) + { + boolean flag1 = sender instanceof MinecraftServer && this.server.shouldBroadcastConsoleToOps(); + boolean flag2 = sender instanceof RConConsoleSource && this.server.shouldBroadcastRconToOps(); + + if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer)) + { + entityplayer.addChatMessage(itextcomponent); + } + } + } + } + + if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands")) + { + minecraftserver.addChatMessage(itextcomponent); + } + + boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); + + if (sender instanceof CommandBlockBaseLogic) + { + flag3 = ((CommandBlockBaseLogic)sender).shouldTrackOutput(); + } + + if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer) + { + sender.addChatMessage(new TextComponentTranslation(translationKey, translationArgs)); + } + } + + protected MinecraftServer getServer() + { + return this.server; + } +} diff --git a/src/minecraft/net/minecraft/server/MinecraftServer.java b/src/minecraft/net/minecraft/server/MinecraftServer.java new file mode 100644 index 0000000..896d00a --- /dev/null +++ b/src/minecraft/net/minecraft/server/MinecraftServer.java @@ -0,0 +1,1595 @@ +package net.minecraft.server; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.base64.Base64; + +import java.awt.GraphicsEnvironment; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.Proxy; +import java.security.KeyPair; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Queue; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; + +import javax.annotation.Nullable; +import javax.imageio.ImageIO; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandManager; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.ICrashReportDetail; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetworkSystem; +import net.minecraft.network.ServerStatusResponse; +import net.minecraft.network.play.server.SPacketTimeUpdate; +import net.minecraft.profiler.ISnooperInfo; +import net.minecraft.profiler.Profiler; +import net.minecraft.profiler.Snooper; +import net.minecraft.server.management.PlayerList; +import net.minecraft.server.management.PlayerProfileCache; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.IThreadListener; +import net.minecraft.util.ITickable; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Util; +import net.minecraft.util.datafix.DataFixer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.GameType; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.ServerWorldEventHandler; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldServerMulti; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.storage.AnvilSaveConverter; +import net.minecraft.world.demo.DemoWorldServer; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.google.common.collect.Queues; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListenableFutureTask; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfileRepository; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + +import cubimod.Cubitick; + +public abstract class MinecraftServer implements Runnable, ICommandSender, IThreadListener, ISnooperInfo +{ + // Cubitick: msToTick = milliseconds until server ticks + public static long msToTick; + public static MinecraftServer currentInstance; + + private static final Logger LOG = LogManager.getLogger(); + public static final File USER_CACHE_FILE = new File("usercache.json"); + private final ISaveFormat anvilConverterForAnvilFile; + + /** The PlayerUsageSnooper instance. */ + private final Snooper usageSnooper = new Snooper("server", this, getCurrentTimeMillis()); + private final File anvilFile; + private final List tickables = Lists.newArrayList(); + public final ICommandManager commandManager; + public final Profiler theProfiler = new Profiler(); + private final NetworkSystem networkSystem; + private final ServerStatusResponse statusResponse = new ServerStatusResponse(); + private final Random random = new Random(); + private final DataFixer dataFixer; + + /** The server's port. */ + private int serverPort = -1; + + /** The server world instances. */ + public WorldServer[] worldServers; + + /** The player list for this server */ + private PlayerList playerList; + + /** + * Indicates whether the server is running or not. Set to false to initiate a shutdown. + */ + private boolean serverRunning = true; + + /** Indicates to other classes that the server is safely stopped. */ + private boolean serverStopped; + + /** Incremented every tick. */ + private int tickCounter; + protected final Proxy serverProxy; + + /** + * The task the server is currently working on(and will output on outputPercentRemaining). + */ + public String currentTask; + + /** The percentage of the current task finished so far. */ + public int percentDone; + + /** True if the server is in online mode. */ + private boolean onlineMode; + + /** True if the server has animals turned on. */ + private boolean canSpawnAnimals; + private boolean canSpawnNPCs; + + /** Indicates whether PvP is active on the server or not. */ + private boolean pvpEnabled; + + /** Determines if flight is allowed or not. */ + private boolean allowFlight; + + /** The server MOTD string. */ + private String motd; + + /** Maximum build height. */ + private int buildLimit; + private int maxPlayerIdleMinutes; + public final long[] tickTimeArray = new long[100]; + + /** Stats are [dimension][tick%100] system.nanoTime is stored. */ + public long[][] timeOfLastDimensionTick; + private KeyPair serverKeyPair; + + /** Username of the server owner (for integrated servers) */ + private String serverOwner; + private String folderName; + private String worldName; + private boolean isDemo; + private boolean enableBonusChest; + + /** The texture pack for the server */ + private String resourcePackUrl = ""; + private String resourcePackHash = ""; + private boolean serverIsRunning; + + /** + * Set when warned for "Can't keep up", which triggers again after 15 seconds. + */ + private long timeOfLastWarning; + private String userMessage; + private boolean startProfiling; + private boolean isGamemodeForced; + private final YggdrasilAuthenticationService authService; + private final MinecraftSessionService sessionService; + private final GameProfileRepository profileRepo; + private final PlayerProfileCache profileCache; + private long nanoTimeSinceStatusRefresh; + public final Queue < FutureTask> futureTaskQueue = Queues. < FutureTask> newArrayDeque(); + private Thread serverThread; + private long currentTime = getCurrentTimeMillis(); + private boolean worldIconSet; + + public MinecraftServer(File anvilFileIn, Proxy proxyIn, DataFixer dataFixerIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn) + { + this.serverProxy = proxyIn; + this.authService = authServiceIn; + this.sessionService = sessionServiceIn; + this.profileRepo = profileRepoIn; + this.profileCache = profileCacheIn; + this.anvilFile = anvilFileIn; + this.networkSystem = new NetworkSystem(this); + this.commandManager = this.createNewCommandManager(); + this.anvilConverterForAnvilFile = new AnvilSaveConverter(anvilFileIn, dataFixerIn); + this.dataFixer = dataFixerIn; + + // Cubitick: need a static instance + currentInstance = this; + } + + public ServerCommandManager createNewCommandManager() + { + return new ServerCommandManager(this); + } + + // Cubitick: used in the GuiChat class to interrupt the server's sleep + public static void interruptTickSleep() + { + MinecraftServer mcs = currentInstance; + if(mcs == null) { + LOG.warn("[Cubitick] Warning: Tried to interrupt server tick sleep, but server is null."); + return; + } + mcs.currentTime = mcs.getCurrentTimeMillis(); + mcs.msToTick = -1; + } + + /** + * Initialises the server and starts it. + */ + public abstract boolean startServer() throws IOException; + + public void convertMapIfNeeded(String worldNameIn) + { + if (this.getActiveAnvilConverter().isOldMapFormat(worldNameIn)) + { + LOG.info("Converting map!"); + this.setUserMessage("menu.convertingLevel"); + this.getActiveAnvilConverter().convertMapFormat(worldNameIn, new IProgressUpdate() + { + private long startTime = System.currentTimeMillis(); + public void displaySavingString(String message) + { + } + public void resetProgressAndMessage(String message) + { + } + public void setLoadingProgress(int progress) + { + if (System.currentTimeMillis() - this.startTime >= 1000L) + { + this.startTime = System.currentTimeMillis(); + MinecraftServer.LOG.info("Converting... {}%", new Object[] {Integer.valueOf(progress)}); + } + } + public void setDoneWorking() + { + } + public void displayLoadingString(String message) + { + } + }); + } + } + + /** + * Typically "menu.convertingLevel", "menu.loadingLevel" or others. + */ + protected synchronized void setUserMessage(String message) + { + this.userMessage = message; + } + + public synchronized String getUserMessage() + { + return this.userMessage; + } + + public void loadAllWorlds(String saveName, String worldNameIn, long seed, WorldType type, String generatorOptions) + { + this.convertMapIfNeeded(saveName); + this.setUserMessage("menu.loadingLevel"); + this.worldServers = new WorldServer[3]; + this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(saveName, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + WorldSettings worldsettings; + + if (worldinfo == null) + { + if (this.isDemo()) + { + worldsettings = DemoWorldServer.DEMO_WORLD_SETTINGS; + } + else + { + worldsettings = new WorldSettings(seed, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), type); + worldsettings.setGeneratorOptions(generatorOptions); + + if (this.enableBonusChest) + { + worldsettings.enableBonusChest(); + } + } + + worldinfo = new WorldInfo(worldsettings, worldNameIn); + } + else + { + worldinfo.setWorldName(worldNameIn); + worldsettings = new WorldSettings(worldinfo); + } + + for (int i = 0; i < this.worldServers.length; ++i) + { + int j = 0; + + if (i == 1) + { + j = -1; + } + + if (i == 2) + { + j = 1; + } + + if (i == 0) + { + if (this.isDemo()) + { + this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); + } + else + { + this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); + } + + this.worldServers[i].initialize(worldsettings); + } + else + { + this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); + } + + this.worldServers[i].addEventListener(new ServerWorldEventHandler(this, this.worldServers[i])); + + if (!this.isSinglePlayer()) + { + this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); + } + } + + this.playerList.setPlayerManager(this.worldServers); + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } + + public void initialWorldChunkLoad() + { + int i = 16; + int j = 4; + int k = 192; + int l = 625; + int i1 = 0; + this.setUserMessage("menu.generatingTerrain"); + int j1 = 0; + LOG.info("Preparing start region for level 0"); + WorldServer worldserver = this.worldServers[0]; + BlockPos blockpos = worldserver.getSpawnPoint(); + long k1 = getCurrentTimeMillis(); + + for (int l1 = -192; l1 <= 192 && this.isServerRunning(); l1 += 16) + { + for (int i2 = -192; i2 <= 192 && this.isServerRunning(); i2 += 16) + { + long j2 = getCurrentTimeMillis(); + + if (j2 - k1 > 1000L) + { + this.outputPercentRemaining("Preparing spawn area", i1 * 100 / 625); + k1 = j2; + } + + ++i1; + worldserver.getChunkProvider().provideChunk(blockpos.getX() + l1 >> 4, blockpos.getZ() + i2 >> 4); + } + } + + this.clearCurrentTask(); + } + + public void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) + { + File file1 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip"); + + if (file1.isFile()) + { + this.setResourcePack("level://" + worldNameIn + "/" + "resources.zip", ""); + } + } + + public abstract boolean canStructuresSpawn(); + + public abstract GameType getGameType(); + + /** + * Get the server's difficulty + */ + public abstract EnumDifficulty getDifficulty(); + + /** + * Defaults to false. + */ + public abstract boolean isHardcore(); + + public abstract int getOpPermissionLevel(); + + /** + * Get if RCON command events should be broadcast to ops + */ + public abstract boolean shouldBroadcastRconToOps(); + + /** + * Get if console command events should be broadcast to ops + */ + public abstract boolean shouldBroadcastConsoleToOps(); + + /** + * Used to display a percent remaining given text and the percentage. + */ + protected void outputPercentRemaining(String message, int percent) + { + this.currentTask = message; + this.percentDone = percent; + LOG.info("{}: {}%", new Object[] {message, Integer.valueOf(percent)}); + } + + /** + * Set current task to null and set its percentage to 0. + */ + protected void clearCurrentTask() + { + this.currentTask = null; + this.percentDone = 0; + } + + /** + * par1 indicates if a log message should be output. + */ + public void saveAllWorlds(boolean dontLog) + { + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + if (!dontLog) + { + LOG.info("Saving chunks for level \'{}\'/{}", new Object[] {worldserver.getWorldInfo().getWorldName(), worldserver.provider.getDimensionType().getName()}); + } + + try + { + worldserver.saveAllChunks(true, (IProgressUpdate)null); + } + catch (MinecraftException minecraftexception) + { + LOG.warn(minecraftexception.getMessage()); + } + } + } + } + + /** + * Saves all necessary data as preparation for stopping the server. + */ + public void stopServer() + { + LOG.info("Stopping server"); + + if (this.getNetworkSystem() != null) + { + this.getNetworkSystem().terminateEndpoints(); + } + + if (this.playerList != null) + { + LOG.info("Saving players"); + this.playerList.saveAllPlayerData(); + this.playerList.removeAllPlayers(); + } + + if (this.worldServers != null) + { + LOG.info("Saving worlds"); + + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + worldserver.disableLevelSaving = false; + } + } + + this.saveAllWorlds(false); + + for (WorldServer worldserver1 : this.worldServers) + { + if (worldserver1 != null) + { + worldserver1.flush(); + } + } + } + + if (this.usageSnooper.isSnooperRunning()) + { + this.usageSnooper.stopSnooper(); + } + } + + public boolean isServerRunning() + { + return this.serverRunning; + } + + /** + * Sets the serverRunning variable to false, in order to get the server to shut down. + */ + public void initiateShutdown() + { + this.serverRunning = false; + } + + public void run() + { + try + { + if (this.startServer()) + { + this.currentTime = getCurrentTimeMillis(); + long i = 0L; + this.statusResponse.setServerDescription(new TextComponentString(this.motd)); + this.statusResponse.setVersion(new ServerStatusResponse.Version("1.10", 210)); + this.applyServerIconToResponse(this.statusResponse); + + while (this.serverRunning) + { + long k = getCurrentTimeMillis(); + long j = k - this.currentTime; + + // Cubitick: adjusted some timings + if (j > 100*Cubitick.getTickms() && this.currentTime - this.timeOfLastWarning >= 15000L) + { + LOG.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] {Long.valueOf(j), Long.valueOf(j / 50L)}); + j = (long)(100*Cubitick.getTickms()); + this.timeOfLastWarning = this.currentTime; + } + + if (j < 0L) + { + LOG.warn("Time ran backwards! Did the system time change?"); + j = 0L; + } + + i += j; + this.currentTime = k; + + if (this.worldServers[0].areAllPlayersAsleep()) + { + this.tick(); + i = 0L; + } + else + { + // Cubitick + while (i > Cubitick.getTickms()) + { + i -= Cubitick.getTickms(); + this.tick(); + } + } + + // Cubitick + // *************** The Tickrate Magic Happens Here *************** + // original line: Thread.sleep(Math.max(1L, 50L - i)); + + msToTick = (long)(Cubitick.getTickms() - i); + if(msToTick <= 0L) { + if(Cubitick.tickrateWorld > 20.0 && !Cubitick.synctick) msToTick = 0L; + else msToTick = 1L; + } + for(long ms = 0; ms < msToTick; ms++) { + Thread.sleep(1L); + if(!Cubitick.synctick) { + } + } + + // Cubitick: process the chat (for low tickrates where we can't wait for the tick to finish) + if(!Cubitick.synctick && msToTick < 0) + { + synchronized (this.futureTaskQueue) + { + while (!this.futureTaskQueue.isEmpty()) + { + try + { + ((FutureTask)this.futureTaskQueue.poll()).run(); + } + catch (Throwable var9) + { + LOG.fatal(var9); + } + } + } + } + + this.serverIsRunning = true; + } + } + else + { + this.finalTick((CrashReport)null); + } + } + catch (Throwable throwable1) + { + LOG.error("Encountered an unexpected exception", throwable1); + CrashReport crashreport = null; + + if (throwable1 instanceof ReportedException) + { + crashreport = this.addServerInfoToCrashReport(((ReportedException)throwable1).getCrashReport()); + } + else + { + crashreport = this.addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", throwable1)); + } + + File file1 = new File(new File(this.getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt"); + + if (crashreport.saveToFile(file1)) + { + LOG.error("This crash report has been saved to: {}", new Object[] {file1.getAbsolutePath()}); + } + else + { + LOG.error("We were unable to save this crash report to disk."); + } + + this.finalTick(crashreport); + } + finally + { + try + { + this.serverStopped = true; + this.stopServer(); + } + catch (Throwable throwable) + { + LOG.error("Exception stopping the server", throwable); + } + finally + { + this.systemExitNow(); + } + } + } + + public void applyServerIconToResponse(ServerStatusResponse response) + { + File file1 = this.getFile("server-icon.png"); + + if (!file1.exists()) + { + file1 = this.getActiveAnvilConverter().getFile(this.getFolderName(), "icon.png"); + } + + if (file1.isFile()) + { + ByteBuf bytebuf = Unpooled.buffer(); + + try + { + BufferedImage bufferedimage = ImageIO.read(file1); + Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]); + Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]); + ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf))); + ByteBuf bytebuf1 = Base64.encode(bytebuf); + response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8)); + } + catch (Exception exception) + { + LOG.error((String)"Couldn\'t load server icon", (Throwable)exception); + } + finally + { + bytebuf.release(); + } + } + } + + public boolean isWorldIconSet() + { + this.worldIconSet = this.worldIconSet || this.getWorldIconFile().isFile(); + return this.worldIconSet; + } + + public File getWorldIconFile() + { + return this.getActiveAnvilConverter().getFile(this.getFolderName(), "icon.png"); + } + + public File getDataDirectory() + { + return new File("."); + } + + /** + * Called on exit from the main run() loop. + */ + public void finalTick(CrashReport report) + { + } + + /** + * Directly calls System.exit(0), instantly killing the program. + */ + public void systemExitNow() + { + } + + /** + * Main function called by run() every loop. + */ + public void tick() + { + long i = System.nanoTime(); + ++this.tickCounter; + + if (this.startProfiling) + { + this.startProfiling = false; + this.theProfiler.profilingEnabled = true; + this.theProfiler.clearProfiling(); + } + + this.theProfiler.startSection("root"); + this.updateTimeLightAndEntities(); + + if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L) + { + this.nanoTimeSinceStatusRefresh = i; + this.statusResponse.setPlayers(new ServerStatusResponse.Players(this.getMaxPlayers(), this.getCurrentPlayerCount())); + GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)]; + int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length); + + for (int k = 0; k < agameprofile.length; ++k) + { + agameprofile[k] = ((EntityPlayerMP)this.playerList.getPlayerList().get(j + k)).getGameProfile(); + } + + Collections.shuffle(Arrays.asList(agameprofile)); + this.statusResponse.getPlayers().setPlayers(agameprofile); + } + + if (this.tickCounter % 900 == 0) + { + this.theProfiler.startSection("save"); + this.playerList.saveAllPlayerData(); + this.saveAllWorlds(true); + this.theProfiler.endSection(); + } + + this.theProfiler.startSection("tallying"); + this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i; + this.theProfiler.endSection(); + this.theProfiler.startSection("snooper"); + + if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100) + { + this.usageSnooper.startSnooper(); + } + + if (this.tickCounter % 6000 == 0) + { + this.usageSnooper.addMemoryStatsToSnooper(); + } + + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + public void updateTimeLightAndEntities() + { + this.theProfiler.startSection("jobs"); + + synchronized (this.futureTaskQueue) + { + while (!this.futureTaskQueue.isEmpty()) + { + Util.runTask((FutureTask)this.futureTaskQueue.poll(), LOG); + } + } + + this.theProfiler.endStartSection("levels"); + + for (int j = 0; j < this.worldServers.length; ++j) + { + long i = System.nanoTime(); + + if (j == 0 || this.getAllowNether()) + { + WorldServer worldserver = this.worldServers[j]; + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + + if (this.tickCounter % 20 == 0) + { + this.theProfiler.startSection("timeSync"); + this.playerList.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionType().getId()); + this.theProfiler.endSection(); + } + + this.theProfiler.startSection("tick"); + + try + { + worldserver.tick(); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world"); + worldserver.addWorldInfoToCrashReport(crashreport); + throw new ReportedException(crashreport); + } + + try + { + worldserver.updateEntities(); + } + catch (Throwable throwable) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities"); + worldserver.addWorldInfoToCrashReport(crashreport1); + throw new ReportedException(crashreport1); + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + worldserver.getEntityTracker().updateTrackedEntities(); + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; + } + + this.theProfiler.endStartSection("connection"); + this.getNetworkSystem().networkTick(); + this.theProfiler.endStartSection("players"); + this.playerList.onTick(); + this.theProfiler.endStartSection("tickables"); + + for (int k = 0; k < this.tickables.size(); ++k) + { + ((ITickable)this.tickables.get(k)).update(); + } + + this.theProfiler.endSection(); + } + + public boolean getAllowNether() + { + return true; + } + + public void startServerThread() + { + this.serverThread = new Thread(this, "Server thread"); + this.serverThread.start(); + } + + /** + * Returns a File object from the specified string. + */ + public File getFile(String fileName) + { + return new File(this.getDataDirectory(), fileName); + } + + /** + * Logs the message with a level of WARN. + */ + public void logWarning(String msg) + { + LOG.warn(msg); + } + + /** + * Gets the worldServer by the given dimension. + */ + public WorldServer worldServerForDimension(int dimension) + { + return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); + } + + /** + * Returns the server's Minecraft version as string. + */ + public String getMinecraftVersion() + { + return "1.10"; + } + + /** + * Returns the number of players currently on the server. + */ + public int getCurrentPlayerCount() + { + return this.playerList.getCurrentPlayerCount(); + } + + /** + * Returns the maximum number of players allowed on the server. + */ + public int getMaxPlayers() + { + return this.playerList.getMaxPlayers(); + } + + /** + * Returns an array of the usernames of all the connected players. + */ + public String[] getAllUsernames() + { + return this.playerList.getAllUsernames(); + } + + /** + * Returns an array of the GameProfiles of all the connected players + */ + public GameProfile[] getGameProfiles() + { + return this.playerList.getAllProfiles(); + } + + public String getServerModName() + { + return "vanilla"; + } + + /** + * Adds the server info, including from theWorldServer, to the crash report. + */ + public CrashReport addServerInfoToCrashReport(CrashReport report) + { + report.getCategory().func_189529_a("Profiler Position", new ICrashReportDetail() + { + public String call() throws Exception + { + return MinecraftServer.this.theProfiler.profilingEnabled ? MinecraftServer.this.theProfiler.getNameOfLastSection() : "N/A (disabled)"; + } + }); + + if (this.playerList != null) + { + report.getCategory().func_189529_a("Player Count", new ICrashReportDetail() + { + public String call() + { + return MinecraftServer.this.playerList.getCurrentPlayerCount() + " / " + MinecraftServer.this.playerList.getMaxPlayers() + "; " + MinecraftServer.this.playerList.getPlayerList(); + } + }); + } + + return report; + } + + public List getTabCompletions(ICommandSender sender, String input, @Nullable BlockPos pos, boolean hasTargetBlock) + { + List list = Lists.newArrayList(); + boolean flag = input.startsWith("/"); + + if (flag) + { + input = input.substring(1); + } + + if (!flag && !hasTargetBlock) + { + String[] astring = input.split(" ", -1); + String s2 = astring[astring.length - 1]; + + for (String s1 : this.playerList.getAllUsernames()) + { + if (CommandBase.doesStringStartWith(s2, s1)) + { + list.add(s1); + } + } + + return list; + } + else + { + boolean flag1 = !input.contains(" "); + List list1 = this.commandManager.getTabCompletionOptions(sender, input, pos); + + if (!list1.isEmpty()) + { + for (String s : list1) + { + if (flag1) + { + list.add("/" + s); + } + else + { + list.add(s); + } + } + } + + return list; + } + } + + public boolean isAnvilFileSet() + { + return this.anvilFile != null; + } + + /** + * Get the name of this object. For players this returns their username + */ + public String getName() + { + return "Server"; + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(ITextComponent component) + { + LOG.info(component.getUnformattedText()); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return true; + } + + public ICommandManager getCommandManager() + { + return this.commandManager; + } + + /** + * Gets KeyPair instanced in MinecraftServer. + */ + public KeyPair getKeyPair() + { + return this.serverKeyPair; + } + + /** + * Returns the username of the server owner (for integrated servers) + */ + public String getServerOwner() + { + return this.serverOwner; + } + + /** + * Sets the username of the owner of this server (in the case of an integrated server) + */ + public void setServerOwner(String owner) + { + this.serverOwner = owner; + } + + public boolean isSinglePlayer() + { + return this.serverOwner != null; + } + + public String getFolderName() + { + return this.folderName; + } + + public void setFolderName(String name) + { + this.folderName = name; + } + + public void setWorldName(String worldNameIn) + { + this.worldName = worldNameIn; + } + + public String getWorldName() + { + return this.worldName; + } + + public void setKeyPair(KeyPair keyPair) + { + this.serverKeyPair = keyPair; + } + + public void setDifficultyForAllWorlds(EnumDifficulty difficulty) + { + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + if (worldserver.getWorldInfo().isHardcoreModeEnabled()) + { + worldserver.getWorldInfo().setDifficulty(EnumDifficulty.HARD); + worldserver.setAllowedSpawnTypes(true, true); + } + else if (this.isSinglePlayer()) + { + worldserver.getWorldInfo().setDifficulty(difficulty); + worldserver.setAllowedSpawnTypes(worldserver.getDifficulty() != EnumDifficulty.PEACEFUL, true); + } + else + { + worldserver.getWorldInfo().setDifficulty(difficulty); + worldserver.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals); + } + } + } + } + + public boolean allowSpawnMonsters() + { + return true; + } + + /** + * Gets whether this is a demo or not. + */ + public boolean isDemo() + { + return this.isDemo; + } + + /** + * Sets whether this is a demo or not. + */ + public void setDemo(boolean demo) + { + this.isDemo = demo; + } + + public void canCreateBonusChest(boolean enable) + { + this.enableBonusChest = enable; + } + + public ISaveFormat getActiveAnvilConverter() + { + return this.anvilConverterForAnvilFile; + } + + public String getResourcePackUrl() + { + return this.resourcePackUrl; + } + + public String getResourcePackHash() + { + return this.resourcePackHash; + } + + public void setResourcePack(String url, String hash) + { + this.resourcePackUrl = url; + this.resourcePackHash = hash; + } + + public void addServerStatsToSnooper(Snooper playerSnooper) + { + playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false)); + playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0)); + + if (this.playerList != null) + { + playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount())); + playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers())); + playerSnooper.addClientStat("players_seen", Integer.valueOf(this.playerList.getAvailablePlayerDat().length)); + } + + playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode)); + playerSnooper.addClientStat("gui_state", this.getGuiEnabled() ? "enabled" : "disabled"); + playerSnooper.addClientStat("run_time", Long.valueOf((getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L)); + playerSnooper.addClientStat("avg_tick_ms", Integer.valueOf((int)(MathHelper.average(this.tickTimeArray) * 1.0E-6D))); + int i = 0; + + if (this.worldServers != null) + { + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + WorldInfo worldinfo = worldserver.getWorldInfo(); + playerSnooper.addClientStat("world[" + i + "][dimension]", Integer.valueOf(worldserver.provider.getDimensionType().getId())); + playerSnooper.addClientStat("world[" + i + "][mode]", worldinfo.getGameType()); + playerSnooper.addClientStat("world[" + i + "][difficulty]", worldserver.getDifficulty()); + playerSnooper.addClientStat("world[" + i + "][hardcore]", Boolean.valueOf(worldinfo.isHardcoreModeEnabled())); + playerSnooper.addClientStat("world[" + i + "][generator_name]", worldinfo.getTerrainType().getWorldTypeName()); + playerSnooper.addClientStat("world[" + i + "][generator_version]", Integer.valueOf(worldinfo.getTerrainType().getGeneratorVersion())); + playerSnooper.addClientStat("world[" + i + "][height]", Integer.valueOf(this.buildLimit)); + playerSnooper.addClientStat("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.getChunkProvider().getLoadedChunkCount())); + ++i; + } + } + } + + playerSnooper.addClientStat("worlds", Integer.valueOf(i)); + } + + public void addServerTypeToSnooper(Snooper playerSnooper) + { + playerSnooper.addStatToSnooper("singleplayer", Boolean.valueOf(this.isSinglePlayer())); + playerSnooper.addStatToSnooper("server_brand", this.getServerModName()); + playerSnooper.addStatToSnooper("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported"); + playerSnooper.addStatToSnooper("dedicated", Boolean.valueOf(this.isDedicatedServer())); + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return true; + } + + public abstract boolean isDedicatedServer(); + + public boolean isServerInOnlineMode() + { + return this.onlineMode; + } + + public void setOnlineMode(boolean online) + { + this.onlineMode = online; + } + + public boolean getCanSpawnAnimals() + { + return this.canSpawnAnimals; + } + + public void setCanSpawnAnimals(boolean spawnAnimals) + { + this.canSpawnAnimals = spawnAnimals; + } + + public boolean getCanSpawnNPCs() + { + return this.canSpawnNPCs; + } + + /** + * Get if native transport should be used. Native transport means linux server performance improvements and + * optimized packet sending/receiving on linux + */ + public abstract boolean shouldUseNativeTransport(); + + public void setCanSpawnNPCs(boolean spawnNpcs) + { + this.canSpawnNPCs = spawnNpcs; + } + + public boolean isPVPEnabled() + { + return this.pvpEnabled; + } + + public void setAllowPvp(boolean allowPvp) + { + this.pvpEnabled = allowPvp; + } + + public boolean isFlightAllowed() + { + return this.allowFlight; + } + + public void setAllowFlight(boolean allow) + { + this.allowFlight = allow; + } + + /** + * Return whether command blocks are enabled. + */ + public abstract boolean isCommandBlockEnabled(); + + public String getMOTD() + { + return this.motd; + } + + public void setMOTD(String motdIn) + { + this.motd = motdIn; + } + + public int getBuildLimit() + { + return this.buildLimit; + } + + public void setBuildLimit(int maxBuildHeight) + { + this.buildLimit = maxBuildHeight; + } + + public boolean isServerStopped() + { + return this.serverStopped; + } + + public PlayerList getPlayerList() + { + return this.playerList; + } + + public void setPlayerList(PlayerList list) + { + this.playerList = list; + } + + /** + * Sets the game type for all worlds. + */ + public void setGameType(GameType gameMode) + { + for (WorldServer worldserver : this.worldServers) + { + worldserver.getWorldInfo().setGameType(gameMode); + } + } + + public NetworkSystem getNetworkSystem() + { + return this.networkSystem; + } + + public boolean serverIsInRunLoop() + { + return this.serverIsRunning; + } + + public boolean getGuiEnabled() + { + return false; + } + + /** + * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. + */ + public abstract String shareToLAN(GameType type, boolean allowCheats); + + public int getTickCounter() + { + return this.tickCounter; + } + + public void enableProfiling() + { + this.startProfiling = true; + } + + public Snooper getPlayerUsageSnooper() + { + return this.usageSnooper; + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return BlockPos.ORIGIN; + } + + /** + * Get the position vector. {@code null} is not allowed! If you are not an entity in the world, return 0.0D, + * 0.0D, 0.0D + */ + public Vec3d getPositionVector() + { + return Vec3d.ZERO; + } + + /** + * Get the world, if available. {@code null} is not allowed! If you are not an entity in the world, return + * the overworld + */ + public World getEntityWorld() + { + return this.worldServers[0]; + } + + /** + * Returns the entity associated with the command sender. MAY BE NULL! + */ + public Entity getCommandSenderEntity() + { + return null; + } + + public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + return false; + } + + public boolean getForceGamemode() + { + return this.isGamemodeForced; + } + + public Proxy getServerProxy() + { + return this.serverProxy; + } + + public static long getCurrentTimeMillis() + { + return System.currentTimeMillis(); + } + + public int getMaxPlayerIdleMinutes() + { + return this.maxPlayerIdleMinutes; + } + + public void setPlayerIdleTimeout(int idleTimeout) + { + this.maxPlayerIdleMinutes = idleTimeout; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public ITextComponent getDisplayName() + { + return new TextComponentString(this.getName()); + } + + public boolean isAnnouncingPlayerAchievements() + { + return true; + } + + public MinecraftSessionService getMinecraftSessionService() + { + return this.sessionService; + } + + public GameProfileRepository getGameProfileRepository() + { + return this.profileRepo; + } + + public PlayerProfileCache getPlayerProfileCache() + { + return this.profileCache; + } + + public ServerStatusResponse getServerStatusResponse() + { + return this.statusResponse; + } + + public void refreshStatusNextTick() + { + this.nanoTimeSinceStatusRefresh = 0L; + } + + @Nullable + public Entity getEntityFromUuid(UUID uuid) + { + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + Entity entity = worldserver.getEntityFromUuid(uuid); + + if (entity != null) + { + return entity; + } + } + } + + return null; + } + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + public boolean sendCommandFeedback() + { + return this.worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); + } + + public void setCommandStat(CommandResultStats.Type type, int amount) + { + } + + /** + * Get the Minecraft server instance + */ + public MinecraftServer getServer() + { + // Cubitick: need a static instance + return currentInstance = this; + } + + public int getMaxWorldSize() + { + return 29999984; + } + + public ListenableFuture callFromMainThread(Callable callable) + { + Validate.notNull(callable); + + if (!this.isCallingFromMinecraftThread() && !this.isServerStopped()) + { + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); + + synchronized (this.futureTaskQueue) + { + this.futureTaskQueue.add(listenablefuturetask); + return listenablefuturetask; + } + } + else + { + try + { + return Futures.immediateFuture(callable.call()); + } + catch (Exception exception) + { + return Futures.immediateFailedCheckedFuture(exception); + } + } + } + + public ListenableFuture addScheduledTask(Runnable runnableToSchedule) + { + Validate.notNull(runnableToSchedule); + return this.callFromMainThread(Executors.callable(runnableToSchedule)); + } + + public boolean isCallingFromMinecraftThread() + { + return Thread.currentThread() == this.serverThread; + } + + /** + * The compression treshold. If the packet is larger than the specified amount of bytes, it will be compressed + */ + public int getNetworkCompressionThreshold() + { + return 256; + } + + public DataFixer getDataFixer() + { + return this.dataFixer; + } + + public int getSpawnRadius(@Nullable WorldServer worldIn) + { + return worldIn != null ? worldIn.getGameRules().getInt("spawnRadius") : 10; + } +}