From 7fa69fff7d11826c4804024ea2ad6ff40e83357a Mon Sep 17 00:00:00 2001 From: Cubitect Date: Sat, 16 Apr 2016 16:48:12 +0100 Subject: [PATCH] Initial obfuscated mod: [1.9.2]v1.5.1 --- README.md | 2 + fixvers.sh | 30 + src/CommandRerender.java | 59 + src/CommandTickSync.java | 41 + src/CommandTickrate.java | 41 + src/{minecraft/cubimod => }/Cubitick.java | 38 +- src/GuiPacketOptionsList.java | 139 + src/GuiServerPackets.java | 105 + src/MinecraftServer.java | 1141 +++++ src/Namepipe.java | 18 + .../settings => }/ServerPacketData.java | 1445 +++--- 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 +++++++ .../cubimod/command/CommandRerender.java | 56 - .../cubimod/command/CommandTickSync.java | 65 - .../cubimod/command/CommandTickrate.java | 64 - .../cubimod/gui/GuiPacketOptionsList.java | 131 - .../cubimod/gui/GuiServerPackets.java | 109 - .../net/minecraft/client/Minecraft.java | 3974 ----------------- .../net/minecraft/client/gui/GuiChat.java | 367 -- .../net/minecraft/client/gui/GuiOptions.java | 250 -- .../minecraft/client/gui/GuiOverlayDebug.java | 268 -- .../client/network/NetHandlerPlayClient.java | 2692 ----------- .../client/renderer/EntityRenderer.java | 2272 ---------- .../command/ServerCommandManager.java | 168 - .../net/minecraft/server/MinecraftServer.java | 1593 ------- 31 files changed, 9261 insertions(+), 12749 deletions(-) create mode 100755 fixvers.sh create mode 100644 src/CommandRerender.java create mode 100644 src/CommandTickSync.java create mode 100644 src/CommandTickrate.java rename src/{minecraft/cubimod => }/Cubitick.java (73%) create mode 100644 src/GuiPacketOptionsList.java create mode 100644 src/GuiServerPackets.java create mode 100644 src/MinecraftServer.java create mode 100644 src/Namepipe.java rename src/{minecraft/cubimod/settings => }/ServerPacketData.java (54%) create mode 100644 src/bc.java create mode 100644 src/bcc.java create mode 100644 src/bcz.java create mode 100644 src/beb.java create mode 100644 src/bes.java create mode 100644 src/bkp.java create mode 100644 src/bnd.java delete mode 100644 src/minecraft/cubimod/command/CommandRerender.java delete mode 100644 src/minecraft/cubimod/command/CommandTickSync.java delete mode 100644 src/minecraft/cubimod/command/CommandTickrate.java delete mode 100644 src/minecraft/cubimod/gui/GuiPacketOptionsList.java delete mode 100644 src/minecraft/cubimod/gui/GuiServerPackets.java delete mode 100644 src/minecraft/net/minecraft/client/Minecraft.java delete mode 100644 src/minecraft/net/minecraft/client/gui/GuiChat.java delete mode 100644 src/minecraft/net/minecraft/client/gui/GuiOptions.java delete mode 100644 src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java delete mode 100644 src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java delete mode 100644 src/minecraft/net/minecraft/client/renderer/EntityRenderer.java delete mode 100644 src/minecraft/net/minecraft/command/ServerCommandManager.java delete mode 100644 src/minecraft/net/minecraft/server/MinecraftServer.java diff --git a/README.md b/README.md index 791a627..ac5a8fb 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,5 @@ Cubitick 1.4.X+ comes bundled with a packet analysis tool which lets you view th ## 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. +Some versions of this mod are written by modifying minecraft's obfuscated code (for minecraft versions were MCP is unavailable). For those version I used the [CFR java decompiler](http://www.benf.org/other/cfr/) to get the source code. However, it turns out that it is not possible to modify the MinecraftServer class this way, as only classes in the default directory are accessible this way. To work around this issue I used [Krakatau Bytecode Tools](https://github.com/Storyyeller/Krakatau) to move the MinecraftServer class into the default directory. + diff --git a/fixvers.sh b/fixvers.sh new file mode 100755 index 0000000..40e3968 --- /dev/null +++ b/fixvers.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# To use, place this file inside the minecraft version directory, and run: +# ./fixvers.sh [VERSION_DIR] +# Where the actual minecraft jar file should be located at "./VERSION_DIR/VERSION_DIR.jar" + +# This script disassembles and fixes the internal name of net/minecraft/server/MinecraftServer +# such that it becomes accessable to the modded classes. The 'fixed' classes are placed in '$out'. +# The disassembler used here is the "Krakatau Bytecode Tools" by Robert Grosse. + +tmp="./tmp_deasm" +out="./$1/fixclasses" +krakatauDir="./Krakatau-master" + +unzip -q ./$1/$1.jar -d $out +python $krakatauDir/disassemble.py -r $out -out $tmp 1>/dev/null +rm -r $out/* +rm $(grep -rL 'MinecraftServer' $tmp/* 2>/dev/null) 2>/dev/null +mv $tmp/net/minecraft/server/MinecraftServer* $tmp +find $tmp -type f -print0 | xargs -0 sed -i 's#net/minecraft/server/MinecraftServer#MinecraftServer#g' +python $krakatauDir/assemble.py -q -r $tmp -out $out +rm -r $tmp +if [ ! -e ./$1/$1_ori.jar ] +then + cp ./$1/$1.jar ./$1/$1_ori.jar +fi +wdir=$(pwd) +cd $out +jar uf $wdir/$1/$1.jar ./*.class +cd $wdir diff --git a/src/CommandRerender.java b/src/CommandRerender.java new file mode 100644 index 0000000..2cd0110 --- /dev/null +++ b/src/CommandRerender.java @@ -0,0 +1,59 @@ +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 new file mode 100644 index 0000000..2abd079 --- /dev/null +++ b/src/CommandTickSync.java @@ -0,0 +1,41 @@ +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 new file mode 100644 index 0000000..1dda9d1 --- /dev/null +++ b/src/CommandTickrate.java @@ -0,0 +1,41 @@ +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/minecraft/cubimod/Cubitick.java b/src/Cubitick.java similarity index 73% rename from src/minecraft/cubimod/Cubitick.java rename to src/Cubitick.java index c9d1fca..3d966f2 100644 --- a/src/minecraft/cubimod/Cubitick.java +++ b/src/Cubitick.java @@ -1,25 +1,18 @@ -package cubimod; - import java.io.IOException; import java.net.URL; import java.util.Arrays; import java.util.Scanner; -import cubimod.settings.ServerPacketData; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.Timer; - public class Cubitick { - public static Cubitick instance = new Cubitick(); + public static Cubitick instance; public static boolean initialised = false; private String author = "Cubitect"; private String name = "Cubitick"; - private String versionName = "[1.8]v1.5.1"; + private String versionName = "[1.9.2]v1.5.1"; private String versionType = "main"; - private String mcVersion = "1.8"; + private String mcVersion = "1.9"; private String mcType = "release"; public static final float tickrate = 20F; @@ -29,6 +22,9 @@ public class Cubitick public Cubitick() { + System.out.println("[" + name + "] Initializing..."); + + instance = this; ServerPacketData.init(); initialised = false; } @@ -84,18 +80,18 @@ public static void setTickWorld(float rate) private static void setTimerWorld(float rate) { - Minecraft mc = Minecraft.getMinecraft(); - float elapsedPartialTicks = mc.timerWorld.elapsedPartialTicks; - int elapsedTicks = mc.timerWorld.elapsedTicks; - float renderPartialTicks = mc.timerWorld.renderPartialTicks; + bcc mc = bcc.z(); + float elapsedPartialTicks = mc.timerWorld.e; + int elapsedTicks = mc.timerWorld.b; + float renderPartialTicks = mc.timerWorld.c; - mc.timerWorld = new Timer(rate); + mc.timerWorld = new bci(rate); - mc.timerWorld.elapsedPartialTicks = elapsedPartialTicks; - mc.timerWorld.elapsedTicks = elapsedTicks; - mc.timerWorld.renderPartialTicks = renderPartialTicks; + mc.timerWorld.e = elapsedPartialTicks; + mc.timerWorld.b = elapsedTicks; + mc.timerWorld.c = renderPartialTicks; - mc.timer = new Timer(tickrate); + mc.timer = new bci(tickrate); } public static float getTickms() @@ -106,7 +102,7 @@ public static float getTickms() public static void playerChat(String str) { - if(Minecraft.getMinecraft().thePlayer == null) return; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + if(bcc.z().h == null) return; + bcc.z().h.b(new fa(str)); } } diff --git a/src/GuiPacketOptionsList.java b/src/GuiPacketOptionsList.java new file mode 100644 index 0000000..8ed53be --- /dev/null +++ b/src/GuiPacketOptionsList.java @@ -0,0 +1,139 @@ +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 new file mode 100644 index 0000000..5905ade --- /dev/null +++ b/src/GuiServerPackets.java @@ -0,0 +1,105 @@ +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 new file mode 100644 index 0000000..2128ccb --- /dev/null +++ b/src/MinecraftServer.java @@ -0,0 +1,1141 @@ +/* + * 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 new file mode 100644 index 0000000..d7e2977 --- /dev/null +++ b/src/Namepipe.java @@ -0,0 +1,18 @@ +// 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/minecraft/cubimod/settings/ServerPacketData.java b/src/ServerPacketData.java similarity index 54% rename from src/minecraft/cubimod/settings/ServerPacketData.java rename to src/ServerPacketData.java index 204bbbf..ff38f03 100644 --- a/src/minecraft/cubimod/settings/ServerPacketData.java +++ b/src/ServerPacketData.java @@ -1,5 +1,3 @@ -package cubimod.settings; - import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -12,109 +10,89 @@ import java.util.Properties; import java.util.UUID; -import net.minecraft.block.Block; -import net.minecraft.block.BlockChest; -import net.minecraft.block.BlockEnderChest; -import net.minecraft.block.BlockNote; -import net.minecraft.block.BlockPistonBase; -import net.minecraft.block.BlockPistonExtension; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.HoverEvent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.play.server.S20PacketEntityProperties; -import net.minecraft.network.play.server.S22PacketMultiBlockChange; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import cubimod.Cubitick; - public class ServerPacketData { public static final String configFileName = "packet_analysis.cfg"; public static final String[] packetName = { - "S00 Keep Alive", - "S01 Join Game", - "S02 Chat Message", - "S03 Time Update", - "S04 Entity Equipment", - "S05 Spawn Position", - "S06 Update Health", - "S07 Respawn", - "S08 Player Position And Look", - "S09 Held Item Change", - "S0A Use Bed", - "S0B Animation", - "S0C Spawn Player", - "S0D Collect Item", - "S0E Spawn Object", - "S0F Spawn Mob", - "S10 Spawn Painting", - "S11 Spawn Experience Orb", - "S12 Entity Velocity", - "S13 Destroy Entities", - "S14 Entity", - "S15 Entity Relative Move", - "S16 Entity Look", - "S17 Entity Look And Relative Move", - "S18 Entity Teleport", - "S19 Entity Head Look", - "S1A Entity Status", - "S1B Attach Entity", - "S1C Entity Metadata", - "S1D Entity Effect", - "S1E Remove Entity Effect", - "S1F Set Experience", - "S20 Entity Properties", - "S21 Chunk Data", - "S22 Multi Block Change", - "S23 Block Change", - "S24 Block Action", - "S25 Block Break Animation", - "S26 Map Chunk Bulk", - "S27 Explosion", - "S28 Effect", - "S29 Sound Effect", - "S2A Particle", - "S2B Change Game State", - "S2C Spawn Global Entity", - "S2D Open Window", - "S2E Close Window", - "S2F Set Slot", - "S30 Window Items", - "S31 Window Property", - "S32 Confirm Transaction", - "S33 Update Sign", - "S34 Map", - "S35 Update Block Entity", - "S36 Open Sign Editor", - "S37 Statistics", - "S38 Player List Item", - "S39 Player Abilities", - "S3A Tab-Complete", - "S3B Scoreboard Objective", - "S3C Update Score", - "S3D Display Scoreboard", - "S3E Teams", - "S3F Plugin Message", - "S40 Disconnect", - "S41 Server Difficulty", - "S42 Combat Event", - "S43 Camera", - "S44 World Border", + "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 Set Compression", - "S47 Player List Header And Footer", - "S48 Resource Pack Send", - "S49 Update Entity NBT" + "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[] = @@ -184,7 +162,7 @@ public static void loadSettings() finally { if(input != null) { try { - input.close(); + input.close(); } catch (IOException e) { e.printStackTrace(); } @@ -192,38 +170,37 @@ public static void loadSettings() } } - public static void playerChat(String str) { - if(Minecraft.getMinecraft().thePlayer == null) return; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str)); + if(bcc.z().h == null) return; + bcc.z().h.b(new fa(str)); } public static void playerChat(String str, String hoverText) { - if(Minecraft.getMinecraft().thePlayer == null) return; - ChatComponentText strChat = new ChatComponentText(str); - ChatComponentText hoverChat = new ChatComponentText(hoverText); - HoverEvent he = new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverChat); - strChat.getChatStyle().setChatHoverEvent(he); - Minecraft.getMinecraft().thePlayer.addChatMessage(strChat); + 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" + Minecraft.getMinecraft().tickcounter + " §e[" + packetName[packetID] + "]"; + 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) { - WorldClient world = Minecraft.getMinecraft().theWorld; + bkr world = bcc.z().f; if(world != null) { - Entity entity = world.getEntityByID(entityID); - if(entity != null) return entity.getName(); + rr entity = world.a(entityID); // getEntityByID(.) + if(entity != null) return entity.h_(); // getName() } return "(null)"; } @@ -231,13 +208,13 @@ private static String eid2str(int entityID) private static String eidTag(int entityID) { String str = "EntityID: " + entityID; - WorldClient world = Minecraft.getMinecraft().theWorld; + bkr world = bcc.z().f; if(world != null) { - Entity entity = world.getEntityByID(entityID); + rr entity = world.a(entityID); if(entity != null) { - str += " §7→" + entity.getName(); + str += " §7→" + entity.h_(); } else { str += " §7→(null)"; @@ -250,8 +227,8 @@ private static String eidInfo(int entityID) { return eid2str(entityID) + " (" + entityID + ")"; } - private static String pos2str(BlockPos pos) { - return "[" + pos.getX() + "," + pos.getY() + "," + pos.getZ() + "]"; + private static String pos2str(cj pos) { + return "[" + pos.p() + "," + pos.q() + "," + pos.r() + "]"; } private static String pos2str(int x, int z) { @@ -270,414 +247,154 @@ private static String rot2str(float yaw, float pitch) { return "[Yaw:" + yaw + ",Pitch:" + pitch + "]"; } - // Keep Alive - public static void displayS00(int keepAlive) - { - String info = "Keep Alive: " + keepAlive; - playerChatPacketInfo(0x00, "", info); - } - - // Join Game - public static void displayS01(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(0x01, "", info); - } - - // Chat Message - public static void displayS02(IChatComponent chat, byte position) + // 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 posstr; - switch(position) { - case 0: posstr = "chat"; break; - case 1: posstr = "system message"; break; - case 2: posstr = "above hotbar"; break; - default: posstr = "unknown"; - } - String info = - "Text: " + chat.getUnformattedText() + "\n" + - "Position: " + position + " §7[" + posstr + "]"; - playerChatPacketInfo(0x02, "", info); - } - - // Time Update - public static void displayS03(long worldAge, long timeOfDay) - { - String info = - "World Age: " + worldAge + "\n" + - "Time of Day: " + timeOfDay; - playerChatPacketInfo(0x03, "" + worldAge, info); - } - - // Entity Equipment - public static void displayS04(int entityID, int slot, ItemStack item) - { - String itemName = (item == null) ? "(null)" : item.getDisplayName(); - String info = eidTag(entityID) + "\n" + - "Slot: " + slot + "\n" + - "Item: " + itemName; - playerChatPacketInfo(0x04, "\"" + itemName + "\" for " + eidInfo(entityID), info); - } - - // Spawn Position - public static void displayS05(BlockPos position) - { - String posStr = pos2str(position); - String info = "Position: " + posStr; - playerChatPacketInfo(0x05, posStr, info); - } - - // Update Health - public static void displayS06(float health, int food, float saturation) - { - String info = - "Health: " + health + "\n" + - "Food: " + food + "\n" + - "Saturation: " + saturation; - playerChatPacketInfo(0x06, "", info); - } - - // Respawn - public static void displayS07(int dimension, int difficulty, int gameMode, String levelType) - { - String info = - "Dimension: " + dimension + "\n" + - "Difficulty: " + difficulty + "\n" + - "Gamemode: " + gameMode + "\n" + - "Level Type: " + levelType; - playerChatPacketInfo(0x07, "", info); - } - - // Player Position And Look - public static void displayS08(double x, double y, double z, float yaw, float pitch, String flags) - { - // 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; - playerChatPacketInfo(0x08, "", info); - } - - // Held Item Change - public static void displayS09(int slot) - { - String info = "Slot: " + slot; - playerChatPacketInfo(0x09, "", info); - } - - // Use Bed - public static void displayS0A(EntityPlayer player, BlockPos location) - { - String info = - "Player: " + player.getName() + "\n" + - "Location: " + pos2str(location); - playerChatPacketInfo(0x0A, "", info); - } - - // Animation - public static void displayS0B(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(0x0B, eidInfo(entityID), info); - } - - // Spawn Player - public static void displayS0C(int entityID, UUID uuid, double x, double y, double z, float yaw, float pitch, int currentItem, 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" + - "Held ItemID: " + currentItem + "\n" + - ""; - playerChatPacketInfo(0x0C, eidInfo(entityID), info); + "Data: " + data + "\n" + + "Velocity: " + pos2str(velX,velY,velZ); + playerChatPacketInfo(0x00, eidInfo(entityID), info); } - // Collect Item - public static void displayS0D(int collectedEntityID, int collectorEntityID) + // Spawn Experience Orb 01 + public static void display_S01(int entityID, double x, double y, double z, int count) { String info = - "Collected " + eidTag(collectedEntityID) + "\n" + - "Collector " + eidTag(collectorEntityID); - playerChatPacketInfo(0x0D, "", info); + eidTag(entityID) + "\n" + + "Position: " + pos2str(x,y,z) + "\n" + + "Count: " + count; + playerChatPacketInfo(0x01, "Count: " + count, info); } - // Spawn Object - public static void displayS0E(int entityID, int type, double x, double y, double z, float yaw, float pitch, int data, double velX, double velY, double velZ) + // Spawn Global Entity 02 + public static void displayS02(int entityID, int isLightningBlot, double x, double y, double z) { - String info = - eidTag(entityID) + "\n" + - "Type: " + type + "\n" + - "Position" + pos2str(x,y,z) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "Data: " + data + "\n" + - "Velocity: " + pos2str(velX,velY,velZ); - playerChatPacketInfo(0x0E, eidInfo(entityID), info); + String info = + eidTag(entityID) + "\n" + + "Is Lightning Blot: " + isLightningBlot + "\n" + + "Position: " + pos2str(x,y,z); + playerChatPacketInfo(0x02, eid2str(entityID), info); } - // Spawn Mob - public static void displayS0F(int entityID, int type, double x, double y, double z, float yaw, float pitch, float headPitch, double velX, double velY, double velZ, List meta) + // 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(0x0F, eidInfo(entityID) + " @" + pos2str(x,y,z), info); + playerChatPacketInfo(0x03, eidInfo(entityID) + " @" + pos2str(x,y,z), info); } - // Spawn Painting - public static void displayS10(int entityID, String title, BlockPos location, String facing) + // 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(0x10, "", info); - } - - // Spawn Experience Orb - public static void displayS11(int entityID, double x, double y, double z, int count) - { - String info = - eidTag(entityID) + "\n" + - "Position: " + pos2str(x,y,z) + "\n" + - "Count: " + count; - playerChatPacketInfo(0x11, "Count: " + count, info); + playerChatPacketInfo(0x04, "", info); } - // Entity Velocity - public static void displayS12(int entityID, double velX, double velY, double velZ) + // 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" + - "Velocity: " + pos2str(velX,velY,velZ); - playerChatPacketInfo(0x12, eidInfo(entityID), info); + "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); } - // Destroy Entities - // Called before processing to determine the entities before they are destroyed - public static void displayS13(int count, int entityIDs[]) + // Animation 06 + public static void display_S06(int entityID, int animation) { - 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] + ")"; + // 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; } - if(count > displayMax) info += " ..."; - playerChatPacketInfo(0x13, "", info); - } - - // Entity - public static void displayS14(int entityID) - { - String info = eidTag(entityID); - playerChatPacketInfo(0x14, eidInfo(entityID), info); - } - - // Entity Relative Move - public static void displayS15(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(0x15, eidInfo(entityID), info); - } - - // Entity Look - public static void displayS16(int entityID, float yaw, float pitch, boolean onGround) - { - String info = - eidTag(entityID) + "\n" + - "Rotation: " + rot2str(yaw,pitch) + "\n" + - "On Ground: " + onGround; - playerChatPacketInfo(0x16, eidInfo(entityID), info); - } - - // Entity Look And Relative Move - public static void displayS17(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(0x17, eidInfo(entityID), info); - } - - // Entity Teleport - public static void displayS18(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(0x18, eidInfo(entityID), info); - } - - // Entity Head Look - public static void displayS19(int entityID, float yaw) - { - String info = - eidTag(entityID) + "\n" + - "Yaw: " + yaw; - playerChatPacketInfo(0x19, eidInfo(entityID), info); - } - - // Entity Status - public static void displayS1A(int entityID, int statusID) - { - String info = - eidTag(entityID) + "\n" + - "Status: " + statusID; - playerChatPacketInfo(0x1A, eidInfo(entityID), info); - } - - // Attach Entity - public static void displayS1B(int attachedEntityID, int holdingEntityID, int leash) - { - String info = - "Attached " + eidTag(attachedEntityID) + "\n" + - "Vehicle " + eidTag(holdingEntityID) + "\n" + - "Leash: " + leash; - playerChatPacketInfo(0x1B, "", info); - } - - // Entity Metadata - public static void displayS1C(int entityID, List meta) - { - String info = - eidTag(entityID) + "\n" + - ""; - playerChatPacketInfo(0x1C, eidInfo(entityID), info); - } - - // Entity Effect - public static void displayS1D(int entityID, int effectID, int duration, int amplifier, boolean particles) - { - String info = - eidTag(entityID) + "\n" + - "EffectID: " + effectID + "\n" + - "Amplifier: " + amplifier + "\n" + - "Duration: " + duration + "\n" + - "Particles: " + particles; - playerChatPacketInfo(0x1D, eidInfo(entityID), info); - } - - // Remove Entity Effect - public static void displayS1E(int entityID, int effectID) - { + String info = eidTag(entityID) + "\n" + - "EffectID: " + effectID; - playerChatPacketInfo(0x1E, eidInfo(entityID), info); + "Animation: " + animation + " §7[" + anim + "]"; + playerChatPacketInfo(0x06, eidInfo(entityID), info); } - // Set Experience - public static void displayS1F(float expBar, int level, int total) + // Statistics 07 + public static void display_S07() { String info = - "Experience bar: " + expBar + "\n" + - "Level: " + level + "\n" + - "Total Experience: " + total; - playerChatPacketInfo(0x1F, "", info); + ""; + playerChatPacketInfo(0x07, "", info); } - // Entity Properties - public static void displayS20(int entityID, List attributes) + // Block Break Animation 08 + public static void display_S08(int entityID, cj pos, int destroyStage) { String info = eidTag(entityID) + "\n" + - ""; - - playerChatPacketInfo(0x20, eidInfo(entityID), info); - } - - // Chunk Data - // Updated an existing chunk - public static void displayS21(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(0x21, pos2str(chunkX,chunkZ), info); + "Position: " + pos2str(pos) + "\n" + + "Destroy Stage: " + destroyStage; + playerChatPacketInfo(0x08, eidInfo(entityID), info); } - // Multi Block Change - public static void displayS22(S22PacketMultiBlockChange.BlockUpdateData blockUpdates[]) + // Update Block Entity 09 + public static void display_S09(cj pos, int type, Object nbt) { - String info = ""; - - for(int i = 0; i < blockUpdates.length; i++) - { - S22PacketMultiBlockChange.BlockUpdateData update = blockUpdates[i]; - BlockPos pos = update.func_180090_a(); - IBlockState ibs = update.func_180088_c(); - - info += pos2str(pos) + ":§c" + (ibs + "").substring(10).replace("[", "§7["); - if(i < blockUpdates.length-1) info += "\n"; + 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"; } - playerChatPacketInfo(0x22, "" + blockUpdates.length + " Block Updates", info); + + String info = + "Position: " + pos2str(pos) + "\n" + + "Type: " + typestr + "\n" + + ""; + playerChatPacketInfo(0x09, typestr, info); } - // Block Change - public static void displayS23(BlockPos pos, IBlockState ibs) - { - String info = pos2str(pos) + ":§c" + (ibs + "").substring(10).replace("[", "§7["); - playerChatPacketInfo(0x23, pos2str(pos), info); - } - // Block Action - public static void displayS24(BlockPos pos, Block block, int event, int eventParam) + // Block Action 0A + public static void display_S0A(cj pos, ajt block, int event, int eventParam) { - String blockName = I18n.format(block.getUnlocalizedName() + ".name"); + 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 BlockNote) + if(block instanceof and) // BlockNote : and { switch(event) { case 0: action += "Harp"; break; @@ -690,7 +407,8 @@ public static void displayS24(BlockPos pos, Block block, int event, int eventPar info += action + "]\nParameter: " + eventParam + " §7[Pitch]"; } - else if(block instanceof BlockPistonExtension || block instanceof BlockPistonBase) + // BlockPistonBase : aqu, BlockPistonExtension : aqv + else if(block instanceof aqu || block instanceof aqv) { switch(event) { case 0: action += "Pushing"; break; @@ -712,7 +430,8 @@ else if(block instanceof BlockPistonExtension || block instanceof BlockPistonBas info += "]"; } - else if(block instanceof BlockChest || block instanceof BlockEnderChest) + // BlockChest : ake, BlockEnderChest : alf + else if(block instanceof ake || block instanceof alf) { info += "]\n" + "Parameter: " + eventParam + " §7[Players Opening]"; } @@ -723,101 +442,245 @@ else if(block instanceof BlockChest || block instanceof BlockEnderChest) String quickInfo = "§c" + blockName; if(!action.isEmpty()) quickInfo += ": §7" + action; - playerChatPacketInfo(0x24, quickInfo, info); + playerChatPacketInfo(0x0A, quickInfo, info); } - // Block Break Animation - public static void displayS25(int entityID, BlockPos pos, int destroyStage) + // 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 = - eidTag(entityID) + "\n" + - "Position: " + pos2str(pos) + "\n" + - "Destroy Stage: " + destroyStage; - playerChatPacketInfo(0x25, eidInfo(entityID), 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); } - // Map Chunk Bulk - // Initial chunk loading - public static void displayS26(int chunkX[], int chunkZ[], int bitMasks[]) + // Server Difficulty 0D + public static void display_S0D(int difficulty, boolean isLocked) { - String info = "Loading Chunks: "; - int minX = Integer.MAX_VALUE, minZ = Integer.MAX_VALUE, maxX = Integer.MIN_VALUE, maxZ = -Integer.MIN_VALUE; - - for(int i = 0; i < chunkX.length; i++) - { - if(chunkX[i] < minX) minX = chunkX[i]; - if(chunkZ[i] < minZ) minZ = chunkZ[i]; - if(chunkX[i] > maxX) maxX = chunkX[i]; - if(chunkZ[i] > maxZ) maxZ = chunkZ[i]; - - info += "\n" + String.format("%1$-9s", pos2str(chunkX[i],chunkZ[i])) + " Sections:" + - String.format("%16s", Integer.toBinaryString(bitMasks[i])).replace(' ', '0').replace("1", "§a1§f"); + 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 quickInfo = "[" + minX + "," + minZ + "]->[" + maxX + "," + maxZ + "] (" + chunkX.length + ")"; + 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(0x26, quickInfo, info); + playerChatPacketInfo(0x10, "" + blockUpdates.length + " Block Updates", info); } - // Explosion - public static void displayS27(double x, double y, double z, float radius, List affectedBlockOffsets, float velX, float velY, float velZ) + // Confirm Transaction (clientbound) 11 + public static void display_S11(int windowID, int actionNumber, boolean accepted) { 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:"; + "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 maxLen = 20; - for(int i = 0; i < maxLen && i < affectedBlockOffsets.size(); i++) + final int dispMax = 9; + int dispCnt = 0; + for(int i = 0; i < slots.length && dispCnt < dispMax; i++) { - if(i % 5 == 0) info += "\n"; - info += pos2str((BlockPos)affectedBlockOffsets.get(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..."; - if(affectedBlockOffsets.size() > maxLen) info += "..."; + 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 - playerChatPacketInfo(0x27, "@" + pos2str(Math.floor(x),Math.floor(y),Math.floor(z)), info); + 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); } - // Effect - public static void displayS28(int effectID, BlockPos pos, int data, boolean noRelativeVol) + // Plugin Message (clientbound) 18 + public static void display_S18(String channelName) { String info = - "Effect ID: " + effectID + "\n" + - "Position: " + pos2str(pos) + "\n" + - "Data: " + data + "\n" + - "Serverwide: " + noRelativeVol; - playerChatPacketInfo(0x28, "", info); + "Channel Name: " + channelName + "\n" + + ""; + playerChatPacketInfo(0x18, channelName, info); } - // Sound Effect - public static void displayS29(double x, double y, double z, String soundName, float volume, float pitch) + // 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(0x29, soundName, info); + playerChatPacketInfo(0x19, soundName, info); } - // Particle - public static void displayS2A(String particleID, int count, boolean isLongDist, double x, double y, double z, float Dx, float Dy, float Dz, float offsetScale) + // 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 = - "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(0x2A, particleID + " ×" + count, info); + "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 - public static void displayS2B(int reason, float data) + // Change Game State 1E + public static void display_S1E(int reason, float data) { String info = ""; @@ -838,155 +701,157 @@ public static void displayS2B(int reason, float data) info += "State: " + str + "\n" + "Value: " + data; - playerChatPacketInfo(0x2B, str, info); + playerChatPacketInfo(0x1E, str, info); } - // Spawn Global Entity - public static void displayS2C(int entityID, int isLightningBlot, double x, double y, double z) + // Keep Alive 1F + public static void displayS1F(int keepAlive) { - String info = - eidTag(entityID) + "\n" + - "Is Lightning Blot: " + isLightningBlot + "\n" + - "Position: " + pos2str(x,y,z); - playerChatPacketInfo(0x2C, eid2str(entityID), info); + String info = "Keep Alive ID: " + keepAlive; + playerChatPacketInfo(0x1F, "", info); } - // Open Window - public static void displayS2D(int windowID, String type, IChatComponent title, int slotNum, int entityID) + // Chunk Data 20 + public static void display_S20(int chunkX, int chunkZ, boolean groundUpCont, int primBitMask, int size, byte data[], byte biomes[]) { String info = - "WindowID: " + windowID + "\n" + - "Type: " + type + "\n" + - "Title: " + (title == null ? "(null)" : title.getUnformattedText()) + "\n" + - "Number of Slots: " + slotNum + "\n" + - eidTag(entityID); - playerChatPacketInfo(0x2D, type, 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); } - // Close Window - public static void displayS2E() + // Effect 21 + public static void display_S21(int effectID, cj pos, int data, boolean noRelativeVol) { - String info = "§7[Closes Current Window]"; - playerChatPacketInfo(0x2E, "", info); + String info = + "Effect ID: " + effectID + "\n" + + "Position: " + pos2str(pos) + "\n" + + "Data: " + data + "\n" + + "Serverwide: " + noRelativeVol; + playerChatPacketInfo(0x21, "", info); } - // Set Slot - public static void displayS2F(int windowID, int slot, ItemStack stack) + // 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 stackStr; - if(stack == null) stackStr = "(null)"; - else stackStr = stack.getDisplayName() + " §7×" + stack.stackSize; - String info = - "WindowID: " + windowID + "\n" + - "Slot: " + slot + "\n" + - "ItemStack: " + stackStr; - playerChatPacketInfo(0x2F, "" + slot + " → [" + stackStr + "]", 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); } - // Window Items - public static void displayS30(int windowID, ItemStack slots[]) + // Join Game 23 + public static void display_S23(int entityID, int gameMode, int dimension, int difficulty, int maxPlayers, String levelType, boolean reducedDebugInfo) { - String info = - "WindowID: " + windowID; - - 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].getDisplayName() + " §8×" + slots[i].stackSize; - info += "\nSlot[" + i + "]: " + i + " §7[" + stackName + "§7]"; - dispCnt++; - } - if(dispCnt > dispMax) info += " ..."; - - playerChatPacketInfo(0x30, "", info); + 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); } - // Window Property - public static void displayS31(int windowID, int property, int value) + // Map 24 + public static void display_S24(int mapID) { String info = - "WindowID: " + windowID + "\n" + - "Property: " + property + "\n" + - "Value: " + value; - playerChatPacketInfo(0x31, "", info); + "MapID: " + mapID + "\n" + + ""; + playerChatPacketInfo(0x24, "", info); } - // Confirm Transaction - public static void displayS32(int windowID, int actionNumber, boolean accepted) + // Entity Relative Move 25 + public static void display_S25(int entityID, double x, double y, double z, boolean onGround) { String info = - "WindowID: " + windowID + "\n" + - "Action Number: " + actionNumber + "\n" + - "Accepted: " + accepted; - playerChatPacketInfo(0x32, "", info); + eidTag(entityID) + "\n" + + "Delta Position: " + pos2str(x,y,z) + "\n" + + "On Ground: " + onGround; + playerChatPacketInfo(0x25, eidInfo(entityID), info); } - // Update Sign - public static void displayS33(BlockPos pos, IChatComponent lines[]) + // Entity Look 26 + public static void display_S26(int entityID, float yaw, float pitch, boolean onGround) { String info = - "Position: " + pos2str(pos); - - for(int i = 0; i < lines.length; i++) - { - info += "\nL[" + i + "]: " + (lines[i] == null ? "(null)" : lines[i].getUnformattedText()); - } - - playerChatPacketInfo(0x33, "", info); + eidTag(entityID) + "\n" + + "Rotation: " + rot2str(yaw,pitch) + "\n" + + "On Ground: " + onGround; + playerChatPacketInfo(0x26, eidInfo(entityID), info); } - // Map - public static void displayS34(int mapID) + // 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 = - "MapID: " + mapID + "\n" + - ""; - playerChatPacketInfo(0x34, "", info); + eidTag(entityID) + "\n" + + "Delta Position: " + pos2str(x,y,z) + "\n" + + "Rotation: " + rot2str(yaw,pitch) + "\n" + + "On Ground: " + onGround; + playerChatPacketInfo(0x27, eidInfo(entityID), info); } - // Update Block Entity - public static void displayS35(BlockPos pos, int type, NBTTagCompound nbt) + // 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 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(0x35, typestr, info); + "Position: " + pos2str(x,y,z) + "\n" + + "Rotation: " + rot2str(yaw,pitch);; + playerChatPacketInfo(0x29, "", info); } - // Open Sign Editor - public static void displayS36(BlockPos pos) + // Open Sign Editor 2A + public static void display_S2A(cj pos) { String info = "Position: " + pos2str(pos); - playerChatPacketInfo(0x36, "", info); + playerChatPacketInfo(0x2A, "", info); } - // Statistics - public static void displayS37() + // Player Abilities (clientbound) 2B + public static void display_S2B(boolean isFlying, boolean isCreativeMode, boolean isInvulnerable, boolean isAllowFlying, float flySpeed, float fieldOfView) { String info = - ""; - playerChatPacketInfo(0x37, "", info); + "IsFlying: " + isFlying + "\n" + + "IsCreativeMode: " + isCreativeMode + "\n" + + "IsInvulnerable: " + isInvulnerable + "\n" + + "IsAllowFlying: " + isAllowFlying + "\n" + + "Flying Speed: " + flySpeed + "\n" + + "Field of View: " + fieldOfView; + playerChatPacketInfo(0x2B, "", info); } - // Player List Item - public static void displayS38(String uuids[], String[] action) + // 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++) @@ -995,75 +860,195 @@ public static void displayS38(String uuids[], String[] action) if(i < uuids.length-1) info += "\n"; } - playerChatPacketInfo(0x38, "", info); + playerChatPacketInfo(0x2D, "", info); } - // Player Abilities - public static void displayS39(boolean isFlying, boolean isCreativeMode, boolean isInvulnerable, boolean isAllowFlying, float flySpeed, float fieldOfView) + // 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 = - "IsFlying: " + isFlying + "\n" + - "IsCreativeMode: " + isCreativeMode + "\n" + - "IsInvulnerable: " + isInvulnerable + "\n" + - "IsAllowFlying: " + isAllowFlying + "\n" + - "Flying Speed: " + flySpeed + "\n" + - "Field of View: " + fieldOfView; - playerChatPacketInfo(0x39, "", info); + "Position: " + pos2str(x,y,z) + "\n" + + "Rotation: " + rot2str(yaw,pitch) + "\n" + + "Flags: " + flags + "\n" + + "TeleportID: " + teleportID; + playerChatPacketInfo(0x2E, "", info); } - // Tab-Complete - public static void displayS3A(String strs[]) + // Use Bed 2F + public static void display_S2F(zj player, cj location) { - String info = ""; - final int dispMax = 9; - for(int i = 0; i < strs.length; i++) + 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++) { - if(i >= dispMax) { - info += " ..."; - break; - } - info += strs[i]; - if(i < strs.length-1) info += "\n"; + info += "\nEntity[" + i + "]: " + eid2str(entityIDs[i]) + " (" + entityIDs[i] + ")"; } - - playerChatPacketInfo(0x3A, "", info); + if(count > displayMax) info += " ..."; + playerChatPacketInfo(0x30, "", info); } - // Scoreboard Objective - public static void displayS3B(String name, String type, int mode, String renderType) + // Remove Entity Effect 31 + public static void display_S31(int entityID, String effect) { String info = - "Name: " + name + "\n" + - "Type: " + type + "\n" + - "Mode: " + mode + "\n" + - "Render Type: " + renderType; - playerChatPacketInfo(0x3B, "", info); + eidTag(entityID) + "\n" + + "Effect: " + effect; + playerChatPacketInfo(0x31, eidInfo(entityID), info); } - // Update Score - public static void displayS3C(String scoreName, String objectiveName, String action, int value) + // Resource Pack Send 32 + public static void display_S32(String url, String hash) { String info = - "Score Name: " + scoreName + "\n" + - "Objective Name: " + objectiveName + "\n" + - "Action: " + action + "\n" + - "Value: " + value; - playerChatPacketInfo(0x3C, "", 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); } - // Display Scoreboard - public static void displayS3D(int pos, String scoreName) + // 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); } - // Teams - public static void displayS3E(int mode, String teamName, + // 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) @@ -1079,8 +1064,8 @@ public static void displayS3E(int mode, String teamName, } String info = - "Team Name: " + teamName + "\n" + "Mode: " + mode + " §7[" + modeStr + "]\n" + + "Team Name: " + teamName + "\n" + "Team Display Name: " + teamDispName + "\n" + "Prefix: " + prefix + "\n" + "Suffix: " + suffix + "\n" + @@ -1108,62 +1093,39 @@ public static void displayS3E(int mode, String teamName, if(i >= dispMax) info += "..."; } - playerChatPacketInfo(0x3E, "", info); - } - - // Plugin Message - public static void displayS3F(String channelName) - { - String info = - "Channel Name: " + channelName + "\n" + - ""; - playerChatPacketInfo(0x3F, channelName, info); - } - - // Disconnect - public static void displayS40(IChatComponent reason) - { - String info = "Reason: " + reason.getUnformattedText(); - playerChatPacketInfo(0x40, "", info); - } - - // Server Difficulty - public static void displayS41(int difficulty, boolean isLocked) - { - String info = - "Difficulty: " + difficulty + "\n" + - "Locked: " + isLocked; playerChatPacketInfo(0x41, "", info); } - // Combat Event - public static void displayS42(String event, int duration, int entityID, int playerID, String message) - { + // Update Score 42 + public static void display_S42(String scoreName, String objectiveName, String action, int value) + { String info = - "Event: " + event + "\n" + - "Duration: " + duration + "\n" + - "EntityID: " + entityID + " §7→" + eid2str(entityID) + "\n" + - "PlayerID: " + playerID + " §7→" + eid2str(playerID) + "\n" + - "Message: " + message; + "Score Name: " + scoreName + "\n" + + "Objective Name: " + objectiveName + "\n" + + "Action: " + action + "\n" + + "Value: " + value; playerChatPacketInfo(0x42, "", info); } - // Camera - public static void displayS43(int camEntityID) + // Spawn Position 43 + public static void display_S43(cj position) { - String info = "Camera " + eidTag(camEntityID); - playerChatPacketInfo(0x43, eidInfo(camEntityID), info); + String posStr = pos2str(position); + String info = "Position: " + posStr; + playerChatPacketInfo(0x43, posStr, info); } - // World Border 35 - public static void displayS44() + // Time Update 44 + public static void display_S44(long worldAge, long timeOfDay) { - String info = ""; - playerChatPacketInfo(0x44, "", info); + String info = + "World Age: " + worldAge + "\n" + + "Time of Day: " + timeOfDay; + playerChatPacketInfo(0x44, "(" + worldAge + ", " + timeOfDay + ")", info); } // Title 45 - public static void displayS45(String action, String title, String subTitle, int fadeIn, int stay, int fadeOut) + public static void display_S45(String action, String title, String subTitle, int fadeIn, int stay, int fadeOut) { String info = "Action: " + action + "\n" + @@ -1175,37 +1137,82 @@ public static void displayS45(String action, String title, String subTitle, int playerChatPacketInfo(0x45, "", info); } - // Set Compression Level - public static void displayS46(int compressionLevel) + // Update Sign (clientbound) 46 + public static void display_S46(cj pos, eu lines[]) { - String info = "Compression Level: " + compressionLevel; + 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); } - // Player List Header And Footer - public static void displayS47(IChatComponent header, IChatComponent footer) + // 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 = - "Header: " + header.getUnformattedText() + "\n" + - "Footer: " + footer.getUnformattedText(); - playerChatPacketInfo(0x47, "", info); + "Sound Name: " + soundName + "\n" + + "Sound Category: " + soundCategory + "\n" + + "Position: " + pos2str(x,y,z) + "\n" + + "Volume: " + volume + "\n" + + "Pitch: " + pitch; + playerChatPacketInfo(0x47, soundName, info); } - // Resource Pack Send 32 - public static void displayS48(String url, String hash) + // Player List Header And Footer 48 + public static void display_S48(eu header, eu footer) { String info = - "URL: " + url + "\n" + - "Hash: " + hash; + "Header: " + header.c() + "\n" + + "Footer: " + footer.c(); playerChatPacketInfo(0x48, "", info); } - // Entity NBT ? - public static void displayS49(int entityID, NBTTagCompound nbt) + // 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" + - ""; - playerChatPacketInfo(0x49, eidInfo(entityID), info); + "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 new file mode 100644 index 0000000..c84697d --- /dev/null +++ b/src/bc.java @@ -0,0 +1,126 @@ +// 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 new file mode 100644 index 0000000..0425e36 --- /dev/null +++ b/src/bcc.java @@ -0,0 +1,2760 @@ +// 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 new file mode 100644 index 0000000..a3490e3 --- /dev/null +++ b/src/bcz.java @@ -0,0 +1,257 @@ +// 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 new file mode 100644 index 0000000..d136a53 --- /dev/null +++ b/src/beb.java @@ -0,0 +1,201 @@ +// 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 new file mode 100644 index 0000000..4ac366d --- /dev/null +++ b/src/bes.java @@ -0,0 +1,155 @@ +// 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 new file mode 100644 index 0000000..1c698e1 --- /dev/null +++ b/src/bkp.java @@ -0,0 +1,1814 @@ +// 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 new file mode 100644 index 0000000..17d943a --- /dev/null +++ b/src/bnd.java @@ -0,0 +1,1629 @@ +// 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/minecraft/cubimod/command/CommandRerender.java b/src/minecraft/cubimod/command/CommandRerender.java deleted file mode 100644 index 6ef9f63..0000000 --- a/src/minecraft/cubimod/command/CommandRerender.java +++ /dev/null @@ -1,56 +0,0 @@ -package cubimod.command; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.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"; - } - - public void processCommand(ICommandSender sender, String[] args) throws CommandException - { - if(args.length == 0) { - Minecraft.getMinecraft().scheduledReload = true; - } - else if(args.length <= 5) { - notifyOperators(sender, this, "§cUsage:\n§c"+getCommandUsage(sender)); - return; - } else { - BlockPos pos1 = func_175757_a(sender, args, 0, false); - BlockPos pos2 = func_175757_a(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 List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) - { - return null; - } - - 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 deleted file mode 100644 index b5ae96c..0000000 --- a/src/minecraft/cubimod/command/CommandTickSync.java +++ /dev/null @@ -1,65 +0,0 @@ -package cubimod.command; - -import java.util.List; - -import cubimod.Cubitick; -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.CommandResultStats; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.JsonToNBT; -import net.minecraft.nbt.NBTException; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; -import net.minecraft.world.GameRules; - -public class CommandTickSync extends CommandBase -{ - public String getCommandName() - { - return "ticksync"; - } - - public int getRequiredPermissionLevel() - { - return 2; - } - - public String getCommandUsage(ICommandSender sender) - { - return "/ticksync [true/false]"; - } - - public void processCommand(ICommandSender sender, String[] args) throws CommandException - { - if(args.length < 1) { - notifyOperators(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; - notifyOperators(sender, this, "Tickrate is now synchronised"); - } else if(args[0].equals("false") || args[0].equals("off")) { - Cubitick.synctick = false; - notifyOperators(sender, this, "Tickrate is now desynchronised"); - } else { - notifyOperators(sender, this, "Tickrate synchronisation can only be true/on or false/off"); - } - } - } - - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) - { - return null; - } - - 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 deleted file mode 100644 index c9faf8e..0000000 --- a/src/minecraft/cubimod/command/CommandTickrate.java +++ /dev/null @@ -1,64 +0,0 @@ -package cubimod.command; - -import java.util.List; - -import cubimod.Cubitick; -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.CommandResultStats; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.JsonToNBT; -import net.minecraft.nbt.NBTException; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; - -public class CommandTickrate extends CommandBase -{ - public String getCommandName() - { - return "tickrate"; - } - - public int getRequiredPermissionLevel() - { - return 2; - } - - public String getCommandUsage(ICommandSender sender) - { - return "/tickrate [rate]"; - } - - public void processCommand(ICommandSender sender, String[] args) throws CommandException - { - if(args.length < 1) { - notifyOperators(sender, this, "Tickrate is " + Cubitick.tickrateWorld + " ticks per second"); - return; - } else { - float tickspeed = (float)parseDouble(args[0], 0); - if(tickspeed >= 0) { - Cubitick.setTickWorld(tickspeed); - notifyOperators(sender, this, "Tickrate set to " + tickspeed); - } else { - notifyOperators(sender, this, "Tickrate should be a non-negative floating point number"); - return; - } - } - } - - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) - { - return null; - } - - public boolean isUsernameIndex(String[] args, int index) - { - return index == 0; - } -} - diff --git a/src/minecraft/cubimod/gui/GuiPacketOptionsList.java b/src/minecraft/cubimod/gui/GuiPacketOptionsList.java deleted file mode 100644 index cc8ff8d..0000000 --- a/src/minecraft/cubimod/gui/GuiPacketOptionsList.java +++ /dev/null @@ -1,131 +0,0 @@ -package cubimod.gui; - -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.ArrayUtils; - -import com.google.common.collect.Lists; - -import cubimod.settings.ServerPacketData; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiControls; -import net.minecraft.client.gui.GuiKeyBindingList; -import net.minecraft.client.gui.GuiListExtended; -import net.minecraft.client.gui.GuiOptionButton; -import net.minecraft.client.gui.GuiOptionsRowList; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.util.EnumChatFormatting; - -public class GuiPacketOptionsList extends GuiListExtended -{ - private final GuiServerPackets guiServerPackets; - private final Minecraft mc; - private final GuiListExtended.IGuiListEntry listEntries[]; - private int maxListLabelWidth = 0; - - public boolean isActive[]; - - public GuiPacketOptionsList(GuiServerPackets guiServerPackets, Minecraft mcIn) - { - super(mcIn, guiServerPackets.width, guiServerPackets.height, 63, guiServerPackets.height - 32, 20); - this.guiServerPackets = guiServerPackets; - this.mc = mcIn; - this.listEntries = new GuiListExtended.IGuiListEntry[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); - } - } - - protected int getSize() - { - return this.listEntries.length; - } - - public GuiListExtended.IGuiListEntry getListEntry(int idx) - { - return this.listEntries[idx]; - } - - protected int getScrollBarX() - { - return super.getScrollBarX() + 15; - } - - public int getListWidth() - { - return super.getListWidth() + 32; - } - - public void setAll(boolean state) - { - for(int i = 0; i < listEntries.length; i++) - { - isActive[i] = state; - } - } - - public class PacketOptionEntry implements GuiListExtended.IGuiListEntry - { - public final String baseLabel; - public final GuiButton btn; - public final int packetID; - - private PacketOptionEntry(int packetID) - { - this.packetID = packetID; - this.baseLabel = ServerPacketData.packetName[packetID]; - this.btn = new GuiButton(0, 0, 0, 250, 18, this.baseLabel); - } - - public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) - { - if(this.baseLabel == null) - { - this.btn.displayString = ""; - this.btn.enabled = false; - } - else - { - this.btn.displayString = this.baseLabel + ": " + (isActive[this.packetID] ? "§aactive":"§cinactive"); - this.btn.enabled = guiServerPackets.enabled; - } - - this.btn.xPosition = x; - this.btn.yPosition = y; - - this.btn.drawButton(GuiPacketOptionsList.this.mc, mouseX, mouseY); - } - - public boolean mousePressed(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) - { - if(this.btn.enabled && this.btn.mousePressed(GuiPacketOptionsList.this.mc, x, y)) - { - //GuiPacketOptionsList.this.guiServerPackets.buttonId = this.packetID; - isActive[this.packetID] = !isActive[this.packetID]; - return true; - } - else - { - return false; - } - } - - public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) - { - this.btn.mouseReleased(x, y); - } - - public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) {} - } -} - - \ No newline at end of file diff --git a/src/minecraft/cubimod/gui/GuiServerPackets.java b/src/minecraft/cubimod/gui/GuiServerPackets.java deleted file mode 100644 index 264ddd2..0000000 --- a/src/minecraft/cubimod/gui/GuiServerPackets.java +++ /dev/null @@ -1,109 +0,0 @@ -package cubimod.gui; - -import java.awt.List; -import java.io.IOException; -import java.util.ArrayList; - -import cubimod.settings.ServerPacketData; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiKeyBindingList; -import net.minecraft.client.gui.GuiListExtended; -import net.minecraft.client.gui.GuiOptionButton; -import net.minecraft.client.gui.GuiOptionSlider; -import net.minecraft.client.gui.GuiOptionsRowList; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.settings.KeyBinding; - -public class GuiServerPackets extends GuiScreen -{ - private GuiScreen parentScreen; - private GameSettings options; - protected String screenTitle = "Server Packet Analysis..."; - - private GuiPacketOptionsList optionsList; - private GuiButton buttonDone, bEnable, bActivateAll, bDeactivateAll; - public boolean enabled; - - - public GuiServerPackets(GuiScreen screen, GameSettings settings) - { - this.parentScreen = screen; - this.options = settings; - } - - public void initGui() - { - this.enabled = ServerPacketData.enabled; - - optionsList = new GuiPacketOptionsList(this, this.mc); - - buttonList.add(new GuiButton(200, width / 2 - 155 + 160, height - 29, 150, 20, I18n.format("gui.done", new Object[0]))); - buttonList.add(bEnable = new GuiButton(201, width / 2 - 155, height - 29, 150, 20, this.enabled ? "Packet Analysis: Enabled" : "Packet Analysis: Disabled")); - buttonList.add(bActivateAll = new GuiButton(202, width / 2 - 155, 20, 150, 20, "Activate All")); - buttonList.add(bDeactivateAll = new GuiButton(203, width / 2 - 155 + 160, 20, 150, 20, "Deactivate All")); - - bActivateAll.enabled = this.enabled; - bDeactivateAll.enabled = this.enabled; - } - - public void handleMouseInput() throws IOException - { - super.handleMouseInput(); - this.optionsList.func_178039_p(); - } - - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException - { - super.mouseClicked(mouseX, mouseY, mouseButton); // checks menu action buttons - this.optionsList.func_148179_a(mouseX, mouseY, mouseButton); - } - - protected void mouseReleased(int mouseX, int mouseY, int state) - { - if(state != 0 || !this.optionsList.func_148181_b(mouseX, mouseY, state)) - { - super.mouseReleased(mouseX, mouseY, state); - } - } - - protected void actionPerformed(GuiButton button) throws IOException - { - if(button.id == 200) // Done - { - ServerPacketData.enabled = this.enabled; - ServerPacketData.isActive = this.optionsList.isActive; - ServerPacketData.saveSettings(); - this.mc.displayGuiScreen(this.parentScreen); - } - else if(button.id == 201) // Enable - { - this.enabled = !this.enabled; - bActivateAll.enabled = this.enabled; - bDeactivateAll.enabled = this.enabled; - this.bEnable.displayString = this.enabled ? "Packet Analysis: Enabled" : "Packet Analysis: Disabled"; - } - else if(button.id == 202) // Activate All - { - optionsList.setAll(true); - } - else if(button.id == 203) // Deactivate All - { - optionsList.setAll(false); - } - else - { - } - } - - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { - this.drawDefaultBackground(); - this.optionsList.drawScreen(mouseX, mouseY, partialTicks); - this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 8, 16777215); - super.drawScreen(mouseX, mouseY, partialTicks); - } -} \ No newline at end of file diff --git a/src/minecraft/net/minecraft/client/Minecraft.java b/src/minecraft/net/minecraft/client/Minecraft.java deleted file mode 100644 index c173872..0000000 --- a/src/minecraft/net/minecraft/client/Minecraft.java +++ /dev/null @@ -1,3974 +0,0 @@ -package net.minecraft.client; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -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.minecraft.MinecraftSessionService; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; - -import cubimod.Cubitick; - -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.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -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.block.Block; -import net.minecraft.block.material.Material; -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.GuiScreen; -import net.minecraft.client.gui.GuiSleepMP; -import net.minecraft.client.gui.GuiWinGame; -import net.minecraft.client.gui.GuiYesNo; -import net.minecraft.client.gui.GuiYesNoCallback; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.achievement.GuiAchievement; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.client.gui.stream.GuiStreamUnavailable; -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.EffectRenderer; -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.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.chunk.RenderChunk; -import net.minecraft.client.renderer.entity.RenderItem; -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.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.LanguageManager; -import net.minecraft.client.resources.ResourceIndex; -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.IMetadataSerializer; -import net.minecraft.client.resources.data.LanguageMetadataSection; -import net.minecraft.client.resources.data.LanguageMetadataSectionSerializer; -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.resources.model.ModelManager; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.client.stream.IStream; -import net.minecraft.client.stream.NullStream; -import net.minecraft.client.stream.TwitchStream; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLeashKnot; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.boss.BossStatus; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.item.EntityBoat; -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.ItemBlock; -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.C00PacketLoginStart; -import net.minecraft.network.play.client.C16PacketClientStatus; -import net.minecraft.profiler.IPlayerUsage; -import net.minecraft.profiler.PlayerUsageSnooper; -import net.minecraft.profiler.Profiler; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.integrated.IntegratedServer; -import net.minecraft.stats.AchievementList; -import net.minecraft.stats.IStatStringFormat; -import net.minecraft.stats.StatFileWriter; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IThreadListener; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MinecraftError; -import net.minecraft.util.MouseHelper; -import net.minecraft.util.MovementInputFromOptions; -import net.minecraft.util.MovingObjectPosition; -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.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.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.GL11; -import org.lwjgl.opengl.GL20; -import org.lwjgl.opengl.GLContext; -import org.lwjgl.opengl.OpenGLException; -import org.lwjgl.opengl.PixelFormat; -import org.lwjgl.util.glu.GLU; - -public class Minecraft implements IThreadListener, IPlayerUsage -{ - private static final Logger logger = LogManager.getLogger(); - private static final ResourceLocation locationMojangPng = new ResourceLocation("textures/gui/title/mojang.png"); - public static final boolean isRunningOnMac = 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 macDisplayModes = Lists.newArrayList(new DisplayMode[] {new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)}); - private final File fileResourcepacks; - private final PropertyMap twitchDetails; - 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; - public PlayerControllerMP playerController; - private boolean fullscreen; - private boolean field_175619_R = true; - private boolean hasCrashed; - - /** Instance of CrashReport. */ - private CrashReport crashReporter; - public int displayWidth; - public int displayHeight; - - // 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 PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("client", this, MinecraftServer.getCurrentTimeMillis()); - public WorldClient theWorld; - public RenderGlobal renderGlobal; - private RenderManager renderManager; - private RenderItem renderItem; - private ItemRenderer itemRenderer; - public EntityPlayerSP thePlayer; - private Entity field_175622_Z; - public Entity pointedEntity; - public EffectRenderer effectRenderer; - private final Session session; - private boolean isGamePaused; - - /** The font renderer used for displaying and measuring text */ - public FontRenderer fontRendererObj; - public FontRenderer standardGalacticFontRenderer; - - /** The GuiScreen that's being displayed at the moment. */ - public GuiScreen currentScreen; - public LoadingScreenRenderer loadingScreen; - public EntityRenderer entityRenderer; - - /** Mouse left click counter */ - private int leftClickCounter; - - /** Display width */ - private int tempDisplayWidth; - - /** Display height */ - private int tempDisplayHeight; - - /** 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 MovingObjectPosition 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 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; - private final boolean jvm64bit; - private final boolean isDemo; - 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 IMetadataSerializer metadataSerializer_ = new IMetadataSerializer(); - private final List defaultResourcePacks = Lists.newArrayList(); - private final DefaultResourcePack mcDefaultResourcePack; - private ResourcePackRepository mcResourcePackRepository; - private LanguageManager mcLanguageManager; - private IStream stream; - 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 scheduledTasks = Queues.newArrayDeque(); - private long field_175615_aJ = 0L; - private final Thread mcThread = Thread.currentThread(); - private ModelManager modelManager; - private BlockRendererDispatcher field_175618_aM; - - /** - * 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 field_175613_B = false; - public boolean field_175614_C = false; - public boolean field_175611_D = false; - public boolean field_175612_E = true; - - /** Approximate time (in ms) of last update to debug string */ - long debugUpdateTime = getSystemTime(); - - /** holds the current fps */ - int fpsCounter; - long prevFrameTime = -1L; - - /** Profiler currently displayed in the debug screen pie chart */ - private String debugProfilerName = "root"; - private static final String __OBFID = "CL_00000631"; - - public Minecraft(GameConfiguration p_i45547_1_) - { - theMinecraft = this; - this.mcDataDir = p_i45547_1_.field_178744_c.field_178760_a; - this.fileAssets = p_i45547_1_.field_178744_c.field_178759_c; - this.fileResourcepacks = p_i45547_1_.field_178744_c.field_178758_b; - this.launchedVersion = p_i45547_1_.field_178741_d.field_178755_b; - this.twitchDetails = p_i45547_1_.field_178745_a.field_178750_b; - this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(p_i45547_1_.field_178744_c.field_178759_c, p_i45547_1_.field_178744_c.field_178757_d)).func_152782_a()); - this.proxy = p_i45547_1_.field_178745_a.field_178751_c == null ? Proxy.NO_PROXY : p_i45547_1_.field_178745_a.field_178751_c; - this.sessionService = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService(); - this.session = p_i45547_1_.field_178745_a.field_178752_a; - logger.info("Setting user: " + this.session.getUsername()); - logger.info("(Session ID is " + this.session.getSessionID() + ")"); - this.isDemo = p_i45547_1_.field_178741_d.field_178756_a; - this.displayWidth = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1; - this.displayHeight = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1; - this.tempDisplayWidth = p_i45547_1_.field_178743_b.field_178764_a; - this.tempDisplayHeight = p_i45547_1_.field_178743_b.field_178762_b; - this.fullscreen = p_i45547_1_.field_178743_b.field_178763_c; - this.jvm64bit = isJvm64bit(); - this.theIntegratedServer = new IntegratedServer(this); - - if (p_i45547_1_.field_178742_e.field_178754_a != null) - { - this.serverName = p_i45547_1_.field_178742_e.field_178754_a; - this.serverPort = p_i45547_1_.field_178742_e.field_178753_b; - } - - ImageIO.setUseCache(false); - Bootstrap.register(); - } - - public void run() - { - this.running = true; - CrashReport var2; - - try - { - this.startGame(); - } - catch (Throwable var11) - { - var2 = CrashReport.makeCrashReport(var11, "Initializing game"); - var2.makeCategory("Initialization"); - this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(var2)); - 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(); - } - - continue; - } - - this.displayCrashReport(this.crashReporter); - return; - } - } - catch (MinecraftError var12) - { - ; - } - catch (ReportedException var13) - { - this.addGraphicsAndWorldToCrashReport(var13.getCrashReport()); - this.freeMemory(); - logger.fatal("Reported exception thrown!", var13); - this.displayCrashReport(var13.getCrashReport()); - } - catch (Throwable var14) - { - var2 = this.addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", var14)); - this.freeMemory(); - logger.fatal("Unreported exception thrown!", var14); - this.displayCrashReport(var2); - } - finally - { - this.shutdownMinecraftApplet(); - } - - return; - } - } - - /** - * Starts the game: initializes the canvas, the title, the settings, etcetera. - */ - private void startGame() throws LWJGLException - { - 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: " + Sys.getVersion()); - this.func_175594_ao(); - this.func_175605_an(); - this.func_175609_am(); - OpenGlHelper.initializeTextures(); - this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true); - this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); - this.func_175608_ak(); - 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.func_180510_a(this.renderEngine); - this.func_175595_al(); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); - 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.openInventory.setStatStringFormatter(new IStatStringFormat() - { - private static final String __OBFID = "CL_00000632"; - public String formatString(String p_74535_1_) - { - try - { - return String.format(p_74535_1_, new Object[] {GameSettings.getKeyDisplayString(Minecraft.this.gameSettings.keyBindInventory.getKeyCode())}); - } - catch (Exception var3) - { - return "Error: " + var3.getLocalizedMessage(); - } - } - }); - this.mouseHelper = new MouseHelper(); - this.checkGLError("Pre startup"); - GlStateManager.func_179098_w(); - GlStateManager.shadeModel(7425); - GlStateManager.clearDepth(1.0D); - GlStateManager.enableDepth(); - GlStateManager.depthFunc(515); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.cullFace(1029); - 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.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.func_174937_a(false, this.gameSettings.mipmapLevels > 0); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager); - 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.field_175618_aM = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); - this.mcResourceManager.registerReloadListener(this.field_175618_aM); - 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 EffectRenderer(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); - - 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.func_174966_b(); - } - - private void func_175608_ak() - { - 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 func_175595_al() - { - try - { - this.stream = new TwitchStream(this, (Property)Iterables.getFirst(this.twitchDetails.get("twitch_access_token"), (Object)null)); - } - catch (Throwable var2) - { - this.stream = new NullStream(var2); - logger.error("Couldn\'t initialize twitch stream"); - } - } - - private void func_175609_am() throws LWJGLException - { - Display.setResizable(true); - Display.setTitle("Minecraft 1.8"); - - try - { - Display.create((new PixelFormat()).withDepthBits(24)); - } - catch (LWJGLException var4) - { - logger.error("Couldn\'t set pixel format", var4); - - try - { - Thread.sleep(1000L); - } - catch (InterruptedException var3) - { - ; - } - - if (this.fullscreen) - { - this.updateDisplayMode(); - } - - Display.create(); - } - } - - private void func_175605_an() throws LWJGLException - { - if (this.fullscreen) - { - Display.setFullscreen(true); - DisplayMode var1 = Display.getDisplayMode(); - this.displayWidth = Math.max(1, var1.getWidth()); - this.displayHeight = Math.max(1, var1.getHeight()); - } - else - { - Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight)); - } - } - - private void func_175594_ao() - { - Util.EnumOS var1 = Util.getOSType(); - - if (var1 != Util.EnumOS.OSX) - { - InputStream var2 = null; - InputStream var3 = null; - - try - { - var2 = this.mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_16x16.png")); - var3 = this.mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_32x32.png")); - - if (var2 != null && var3 != null) - { - Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(var2), this.readImageToBuffer(var3)}); - } - } - catch (IOException var8) - { - logger.error("Couldn\'t set icon", var8); - } - finally - { - IOUtils.closeQuietly(var2); - IOUtils.closeQuietly(var3); - } - } - } - - private static boolean isJvm64bit() - { - String[] var0 = new String[] {"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"}; - String[] var1 = var0; - int var2 = var0.length; - - for (int var3 = 0; var3 < var2; ++var3) - { - String var4 = var1[var3]; - String var5 = System.getProperty(var4); - - if (var5 != null && var5.contains("64")) - { - return true; - } - } - - return false; - } - - public Framebuffer getFramebuffer() - { - return this.framebufferMc; - } - - public String func_175600_c() - { - return this.launchedVersion; - } - - private void startTimerHackThread() - { - Thread var1 = new Thread("Timer hack thread") - { - private static final String __OBFID = "CL_00000639"; - public void run() - { - while (Minecraft.this.running) - { - try - { - Thread.sleep(2147483647L); - } - catch (InterruptedException var2) - { - ; - } - } - } - }; - var1.setDaemon(true); - var1.start(); - } - - public void crashed(CrashReport crash) - { - this.hasCrashed = true; - this.crashReporter = crash; - } - - /** - * Wrapper around displayCrashReportInternal - */ - public void displayCrashReport(CrashReport crashReportIn) - { - File var2 = new File(getMinecraft().mcDataDir, "crash-reports"); - File var3 = new File(var2, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); - Bootstrap.func_179870_a(crashReportIn.getCompleteReport()); - - if (crashReportIn.getFile() != null) - { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); - System.exit(-1); - } - else if (crashReportIn.saveToFile(var3)) - { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + var3.getAbsolutePath()); - System.exit(-1); - } - else - { - Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#"); - System.exit(-2); - } - } - - public boolean isUnicode() - { - return this.mcLanguageManager.isCurrentLocaleUnicode() || this.gameSettings.forceUnicodeFont; - } - - public void refreshResources() - { - ArrayList var1 = Lists.newArrayList(this.defaultResourcePacks); - Iterator var2 = this.mcResourcePackRepository.getRepositoryEntries().iterator(); - - while (var2.hasNext()) - { - ResourcePackRepository.Entry var3 = (ResourcePackRepository.Entry)var2.next(); - var1.add(var3.getResourcePack()); - } - - if (this.mcResourcePackRepository.getResourcePackInstance() != null) - { - var1.add(this.mcResourcePackRepository.getResourcePackInstance()); - } - - try - { - this.mcResourceManager.reloadResources(var1); - } - catch (RuntimeException var4) - { - logger.info("Caught error stitching, removing all assigned resourcepacks", var4); - var1.clear(); - var1.addAll(this.defaultResourcePacks); - this.mcResourcePackRepository.func_148527_a(Collections.emptyList()); - this.mcResourceManager.reloadResources(var1); - this.gameSettings.resourcePacks.clear(); - this.gameSettings.saveOptions(); - } - - this.mcLanguageManager.parseLanguageMetadata(var1); - - if (this.renderGlobal != null) - { - this.renderGlobal.loadRenderers(); - } - } - - private ByteBuffer readImageToBuffer(InputStream imageStream) throws IOException - { - BufferedImage var2 = ImageIO.read(imageStream); - int[] var3 = var2.getRGB(0, 0, var2.getWidth(), var2.getHeight(), (int[])null, 0, var2.getWidth()); - ByteBuffer var4 = ByteBuffer.allocate(4 * var3.length); - int[] var5 = var3; - int var6 = var3.length; - - for (int var7 = 0; var7 < var6; ++var7) - { - int var8 = var5[var7]; - var4.putInt(var8 << 8 | var8 >> 24 & 255); - } - - var4.flip(); - return var4; - } - - private void updateDisplayMode() throws LWJGLException - { - HashSet var1 = Sets.newHashSet(); - Collections.addAll(var1, Display.getAvailableDisplayModes()); - DisplayMode var2 = Display.getDesktopDisplayMode(); - - if (!var1.contains(var2) && Util.getOSType() == Util.EnumOS.OSX) - { - Iterator var3 = macDisplayModes.iterator(); - - while (var3.hasNext()) - { - DisplayMode var4 = (DisplayMode)var3.next(); - boolean var5 = true; - Iterator var6 = var1.iterator(); - DisplayMode var7; - - while (var6.hasNext()) - { - var7 = (DisplayMode)var6.next(); - - if (var7.getBitsPerPixel() == 32 && var7.getWidth() == var4.getWidth() && var7.getHeight() == var4.getHeight()) - { - var5 = false; - break; - } - } - - if (!var5) - { - var6 = var1.iterator(); - - while (var6.hasNext()) - { - var7 = (DisplayMode)var6.next(); - - if (var7.getBitsPerPixel() == 32 && var7.getWidth() == var4.getWidth() / 2 && var7.getHeight() == var4.getHeight() / 2) - { - var2 = var7; - break; - } - } - } - } - } - - Display.setDisplayMode(var2); - this.displayWidth = var2.getWidth(); - this.displayHeight = var2.getHeight(); - } - - private void func_180510_a(TextureManager p_180510_1_) - { - ScaledResolution var2 = new ScaledResolution(this, this.displayWidth, this.displayHeight); - int var3 = var2.getScaleFactor(); - Framebuffer var4 = new Framebuffer(var2.getScaledWidth() * var3, var2.getScaledHeight() * var3, true); - var4.bindFramebuffer(false); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0.0D, (double)var2.getScaledWidth(), (double)var2.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.func_179098_w(); - InputStream var5 = null; - - try - { - var5 = this.mcDefaultResourcePack.getInputStream(locationMojangPng); - this.mojangLogo = p_180510_1_.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(var5))); - p_180510_1_.bindTexture(this.mojangLogo); - } - catch (IOException var12) - { - logger.error("Unable to load logo: " + locationMojangPng, var12); - } - finally - { - IOUtils.closeQuietly(var5); - } - - Tessellator var6 = Tessellator.getInstance(); - WorldRenderer var7 = var6.getWorldRenderer(); - var7.startDrawingQuads(); - var7.func_178991_c(16777215); - var7.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); - var7.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); - var7.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); - var7.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - var6.draw(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - var7.func_178991_c(16777215); - short var8 = 256; - short var9 = 256; - this.scaledTessellator((var2.getScaledWidth() - var8) / 2, (var2.getScaledHeight() - var9) / 2, 0, 0, var8, var9); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - var4.unbindFramebuffer(); - var4.framebufferRender(var2.getScaledWidth() * var3, var2.getScaledHeight() * var3); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - this.func_175601_h(); - } - - /** - * Loads Tessellator with a scaled resolution - */ - public void scaledTessellator(int width, int height, int width2, int height2, int stdTextureWidth, int stdTextureHeight) - { - float var7 = 0.00390625F; - float var8 = 0.00390625F; - WorldRenderer var9 = Tessellator.getInstance().getWorldRenderer(); - var9.startDrawingQuads(); - var9.addVertexWithUV((double)(width + 0), (double)(height + stdTextureHeight), 0.0D, (double)((float)(width2 + 0) * var7), (double)((float)(height2 + stdTextureHeight) * var8)); - var9.addVertexWithUV((double)(width + stdTextureWidth), (double)(height + stdTextureHeight), 0.0D, (double)((float)(width2 + stdTextureWidth) * var7), (double)((float)(height2 + stdTextureHeight) * var8)); - var9.addVertexWithUV((double)(width + stdTextureWidth), (double)(height + 0), 0.0D, (double)((float)(width2 + stdTextureWidth) * var7), (double)((float)(height2 + 0) * var8)); - var9.addVertexWithUV((double)(width + 0), (double)(height + 0), 0.0D, (double)((float)(width2 + 0) * var7), (double)((float)(height2 + 0) * var8)); - 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(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(); - } - - if (guiScreenIn instanceof GuiMainMenu) - { - this.gameSettings.showDebugInfo = false; - this.ingameGUI.getChatGUI().clearChatMessages(); - } - - this.currentScreen = (GuiScreen)guiScreenIn; - - if (guiScreenIn != null) - { - this.setIngameNotInFocus(); - ScaledResolution var2 = new ScaledResolution(this, this.displayWidth, this.displayHeight); - int var3 = var2.getScaledWidth(); - int var4 = var2.getScaledHeight(); - ((GuiScreen)guiScreenIn).setWorldAndResolution(this, var3, var4); - 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) - { - if (this.field_175619_R) - { - int var2 = GL11.glGetError(); - - if (var2 != 0) - { - String var3 = GLU.gluErrorString(var2); - logger.error("########## GL ERROR ##########"); - logger.error("@ " + message); - logger.error(var2 + ": " + var3); - } - } - } - - /** - * 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 - { - this.stream.shutdownStream(); - 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 - { - this.mcProfiler.startSection("root"); - - if (Display.isCreated() && Display.isCloseRequested()) - { - this.shutdown(); - } - - if (this.isGamePaused && this.theWorld != null) - { - float var1 = this.timer.renderPartialTicks; - this.timer.updateTimer(); - this.timer.renderPartialTicks = var1; - - // 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"); - Queue var6 = this.scheduledTasks; - - synchronized (this.scheduledTasks) - { - while (!this.scheduledTasks.isEmpty()) - { - ((FutureTask)this.scheduledTasks.poll()).run(); - } - } - - // 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 var7 = 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 var8 = System.nanoTime() - var7; - 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.func_179098_w(); - - if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) - { - this.gameSettings.thirdPersonView = 0; - } - - 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); - 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(var8); - } - 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.func_152430_c(this.timer.renderPartialTicks); - GlStateManager.popMatrix(); - this.mcProfiler.startSection("root"); - this.func_175601_h(); - Thread.yield(); - this.mcProfiler.startSection("stream"); - this.mcProfiler.startSection("update"); - this.stream.func_152935_j(); - this.mcProfiler.endStartSection("submit"); - this.stream.func_152922_k(); - this.mcProfiler.endSection(); - this.mcProfiler.endSection(); - this.checkGLError("Post render"); - ++this.fpsCounter; - this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic(); - - 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.field_178592_a), RenderChunk.field_178592_a != 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 ? " clouds" : "", OpenGlHelper.func_176075_f() ? " vbo" : ""}); - RenderChunk.field_178592_a = 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 func_175601_h() - { - this.mcProfiler.startSection("display_update"); - Display.update(); - this.mcProfiler.endSection(); - this.func_175604_i(); - } - - protected void func_175604_i() - { - if (!this.fullscreen && Display.wasResized()) - { - int var1 = this.displayWidth; - int var2 = this.displayHeight; - this.displayWidth = Display.getWidth(); - this.displayHeight = Display.getHeight(); - - if (this.displayWidth != var1 || this.displayHeight != var2) - { - 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 var2 = this.mcProfiler.getProfilingData(this.debugProfilerName); - - if (var2 != null && !var2.isEmpty()) - { - Profiler.Result var3 = (Profiler.Result)var2.remove(0); - - if (keyCount == 0) - { - if (var3.field_76331_c.length() > 0) - { - int var4 = this.debugProfilerName.lastIndexOf("."); - - if (var4 >= 0) - { - this.debugProfilerName = this.debugProfilerName.substring(0, var4); - } - } - } - else - { - --keyCount; - - if (keyCount < var2.size() && !((Profiler.Result)var2.get(keyCount)).field_76331_c.equals("unspecified")) - { - if (this.debugProfilerName.length() > 0) - { - this.debugProfilerName = this.debugProfilerName + "."; - } - - this.debugProfilerName = this.debugProfilerName + ((Profiler.Result)var2.get(keyCount)).field_76331_c; - } - } - } - } - - /** - * Parameter appears to be unused - */ - private void displayDebugInfo(long elapsedTicksTime) - { - if (this.mcProfiler.profilingEnabled) - { - List var3 = this.mcProfiler.getProfilingData(this.debugProfilerName); - Profiler.Result var4 = (Profiler.Result)var3.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); - GL11.glLineWidth(1.0F); - GlStateManager.func_179090_x(); - Tessellator var5 = Tessellator.getInstance(); - WorldRenderer var6 = var5.getWorldRenderer(); - short var7 = 160; - int var8 = this.displayWidth - var7 - 10; - int var9 = this.displayHeight - var7 * 2; - GlStateManager.enableBlend(); - var6.startDrawingQuads(); - var6.func_178974_a(0, 200); - var6.addVertex((double)((float)var8 - (float)var7 * 1.1F), (double)((float)var9 - (float)var7 * 0.6F - 16.0F), 0.0D); - var6.addVertex((double)((float)var8 - (float)var7 * 1.1F), (double)(var9 + var7 * 2), 0.0D); - var6.addVertex((double)((float)var8 + (float)var7 * 1.1F), (double)(var9 + var7 * 2), 0.0D); - var6.addVertex((double)((float)var8 + (float)var7 * 1.1F), (double)((float)var9 - (float)var7 * 0.6F - 16.0F), 0.0D); - var5.draw(); - GlStateManager.disableBlend(); - double var10 = 0.0D; - int var14; - - for (int var12 = 0; var12 < var3.size(); ++var12) - { - Profiler.Result var13 = (Profiler.Result)var3.get(var12); - var14 = MathHelper.floor_double(var13.field_76332_a / 4.0D) + 1; - var6.startDrawing(6); - var6.func_178991_c(var13.func_76329_a()); - var6.addVertex((double)var8, (double)var9, 0.0D); - int var15; - float var16; - float var17; - float var18; - - for (var15 = var14; var15 >= 0; --var15) - { - var16 = (float)((var10 + var13.field_76332_a * (double)var15 / (double)var14) * Math.PI * 2.0D / 100.0D); - var17 = MathHelper.sin(var16) * (float)var7; - var18 = MathHelper.cos(var16) * (float)var7 * 0.5F; - var6.addVertex((double)((float)var8 + var17), (double)((float)var9 - var18), 0.0D); - } - - var5.draw(); - var6.startDrawing(5); - var6.func_178991_c((var13.func_76329_a() & 16711422) >> 1); - - for (var15 = var14; var15 >= 0; --var15) - { - var16 = (float)((var10 + var13.field_76332_a * (double)var15 / (double)var14) * Math.PI * 2.0D / 100.0D); - var17 = MathHelper.sin(var16) * (float)var7; - var18 = MathHelper.cos(var16) * (float)var7 * 0.5F; - var6.addVertex((double)((float)var8 + var17), (double)((float)var9 - var18), 0.0D); - var6.addVertex((double)((float)var8 + var17), (double)((float)var9 - var18 + 10.0F), 0.0D); - } - - var5.draw(); - var10 += var13.field_76332_a; - } - - DecimalFormat var19 = new DecimalFormat("##0.00"); - GlStateManager.func_179098_w(); - String var20 = ""; - - if (!var4.field_76331_c.equals("unspecified")) - { - var20 = var20 + "[0] "; - } - - if (var4.field_76331_c.length() == 0) - { - var20 = var20 + "ROOT "; - } - else - { - var20 = var20 + var4.field_76331_c + " "; - } - - var14 = 16777215; - this.fontRendererObj.func_175063_a(var20, (float)(var8 - var7), (float)(var9 - var7 / 2 - 16), var14); - this.fontRendererObj.func_175063_a(var20 = var19.format(var4.field_76330_b) + "%", (float)(var8 + var7 - this.fontRendererObj.getStringWidth(var20)), (float)(var9 - var7 / 2 - 16), var14); - - for (int var21 = 0; var21 < var3.size(); ++var21) - { - Profiler.Result var22 = (Profiler.Result)var3.get(var21); - String var23 = ""; - - if (var22.field_76331_c.equals("unspecified")) - { - var23 = var23 + "[?] "; - } - else - { - var23 = var23 + "[" + (var21 + 1) + "] "; - } - - var23 = var23 + var22.field_76331_c; - this.fontRendererObj.func_175063_a(var23, (float)(var8 - var7), (float)(var9 + var7 / 2 + var21 * 8 + 20), var22.func_76329_a()); - this.fontRendererObj.func_175063_a(var23 = var19.format(var22.field_76332_a) + "%", (float)(var8 + var7 - 50 - this.fontRendererObj.getStringWidth(var23)), (float)(var9 + var7 / 2 + var21 * 8 + 20), var22.func_76329_a()); - this.fontRendererObj.func_175063_a(var23 = var19.format(var22.field_76330_b) + "%", (float)(var8 + var7 - this.fontRendererObj.getStringWidth(var23)), (float)(var9 + var7 / 2 + var21 * 8 + 20), var22.func_76329_a()); - } - } - } - - /** - * 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) - { - 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) - { - KeyBinding.unPressAllKeys(); - 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.isUsingItem()) - { - if (leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos var2 = this.objectMouseOver.func_178782_a(); - - if (this.theWorld.getBlockState(var2).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(var2, this.objectMouseOver.field_178784_b)) - { - this.effectRenderer.func_180532_a(var2, this.objectMouseOver.field_178784_b); - this.thePlayer.swingItem(); - } - } - else - { - this.playerController.resetBlockRemoving(); - } - } - } - - private void clickMouse() - { - if (this.leftClickCounter <= 0) - { - this.thePlayer.swingItem(); - - if (this.objectMouseOver == null) - { - logger.error("Null returned as \'hitResult\', this shouldn\'t happen!"); - - if (this.playerController.isNotCreative()) - { - this.leftClickCounter = 10; - } - } - else - { - switch (Minecraft.SwitchEnumMinecartType.field_152390_a[this.objectMouseOver.typeOfHit.ordinal()]) - { - case 1: - this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit); - break; - - case 2: - BlockPos var1 = this.objectMouseOver.func_178782_a(); - - if (this.theWorld.getBlockState(var1).getBlock().getMaterial() != Material.air) - { - this.playerController.func_180511_b(var1, this.objectMouseOver.field_178784_b); - break; - } - - case 3: - default: - if (this.playerController.isNotCreative()) - { - this.leftClickCounter = 10; - } - } - } - } - } - - /** - * Called when user clicked he's mouse right button (place) - */ - private void rightClickMouse() - { - this.rightClickDelayTimer = 4; - boolean var1 = true; - ItemStack var2 = this.thePlayer.inventory.getCurrentItem(); - - if (this.objectMouseOver == null) - { - logger.warn("Null returned as \'hitResult\', this shouldn\'t happen!"); - } - else - { - switch (Minecraft.SwitchEnumMinecartType.field_152390_a[this.objectMouseOver.typeOfHit.ordinal()]) - { - case 1: - if (this.playerController.func_178894_a(this.thePlayer, this.objectMouseOver.entityHit, this.objectMouseOver)) - { - var1 = false; - } - else if (this.playerController.interactWithEntitySendPacket(this.thePlayer, this.objectMouseOver.entityHit)) - { - var1 = false; - } - - break; - - case 2: - BlockPos var3 = this.objectMouseOver.func_178782_a(); - - if (this.theWorld.getBlockState(var3).getBlock().getMaterial() != Material.air) - { - int var4 = var2 != null ? var2.stackSize : 0; - - if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, var2, var3, this.objectMouseOver.field_178784_b, this.objectMouseOver.hitVec)) - { - var1 = false; - this.thePlayer.swingItem(); - } - - if (var2 == null) - { - return; - } - - if (var2.stackSize == 0) - { - this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null; - } - else if (var2.stackSize != var4 || this.playerController.isInCreativeMode()) - { - this.entityRenderer.itemRenderer.resetEquippedProgress(); - } - } - } - } - - if (var1) - { - ItemStack var5 = this.thePlayer.inventory.getCurrentItem(); - - if (var5 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var5)) - { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); - } - } - } - - /** - * 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.func_175601_h(); - } - catch (Exception var2) - { - logger.error("Couldn\'t toggle fullscreen", var2); - } - } - - /** - * 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 var3 = new ScaledResolution(this, width, height); - this.currentScreen.func_175273_b(this, var3.getScaledWidth(), var3.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); - } - } - - /** - * 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.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; - } - - CrashReport var2; - CrashReportCategory var3; - - if (this.currentScreen != null) - { - try - { - this.currentScreen.handleInput(); - } - catch (Throwable var7) - { - var2 = CrashReport.makeCrashReport(var7, "Updating screen events"); - var3 = var2.makeCategory("Affected screen"); - var3.addCrashSectionCallable("Screen name", new Callable() - { - private static final String __OBFID = "CL_00000640"; - public String call() - { - return Minecraft.this.currentScreen.getClass().getCanonicalName(); - } - }); - throw new ReportedException(var2); - } - - if (this.currentScreen != null) - { - try - { - this.currentScreen.updateScreen(); - } - catch (Throwable var6) - { - var2 = CrashReport.makeCrashReport(var6, "Ticking screen"); - var3 = var2.makeCategory("Affected screen"); - var3.addCrashSectionCallable("Screen name", new Callable() - { - private static final String __OBFID = "CL_00000642"; - public String call() - { - return Minecraft.this.currentScreen.getClass().getCanonicalName(); - } - }); - throw new ReportedException(var2); - } - } - } - - if (this.currentScreen == null || this.currentScreen.allowUserInput) - { - this.mcProfiler.endStartSection("mouse"); - int var1; - - while (Mouse.next()) - { - var1 = Mouse.getEventButton(); - KeyBinding.setKeyBindState(var1 - 100, Mouse.getEventButtonState()); - - if (Mouse.getEventButtonState()) - { - if (this.thePlayer.func_175149_v() && var1 == 2) - { - this.ingameGUI.func_175187_g().func_175261_b(); - } - else - { - KeyBinding.onTick(var1 - 100); - } - } - - long var10 = getSystemTime() - this.systemTime; - - // Cubitick: tickrate fix to mouse wheel input - if (var10 <= (long)Math.max(200F*(Cubitick.tickrate/Cubitick.tickrateWorld), 200L)) - { - int var4 = Mouse.getEventDWheel(); - - if (var4 != 0) - { - if (this.thePlayer.func_175149_v()) - { - var4 = var4 < 0 ? -1 : 1; - - if (this.ingameGUI.func_175187_g().func_175262_a()) - { - this.ingameGUI.func_175187_g().func_175259_b(-var4); - } - else - { - float var5 = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float)var4 * 0.005F, 0.0F, 0.2F); - this.thePlayer.capabilities.setFlySpeed(var5); - } - } - else - { - this.thePlayer.inventory.changeCurrentItem(var4); - } - } - - if (this.currentScreen == null) - { - if (!this.inGameHasFocus && Mouse.getEventButtonState()) - { - this.setIngameFocus(); - } - } - else if (this.currentScreen != null) - { - this.currentScreen.handleMouseInput(); - } - } - } - - if (this.leftClickCounter > 0) - { - --this.leftClickCounter; - } - - this.mcProfiler.endStartSection("keyboard"); - - while (Keyboard.next()) - { - var1 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); - KeyBinding.setKeyBindState(var1, Keyboard.getEventKeyState()); - - if (Keyboard.getEventKeyState()) - { - KeyBinding.onTick(var1); - } - - 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.debugCrashKeyPressTime = getSystemTime(); - } - - this.dispatchKeypresses(); - - if (Keyboard.getEventKeyState()) - { - if (var1 == 62 && this.entityRenderer != null) - { - this.entityRenderer.func_175071_c(); - } - - if (this.currentScreen != null) - { - this.currentScreen.handleKeyboardInput(); - } - else - { - if (var1 == 1) - { - this.displayInGameMenu(); - } - - if (var1 == 32 && Keyboard.isKeyDown(61) && this.ingameGUI != null) - { - this.ingameGUI.getChatGUI().clearChatMessages(); - } - - if (var1 == 31 && Keyboard.isKeyDown(61)) - { - this.refreshResources(); - } - - if (var1 == 17 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 18 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 47 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 38 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 22 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 20 && Keyboard.isKeyDown(61)) - { - this.refreshResources(); - } - - if (var1 == 33 && Keyboard.isKeyDown(61)) - { - boolean var11 = Keyboard.isKeyDown(42) | Keyboard.isKeyDown(54); - this.gameSettings.setOptionValue(GameSettings.Options.RENDER_DISTANCE, var11 ? -1 : 1); - } - - if (var1 == 30 && Keyboard.isKeyDown(61)) - { - this.renderGlobal.loadRenderers(); - } - - if (var1 == 35 && Keyboard.isKeyDown(61)) - { - this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips; - this.gameSettings.saveOptions(); - } - - if (var1 == 48 && Keyboard.isKeyDown(61)) - { - this.renderManager.func_178629_b(!this.renderManager.func_178634_b()); - } - - if (var1 == 25 && Keyboard.isKeyDown(61)) - { - this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus; - this.gameSettings.saveOptions(); - } - - if (var1 == 59) - { - this.gameSettings.hideGUI = !this.gameSettings.hideGUI; - } - - if (var1 == 61) - { - this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo; - this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown(); - } - - if (this.gameSettings.keyBindTogglePerspective.isPressed()) - { - ++this.gameSettings.thirdPersonView; - - if (this.gameSettings.thirdPersonView > 2) - { - this.gameSettings.thirdPersonView = 0; - } - - if (this.gameSettings.thirdPersonView == 0) - { - this.entityRenderer.func_175066_a(this.func_175606_aa()); - } - else if (this.gameSettings.thirdPersonView == 1) - { - this.entityRenderer.func_175066_a((Entity)null); - } - } - - if (this.gameSettings.keyBindSmoothCamera.isPressed()) - { - this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; - } - } - - if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) - { - if (var1 == 11) - { - this.updateDebugProfilerName(0); - } - - for (int var12 = 0; var12 < 9; ++var12) - { - if (var1 == 2 + var12) - { - this.updateDebugProfilerName(var12 + 1); - } - } - } - } - } - - for (var1 = 0; var1 < 9; ++var1) - { - if (this.gameSettings.keyBindsHotbar[var1].isPressed()) - { - if (this.thePlayer.func_175149_v()) - { - this.ingameGUI.func_175187_g().func_175260_a(var1); - } - else - { - this.thePlayer.inventory.currentItem = var1; - } - } - } - - boolean var9 = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN; - - while (this.gameSettings.keyBindInventory.isPressed()) - { - if (this.playerController.isRidingHorse()) - { - this.thePlayer.func_175163_u(); - } - else - { - this.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT)); - this.displayGuiScreen(new GuiInventory(this.thePlayer)); - } - } - - while (this.gameSettings.keyBindDrop.isPressed()) - { - if (!this.thePlayer.func_175149_v()) - { - this.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown()); - } - } - - while (this.gameSettings.keyBindChat.isPressed() && var9) - { - this.displayGuiScreen(new GuiChat()); - } - - if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed() && var9) - { - this.displayGuiScreen(new GuiChat("/")); - } - - if (this.thePlayer.isUsingItem()) - { - if (!this.gameSettings.keyBindUseItem.getIsKeyPressed()) - { - this.playerController.onStoppedUsingItem(this.thePlayer); - } - - label435: - - while (true) - { - if (!this.gameSettings.keyBindAttack.isPressed()) - { - while (this.gameSettings.keyBindUseItem.isPressed()) - { - ; - } - - while (true) - { - if (this.gameSettings.keyBindPickBlock.isPressed()) - { - continue; - } - - break label435; - } - } - } - } - 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.getIsKeyPressed() && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem()) - { - this.rightClickMouse(); - } - - this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.getIsKeyPressed() && this.inGameHasFocus); - } - - 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.func_175658_ac() > 0) - { - this.theWorld.setLastLightningBolt(this.theWorld.func_175658_ac() - 1); - } - - // Cubitick: custom version of the World.updateEntities() method which skips the update for a specified entity - // this.theWorld.updateEntities(this.thePlayer); - - // 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); - } - } - - 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 var8) - { - var2 = CrashReport.makeCrashReport(var8, "Exception in world tick"); - - if (this.theWorld == null) - { - var3 = var2.makeCategory("Affected level"); - var3.addCrashSection("Problem", "Level is null!"); - } - else - { - this.theWorld.addWorldInfoToCrashReport(var2); - } - - throw new ReportedException(var2); - } - } - - 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(); - } - - - /*************************************************** - * Original runTick() used in synchronisation mode * - ***************************************************/ - - 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.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; - } - - CrashReport var2; - CrashReportCategory var3; - - if (this.currentScreen != null) - { - try - { - this.currentScreen.handleInput(); - } - catch (Throwable var7) - { - var2 = CrashReport.makeCrashReport(var7, "Updating screen events"); - var3 = var2.makeCategory("Affected screen"); - var3.addCrashSectionCallable("Screen name", new Callable() - { - private static final String __OBFID = "CL_00000640"; - public String call() - { - return Minecraft.this.currentScreen.getClass().getCanonicalName(); - } - }); - throw new ReportedException(var2); - } - - if (this.currentScreen != null) - { - try - { - this.currentScreen.updateScreen(); - } - catch (Throwable var6) - { - var2 = CrashReport.makeCrashReport(var6, "Ticking screen"); - var3 = var2.makeCategory("Affected screen"); - var3.addCrashSectionCallable("Screen name", new Callable() - { - private static final String __OBFID = "CL_00000642"; - public String call() - { - return Minecraft.this.currentScreen.getClass().getCanonicalName(); - } - }); - throw new ReportedException(var2); - } - } - } - - if (this.currentScreen == null || this.currentScreen.allowUserInput) - { - this.mcProfiler.endStartSection("mouse"); - int var1; - - while (Mouse.next()) - { - var1 = Mouse.getEventButton(); - KeyBinding.setKeyBindState(var1 - 100, Mouse.getEventButtonState()); - - if (Mouse.getEventButtonState()) - { - if (this.thePlayer.func_175149_v() && var1 == 2) - { - this.ingameGUI.func_175187_g().func_175261_b(); - } - else - { - KeyBinding.onTick(var1 - 100); - } - } - - long var10 = getSystemTime() - this.systemTime; - - if (var10 <= 200L) - { - int var4 = Mouse.getEventDWheel(); - - if (var4 != 0) - { - if (this.thePlayer.func_175149_v()) - { - var4 = var4 < 0 ? -1 : 1; - - if (this.ingameGUI.func_175187_g().func_175262_a()) - { - this.ingameGUI.func_175187_g().func_175259_b(-var4); - } - else - { - float var5 = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float)var4 * 0.005F, 0.0F, 0.2F); - this.thePlayer.capabilities.setFlySpeed(var5); - } - } - else - { - this.thePlayer.inventory.changeCurrentItem(var4); - } - } - - if (this.currentScreen == null) - { - if (!this.inGameHasFocus && Mouse.getEventButtonState()) - { - this.setIngameFocus(); - } - } - else if (this.currentScreen != null) - { - this.currentScreen.handleMouseInput(); - } - } - } - - if (this.leftClickCounter > 0) - { - --this.leftClickCounter; - } - - this.mcProfiler.endStartSection("keyboard"); - - while (Keyboard.next()) - { - var1 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); - KeyBinding.setKeyBindState(var1, Keyboard.getEventKeyState()); - - if (Keyboard.getEventKeyState()) - { - KeyBinding.onTick(var1); - } - - 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.debugCrashKeyPressTime = getSystemTime(); - } - - this.dispatchKeypresses(); - - if (Keyboard.getEventKeyState()) - { - if (var1 == 62 && this.entityRenderer != null) - { - this.entityRenderer.func_175071_c(); - } - - if (this.currentScreen != null) - { - this.currentScreen.handleKeyboardInput(); - } - else - { - if (var1 == 1) - { - this.displayInGameMenu(); - } - - if (var1 == 32 && Keyboard.isKeyDown(61) && this.ingameGUI != null) - { - this.ingameGUI.getChatGUI().clearChatMessages(); - } - - if (var1 == 31 && Keyboard.isKeyDown(61)) - { - this.refreshResources(); - } - - if (var1 == 17 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 18 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 47 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 38 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 22 && Keyboard.isKeyDown(61)) - { - ; - } - - if (var1 == 20 && Keyboard.isKeyDown(61)) - { - this.refreshResources(); - } - - if (var1 == 33 && Keyboard.isKeyDown(61)) - { - boolean var11 = Keyboard.isKeyDown(42) | Keyboard.isKeyDown(54); - this.gameSettings.setOptionValue(GameSettings.Options.RENDER_DISTANCE, var11 ? -1 : 1); - } - - if (var1 == 30 && Keyboard.isKeyDown(61)) - { - this.renderGlobal.loadRenderers(); - } - - if (var1 == 35 && Keyboard.isKeyDown(61)) - { - this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips; - this.gameSettings.saveOptions(); - } - - if (var1 == 48 && Keyboard.isKeyDown(61)) - { - this.renderManager.func_178629_b(!this.renderManager.func_178634_b()); - } - - if (var1 == 25 && Keyboard.isKeyDown(61)) - { - this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus; - this.gameSettings.saveOptions(); - } - - if (var1 == 59) - { - this.gameSettings.hideGUI = !this.gameSettings.hideGUI; - } - - if (var1 == 61) - { - this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo; - this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown(); - } - - if (this.gameSettings.keyBindTogglePerspective.isPressed()) - { - ++this.gameSettings.thirdPersonView; - - if (this.gameSettings.thirdPersonView > 2) - { - this.gameSettings.thirdPersonView = 0; - } - - if (this.gameSettings.thirdPersonView == 0) - { - this.entityRenderer.func_175066_a(this.func_175606_aa()); - } - else if (this.gameSettings.thirdPersonView == 1) - { - this.entityRenderer.func_175066_a((Entity)null); - } - } - - if (this.gameSettings.keyBindSmoothCamera.isPressed()) - { - this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; - } - } - - if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) - { - if (var1 == 11) - { - this.updateDebugProfilerName(0); - } - - for (int var12 = 0; var12 < 9; ++var12) - { - if (var1 == 2 + var12) - { - this.updateDebugProfilerName(var12 + 1); - } - } - } - } - } - - for (var1 = 0; var1 < 9; ++var1) - { - if (this.gameSettings.keyBindsHotbar[var1].isPressed()) - { - if (this.thePlayer.func_175149_v()) - { - this.ingameGUI.func_175187_g().func_175260_a(var1); - } - else - { - this.thePlayer.inventory.currentItem = var1; - } - } - } - - boolean var9 = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN; - - while (this.gameSettings.keyBindInventory.isPressed()) - { - if (this.playerController.isRidingHorse()) - { - this.thePlayer.func_175163_u(); - } - else - { - this.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT)); - this.displayGuiScreen(new GuiInventory(this.thePlayer)); - } - } - - while (this.gameSettings.keyBindDrop.isPressed()) - { - if (!this.thePlayer.func_175149_v()) - { - this.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown()); - } - } - - while (this.gameSettings.keyBindChat.isPressed() && var9) - { - this.displayGuiScreen(new GuiChat()); - } - - if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed() && var9) - { - this.displayGuiScreen(new GuiChat("/")); - } - - if (this.thePlayer.isUsingItem()) - { - if (!this.gameSettings.keyBindUseItem.getIsKeyPressed()) - { - this.playerController.onStoppedUsingItem(this.thePlayer); - } - - label435: - - while (true) - { - if (!this.gameSettings.keyBindAttack.isPressed()) - { - while (this.gameSettings.keyBindUseItem.isPressed()) - { - ; - } - - while (true) - { - if (this.gameSettings.keyBindPickBlock.isPressed()) - { - continue; - } - - break label435; - } - } - } - } - 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.getIsKeyPressed() && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem()) - { - this.rightClickMouse(); - } - - this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.getIsKeyPressed() && this.inGameHasFocus); - } - - 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.func_175658_ac() > 0) - { - this.theWorld.setLastLightningBolt(this.theWorld.func_175658_ac() - 1); - } - - this.theWorld.updateEntities(); - } - } - - 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 var8) - { - var2 = CrashReport.makeCrashReport(var8, "Exception in world tick"); - - if (this.theWorld == null) - { - var3 = var2.makeCategory("Affected level"); - var3.addCrashSection("Problem", "Level is null!"); - } - else - { - this.theWorld.addWorldInfoToCrashReport(var2); - } - - throw new ReportedException(var2); - } - } - - 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(); - - // PacketAnalysis - if(scheduledReload){ - this.renderGlobal.loadRenderers(); - scheduledReload = false; - } - } - - /** - * Arguments: World foldername, World ingame name, WorldSettings - */ - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) - { - this.loadWorld((WorldClient)null); - System.gc(); - ISaveHandler var4 = this.saveLoader.getSaveLoader(folderName, false); - WorldInfo var5 = var4.loadWorldInfo(); - - if (var5 == null && worldSettingsIn != null) - { - var5 = new WorldInfo(worldSettingsIn, folderName); - var4.saveWorldInfo(var5); - } - - if (worldSettingsIn == null) - { - worldSettingsIn = new WorldSettings(var5); - } - - try - { - this.theIntegratedServer = new IntegratedServer(this, folderName, worldName, worldSettingsIn); - this.theIntegratedServer.startServerThread(); - this.integratedServerIsRunning = true; - } - catch (Throwable var10) - { - CrashReport var7 = CrashReport.makeCrashReport(var10, "Starting integrated server"); - CrashReportCategory var8 = var7.makeCategory("Starting integrated server"); - var8.addCrashSection("Level ID", folderName); - var8.addCrashSection("Level Name", worldName); - throw new ReportedException(var7); - } - - this.loadingScreen.displaySavingString(I18n.format("menu.loadingLevel", new Object[0])); - - while (!this.theIntegratedServer.serverIsInRunLoop()) - { - String var6 = this.theIntegratedServer.getUserMessage(); - - if (var6 != null) - { - this.loadingScreen.displayLoadingString(I18n.format(var6, new Object[0])); - } - else - { - this.loadingScreen.displayLoadingString(""); - } - - try - { - Thread.sleep(200L); - } - catch (InterruptedException var9) - { - ; - } - } - - this.displayGuiScreen((GuiScreen)null); - SocketAddress var11 = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager var12 = NetworkManager.provideLocalClient(var11); - var12.setNetHandler(new NetHandlerLoginClient(var12, this, (GuiScreen)null)); - var12.sendPacket(new C00Handshake(47, var11.toString(), 0, EnumConnectionState.LOGIN)); - var12.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); - this.myNetworkManager = var12; - } - - /** - * 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(WorldClient worldClientIn, String loadingMessage) - { - if (worldClientIn == null) - { - NetHandlerPlayClient var3 = this.getNetHandler(); - - if (var3 != null) - { - var3.cleanup(); - } - - if (this.theIntegratedServer != null && this.theIntegratedServer.func_175578_N()) - { - this.theIntegratedServer.initiateShutdown(); - this.theIntegratedServer.func_175592_a(); - } - - this.theIntegratedServer = null; - this.guiAchievement.clearAchievements(); - this.entityRenderer.getMapItemRenderer().func_148249_a(); - } - - this.field_175622_Z = null; - this.myNetworkManager = null; - - if (this.loadingScreen != null) - { - this.loadingScreen.resetProgressAndMessage(loadingMessage); - this.loadingScreen.displayLoadingString(""); - } - - if (worldClientIn == null && this.theWorld != null) - { - if (this.mcResourcePackRepository.getResourcePackInstance() != null) - { - this.mcResourcePackRepository.func_148529_f(); - this.func_175603_A(); - } - - this.setServerData((ServerData)null); - this.integratedServerIsRunning = false; - } - - this.mcSoundHandler.stopSounds(); - this.theWorld = worldClientIn; - - if (worldClientIn != null) - { - if (this.renderGlobal != null) - { - this.renderGlobal.setWorldAndLoadRenderers(worldClientIn); - } - - if (this.effectRenderer != null) - { - this.effectRenderer.clearEffects(worldClientIn); - } - - if (this.thePlayer == null) - { - this.thePlayer = this.playerController.func_178892_a(worldClientIn, new StatFileWriter()); - 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.field_175622_Z = 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 var2 = 0; - String var3 = null; - - if (this.thePlayer != null) - { - var2 = this.thePlayer.getEntityId(); - this.theWorld.removeEntity(this.thePlayer); - var3 = this.thePlayer.getClientBrand(); - } - - this.field_175622_Z = null; - EntityPlayerSP var4 = this.thePlayer; - this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter()); - this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(var4.getDataWatcher().getAllWatched()); - this.thePlayer.dimension = dimension; - this.field_175622_Z = this.thePlayer; - this.thePlayer.preparePlayerToSpawn(); - this.thePlayer.func_175158_f(var3); - this.theWorld.spawnEntityInWorld(this.thePlayer); - this.playerController.flipPlayer(this.thePlayer); - this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); - this.thePlayer.setEntityId(var2); - this.playerController.setPlayerCapabilities(this.thePlayer); - this.thePlayer.func_175150_k(var4.func_175140_cp()); - - if (this.currentScreen instanceof GuiGameOver) - { - this.displayGuiScreen((GuiScreen)null); - } - } - - /** - * Gets whether this is a demo or not. - */ - public final boolean isDemo() - { - return this.isDemo; - } - - public NetHandlerPlayClient getNetHandler() - { - return this.thePlayer != null ? this.thePlayer.sendQueue : null; - } - - 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) - { - boolean var1 = this.thePlayer.capabilities.isCreativeMode; - int var3 = 0; - boolean var4 = false; - TileEntity var5 = null; - Object var2; - - if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos var6 = this.objectMouseOver.func_178782_a(); - Block var7 = this.theWorld.getBlockState(var6).getBlock(); - - if (var7.getMaterial() == Material.air) - { - return; - } - - var2 = var7.getItem(this.theWorld, var6); - - if (var2 == null) - { - return; - } - - if (var1 && GuiScreen.isCtrlKeyDown()) - { - var5 = this.theWorld.getTileEntity(var6); - } - - Block var8 = var2 instanceof ItemBlock && !var7.isFlowerPot() ? Block.getBlockFromItem((Item)var2) : var7; - var3 = var8.getDamageValue(this.theWorld, var6); - var4 = ((Item)var2).getHasSubtypes(); - } - else - { - if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !var1) - { - return; - } - - if (this.objectMouseOver.entityHit instanceof EntityPainting) - { - var2 = Items.painting; - } - else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) - { - var2 = Items.lead; - } - else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) - { - EntityItemFrame var11 = (EntityItemFrame)this.objectMouseOver.entityHit; - ItemStack var14 = var11.getDisplayedItem(); - - if (var14 == null) - { - var2 = Items.item_frame; - } - else - { - var2 = var14.getItem(); - var3 = var14.getMetadata(); - var4 = true; - } - } - else if (this.objectMouseOver.entityHit instanceof EntityMinecart) - { - EntityMinecart var12 = (EntityMinecart)this.objectMouseOver.entityHit; - - switch (Minecraft.SwitchEnumMinecartType.field_178901_b[var12.func_180456_s().ordinal()]) - { - case 1: - var2 = Items.furnace_minecart; - break; - - case 2: - var2 = Items.chest_minecart; - break; - - case 3: - var2 = Items.tnt_minecart; - break; - - case 4: - var2 = Items.hopper_minecart; - break; - - case 5: - var2 = Items.command_block_minecart; - break; - - default: - var2 = Items.minecart; - } - } - else if (this.objectMouseOver.entityHit instanceof EntityBoat) - { - var2 = Items.boat; - } - else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) - { - var2 = Items.armor_stand; - } - else - { - var2 = Items.spawn_egg; - var3 = EntityList.getEntityID(this.objectMouseOver.entityHit); - var4 = true; - - if (!EntityList.entityEggs.containsKey(Integer.valueOf(var3))) - { - return; - } - } - } - - InventoryPlayer var13 = this.thePlayer.inventory; - - if (var5 == null) - { - var13.setCurrentItem((Item)var2, var3, var4, var1); - } - else - { - NBTTagCompound var15 = new NBTTagCompound(); - var5.writeToNBT(var15); - ItemStack var17 = new ItemStack((Item)var2, 1, var3); - var17.setTagInfo("BlockEntityTag", var15); - NBTTagCompound var9 = new NBTTagCompound(); - NBTTagList var10 = new NBTTagList(); - var10.appendTag(new NBTTagString("(+NBT)")); - var9.setTag("Lore", var10); - var17.setTagInfo("display", var9); - var13.setInventorySlotContents(var13.currentItem, var17); - } - - if (var1) - { - int var16 = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + var13.currentItem; - this.playerController.sendSlotPacket(var13.getStackInSlot(var13.currentItem), var16); - } - } - } - - /** - * adds core server Info (GL version , Texture pack, isModded, type), and the worldInfo to the crash report - */ - public CrashReport addGraphicsAndWorldToCrashReport(CrashReport theCrash) - { - theCrash.getCategory().addCrashSectionCallable("Launched Version", new Callable() - { - private static final String __OBFID = "CL_00000643"; - public String call() - { - return Minecraft.this.launchedVersion; - } - }); - theCrash.getCategory().addCrashSectionCallable("LWJGL", new Callable() - { - private static final String __OBFID = "CL_00000644"; - public String call() - { - return Sys.getVersion(); - } - }); - theCrash.getCategory().addCrashSectionCallable("OpenGL", new Callable() - { - private static final String __OBFID = "CL_00000645"; - public String call() - { - return GL11.glGetString(GL11.GL_RENDERER) + " GL version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR); - } - }); - theCrash.getCategory().addCrashSectionCallable("GL Caps", new Callable() - { - private static final String __OBFID = "CL_00000646"; - public String call() - { - return OpenGlHelper.func_153172_c(); - } - }); - theCrash.getCategory().addCrashSectionCallable("Using VBOs", new Callable() - { - private static final String __OBFID = "CL_00000647"; - public String call() - { - return Minecraft.this.gameSettings.field_178881_t ? "Yes" : "No"; - } - }); - theCrash.getCategory().addCrashSectionCallable("Is Modded", new Callable() - { - private static final String __OBFID = "CL_00000633"; - public String call() - { - String var1 = ClientBrandRetriever.getClientModName(); - return !var1.equals("vanilla") ? "Definitely; Client brand changed to \'" + var1 + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and client brand is untouched."); - } - }); - theCrash.getCategory().addCrashSectionCallable("Type", new Callable() - { - private static final String __OBFID = "CL_00000634"; - public String call() - { - return "Client (map_client.txt)"; - } - }); - theCrash.getCategory().addCrashSectionCallable("Resource Packs", new Callable() - { - private static final String __OBFID = "CL_00000635"; - public String call() - { - return Minecraft.this.gameSettings.resourcePacks.toString(); - } - }); - theCrash.getCategory().addCrashSectionCallable("Current Language", new Callable() - { - private static final String __OBFID = "CL_00000636"; - public String call() - { - return Minecraft.this.mcLanguageManager.getCurrentLanguage().toString(); - } - }); - theCrash.getCategory().addCrashSectionCallable("Profiler Position", new Callable() - { - private static final String __OBFID = "CL_00000637"; - public String call() - { - return Minecraft.this.mcProfiler.profilingEnabled ? Minecraft.this.mcProfiler.getNameOfLastSection() : "N/A (disabled)"; - } - }); - - 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 func_175603_A() - { - return this.addScheduledTask(new Runnable() - { - private static final String __OBFID = "CL_00001853"; - public void run() - { - Minecraft.this.refreshResources(); - } - }); - } - - public void addServerStatsToSnooper(PlayerUsageSnooper 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)); - String var2 = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big"; - playerSnooper.addClientStat("endianness", var2); - playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size())); - int var3 = 0; - Iterator var4 = this.mcResourcePackRepository.getRepositoryEntries().iterator(); - - while (var4.hasNext()) - { - ResourcePackRepository.Entry var5 = (ResourcePackRepository.Entry)var4.next(); - playerSnooper.addClientStat("resource_pack[" + var3++ + "]", var5.getResourcePackName()); - } - - if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null) - { - playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID()); - } - } - - public void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper) - { - playerSnooper.addStatToSnooper("opengl_version", GL11.glGetString(GL11.GL_VERSION)); - playerSnooper.addStatToSnooper("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR)); - playerSnooper.addStatToSnooper("client_brand", ClientBrandRetriever.getClientModName()); - playerSnooper.addStatToSnooper("launched_version", this.launchedVersion); - ContextCapabilities var2 = GLContext.getCapabilities(); - playerSnooper.addStatToSnooper("gl_caps[ARB_arrays_of_arrays]", Boolean.valueOf(var2.GL_ARB_arrays_of_arrays)); - playerSnooper.addStatToSnooper("gl_caps[ARB_base_instance]", Boolean.valueOf(var2.GL_ARB_base_instance)); - playerSnooper.addStatToSnooper("gl_caps[ARB_blend_func_extended]", Boolean.valueOf(var2.GL_ARB_blend_func_extended)); - playerSnooper.addStatToSnooper("gl_caps[ARB_clear_buffer_object]", Boolean.valueOf(var2.GL_ARB_clear_buffer_object)); - playerSnooper.addStatToSnooper("gl_caps[ARB_color_buffer_float]", Boolean.valueOf(var2.GL_ARB_color_buffer_float)); - playerSnooper.addStatToSnooper("gl_caps[ARB_compatibility]", Boolean.valueOf(var2.GL_ARB_compatibility)); - playerSnooper.addStatToSnooper("gl_caps[ARB_compressed_texture_pixel_storage]", Boolean.valueOf(var2.GL_ARB_compressed_texture_pixel_storage)); - playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(var2.GL_ARB_compute_shader)); - playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(var2.GL_ARB_copy_buffer)); - playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(var2.GL_ARB_copy_image)); - playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(var2.GL_ARB_depth_buffer_float)); - playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(var2.GL_ARB_compute_shader)); - playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(var2.GL_ARB_copy_buffer)); - playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(var2.GL_ARB_copy_image)); - playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(var2.GL_ARB_depth_buffer_float)); - playerSnooper.addStatToSnooper("gl_caps[ARB_depth_clamp]", Boolean.valueOf(var2.GL_ARB_depth_clamp)); - playerSnooper.addStatToSnooper("gl_caps[ARB_depth_texture]", Boolean.valueOf(var2.GL_ARB_depth_texture)); - playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers]", Boolean.valueOf(var2.GL_ARB_draw_buffers)); - playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers_blend]", Boolean.valueOf(var2.GL_ARB_draw_buffers_blend)); - playerSnooper.addStatToSnooper("gl_caps[ARB_draw_elements_base_vertex]", Boolean.valueOf(var2.GL_ARB_draw_elements_base_vertex)); - playerSnooper.addStatToSnooper("gl_caps[ARB_draw_indirect]", Boolean.valueOf(var2.GL_ARB_draw_indirect)); - playerSnooper.addStatToSnooper("gl_caps[ARB_draw_instanced]", Boolean.valueOf(var2.GL_ARB_draw_instanced)); - playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_attrib_location]", Boolean.valueOf(var2.GL_ARB_explicit_attrib_location)); - playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_uniform_location]", Boolean.valueOf(var2.GL_ARB_explicit_uniform_location)); - playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_layer_viewport]", Boolean.valueOf(var2.GL_ARB_fragment_layer_viewport)); - playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program]", Boolean.valueOf(var2.GL_ARB_fragment_program)); - playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_shader]", Boolean.valueOf(var2.GL_ARB_fragment_shader)); - playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program_shadow]", Boolean.valueOf(var2.GL_ARB_fragment_program_shadow)); - playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(var2.GL_ARB_framebuffer_object)); - playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_sRGB]", Boolean.valueOf(var2.GL_ARB_framebuffer_sRGB)); - playerSnooper.addStatToSnooper("gl_caps[ARB_geometry_shader4]", Boolean.valueOf(var2.GL_ARB_geometry_shader4)); - playerSnooper.addStatToSnooper("gl_caps[ARB_gpu_shader5]", Boolean.valueOf(var2.GL_ARB_gpu_shader5)); - playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_pixel]", Boolean.valueOf(var2.GL_ARB_half_float_pixel)); - playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_vertex]", Boolean.valueOf(var2.GL_ARB_half_float_vertex)); - playerSnooper.addStatToSnooper("gl_caps[ARB_instanced_arrays]", Boolean.valueOf(var2.GL_ARB_instanced_arrays)); - playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_alignment]", Boolean.valueOf(var2.GL_ARB_map_buffer_alignment)); - playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_range]", Boolean.valueOf(var2.GL_ARB_map_buffer_range)); - playerSnooper.addStatToSnooper("gl_caps[ARB_multisample]", Boolean.valueOf(var2.GL_ARB_multisample)); - playerSnooper.addStatToSnooper("gl_caps[ARB_multitexture]", Boolean.valueOf(var2.GL_ARB_multitexture)); - playerSnooper.addStatToSnooper("gl_caps[ARB_occlusion_query2]", Boolean.valueOf(var2.GL_ARB_occlusion_query2)); - playerSnooper.addStatToSnooper("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(var2.GL_ARB_pixel_buffer_object)); - playerSnooper.addStatToSnooper("gl_caps[ARB_seamless_cube_map]", Boolean.valueOf(var2.GL_ARB_seamless_cube_map)); - playerSnooper.addStatToSnooper("gl_caps[ARB_shader_objects]", Boolean.valueOf(var2.GL_ARB_shader_objects)); - playerSnooper.addStatToSnooper("gl_caps[ARB_shader_stencil_export]", Boolean.valueOf(var2.GL_ARB_shader_stencil_export)); - playerSnooper.addStatToSnooper("gl_caps[ARB_shader_texture_lod]", Boolean.valueOf(var2.GL_ARB_shader_texture_lod)); - playerSnooper.addStatToSnooper("gl_caps[ARB_shadow]", Boolean.valueOf(var2.GL_ARB_shadow)); - playerSnooper.addStatToSnooper("gl_caps[ARB_shadow_ambient]", Boolean.valueOf(var2.GL_ARB_shadow_ambient)); - playerSnooper.addStatToSnooper("gl_caps[ARB_stencil_texturing]", Boolean.valueOf(var2.GL_ARB_stencil_texturing)); - playerSnooper.addStatToSnooper("gl_caps[ARB_sync]", Boolean.valueOf(var2.GL_ARB_sync)); - playerSnooper.addStatToSnooper("gl_caps[ARB_tessellation_shader]", Boolean.valueOf(var2.GL_ARB_tessellation_shader)); - playerSnooper.addStatToSnooper("gl_caps[ARB_texture_border_clamp]", Boolean.valueOf(var2.GL_ARB_texture_border_clamp)); - playerSnooper.addStatToSnooper("gl_caps[ARB_texture_buffer_object]", Boolean.valueOf(var2.GL_ARB_texture_buffer_object)); - playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(var2.GL_ARB_texture_cube_map)); - playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map_array]", Boolean.valueOf(var2.GL_ARB_texture_cube_map_array)); - playerSnooper.addStatToSnooper("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(var2.GL_ARB_texture_non_power_of_two)); - playerSnooper.addStatToSnooper("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(var2.GL_ARB_uniform_buffer_object)); - playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_blend]", Boolean.valueOf(var2.GL_ARB_vertex_blend)); - playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(var2.GL_ARB_vertex_buffer_object)); - playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_program]", Boolean.valueOf(var2.GL_ARB_vertex_program)); - playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_shader]", Boolean.valueOf(var2.GL_ARB_vertex_shader)); - playerSnooper.addStatToSnooper("gl_caps[EXT_bindable_uniform]", Boolean.valueOf(var2.GL_EXT_bindable_uniform)); - playerSnooper.addStatToSnooper("gl_caps[EXT_blend_equation_separate]", Boolean.valueOf(var2.GL_EXT_blend_equation_separate)); - playerSnooper.addStatToSnooper("gl_caps[EXT_blend_func_separate]", Boolean.valueOf(var2.GL_EXT_blend_func_separate)); - playerSnooper.addStatToSnooper("gl_caps[EXT_blend_minmax]", Boolean.valueOf(var2.GL_EXT_blend_minmax)); - playerSnooper.addStatToSnooper("gl_caps[EXT_blend_subtract]", Boolean.valueOf(var2.GL_EXT_blend_subtract)); - playerSnooper.addStatToSnooper("gl_caps[EXT_draw_instanced]", Boolean.valueOf(var2.GL_EXT_draw_instanced)); - playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_multisample]", Boolean.valueOf(var2.GL_EXT_framebuffer_multisample)); - playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_object]", Boolean.valueOf(var2.GL_EXT_framebuffer_object)); - playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_sRGB]", Boolean.valueOf(var2.GL_EXT_framebuffer_sRGB)); - playerSnooper.addStatToSnooper("gl_caps[EXT_geometry_shader4]", Boolean.valueOf(var2.GL_EXT_geometry_shader4)); - playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_program_parameters]", Boolean.valueOf(var2.GL_EXT_gpu_program_parameters)); - playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_shader4]", Boolean.valueOf(var2.GL_EXT_gpu_shader4)); - playerSnooper.addStatToSnooper("gl_caps[EXT_multi_draw_arrays]", Boolean.valueOf(var2.GL_EXT_multi_draw_arrays)); - playerSnooper.addStatToSnooper("gl_caps[EXT_packed_depth_stencil]", Boolean.valueOf(var2.GL_EXT_packed_depth_stencil)); - playerSnooper.addStatToSnooper("gl_caps[EXT_paletted_texture]", Boolean.valueOf(var2.GL_EXT_paletted_texture)); - playerSnooper.addStatToSnooper("gl_caps[EXT_rescale_normal]", Boolean.valueOf(var2.GL_EXT_rescale_normal)); - playerSnooper.addStatToSnooper("gl_caps[EXT_separate_shader_objects]", Boolean.valueOf(var2.GL_EXT_separate_shader_objects)); - playerSnooper.addStatToSnooper("gl_caps[EXT_shader_image_load_store]", Boolean.valueOf(var2.GL_EXT_shader_image_load_store)); - playerSnooper.addStatToSnooper("gl_caps[EXT_shadow_funcs]", Boolean.valueOf(var2.GL_EXT_shadow_funcs)); - playerSnooper.addStatToSnooper("gl_caps[EXT_shared_texture_palette]", Boolean.valueOf(var2.GL_EXT_shared_texture_palette)); - playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_clear_tag]", Boolean.valueOf(var2.GL_EXT_stencil_clear_tag)); - playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_two_side]", Boolean.valueOf(var2.GL_EXT_stencil_two_side)); - playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_wrap]", Boolean.valueOf(var2.GL_EXT_stencil_wrap)); - playerSnooper.addStatToSnooper("gl_caps[EXT_texture_3d]", Boolean.valueOf(var2.GL_EXT_texture_3d)); - playerSnooper.addStatToSnooper("gl_caps[EXT_texture_array]", Boolean.valueOf(var2.GL_EXT_texture_array)); - playerSnooper.addStatToSnooper("gl_caps[EXT_texture_buffer_object]", Boolean.valueOf(var2.GL_EXT_texture_buffer_object)); - playerSnooper.addStatToSnooper("gl_caps[EXT_texture_integer]", Boolean.valueOf(var2.GL_EXT_texture_integer)); - playerSnooper.addStatToSnooper("gl_caps[EXT_texture_lod_bias]", Boolean.valueOf(var2.GL_EXT_texture_lod_bias)); - playerSnooper.addStatToSnooper("gl_caps[EXT_texture_sRGB]", Boolean.valueOf(var2.GL_EXT_texture_sRGB)); - playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_shader]", Boolean.valueOf(var2.GL_EXT_vertex_shader)); - playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_weighting]", Boolean.valueOf(var2.GL_EXT_vertex_weighting)); - playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS))); - GL11.glGetError(); - playerSnooper.addStatToSnooper("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS))); - GL11.glGetError(); - playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_attribs]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_ATTRIBS))); - GL11.glGetError(); - playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS))); - GL11.glGetError(); - playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS))); - GL11.glGetError(); - playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(35071))); - GL11.glGetError(); - playerSnooper.addStatToSnooper("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); - } - - /** - * Used in the usage snooper. - */ - public static int getGLMaximumTextureSize() - { - for (int var0 = 16384; var0 > 0; var0 >>= 1) - { - GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, var0, var0, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); - int var1 = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); - - if (var1 != 0) - { - return var0; - } - } - - 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; - } - - 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; - } - - /** - * Returns the currently running integrated server - */ - public IntegratedServer getIntegratedServer() - { - return this.theIntegratedServer; - } - - public static void stopIntegratedServer() - { - if (theMinecraft != null) - { - IntegratedServer var0 = theMinecraft.getIntegratedServer(); - - if (var0 != null) - { - var0.stopServer(); - } - } - } - - /** - * Returns the PlayerUsageSnooper instance. - */ - public PlayerUsageSnooper 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; - } - - public PropertyMap func_180509_L() - { - return this.twitchDetails; - } - - 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.currentScreen instanceof GuiWinGame ? MusicTicker.MusicType.CREDITS : (this.thePlayer != null ? (this.thePlayer.worldObj.provider instanceof WorldProviderHell ? MusicTicker.MusicType.NETHER : (this.thePlayer.worldObj.provider instanceof WorldProviderEnd ? (BossStatus.bossName != null && BossStatus.statusBarTime > 0 ? 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 IStream getTwitchStream() - { - return this.stream; - } - - public void dispatchKeypresses() - { - int var1 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey(); - - if (var1 != 0 && !Keyboard.isRepeatEvent()) - { - if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L) - { - if (Keyboard.getEventKeyState()) - { - if (var1 == this.gameSettings.keyBindStreamStartStop.getKeyCode()) - { - if (this.getTwitchStream().func_152934_n()) - { - this.getTwitchStream().func_152914_u(); - } - else if (this.getTwitchStream().func_152924_m()) - { - this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() - { - private static final String __OBFID = "CL_00001852"; - public void confirmClicked(boolean result, int id) - { - if (result) - { - Minecraft.this.getTwitchStream().func_152930_t(); - } - - Minecraft.this.displayGuiScreen((GuiScreen)null); - } - }, I18n.format("stream.confirm_start", new Object[0]), "", 0)); - } - else if (this.getTwitchStream().func_152928_D() && this.getTwitchStream().func_152936_l()) - { - if (this.theWorld != null) - { - this.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Not ready to start streaming yet!")); - } - } - else - { - GuiStreamUnavailable.func_152321_a(this.currentScreen); - } - } - else if (var1 == this.gameSettings.keyBindStreamPauseUnpause.getKeyCode()) - { - if (this.getTwitchStream().func_152934_n()) - { - if (this.getTwitchStream().isPaused()) - { - this.getTwitchStream().func_152933_r(); - } - else - { - this.getTwitchStream().func_152916_q(); - } - } - } - else if (var1 == this.gameSettings.keyBindStreamCommercials.getKeyCode()) - { - if (this.getTwitchStream().func_152934_n()) - { - this.getTwitchStream().func_152931_p(); - } - } - else if (var1 == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) - { - this.stream.func_152910_a(true); - } - else if (var1 == this.gameSettings.keyBindFullscreen.getKeyCode()) - { - this.toggleFullscreen(); - } - else if (var1 == this.gameSettings.keyBindScreenshot.getKeyCode()) - { - this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc)); - } - } - else if (var1 == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) - { - this.stream.func_152910_a(false); - } - } - } - } - - public MinecraftSessionService getSessionService() - { - return this.sessionService; - } - - public SkinManager getSkinManager() - { - return this.skinManager; - } - - public Entity func_175606_aa() - { - return this.field_175622_Z; - } - - public void func_175607_a(Entity p_175607_1_) - { - this.field_175622_Z = p_175607_1_; - this.entityRenderer.func_175066_a(p_175607_1_); - } - - public ListenableFuture addScheduledTask(Callable callableToSchedule) - { - Validate.notNull(callableToSchedule); - - if (!this.isCallingFromMinecraftThread()) - { - ListenableFutureTask var2 = ListenableFutureTask.create(callableToSchedule); - Queue var3 = this.scheduledTasks; - - synchronized (this.scheduledTasks) - { - this.scheduledTasks.add(var2); - return var2; - } - } - else - { - try - { - return Futures.immediateFuture(callableToSchedule.call()); - } - catch (Exception var6) - { - return Futures.immediateFailedCheckedFuture(var6); - } - } - } - - 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.field_175618_aM; - } - - public RenderManager getRenderManager() - { - return this.renderManager; - } - - public RenderItem getRenderItem() - { - return this.renderItem; - } - - public ItemRenderer getItemRenderer() - { - return this.itemRenderer; - } - - public static int func_175610_ah() - { - return debugFPS; - } - - public static Map func_175596_ai() - { - HashMap var0 = Maps.newHashMap(); - var0.put("X-Minecraft-Username", getMinecraft().getSession().getUsername()); - var0.put("X-Minecraft-UUID", getMinecraft().getSession().getPlayerID()); - var0.put("X-Minecraft-Version", "1.8"); - return var0; - } - - static final class SwitchEnumMinecartType - { - static final int[] field_152390_a; - - static final int[] field_178901_b = new int[EntityMinecart.EnumMinecartType.values().length]; - private static final String __OBFID = "CL_00001959"; - - static - { - try - { - field_178901_b[EntityMinecart.EnumMinecartType.FURNACE.ordinal()] = 1; - } - catch (NoSuchFieldError var8) - { - ; - } - - try - { - field_178901_b[EntityMinecart.EnumMinecartType.CHEST.ordinal()] = 2; - } - catch (NoSuchFieldError var7) - { - ; - } - - try - { - field_178901_b[EntityMinecart.EnumMinecartType.TNT.ordinal()] = 3; - } - catch (NoSuchFieldError var6) - { - ; - } - - try - { - field_178901_b[EntityMinecart.EnumMinecartType.HOPPER.ordinal()] = 4; - } - catch (NoSuchFieldError var5) - { - ; - } - - try - { - field_178901_b[EntityMinecart.EnumMinecartType.COMMAND_BLOCK.ordinal()] = 5; - } - catch (NoSuchFieldError var4) - { - ; - } - - field_152390_a = new int[MovingObjectPosition.MovingObjectType.values().length]; - - try - { - field_152390_a[MovingObjectPosition.MovingObjectType.ENTITY.ordinal()] = 1; - } - catch (NoSuchFieldError var3) - { - ; - } - - try - { - field_152390_a[MovingObjectPosition.MovingObjectType.BLOCK.ordinal()] = 2; - } - catch (NoSuchFieldError var2) - { - ; - } - - try - { - field_152390_a[MovingObjectPosition.MovingObjectType.MISS.ordinal()] = 3; - } - catch (NoSuchFieldError var1) - { - ; - } - } - } -} diff --git a/src/minecraft/net/minecraft/client/gui/GuiChat.java b/src/minecraft/net/minecraft/client/gui/GuiChat.java deleted file mode 100644 index a7d8e0f..0000000 --- a/src/minecraft/net/minecraft/client/gui/GuiChat.java +++ /dev/null @@ -1,367 +0,0 @@ -package net.minecraft.client.gui; - -import com.google.common.collect.Lists; - -import cubimod.Cubitick; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.network.play.client.C14PacketTabComplete; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; - -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; - -public class GuiChat extends GuiScreen -{ - 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 boolean playerNamesFound; - private boolean waitingOnAutocomplete; - private int autocompleteIndex; - private List foundPlayerNames = Lists.newArrayList(); - - /** 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 = ""; - private static final String __OBFID = "CL_00000682"; - - public GuiChat() {} - - public GuiChat(String p_i1024_1_) - { - this.defaultInputFieldText = p_i1024_1_; - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - 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); - } - - /** - * 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 who toggle 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.waitingOnAutocomplete = false; - - if (keyCode == 15) - { - this.autocompletePlayerNames(); - } - else - { - this.playerNamesFound = false; - } - - 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 var3 = this.inputField.getText().trim(); - - if (var3.length() > 0) - { - this.func_175275_f(var3); - - // 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 var1 = Mouse.getEventDWheel(); - - if (var1 != 0) - { - if (var1 > 1) - { - var1 = 1; - } - - if (var1 < -1) - { - var1 = -1; - } - - if (!isShiftKeyDown()) - { - var1 *= 7; - } - - this.mc.ingameGUI.getChatGUI().scroll(var1); - } - } - - /** - * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton - */ - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException - { - if (mouseButton == 0) - { - IChatComponent var4 = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); - - if (this.func_175276_a(var4)) - { - return; - } - } - - this.inputField.mouseClicked(mouseX, mouseY, mouseButton); - super.mouseClicked(mouseX, mouseY, mouseButton); - } - - protected void func_175274_a(String p_175274_1_, boolean p_175274_2_) - { - if (p_175274_2_) - { - this.inputField.setText(p_175274_1_); - } - else - { - this.inputField.writeText(p_175274_1_); - } - } - - public void autocompletePlayerNames() - { - String var3; - - if (this.playerNamesFound) - { - this.inputField.deleteFromCursor(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition()); - - if (this.autocompleteIndex >= this.foundPlayerNames.size()) - { - this.autocompleteIndex = 0; - } - } - else - { - int var1 = this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false); - this.foundPlayerNames.clear(); - this.autocompleteIndex = 0; - String var2 = this.inputField.getText().substring(var1).toLowerCase(); - var3 = this.inputField.getText().substring(0, this.inputField.getCursorPosition()); - this.sendAutocompleteRequest(var3, var2); - - if (this.foundPlayerNames.isEmpty()) - { - return; - } - - this.playerNamesFound = true; - this.inputField.deleteFromCursor(var1 - this.inputField.getCursorPosition()); - } - - if (this.foundPlayerNames.size() > 1) - { - StringBuilder var4 = new StringBuilder(); - - for (Iterator var5 = this.foundPlayerNames.iterator(); var5.hasNext(); var4.append(var3)) - { - var3 = (String)var5.next(); - - if (var4.length() > 0) - { - var4.append(", "); - } - } - - this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(var4.toString()), 1); - } - - this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); - } - - private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) - { - if (p_146405_1_.length() >= 1) - { - BlockPos var3 = null; - - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - var3 = this.mc.objectMouseOver.func_178782_a(); - } - - this.mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(p_146405_1_, var3)); - this.waitingOnAutocomplete = true; - } - } - - /** - * 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 p_146402_1_) - { - int var2 = this.sentHistoryCursor + p_146402_1_; - int var3 = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); - var2 = MathHelper.clamp_int(var2, 0, var3); - - if (var2 != this.sentHistoryCursor) - { - if (var2 == var3) - { - this.sentHistoryCursor = var3; - this.inputField.setText(this.historyBuffer); - } - else - { - if (this.sentHistoryCursor == var3) - { - this.historyBuffer = this.inputField.getText(); - } - - this.inputField.setText((String)this.mc.ingameGUI.getChatGUI().getSentMessages().get(var2)); - this.sentHistoryCursor = var2; - } - } - } - - /** - * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks - */ - 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(); - IChatComponent var4 = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); - - if (var4 != null && var4.getChatStyle().getChatHoverEvent() != null) - { - this.func_175272_a(var4, mouseX, mouseY); - } - - super.drawScreen(mouseX, mouseY, partialTicks); - } - - public void onAutocompleteResponse(String[] p_146406_1_) - { - if (this.waitingOnAutocomplete) - { - this.playerNamesFound = false; - this.foundPlayerNames.clear(); - String[] var2 = p_146406_1_; - int var3 = p_146406_1_.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - String var5 = var2[var4]; - - if (var5.length() > 0) - { - this.foundPlayerNames.add(var5); - } - } - - String var6 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); - String var7 = StringUtils.getCommonPrefix(p_146406_1_); - - if (var7.length() > 0 && !var6.equalsIgnoreCase(var7)) - { - this.inputField.deleteFromCursor(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition()); - this.inputField.writeText(var7); - } - else if (this.foundPlayerNames.size() > 0) - { - this.playerNamesFound = true; - this.autocompletePlayerNames(); - } - } - } - - /** - * Returns true if this GUI should pause the game when it is displayed in single-player - */ - public boolean doesGuiPauseGame() - { - return false; - } -} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOptions.java b/src/minecraft/net/minecraft/client/gui/GuiOptions.java deleted file mode 100644 index dcea6f9..0000000 --- a/src/minecraft/net/minecraft/client/gui/GuiOptions.java +++ /dev/null @@ -1,250 +0,0 @@ -package net.minecraft.client.gui; - -import java.io.IOException; - -import cubimod.gui.GuiServerPackets; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.audio.SoundCategory; -import net.minecraft.client.audio.SoundEventAccessorComposite; -import net.minecraft.client.audio.SoundHandler; -import net.minecraft.client.gui.stream.GuiStreamOptions; -import net.minecraft.client.gui.stream.GuiStreamUnavailable; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.stream.IStream; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.world.EnumDifficulty; - -public class GuiOptions extends GuiScreen implements GuiYesNoCallback -{ - private static final GameSettings.Options[] field_146440_f = new GameSettings.Options[] {GameSettings.Options.FOV}; - private final GuiScreen field_146441_g; - - /** Reference to the GameSettings object. */ - private final GameSettings game_settings_1; - private GuiButton field_175357_i; - private GuiLockIconButton field_175356_r; - protected String field_146442_a = "Options"; - private static final String __OBFID = "CL_00000700"; - - public GuiOptions(GuiScreen p_i1046_1_, GameSettings p_i1046_2_) - { - this.field_146441_g = p_i1046_1_; - this.game_settings_1 = p_i1046_2_; - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - public void initGui() - { - int var1 = 0; - this.field_146442_a = I18n.format("options.title", new Object[0]); - GameSettings.Options[] var2 = field_146440_f; - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - GameSettings.Options var5 = var2[var4]; - - if (var5.getEnumFloat()) - { - this.buttonList.add(new GuiOptionSlider(var5.returnEnumOrdinal(), this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), var5)); - } - else - { - GuiOptionButton var6 = new GuiOptionButton(var5.returnEnumOrdinal(), this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), var5, this.game_settings_1.getKeyBinding(var5)); - this.buttonList.add(var6); - } - - ++var1; - } - - if (this.mc.theWorld != null) - { - EnumDifficulty var7 = this.mc.theWorld.getDifficulty(); - this.field_175357_i = new GuiButton(108, this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), 150, 20, this.func_175355_a(var7)); - this.buttonList.add(this.field_175357_i); - - if (this.mc.isSingleplayer() && !this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) - { - this.field_175357_i.func_175211_a(this.field_175357_i.getButtonWidth() - 20); - this.field_175356_r = new GuiLockIconButton(109, this.field_175357_i.xPosition + this.field_175357_i.getButtonWidth(), this.field_175357_i.yPosition); - this.buttonList.add(this.field_175356_r); - this.field_175356_r.func_175229_b(this.mc.theWorld.getWorldInfo().isDifficultyLocked()); - this.field_175356_r.enabled = !this.field_175356_r.func_175230_c(); - this.field_175357_i.enabled = !this.field_175356_r.func_175230_c(); - } - else - { - this.field_175357_i.enabled = false; - } - } - - this.buttonList.add(new GuiButton(110, this.width / 2 - 155, this.height / 6 + 48 - 6, 150, 20, I18n.format("options.skinCustomisation", new Object[0]))); - this.buttonList.add(new GuiButton(8675309, this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, "Super Secret Settings...") - { - private static final String __OBFID = "CL_00000701"; - public void playPressSound(SoundHandler soundHandlerIn) - { - SoundEventAccessorComposite var2 = soundHandlerIn.getRandomSoundFromCategories(new SoundCategory[] {SoundCategory.ANIMALS, SoundCategory.BLOCKS, SoundCategory.MOBS, SoundCategory.PLAYERS, SoundCategory.WEATHER}); - - if (var2 != null) - { - soundHandlerIn.playSound(PositionedSoundRecord.createPositionedSoundRecord(var2.getSoundEventLocation(), 0.5F)); - } - } - }); - this.buttonList.add(new GuiButton(106, this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.sounds", new Object[0]))); - this.buttonList.add(new GuiButton(107, this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.stream", new Object[0]))); - this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.video", new Object[0]))); - this.buttonList.add(new GuiButton(100, this.width / 2 + 5, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.controls", new Object[0]))); - this.buttonList.add(new GuiButton(102, this.width / 2 - 155, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.language", new Object[0]))); - this.buttonList.add(new GuiButton(103, this.width / 2 + 5, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.multiplayer.title", new Object[0]))); - this.buttonList.add(new GuiButton(105, this.width / 2 - 155, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.resourcepack", new Object[0]))); - this.buttonList.add(new GuiButton(104, this.width / 2 + 5, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.snooper.view", new Object[0]))); - this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); - - // PacketAnalysis - GuiButton serverPacketButton = new GuiButton(136, this.width / 2 - 155, this.height / 6 + 24 - 6, 150, 20, I18n.format("Server Packet Options...", new Object[0])); - this.buttonList.add(serverPacketButton); - } - - public String func_175355_a(EnumDifficulty p_175355_1_) - { - ChatComponentText var2 = new ChatComponentText(""); - var2.appendSibling(new ChatComponentTranslation("options.difficulty", new Object[0])); - var2.appendText(": "); - var2.appendSibling(new ChatComponentTranslation(p_175355_1_.getDifficultyResourceKey(), new Object[0])); - return var2.getFormattedText(); - } - - public void confirmClicked(boolean result, int id) - { - this.mc.displayGuiScreen(this); - - if (id == 109 && result && this.mc.theWorld != null) - { - this.mc.theWorld.getWorldInfo().setDifficultyLocked(true); - this.field_175356_r.func_175229_b(true); - this.field_175356_r.enabled = false; - this.field_175357_i.enabled = false; - } - } - - protected void actionPerformed(GuiButton button) throws IOException - { - if (button.enabled) - { - if (button.id < 100 && button instanceof GuiOptionButton) - { - GameSettings.Options var2 = ((GuiOptionButton)button).returnEnumOptions(); - this.game_settings_1.setOptionValue(var2, 1); - button.displayString = this.game_settings_1.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); - } - - if (button.id == 108) - { - this.mc.theWorld.getWorldInfo().setDifficulty(EnumDifficulty.getDifficultyEnum(this.mc.theWorld.getDifficulty().getDifficultyId() + 1)); - this.field_175357_i.displayString = this.func_175355_a(this.mc.theWorld.getDifficulty()); - } - - if (button.id == 109) - { - this.mc.displayGuiScreen(new GuiYesNo(this, (new ChatComponentTranslation("difficulty.lock.title", new Object[0])).getFormattedText(), (new ChatComponentTranslation("difficulty.lock.question", new Object[] {new ChatComponentTranslation(this.mc.theWorld.getWorldInfo().getDifficulty().getDifficultyResourceKey(), new Object[0])})).getFormattedText(), 109)); - } - - if (button.id == 110) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiCustomizeSkin(this)); - } - - if (button.id == 8675309) - { - this.mc.entityRenderer.activateNextShader(); - } - - if (button.id == 101) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiVideoSettings(this, this.game_settings_1)); - } - - if (button.id == 100) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiControls(this, this.game_settings_1)); - } - - if (button.id == 102) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiLanguage(this, this.game_settings_1, this.mc.getLanguageManager())); - } - - if (button.id == 103) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new ScreenChatOptions(this, this.game_settings_1)); - } - - if (button.id == 104) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiSnooper(this, this.game_settings_1)); - } - - if (button.id == 200) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(this.field_146441_g); - } - - if (button.id == 105) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiScreenResourcePacks(this)); - } - - if (button.id == 106) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiScreenOptionsSounds(this, this.game_settings_1)); - } - - if (button.id == 107) - { - this.mc.gameSettings.saveOptions(); - IStream var3 = this.mc.getTwitchStream(); - - if (var3.func_152936_l() && var3.func_152928_D()) - { - this.mc.displayGuiScreen(new GuiStreamOptions(this, this.game_settings_1)); - } - else - { - GuiStreamUnavailable.func_152321_a(this); - } - } - - // PacketAnalysis - if(button.id == 136) - { - this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiServerPackets(this, this.game_settings_1)); - } - } - } - - /** - * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks - */ - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { - this.drawDefaultBackground(); - this.drawCenteredString(this.fontRendererObj, this.field_146442_a, this.width / 2, 15, 16777215); - super.drawScreen(mouseX, mouseY, partialTicks); - } -} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java b/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java deleted file mode 100644 index 2f2314f..0000000 --- a/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +++ /dev/null @@ -1,268 +0,0 @@ -package net.minecraft.client.gui; - -import com.google.common.base.Strings; -import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.Iterator; -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.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -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; -import org.lwjgl.opengl.GL11; - -public class GuiOverlayDebug extends Gui -{ - private final Minecraft mc; - private final FontRenderer fontRenderer; - private static final String __OBFID = "CL_00001956"; - - public GuiOverlayDebug(Minecraft mc) - { - this.mc = mc; - this.fontRenderer = mc.fontRendererObj; - } - - public void func_175237_a(ScaledResolution scaledResolutionIn) - { - this.mc.mcProfiler.startSection("debug"); - GlStateManager.pushMatrix(); - this.func_180798_a(); - this.func_175239_b(scaledResolutionIn); - GlStateManager.popMatrix(); - this.mc.mcProfiler.endSection(); - } - - private boolean func_175236_d() - { - return this.mc.thePlayer.func_175140_cp() || this.mc.gameSettings.field_178879_v; - } - - protected void func_180798_a() - { - List var1 = this.call(); - - for (int var2 = 0; var2 < var1.size(); ++var2) - { - String var3 = (String)var1.get(var2); - - if (!Strings.isNullOrEmpty(var3)) - { - int var4 = this.fontRenderer.FONT_HEIGHT; - int var5 = this.fontRenderer.getStringWidth(var3); - boolean var6 = true; - int var7 = 2 + var4 * var2; - drawRect(1, var7 - 1, 2 + var5 + 1, var7 + var4 - 1, -1873784752); - this.fontRenderer.drawString(var3, 2, var7, 14737632); - } - } - } - - protected void func_175239_b(ScaledResolution p_175239_1_) - { - List var2 = this.func_175238_c(); - - for (int var3 = 0; var3 < var2.size(); ++var3) - { - String var4 = (String)var2.get(var3); - - if (!Strings.isNullOrEmpty(var4)) - { - int var5 = this.fontRenderer.FONT_HEIGHT; - int var6 = this.fontRenderer.getStringWidth(var4); - int var7 = p_175239_1_.getScaledWidth() - 2 - var6; - int var8 = 2 + var5 * var3; - drawRect(var7 - 1, var8 - 1, var7 + var6 + 1, var8 + var5 - 1, -1873784752); - this.fontRenderer.drawString(var4, var7, var8, 14737632); - } - } - } - - protected List call() - { - BlockPos var1 = new BlockPos(this.mc.func_175606_aa().posX, this.mc.func_175606_aa().getEntityBoundingBox().minY, this.mc.func_175606_aa().posZ); - - if (this.func_175236_d()) - { - return Lists.newArrayList(new String[] {"Minecraft 1.8 (" + this.mc.func_175600_c() + "/" + 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(var1.getX() & 15), Integer.valueOf(var1.getY() & 15), Integer.valueOf(var1.getZ() & 15)})}); - } - else - { - Entity var2 = this.mc.func_175606_aa(); - EnumFacing var3 = var2.func_174811_aO(); - String var4 = "Invalid"; - - switch (GuiOverlayDebug.SwitchEnumFacing.field_178907_a[var3.ordinal()]) - { - case 1: - var4 = "Towards negative Z"; - break; - - case 2: - var4 = "Towards positive Z"; - break; - - case 3: - var4 = "Towards negative X"; - break; - - case 4: - var4 = "Towards positive X"; - } - - ArrayList var5 = Lists.newArrayList(new String[] {"Minecraft 1.8 (" + this.mc.func_175600_c() + "/" + 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("XYZ: %.3f / %.5f / %.3f", new Object[]{Double.valueOf(this.mc.func_175606_aa().posX), Double.valueOf(this.mc.func_175606_aa().getEntityBoundingBox().minY), Double.valueOf(this.mc.func_175606_aa().posZ)}), String.format("Block: %d %d %d", new Object[]{Integer.valueOf(var1.getX()), Integer.valueOf(var1.getY()), Integer.valueOf(var1.getZ())}), String.format("Chunk: %d %d %d in %d %d %d", new Object[]{Integer.valueOf(var1.getX() & 15), Integer.valueOf(var1.getY() & 15), Integer.valueOf(var1.getZ() & 15), Integer.valueOf(var1.getX() >> 4), Integer.valueOf(var1.getY() >> 4), Integer.valueOf(var1.getZ() >> 4)}), String.format("Facing: %s (%s) (%.1f / %.1f)", new Object[]{var3, var4, Float.valueOf(MathHelper.wrapAngleTo180_float(var2.rotationYaw)), Float.valueOf(MathHelper.wrapAngleTo180_float(var2.rotationPitch))})}); - - if (this.mc.theWorld != null && this.mc.theWorld.isBlockLoaded(var1)) - { - Chunk var6 = this.mc.theWorld.getChunkFromBlockCoords(var1); - var5.add("Biome: " + var6.getBiome(var1, this.mc.theWorld.getWorldChunkManager()).biomeName); - var5.add("Light: " + var6.setLight(var1, 0) + " (" + var6.getLightFor(EnumSkyBlock.SKY, var1) + " sky, " + var6.getLightFor(EnumSkyBlock.BLOCK, var1) + " block)"); - DifficultyInstance var7 = this.mc.theWorld.getDifficultyForLocation(var1); - - if (this.mc.isIntegratedServerRunning() && this.mc.getIntegratedServer() != null) - { - EntityPlayerMP var8 = this.mc.getIntegratedServer().getConfigurationManager().func_177451_a(this.mc.thePlayer.getUniqueID()); - - if (var8 != null) - { - var7 = var8.worldObj.getDifficultyForLocation(new BlockPos(var8)); - } - } - - var5.add(String.format("Local Difficulty: %.2f (Day %d)", new Object[] {Float.valueOf(var7.func_180168_b()), Long.valueOf(this.mc.theWorld.getWorldTime() / 24000L)})); - } - - if (this.mc.entityRenderer != null && this.mc.entityRenderer.isShaderActive()) - { - var5.add("Shader: " + this.mc.entityRenderer.getShaderGroup().getShaderGroupName()); - } - - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.mc.objectMouseOver.func_178782_a() != null) - { - BlockPos var9 = this.mc.objectMouseOver.func_178782_a(); - var5.add(String.format("Looking at: %d %d %d", new Object[] {Integer.valueOf(var9.getX()), Integer.valueOf(var9.getY()), Integer.valueOf(var9.getZ())})); - } - - return var5; - } - } - - protected List func_175238_c() - { - long var1 = Runtime.getRuntime().maxMemory(); - long var3 = Runtime.getRuntime().totalMemory(); - long var5 = Runtime.getRuntime().freeMemory(); - long var7 = var3 - var5; - ArrayList var9 = 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(var7 * 100L / var1), Long.valueOf(func_175240_a(var7)), Long.valueOf(func_175240_a(var1))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(var3 * 100L / var1), Long.valueOf(func_175240_a(var3))}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); - - // Cubitick : add some tick info - var9.add(""); - var9.add("Server tick : " + (mc.isIntegratedServerRunning() ? mc.getIntegratedServer().getTickCounter() : "Unreachable")); - var9.add("Client tick : " + mc.tickcounter); - - if (this.func_175236_d()) - { - return var9; - } - else - { - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.mc.objectMouseOver.func_178782_a() != null) - { - BlockPos var10 = this.mc.objectMouseOver.func_178782_a(); - IBlockState var11 = this.mc.theWorld.getBlockState(var10); - - if (this.mc.theWorld.getWorldType() != WorldType.DEBUG_WORLD) - { - var11 = var11.getBlock().getActualState(var11, this.mc.theWorld, var10); - } - - var9.add(""); - var9.add(String.valueOf(Block.blockRegistry.getNameForObject(var11.getBlock()))); - Entry var13; - String var14; - - for (Iterator var12 = var11.getProperties().entrySet().iterator(); var12.hasNext(); var9.add(((IProperty)var13.getKey()).getName() + ": " + var14)) - { - var13 = (Entry)var12.next(); - var14 = ((Comparable)var13.getValue()).toString(); - - if (var13.getValue() == Boolean.TRUE) - { - var14 = EnumChatFormatting.GREEN + var14; - } - else if (var13.getValue() == Boolean.FALSE) - { - var14 = EnumChatFormatting.RED + var14; - } - } - } - - return var9; - } - } - - private static long func_175240_a(long p_175240_0_) - { - return p_175240_0_ / 1024L / 1024L; - } - - static final class SwitchEnumFacing - { - static final int[] field_178907_a = new int[EnumFacing.values().length]; - private static final String __OBFID = "CL_00001955"; - - static - { - try - { - field_178907_a[EnumFacing.NORTH.ordinal()] = 1; - } - catch (NoSuchFieldError var4) - { - ; - } - - try - { - field_178907_a[EnumFacing.SOUTH.ordinal()] = 2; - } - catch (NoSuchFieldError var3) - { - ; - } - - try - { - field_178907_a[EnumFacing.WEST.ordinal()] = 3; - } - catch (NoSuchFieldError var2) - { - ; - } - - try - { - field_178907_a[EnumFacing.EAST.ordinal()] = 4; - } - catch (NoSuchFieldError var1) - { - ; - } - } - } -} diff --git a/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java b/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java deleted file mode 100644 index 93de3fc..0000000 --- a/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +++ /dev/null @@ -1,2692 +0,0 @@ -package net.minecraft.client.network; - -import io.netty.buffer.Unpooled; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Random; -import java.util.UUID; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.ClientBrandRetriever; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.GuardianSound; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.gui.GuiDisconnected; -import net.minecraft.client.gui.GuiDownloadTerrain; -import net.minecraft.client.gui.GuiMainMenu; -import net.minecraft.client.gui.GuiMerchant; -import net.minecraft.client.gui.GuiMultiplayer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiScreenBook; -import net.minecraft.client.gui.GuiScreenDemo; -import net.minecraft.client.gui.GuiScreenRealmsProxy; -import net.minecraft.client.gui.GuiWinGame; -import net.minecraft.client.gui.GuiYesNo; -import net.minecraft.client.gui.GuiYesNoCallback; -import net.minecraft.client.gui.IProgressMeter; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.client.multiplayer.ServerList; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.particle.EntityPickupFX; -import net.minecraft.client.player.inventory.ContainerLocalMenu; -import net.minecraft.client.player.inventory.LocalBlockIntercommunication; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.stream.MetadataAchievement; -import net.minecraft.client.stream.MetadataCombat; -import net.minecraft.client.stream.MetadataPlayerDeath; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLeashKnot; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IMerchant; -import net.minecraft.entity.NpcMerchant; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.ai.attributes.BaseAttributeMap; -import net.minecraft.entity.ai.attributes.IAttribute; -import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.entity.ai.attributes.RangedAttribute; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.item.EntityBoat; -import net.minecraft.entity.item.EntityEnderCrystal; -import net.minecraft.entity.item.EntityEnderEye; -import net.minecraft.entity.item.EntityEnderPearl; -import net.minecraft.entity.item.EntityExpBottle; -import net.minecraft.entity.item.EntityFallingBlock; -import net.minecraft.entity.item.EntityFireworkRocket; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.item.EntityPainting; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.entity.item.EntityXPOrb; -import net.minecraft.entity.monster.EntityGuardian; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.entity.projectile.EntityEgg; -import net.minecraft.entity.projectile.EntityFishHook; -import net.minecraft.entity.projectile.EntityLargeFireball; -import net.minecraft.entity.projectile.EntityPotion; -import net.minecraft.entity.projectile.EntitySmallFireball; -import net.minecraft.entity.projectile.EntitySnowball; -import net.minecraft.entity.projectile.EntityWitherSkull; -import net.minecraft.init.Items; -import net.minecraft.inventory.AnimalChest; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryBasic; -import net.minecraft.item.Item; -import net.minecraft.item.ItemMap; -import net.minecraft.item.ItemStack; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.PacketBuffer; -import net.minecraft.network.PacketThreadUtil; -import net.minecraft.network.play.INetHandlerPlayClient; -import net.minecraft.network.play.client.C00PacketKeepAlive; -import net.minecraft.network.play.client.C03PacketPlayer; -import net.minecraft.network.play.client.C0FPacketConfirmTransaction; -import net.minecraft.network.play.client.C17PacketCustomPayload; -import net.minecraft.network.play.client.C19PacketResourcePackStatus; -import net.minecraft.network.play.server.S00PacketKeepAlive; -import net.minecraft.network.play.server.S01PacketJoinGame; -import net.minecraft.network.play.server.S02PacketChat; -import net.minecraft.network.play.server.S03PacketTimeUpdate; -import net.minecraft.network.play.server.S04PacketEntityEquipment; -import net.minecraft.network.play.server.S05PacketSpawnPosition; -import net.minecraft.network.play.server.S06PacketUpdateHealth; -import net.minecraft.network.play.server.S07PacketRespawn; -import net.minecraft.network.play.server.S08PacketPlayerPosLook; -import net.minecraft.network.play.server.S09PacketHeldItemChange; -import net.minecraft.network.play.server.S0APacketUseBed; -import net.minecraft.network.play.server.S0BPacketAnimation; -import net.minecraft.network.play.server.S0CPacketSpawnPlayer; -import net.minecraft.network.play.server.S0DPacketCollectItem; -import net.minecraft.network.play.server.S0EPacketSpawnObject; -import net.minecraft.network.play.server.S0FPacketSpawnMob; -import net.minecraft.network.play.server.S10PacketSpawnPainting; -import net.minecraft.network.play.server.S11PacketSpawnExperienceOrb; -import net.minecraft.network.play.server.S12PacketEntityVelocity; -import net.minecraft.network.play.server.S13PacketDestroyEntities; -import net.minecraft.network.play.server.S14PacketEntity; -import net.minecraft.network.play.server.S14PacketEntity.S15PacketEntityRelMove; -import net.minecraft.network.play.server.S14PacketEntity.S16PacketEntityLook; -import net.minecraft.network.play.server.S14PacketEntity.S17PacketEntityLookMove; -import net.minecraft.network.play.server.S18PacketEntityTeleport; -import net.minecraft.network.play.server.S19PacketEntityHeadLook; -import net.minecraft.network.play.server.S19PacketEntityStatus; -import net.minecraft.network.play.server.S1BPacketEntityAttach; -import net.minecraft.network.play.server.S1CPacketEntityMetadata; -import net.minecraft.network.play.server.S1DPacketEntityEffect; -import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect; -import net.minecraft.network.play.server.S1FPacketSetExperience; -import net.minecraft.network.play.server.S20PacketEntityProperties; -import net.minecraft.network.play.server.S21PacketChunkData; -import net.minecraft.network.play.server.S22PacketMultiBlockChange; -import net.minecraft.network.play.server.S23PacketBlockChange; -import net.minecraft.network.play.server.S24PacketBlockAction; -import net.minecraft.network.play.server.S25PacketBlockBreakAnim; -import net.minecraft.network.play.server.S26PacketMapChunkBulk; -import net.minecraft.network.play.server.S27PacketExplosion; -import net.minecraft.network.play.server.S28PacketEffect; -import net.minecraft.network.play.server.S29PacketSoundEffect; -import net.minecraft.network.play.server.S2APacketParticles; -import net.minecraft.network.play.server.S2BPacketChangeGameState; -import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity; -import net.minecraft.network.play.server.S2DPacketOpenWindow; -import net.minecraft.network.play.server.S2EPacketCloseWindow; -import net.minecraft.network.play.server.S2FPacketSetSlot; -import net.minecraft.network.play.server.S30PacketWindowItems; -import net.minecraft.network.play.server.S31PacketWindowProperty; -import net.minecraft.network.play.server.S32PacketConfirmTransaction; -import net.minecraft.network.play.server.S33PacketUpdateSign; -import net.minecraft.network.play.server.S34PacketMaps; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.network.play.server.S36PacketSignEditorOpen; -import net.minecraft.network.play.server.S37PacketStatistics; -import net.minecraft.network.play.server.S38PacketPlayerListItem; -import net.minecraft.network.play.server.S39PacketPlayerAbilities; -import net.minecraft.network.play.server.S3APacketTabComplete; -import net.minecraft.network.play.server.S3BPacketScoreboardObjective; -import net.minecraft.network.play.server.S3CPacketUpdateScore; -import net.minecraft.network.play.server.S3DPacketDisplayScoreboard; -import net.minecraft.network.play.server.S3EPacketTeams; -import net.minecraft.network.play.server.S3FPacketCustomPayload; -import net.minecraft.network.play.server.S40PacketDisconnect; -import net.minecraft.network.play.server.S41PacketServerDifficulty; -import net.minecraft.network.play.server.S42PacketCombatEvent; -import net.minecraft.network.play.server.S43PacketCamera; -import net.minecraft.network.play.server.S44PacketWorldBorder; -import net.minecraft.network.play.server.S45PacketTitle; -import net.minecraft.network.play.server.S46PacketSetCompressionLevel; -import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; -import net.minecraft.network.play.server.S48PacketResourcePackSend; -import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; -import net.minecraft.potion.PotionEffect; -import net.minecraft.realms.DisconnectedRealmsScreen; -import net.minecraft.scoreboard.IScoreObjectiveCriteria; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.scoreboard.Team; -import net.minecraft.server.MinecraftServer; -import net.minecraft.stats.Achievement; -import net.minecraft.stats.AchievementList; -import net.minecraft.stats.StatBase; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityBanner; -import net.minecraft.tileentity.TileEntityBeacon; -import net.minecraft.tileentity.TileEntityCommandBlock; -import net.minecraft.tileentity.TileEntityFlowerPot; -import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.tileentity.TileEntitySign; -import net.minecraft.tileentity.TileEntitySkull; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StringUtils; -import net.minecraft.village.MerchantRecipeList; -import net.minecraft.world.Explosion; -import net.minecraft.world.WorldProviderSurface; -import net.minecraft.world.WorldSettings; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.storage.MapData; - -import org.apache.logging.log4j.LogManager; -import 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.mojang.authlib.GameProfile; - -import cubimod.Cubitick; -import cubimod.settings.ServerPacketData; - -public class NetHandlerPlayClient implements INetHandlerPlayClient -{ - private static final Logger logger = LogManager.getLogger(); - - /** - * The NetworkManager instance used to communicate with the server (used only by handlePlayerPosLook to update - * positioning and handleJoinGame to inform the server of the client distribution/mods) - */ - private final NetworkManager netManager; - private final GameProfile field_175107_d; - - /** - * Seems to be either null (integrated server) or an instance of either GuiMultiplayer (when connecting to a server) - * or GuiScreenReamlsTOS (when connecting to MCO server) - */ - private final GuiScreen guiScreenServer; - - /** - * Reference to the Minecraft instance, which many handler methods operate on - */ - private Minecraft gameController; - - /** - * Reference to the current ClientWorld instance, which many handler methods operate on - */ - private WorldClient clientWorldController; - - /** - * True if the client has finished downloading terrain and may spawn. Set upon receipt of S08PacketPlayerPosLook, - * reset upon respawning - */ - private boolean doneLoadingTerrain; - - /** - * A mapping from player names to their respective GuiPlayerInfo (specifies the clients response time to the server) - */ - private final Map playerInfoMap = Maps.newHashMap(); - public int currentServerMaxPlayers = 20; - private boolean field_147308_k = false; - - /** - * Just an ordinary random number generator, used to randomize audio pitch of item/orb pickup and randomize both - * particlespawn offset and velocity - */ - private final Random avRandomizer = new Random(); - private static final String __OBFID = "CL_00000878"; - - public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager p_i46300_3_, GameProfile p_i46300_4_) - { - this.gameController = mcIn; - this.guiScreenServer = p_i46300_2_; - this.netManager = p_i46300_3_; - this.field_175107_d = p_i46300_4_; - } - - /** - * Clears the WorldClient instance associated with this NetHandlerPlayClient - */ - public void cleanup() - { - this.clientWorldController = null; - } - - /** - * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new - * WorldClient and sets the player initial dimension - */ - public void handleJoinGame(S01PacketJoinGame packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.playerController = new PlayerControllerMP(this.gameController, this); - this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.func_149198_e(), false, packetIn.func_149195_d(), packetIn.func_149196_i()), packetIn.func_149194_f(), packetIn.func_149192_g(), this.gameController.mcProfiler); - this.gameController.gameSettings.difficulty = packetIn.func_149192_g(); - this.gameController.loadWorld(this.clientWorldController); - this.gameController.thePlayer.dimension = packetIn.func_149194_f(); - this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); - this.gameController.thePlayer.setEntityId(packetIn.func_149197_c()); - this.currentServerMaxPlayers = packetIn.func_149193_h(); - this.gameController.thePlayer.func_175150_k(packetIn.func_179744_h()); - this.gameController.playerController.setGameType(packetIn.func_149198_e()); - this.gameController.gameSettings.sendSettingsToServer(); - this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); - - // Packet Analysis - if(ServerPacketData.enabled) - ServerPacketData.displayS01( - packetIn.func_149197_c(), - packetIn.func_149198_e().getID(), - packetIn.func_149194_f(), - packetIn.func_149192_g().ordinal(), - packetIn.func_149193_h(), - packetIn.func_149196_i().getWorldTypeName(), - packetIn.func_179744_h()); - } - - /** - * Spawns an instance of the objecttype indicated by the packet and sets its position and momentum - */ - public void handleSpawnObject(S0EPacketSpawnObject packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - double var2 = (double)packetIn.func_148997_d() / 32.0D; - double var4 = (double)packetIn.func_148998_e() / 32.0D; - double var6 = (double)packetIn.func_148994_f() / 32.0D; - Object var8 = null; - - if (packetIn.func_148993_l() == 10) - { - var8 = EntityMinecart.func_180458_a(this.clientWorldController, var2, var4, var6, EntityMinecart.EnumMinecartType.func_180038_a(packetIn.func_149009_m())); - } - else if (packetIn.func_148993_l() == 90) - { - Entity var9 = this.clientWorldController.getEntityByID(packetIn.func_149009_m()); - - if (var9 instanceof EntityPlayer) - { - var8 = new EntityFishHook(this.clientWorldController, var2, var4, var6, (EntityPlayer)var9); - } - - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 60) - { - var8 = new EntityArrow(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 61) - { - var8 = new EntitySnowball(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 71) - { - var8 = new EntityItemFrame(this.clientWorldController, new BlockPos(MathHelper.floor_double(var2), MathHelper.floor_double(var4), MathHelper.floor_double(var6)), EnumFacing.getHorizontal(packetIn.func_149009_m())); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 77) - { - var8 = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(var2), MathHelper.floor_double(var4), MathHelper.floor_double(var6))); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 65) - { - var8 = new EntityEnderPearl(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 72) - { - var8 = new EntityEnderEye(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 76) - { - var8 = new EntityFireworkRocket(this.clientWorldController, var2, var4, var6, (ItemStack)null); - } - else if (packetIn.func_148993_l() == 63) - { - var8 = new EntityLargeFireball(this.clientWorldController, var2, var4, var6, (double)packetIn.func_149010_g() / 8000.0D, (double)packetIn.func_149004_h() / 8000.0D, (double)packetIn.func_148999_i() / 8000.0D); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 64) - { - var8 = new EntitySmallFireball(this.clientWorldController, var2, var4, var6, (double)packetIn.func_149010_g() / 8000.0D, (double)packetIn.func_149004_h() / 8000.0D, (double)packetIn.func_148999_i() / 8000.0D); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 66) - { - var8 = new EntityWitherSkull(this.clientWorldController, var2, var4, var6, (double)packetIn.func_149010_g() / 8000.0D, (double)packetIn.func_149004_h() / 8000.0D, (double)packetIn.func_148999_i() / 8000.0D); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 62) - { - var8 = new EntityEgg(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 73) - { - var8 = new EntityPotion(this.clientWorldController, var2, var4, var6, packetIn.func_149009_m()); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 75) - { - var8 = new EntityExpBottle(this.clientWorldController, var2, var4, var6); - packetIn.func_149002_g(0); - } - else if (packetIn.func_148993_l() == 1) - { - var8 = new EntityBoat(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 50) - { - var8 = new EntityTNTPrimed(this.clientWorldController, var2, var4, var6, (EntityLivingBase)null); - } - else if (packetIn.func_148993_l() == 78) - { - var8 = new EntityArmorStand(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 51) - { - var8 = new EntityEnderCrystal(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 2) - { - var8 = new EntityItem(this.clientWorldController, var2, var4, var6); - } - else if (packetIn.func_148993_l() == 70) - { - var8 = new EntityFallingBlock(this.clientWorldController, var2, var4, var6, Block.getStateById(packetIn.func_149009_m() & 65535)); - packetIn.func_149002_g(0); - } - - if (var8 != null) - { - ((Entity)var8).serverPosX = packetIn.func_148997_d(); - ((Entity)var8).serverPosY = packetIn.func_148998_e(); - ((Entity)var8).serverPosZ = packetIn.func_148994_f(); - ((Entity)var8).rotationPitch = (float)(packetIn.func_149008_j() * 360) / 256.0F; - ((Entity)var8).rotationYaw = (float)(packetIn.func_149006_k() * 360) / 256.0F; - Entity[] var12 = ((Entity)var8).getParts(); - - if (var12 != null) - { - int var10 = packetIn.func_149001_c() - ((Entity)var8).getEntityId(); - - for (int var11 = 0; var11 < var12.length; ++var11) - { - var12[var11].setEntityId(var12[var11].getEntityId() + var10); - } - } - - ((Entity)var8).setEntityId(packetIn.func_149001_c()); - this.clientWorldController.addEntityToWorld(packetIn.func_149001_c(), (Entity)var8); - - if (packetIn.func_149009_m() > 0) - { - if (packetIn.func_148993_l() == 60) - { - Entity var13 = this.clientWorldController.getEntityByID(packetIn.func_149009_m()); - - if (var13 instanceof EntityLivingBase && var8 instanceof EntityArrow) - { - ((EntityArrow)var8).shootingEntity = var13; - } - } - - ((Entity)var8).setVelocity((double)packetIn.func_149010_g() / 8000.0D, (double)packetIn.func_149004_h() / 8000.0D, (double)packetIn.func_148999_i() / 8000.0D); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - { - float rotationPitch = (float)(packetIn.func_149008_j() * 360) / 256.0F; - float rotationYaw = (float)(packetIn.func_149006_k() * 360) / 256.0F; - double velX = (double)packetIn.func_149010_g() / 8000.0D; - double velY = (double)packetIn.func_149004_h() / 8000.0D; - double velZ = (double)packetIn.func_148999_i() / 8000.0D; - ServerPacketData.displayS0E(packetIn.func_149001_c(), packetIn.func_148993_l(), var2, var4, var6, rotationYaw, rotationPitch, packetIn.func_149009_m(), velX, velY, velZ); - } - } - - /** - * Spawns an experience orb and sets its value (amount of XP) - */ - public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityXPOrb var2 = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g()); - var2.serverPosX = packetIn.func_148984_d(); - var2.serverPosY = packetIn.func_148983_e(); - var2.serverPosZ = packetIn.func_148982_f(); - var2.rotationYaw = 0.0F; - var2.rotationPitch = 0.0F; - var2.setEntityId(packetIn.func_148985_c()); - this.clientWorldController.addEntityToWorld(packetIn.func_148985_c(), var2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS11( - packetIn.func_148985_c(), - packetIn.func_148984_d()/32.0D, - packetIn.func_148983_e()/32.0D, - packetIn.func_148982_f()/32.0D, - packetIn.func_148986_g()); - } - - /** - * Handles globally visible entities. Used in vanilla for lightning bolts - */ - public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - double var2 = (double)packetIn.func_149051_d() / 32.0D; - double var4 = (double)packetIn.func_149050_e() / 32.0D; - double var6 = (double)packetIn.func_149049_f() / 32.0D; - EntityLightningBolt var8 = null; - - if (packetIn.func_149053_g() == 1) - { - var8 = new EntityLightningBolt(this.clientWorldController, var2, var4, var6); - } - - if (var8 != null) - { - var8.serverPosX = packetIn.func_149051_d(); - var8.serverPosY = packetIn.func_149050_e(); - var8.serverPosZ = packetIn.func_149049_f(); - var8.rotationYaw = 0.0F; - var8.rotationPitch = 0.0F; - var8.setEntityId(packetIn.func_149052_c()); - this.clientWorldController.addWeatherEffect(var8); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS2C(packetIn.func_149052_c(), packetIn.func_149053_g(), var2, var4, var6); - } - - /** - * Handles the spawning of a painting object - */ - public void handleSpawnPainting(S10PacketSpawnPainting packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPainting var2 = new EntityPainting(this.clientWorldController, packetIn.func_179837_b(), packetIn.func_179836_c(), packetIn.func_148961_h()); - this.clientWorldController.addEntityToWorld(packetIn.func_148965_c(), var2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS10(packetIn.func_148965_c(), packetIn.func_148961_h(), packetIn.func_179837_b(), packetIn.func_179836_c().getName()); - } - - /** - * Sets the velocity of the specified entity to the specified value - */ - public void handleEntityVelocity(S12PacketEntityVelocity packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149412_c()); - - if (var2 != null) - { - var2.setVelocity((double)packetIn.func_149411_d() / 8000.0D, (double)packetIn.func_149410_e() / 8000.0D, (double)packetIn.func_149409_f() / 8000.0D); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS12( - packetIn.func_149412_c(), - (double)packetIn.func_149411_d() / 8000.0D, - (double)packetIn.func_149410_e() / 8000.0D, - (double)packetIn.func_149409_f() / 8000.0D); - } - - /** - * Invoked when the server registers new proximate objects in your watchlist or when objects in your watchlist have - * changed -> Registers any changes locally - */ - public void handleEntityMetadata(S1CPacketEntityMetadata packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149375_d()); - - if (var2 != null && packetIn.func_149376_c() != null) - { - var2.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1C(packetIn.func_149375_d(), null); - } - - /** - * Handles the creation of a nearby player entity, sets the position and held item - */ - public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - double var2 = (double)packetIn.func_148942_f() / 32.0D; - double var4 = (double)packetIn.func_148949_g() / 32.0D; - double var6 = (double)packetIn.func_148946_h() / 32.0D; - float var8 = (float)(packetIn.func_148941_i() * 360) / 256.0F; - float var9 = (float)(packetIn.func_148945_j() * 360) / 256.0F; - EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.gameController.theWorld, this.func_175102_a(packetIn.func_179819_c()).func_178845_a()); - var10.prevPosX = var10.lastTickPosX = (double)(var10.serverPosX = packetIn.func_148942_f()); - var10.prevPosY = var10.lastTickPosY = (double)(var10.serverPosY = packetIn.func_148949_g()); - var10.prevPosZ = var10.lastTickPosZ = (double)(var10.serverPosZ = packetIn.func_148946_h()); - int var11 = packetIn.func_148947_k(); - - if (var11 == 0) - { - var10.inventory.mainInventory[var10.inventory.currentItem] = null; - } - else - { - var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(Item.getItemById(var11), 1, 0); - } - - var10.setPositionAndRotation(var2, var4, var6, var8, var9); - this.clientWorldController.addEntityToWorld(packetIn.func_148943_d(), var10); - List var12 = packetIn.func_148944_c(); - - if (var12 != null) - { - var10.getDataWatcher().updateWatchedObjectsFromList(var12); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS0C(packetIn.func_148943_d(), packetIn.func_179819_c(), var2, var4, var6, var8, var9, packetIn.func_148947_k(), packetIn.func_148944_c()); - } - - /** - * Updates an entity's position and rotation as specified by the packet - */ - public void handleEntityTeleport(S18PacketEntityTeleport packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149451_c()); - - if (var2 != null) - { - var2.serverPosX = packetIn.func_149449_d(); - var2.serverPosY = packetIn.func_149448_e(); - var2.serverPosZ = packetIn.func_149446_f(); - double var3 = (double)var2.serverPosX / 32.0D; - double var5 = (double)var2.serverPosY / 32.0D + 0.015625D; - double var7 = (double)var2.serverPosZ / 32.0D; - float var9 = (float)(packetIn.func_149450_g() * 360) / 256.0F; - float var10 = (float)(packetIn.func_149447_h() * 360) / 256.0F; - - if (Math.abs(var2.posX - var3) < 0.03125D && Math.abs(var2.posY - var5) < 0.015625D && Math.abs(var2.posZ - var7) < 0.03125D) - { - var2.func_180426_a(var2.posX, var2.posY, var2.posZ, var9, var10, 3, true); - } - else - { - var2.func_180426_a(var3, var5, var7, var9, var10, 3, true); - } - - var2.onGround = packetIn.func_179697_g(); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS18(packetIn.func_149451_c(), var3, var5, var7, var9, var10, var2.onGround); - } - else if(ServerPacketData.enabled) - { - ServerPacketData.displayS18(-1, 0, 0, 0, 0F, 0F, false); - } - } - - /** - * Updates which hotbar slot of the player is currently selected - */ - public void handleHeldItemChange(S09PacketHeldItemChange packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (packetIn.func_149385_c() >= 0 && packetIn.func_149385_c() < InventoryPlayer.getHotbarSize()) - { - this.gameController.thePlayer.inventory.currentItem = packetIn.func_149385_c(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS09(packetIn.func_149385_c()); - } - - /** - * Updates the specified entity's position by the specified relative moment and absolute rotation. Note that - * subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs. - * rotation or both). - */ - public void handleEntityMovement(S14PacketEntity packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = packetIn.func_149065_a(this.clientWorldController); - - if (var2 != null) - { - var2.serverPosX += packetIn.func_149062_c(); - var2.serverPosY += packetIn.func_149061_d(); - var2.serverPosZ += packetIn.func_149064_e(); - double var3 = (double)var2.serverPosX / 32.0D; - double var5 = (double)var2.serverPosY / 32.0D; - double var7 = (double)var2.serverPosZ / 32.0D; - float var9 = packetIn.func_149060_h() ? (float)(packetIn.func_149066_f() * 360) / 256.0F : var2.rotationYaw; - float var10 = packetIn.func_149060_h() ? (float)(packetIn.func_149063_g() * 360) / 256.0F : var2.rotationPitch; - var2.func_180426_a(var3, var5, var7, var9, var10, 3, false); - var2.onGround = packetIn.func_179742_g(); - - // PacketAnalysis - if(ServerPacketData.enabled) - { - if(packetIn instanceof S15PacketEntityRelMove) - ServerPacketData.displayS15( - var2.getEntityId(), - (double)packetIn.func_149062_c() / 32.0D, - (double)packetIn.func_149061_d() / 32.0D, - (double)packetIn.func_149064_e() / 32.0D, - packetIn.func_179742_g()); - else if(packetIn instanceof S16PacketEntityLook) - ServerPacketData.displayS16( - var2.getEntityId(), - var9, var10, packetIn.func_179742_g()); - else if(packetIn instanceof S17PacketEntityLookMove) - ServerPacketData.displayS17( - var2.getEntityId(), - (double)packetIn.func_149062_c() / 32.0D, - (double)packetIn.func_149061_d() / 32.0D, - (double)packetIn.func_149064_e() / 32.0D, - var9, var10, packetIn.func_179742_g()); - else - ServerPacketData.displayS14(var2.getEntityId()); - } - } - - // PacketAnalysis - else if(ServerPacketData.enabled) - { - ServerPacketData.displayS14(-1); - } - } - - /** - * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the - * rotation of the entity itself - */ - public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = packetIn.func_149381_a(this.clientWorldController); - - if (var2 != null) - { - float var3 = (float)(packetIn.func_149380_c() * 360) / 256.0F; - var2.setRotationYawHead(var3); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS19(var2.getEntityId(), var3); - } - else if(ServerPacketData.enabled) - { - ServerPacketData.displayS19(-1, 0F); - } - } - - /** - * Locally eliminates the entities. Invoked by the server when the items are in fact destroyed, or the player is no - * longer registered as required to monitor them. The latter happens when distance between the player and item - * increases beyond a certain treshold (typically the viewing distance) - */ - public void handleDestroyEntities(S13PacketDestroyEntities packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - // PacketAnalysis - // Display the content before destroying the entities - if(ServerPacketData.enabled) - ServerPacketData.displayS13(packetIn.func_149098_c().length, packetIn.func_149098_c()); - - for (int var2 = 0; var2 < packetIn.func_149098_c().length; ++var2) - { - this.clientWorldController.removeEntityFromWorld(packetIn.func_149098_c()[var2]); - } - } - - /** - * Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning, - * mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the - * player positioning - */ - public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - double var3 = packetIn.func_148932_c(); - double var5 = packetIn.func_148928_d(); - double var7 = packetIn.func_148933_e(); - float var9 = packetIn.func_148931_f(); - float var10 = packetIn.func_148930_g(); - - if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X)) - { - var3 += var2.posX; - } - else - { - var2.motionX = 0.0D; - } - - if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y)) - { - var5 += var2.posY; - } - else - { - var2.motionY = 0.0D; - } - - if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Z)) - { - var7 += var2.posZ; - } - else - { - var2.motionZ = 0.0D; - } - - if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X_ROT)) - { - var10 += var2.rotationPitch; - } - - if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) - { - var9 += var2.rotationYaw; - } - - var2.setPositionAndRotation(var3, var5, var7, var9, var10); - this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(var2.posX, var2.getEntityBoundingBox().minY, var2.posZ, var2.rotationYaw, var2.rotationPitch, false)); - - if (!this.doneLoadingTerrain) - { - this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX; - this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY; - this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ; - this.doneLoadingTerrain = true; - this.gameController.displayGuiScreen((GuiScreen)null); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS08( - var3, var5, var7, var9, var10, - packetIn.func_179834_f().toString() - ); - } - - /** - * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block - * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends - * S21PacketChunkData - */ - public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - S22PacketMultiBlockChange.BlockUpdateData[] var2 = packetIn.func_179844_a(); - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - S22PacketMultiBlockChange.BlockUpdateData var5 = var2[var4]; - this.clientWorldController.func_180503_b(var5.func_180090_a(), var5.func_180088_c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS22(var2); - } - - /** - * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation - */ - public void handleChunkData(S21PacketChunkData packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (packetIn.func_149274_i()) - { - if (packetIn.func_149276_g() == 0) - { - this.clientWorldController.doPreChunk(packetIn.func_149273_e(), packetIn.func_149271_f(), false); - return; - } - - this.clientWorldController.doPreChunk(packetIn.func_149273_e(), packetIn.func_149271_f(), true); - } - - this.clientWorldController.invalidateBlockReceiveRegion(packetIn.func_149273_e() << 4, 0, packetIn.func_149271_f() << 4, (packetIn.func_149273_e() << 4) + 15, 256, (packetIn.func_149271_f() << 4) + 15); - Chunk var2 = this.clientWorldController.getChunkFromChunkCoords(packetIn.func_149273_e(), packetIn.func_149271_f()); - var2.func_177439_a(packetIn.func_149272_d(), packetIn.func_149276_g(), packetIn.func_149274_i()); - this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.func_149273_e() << 4, 0, packetIn.func_149271_f() << 4, (packetIn.func_149273_e() << 4) + 15, 256, (packetIn.func_149271_f() << 4) + 15); - - if (!packetIn.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) - { - var2.resetRelightChecks(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS21( - packetIn.func_149273_e(), packetIn.func_149271_f(), - packetIn.func_149274_i(), packetIn.func_149276_g(), - 0, null, null); - } - - /** - * Updates the block and metadata and generates a blockupdate (and notify the clients) - */ - public void handleBlockChange(S23PacketBlockChange packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.clientWorldController.func_180503_b(packetIn.func_179827_b(), packetIn.func_180728_a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS23(packetIn.func_179827_b(), packetIn.func_180728_a()); - } - - /** - * Closes the network channel - */ - public void handleDisconnect(S40PacketDisconnect packetIn) - { - this.netManager.closeChannel(packetIn.func_149165_c()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS40(packetIn.func_149165_c()); - } - - /** - * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination - */ - public void onDisconnect(IChatComponent reason) - { - this.gameController.loadWorld((WorldClient)null); - - if (this.guiScreenServer != null) - { - if (this.guiScreenServer instanceof GuiScreenRealmsProxy) - { - this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy()); - } - else - { - this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason)); - } - } - else - { - this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason)); - } - } - - public void addToSendQueue(Packet p_147297_1_) - { - this.netManager.sendPacket(p_147297_1_); - } - - public void handleCollectItem(S0DPacketCollectItem packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149354_c()); - Object var3 = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.func_149353_d()); - - if (var3 == null) - { - var3 = this.gameController.thePlayer; - } - - if (var2 != null) - { - if (var2 instanceof EntityXPOrb) - { - this.clientWorldController.playSoundAtEntity(var2, "random.orb", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F); - } - else - { - this.clientWorldController.playSoundAtEntity(var2, "random.pop", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F); - } - - this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, var2, (Entity)var3, 0.5F)); - this.clientWorldController.removeEntityFromWorld(packetIn.func_149354_c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS0D(packetIn.func_149353_d(), packetIn.func_149354_c()); - } - - /** - * Prints a chatmessage in the chat GUI - */ - public void handleChat(S02PacketChat packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (packetIn.func_179841_c() == 2) - { - this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false); - } - else - { - this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS02(packetIn.func_148915_c(), packetIn.func_179841_c()); - } - - /** - * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt - * or receiving a critical hit by normal or magical means - */ - public void handleAnimation(S0BPacketAnimation packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_148978_c()); - - if (var2 != null) - { - if (packetIn.func_148977_d() == 0) - { - EntityLivingBase var3 = (EntityLivingBase)var2; - var3.swingItem(); - } - else if (packetIn.func_148977_d() == 1) - { - var2.performHurtAnimation(); - } - else if (packetIn.func_148977_d() == 2) - { - EntityPlayer var4 = (EntityPlayer)var2; - var4.wakeUpPlayer(false, false, false); - } - else if (packetIn.func_148977_d() == 4) - { - this.gameController.effectRenderer.func_178926_a(var2, EnumParticleTypes.CRIT); - } - else if (packetIn.func_148977_d() == 5) - { - this.gameController.effectRenderer.func_178926_a(var2, EnumParticleTypes.CRIT_MAGIC); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS0B(packetIn.func_148978_c(), packetIn.func_148977_d()); - } - - /** - * Retrieves the player identified by the packet, puts him to sleep if possible (and flags whether all players are - * asleep) - */ - public void handleUseBed(S0APacketUseBed packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - packetIn.getPlayer(this.clientWorldController).func_180469_a(packetIn.func_179798_a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS0A(packetIn.getPlayer(this.clientWorldController), packetIn.func_179798_a()); - } - - /** - * Spawns the mob entity at the specified location, with the specified rotation, momentum and type. Updates the - * entities Datawatchers with the entity metadata specified in the packet - */ - public void handleSpawnMob(S0FPacketSpawnMob packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - double var2 = (double)packetIn.func_149023_f() / 32.0D; - double var4 = (double)packetIn.func_149034_g() / 32.0D; - double var6 = (double)packetIn.func_149029_h() / 32.0D; - float var8 = (float)(packetIn.func_149028_l() * 360) / 256.0F; - float var9 = (float)(packetIn.func_149030_m() * 360) / 256.0F; - EntityLivingBase var10 = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld); - var10.serverPosX = packetIn.func_149023_f(); - var10.serverPosY = packetIn.func_149034_g(); - var10.serverPosZ = packetIn.func_149029_h(); - var10.rotationYawHead = (float)(packetIn.func_149032_n() * 360) / 256.0F; - Entity[] var11 = var10.getParts(); - - if (var11 != null) - { - int var12 = packetIn.func_149024_d() - var10.getEntityId(); - - for (int var13 = 0; var13 < var11.length; ++var13) - { - var11[var13].setEntityId(var11[var13].getEntityId() + var12); - } - } - - var10.setEntityId(packetIn.func_149024_d()); - var10.setPositionAndRotation(var2, var4, var6, var8, var9); - var10.motionX = (double)((float)packetIn.func_149026_i() / 8000.0F); - var10.motionY = (double)((float)packetIn.func_149033_j() / 8000.0F); - var10.motionZ = (double)((float)packetIn.func_149031_k() / 8000.0F); - this.clientWorldController.addEntityToWorld(packetIn.func_149024_d(), var10); - - List var14 = packetIn.func_149027_c(); - - if (var14 != null) - { - var10.getDataWatcher().updateWatchedObjectsFromList(var14); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - { - double velX = (double)((float)packetIn.func_149026_i() / 8000.0F); - double velY = (double)((float)packetIn.func_149033_j() / 8000.0F); - double velZ = (double)((float)packetIn.func_149031_k() / 8000.0F); - float headRot = (float)(packetIn.func_149032_n() * 360) / 256.0F; - - ServerPacketData.displayS0F( - packetIn.func_149024_d(), packetIn.func_149025_e(), - var2, var4, var6, var8, var9, headRot, velX, velY, velZ, var14); - } - } - - public void handleTimeUpdate(S03PacketTimeUpdate packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.theWorld.func_82738_a(packetIn.func_149366_c()); - this.gameController.theWorld.setWorldTime(packetIn.func_149365_d()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS03(packetIn.func_149366_c(), packetIn.func_149365_d()); - } - - public void handleSpawnPosition(S05PacketSpawnPosition packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.thePlayer.func_180473_a(packetIn.func_179800_a(), true); - this.gameController.theWorld.getWorldInfo().setSpawn(packetIn.func_179800_a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS05(packetIn.func_179800_a()); - } - - public void handleEntityAttach(S1BPacketEntityAttach packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Object var2 = this.clientWorldController.getEntityByID(packetIn.func_149403_d()); - Entity var3 = this.clientWorldController.getEntityByID(packetIn.func_149402_e()); - - if (packetIn.func_149404_c() == 0) - { - boolean var4 = false; - - if (packetIn.func_149403_d() == this.gameController.thePlayer.getEntityId()) - { - var2 = this.gameController.thePlayer; - - if (var3 instanceof EntityBoat) - { - ((EntityBoat)var3).setIsBoatEmpty(false); - } - - var4 = ((Entity)var2).ridingEntity == null && var3 != null; - } - else if (var3 instanceof EntityBoat) - { - ((EntityBoat)var3).setIsBoatEmpty(true); - } - - if (var2 == null) - { - return; - } - - ((Entity)var2).mountEntity(var3); - - if (var4) - { - GameSettings var5 = this.gameController.gameSettings; - this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(var5.keyBindSneak.getKeyCode())}), false); - } - } - else if (packetIn.func_149404_c() == 1 && var2 instanceof EntityLiving) - { - if (var3 != null) - { - ((EntityLiving)var2).setLeashedToEntity(var3, false); - } - else - { - ((EntityLiving)var2).clearLeashed(false, false); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1B(packetIn.func_149403_d(), packetIn.func_149402_e(), packetIn.func_149404_c()); - } - - /** - * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), - * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch - * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke - * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) - */ - public void handleEntityStatus(S19PacketEntityStatus packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = packetIn.func_149161_a(this.clientWorldController); - - if (var2 != null) - { - if (packetIn.func_149160_c() == 21) - { - this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian)var2)); - } - else - { - var2.handleHealthUpdate(packetIn.func_149160_c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1A(var2.getEntityId(), packetIn.func_149160_c()); - } - else if(ServerPacketData.enabled) - { - ServerPacketData.displayS1A(-1, -1); - } - } - - public void handleUpdateHealth(S06PacketUpdateHealth packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.thePlayer.setPlayerSPHealth(packetIn.getHealth()); - this.gameController.thePlayer.getFoodStats().setFoodLevel(packetIn.getFoodLevel()); - this.gameController.thePlayer.getFoodStats().setFoodSaturationLevel(packetIn.getSaturationLevel()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS06( - packetIn.getHealth(), - packetIn.getFoodLevel(), - packetIn.getSaturationLevel()); - } - - public void handleSetExperience(S1FPacketSetExperience packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.func_149396_d(), packetIn.func_149395_e()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1F(packetIn.func_149397_c(), packetIn.func_149396_d(), packetIn.func_149395_e()); - } - - public void handleRespawn(S07PacketRespawn packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (packetIn.func_149082_c() != this.gameController.thePlayer.dimension) - { - this.doneLoadingTerrain = false; - Scoreboard var2 = this.clientWorldController.getScoreboard(); - this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.func_149080_f()), packetIn.func_149082_c(), packetIn.func_149081_d(), this.gameController.mcProfiler); - this.clientWorldController.setWorldScoreboard(var2); - this.gameController.loadWorld(this.clientWorldController); - this.gameController.thePlayer.dimension = packetIn.func_149082_c(); - this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); - } - - this.gameController.setDimensionAndSpawnPlayer(packetIn.func_149082_c()); - this.gameController.playerController.setGameType(packetIn.func_149083_e()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS07( - packetIn.func_149082_c(), - packetIn.func_149081_d().getDifficultyId(), - packetIn.func_149083_e().getID(), - packetIn.func_149080_f().getWorldTypeName()); - } - - /** - * Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet. - */ - public void handleExplosion(S27PacketExplosion packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Explosion var2 = new Explosion(this.gameController.theWorld, (Entity)null, packetIn.func_149148_f(), packetIn.func_149143_g(), packetIn.func_149145_h(), packetIn.func_149146_i(), packetIn.func_149150_j()); - var2.doExplosionB(true); - this.gameController.thePlayer.motionX += (double)packetIn.func_149149_c(); - this.gameController.thePlayer.motionY += (double)packetIn.func_149144_d(); - this.gameController.thePlayer.motionZ += (double)packetIn.func_149147_e(); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS27( - packetIn.func_149148_f(), packetIn.func_149143_g(), packetIn.func_149145_h(), - packetIn.func_149146_i(), packetIn.func_149150_j(), - packetIn.func_149149_c(), packetIn.func_149144_d(), packetIn.func_149147_e()); - } - - /** - * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table, - * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse - */ - public void handleOpenWindow(S2DPacketOpenWindow packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - - if ("minecraft:container".equals(packetIn.func_148902_e())) - { - var2.displayGUIChest(new InventoryBasic(packetIn.func_179840_c(), packetIn.func_148898_f())); - var2.openContainer.windowId = packetIn.func_148901_c(); - } - else if ("minecraft:villager".equals(packetIn.func_148902_e())) - { - var2.displayVillagerTradeGui(new NpcMerchant(var2, packetIn.func_179840_c())); - var2.openContainer.windowId = packetIn.func_148901_c(); - } - else if ("EntityHorse".equals(packetIn.func_148902_e())) - { - Entity var3 = this.clientWorldController.getEntityByID(packetIn.func_148897_h()); - - if (var3 instanceof EntityHorse) - { - var2.displayGUIHorse((EntityHorse)var3, new AnimalChest(packetIn.func_179840_c(), packetIn.func_148898_f())); - var2.openContainer.windowId = packetIn.func_148901_c(); - } - } - else if (!packetIn.func_148900_g()) - { - var2.displayGui(new LocalBlockIntercommunication(packetIn.func_148902_e(), packetIn.func_179840_c())); - var2.openContainer.windowId = packetIn.func_148901_c(); - } - else - { - ContainerLocalMenu var4 = new ContainerLocalMenu(packetIn.func_148902_e(), packetIn.func_179840_c(), packetIn.func_148898_f()); - var2.displayGUIChest(var4); - var2.openContainer.windowId = packetIn.func_148901_c(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS2D( - packetIn.func_148901_c(), // id - packetIn.func_148902_e(), // type - packetIn.func_179840_c(), // title - packetIn.func_148898_f(), // slotNum - packetIn.func_148897_h() // entityID - ); - } - - /** - * Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container - */ - public void handleSetSlot(S2FPacketSetSlot packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - - if (packetIn.func_149175_c() == -1) - { - var2.inventory.setItemStack(packetIn.func_149174_e()); - } - else - { - boolean var3 = false; - - if (this.gameController.currentScreen instanceof GuiContainerCreative) - { - GuiContainerCreative var4 = (GuiContainerCreative)this.gameController.currentScreen; - var3 = var4.func_147056_g() != CreativeTabs.tabInventory.getTabIndex(); - } - - if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45) - { - ItemStack var5 = var2.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack(); - - if (packetIn.func_149174_e() != null && (var5 == null || var5.stackSize < packetIn.func_149174_e().stackSize)) - { - packetIn.func_149174_e().animationsToGo = 5; - } - - var2.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); - } - else if (packetIn.func_149175_c() == var2.openContainer.windowId && (packetIn.func_149175_c() != 0 || !var3)) - { - var2.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS2F(packetIn.func_149175_c(), packetIn.func_149173_d(), packetIn.func_149174_e()); - } - - /** - * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player - * and confirms if it is the case. - */ - public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Container var2 = null; - EntityPlayerSP var3 = this.gameController.thePlayer; - - if (packetIn.func_148889_c() == 0) - { - var2 = var3.inventoryContainer; - } - else if (packetIn.func_148889_c() == var3.openContainer.windowId) - { - var2 = var3.openContainer; - } - - if (var2 != null && !packetIn.func_148888_e()) - { - this.addToSendQueue(new C0FPacketConfirmTransaction(packetIn.func_148889_c(), packetIn.func_148890_d(), true)); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS32(packetIn.func_148889_c(), packetIn.func_148890_d(), packetIn.func_148888_e()); - } - - /** - * Handles the placement of a specified ItemStack in a specified container/inventory slot - */ - public void handleWindowItems(S30PacketWindowItems packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - - if (packetIn.func_148911_c() == 0) - { - var2.inventoryContainer.putStacksInSlots(packetIn.func_148910_d()); - } - else if (packetIn.func_148911_c() == var2.openContainer.windowId) - { - var2.openContainer.putStacksInSlots(packetIn.func_148910_d()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS30(packetIn.func_148911_c(), packetIn.func_148910_d()); - } - - /** - * Creates a sign in the specified location if it didn't exist and opens the GUI to edit its text - */ - public void handleSignEditorOpen(S36PacketSignEditorOpen packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Object var2 = this.clientWorldController.getTileEntity(packetIn.func_179777_a()); - - if (!(var2 instanceof TileEntitySign)) - { - var2 = new TileEntitySign(); - ((TileEntity)var2).setWorldObj(this.clientWorldController); - ((TileEntity)var2).setPos(packetIn.func_179777_a()); - } - - this.gameController.thePlayer.func_175141_a((TileEntitySign)var2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS36(packetIn.func_179777_a()); - } - - /** - * Updates a specified sign with the specified text lines - */ - public void handleUpdateSign(S33PacketUpdateSign packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - boolean var2 = false; - - if (this.gameController.theWorld.isBlockLoaded(packetIn.func_179704_a())) - { - TileEntity var3 = this.gameController.theWorld.getTileEntity(packetIn.func_179704_a()); - - if (var3 instanceof TileEntitySign) - { - TileEntitySign var4 = (TileEntitySign)var3; - - if (var4.getIsEditable()) - { - System.arraycopy(packetIn.func_180753_b(), 0, var4.signText, 0, 4); - var4.markDirty(); - } - - var2 = true; - } - } - - if (!var2 && this.gameController.thePlayer != null) - { - this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + packetIn.func_179704_a().getX() + ", " + packetIn.func_179704_a().getY() + ", " + packetIn.func_179704_a().getZ())); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS33(packetIn.func_179704_a(), packetIn.func_180753_b()); - } - - /** - * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, - * beacons, skulls, flowerpot - */ - public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (this.gameController.theWorld.isBlockLoaded(packetIn.func_179823_a())) - { - TileEntity var2 = this.gameController.theWorld.getTileEntity(packetIn.func_179823_a()); - int var3 = packetIn.getTileEntityType(); - - if (var3 == 1 && var2 instanceof TileEntityMobSpawner || var3 == 2 && var2 instanceof TileEntityCommandBlock || var3 == 3 && var2 instanceof TileEntityBeacon || var3 == 4 && var2 instanceof TileEntitySkull || var3 == 5 && var2 instanceof TileEntityFlowerPot || var3 == 6 && var2 instanceof TileEntityBanner) - { - var2.readFromNBT(packetIn.getNbtCompound()); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS35(packetIn.func_179823_a(), packetIn.getTileEntityType(), packetIn.getNbtCompound()); - } - - /** - * Sets the progressbar of the opened window to the specified value - */ - public void handleWindowProperty(S31PacketWindowProperty packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - - if (var2.openContainer != null && var2.openContainer.windowId == packetIn.func_149182_c()) - { - var2.openContainer.updateProgressBar(packetIn.func_149181_d(), packetIn.func_149180_e()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS31(packetIn.func_149182_c(), packetIn.func_149181_d(), packetIn.func_149180_e()); - } - - public void handleEntityEquipment(S04PacketEntityEquipment packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149389_d()); - - if (var2 != null) - { - var2.setCurrentItemOrArmor(packetIn.func_149388_e(), packetIn.func_149390_c()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS04( - packetIn.func_149389_d(), - packetIn.func_149388_e(), - packetIn.func_149390_c()); - } - - /** - * Resets the ItemStack held in hand and closes the window that is opened - */ - public void handleCloseWindow(S2EPacketCloseWindow packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.thePlayer.func_175159_q(); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS2E(); - } - - /** - * Triggers Block.onBlockEventReceived, which is implemented in BlockPistonBase for extension/retraction, BlockNote - * for setting the instrument (including audiovisual feedback) and in BlockContainer to set the number of players - * accessing a (Ender)Chest - */ - public void handleBlockAction(S24PacketBlockAction packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.theWorld.addBlockEvent(packetIn.func_179825_a(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS24(packetIn.func_179825_a(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2()); - } - - /** - * Updates all registered IWorldAccess instances with destroyBlockInWorldPartially - */ - public void handleBlockBreakAnim(S25PacketBlockBreakAnim packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.theWorld.sendBlockBreakProgress(packetIn.func_148845_c(), packetIn.func_179821_b(), packetIn.func_148846_g()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS25(packetIn.func_148845_c(), packetIn.func_179821_b(), packetIn.func_148846_g()); - } - - public void handleMapChunkBulk(S26PacketMapChunkBulk packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - for (int var2 = 0; var2 < packetIn.func_149254_d(); ++var2) - { - int var3 = packetIn.func_149255_a(var2); - int var4 = packetIn.func_149253_b(var2); - - this.clientWorldController.doPreChunk(var3, var4, true); - this.clientWorldController.invalidateBlockReceiveRegion(var3 << 4, 0, var4 << 4, (var3 << 4) + 15, 256, (var4 << 4) + 15); - Chunk var5 = this.clientWorldController.getChunkFromChunkCoords(var3, var4); - var5.func_177439_a(packetIn.func_149256_c(var2), packetIn.func_179754_d(var2), true); - this.clientWorldController.markBlockRangeForRenderUpdate(var3 << 4, 0, var4 << 4, (var3 << 4) + 15, 256, (var4 << 4) + 15); - - if (!(this.clientWorldController.provider instanceof WorldProviderSurface)) - { - var5.resetRelightChecks(); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled && ServerPacketData.isActive[0x26]) - { - int xCoords[] = new int[packetIn.func_149254_d()]; - int zCoords[] = new int[packetIn.func_149254_d()]; - int bitField[] = new int[packetIn.func_149254_d()]; - - for(int i = 0; i < xCoords.length; i++) - { - xCoords[i] = packetIn.func_149255_a(i); - zCoords[i] = packetIn.func_149253_b(i); - bitField[i] = packetIn.func_179754_d(i); - } - - ServerPacketData.displayS26(xCoords, zCoords, bitField); - } - } - - public void handleChangeGameState(S2BPacketChangeGameState packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - int var3 = packetIn.func_149138_c(); - float var4 = packetIn.func_149137_d(); - int var5 = MathHelper.floor_float(var4 + 0.5F); - - if (var3 >= 0 && var3 < S2BPacketChangeGameState.MESSAGE_NAMES.length && S2BPacketChangeGameState.MESSAGE_NAMES[var3] != null) - { - var2.addChatComponentMessage(new ChatComponentTranslation(S2BPacketChangeGameState.MESSAGE_NAMES[var3], new Object[0])); - } - - if (var3 == 1) - { - this.clientWorldController.getWorldInfo().setRaining(true); - this.clientWorldController.setRainStrength(0.0F); - } - else if (var3 == 2) - { - this.clientWorldController.getWorldInfo().setRaining(false); - this.clientWorldController.setRainStrength(1.0F); - } - else if (var3 == 3) - { - this.gameController.playerController.setGameType(WorldSettings.GameType.getByID(var5)); - } - else if (var3 == 4) - { - this.gameController.displayGuiScreen(new GuiWinGame()); - } - else if (var3 == 5) - { - GameSettings var6 = this.gameController.gameSettings; - - if (var4 == 0.0F) - { - this.gameController.displayGuiScreen(new GuiScreenDemo()); - } - else if (var4 == 101.0F) - { - this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.movement", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(var6.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(var6.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(var6.keyBindRight.getKeyCode())})); - } - else if (var4 == 102.0F) - { - this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindJump.getKeyCode())})); - } - else if (var4 == 103.0F) - { - this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindInventory.getKeyCode())})); - } - } - else if (var3 == 6) - { - this.clientWorldController.playSound(var2.posX, var2.posY + (double)var2.getEyeHeight(), var2.posZ, "random.successful_hit", 0.18F, 0.45F, false); - } - else if (var3 == 7) - { - this.clientWorldController.setRainStrength(var4); - } - else if (var3 == 8) - { - this.clientWorldController.setThunderStrength(var4); - } - else if (var3 == 10) - { - this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, var2.posX, var2.posY, var2.posZ, 0.0D, 0.0D, 0.0D, new int[0]); - this.clientWorldController.playSound(var2.posX, var2.posY, var2.posZ, "mob.guardian.curse", 1.0F, 1.0F, false); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS2B(var3, var4); - } - - /** - * Updates the worlds MapStorage with the specified MapData for the specified map-identifier and invokes a - * MapItemRenderer for it - */ - public void handleMaps(S34PacketMaps packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - MapData var2 = ItemMap.loadMapData(packetIn.getMapId(), this.gameController.theWorld); - packetIn.func_179734_a(var2); - this.gameController.entityRenderer.getMapItemRenderer().func_148246_a(var2); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS34(packetIn.getMapId()); - } - - public void handleEffect(S28PacketEffect packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (packetIn.isSoundServerwide()) - { - this.gameController.theWorld.func_175669_a(packetIn.getSoundType(), packetIn.func_179746_d(), packetIn.getSoundData()); - } - else - { - this.gameController.theWorld.playAuxSFX(packetIn.getSoundType(), packetIn.func_179746_d(), packetIn.getSoundData()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS28(packetIn.getSoundType(), packetIn.func_179746_d(), packetIn.getSoundData(), packetIn.isSoundServerwide()); - } - - /** - * Updates the players statistics or achievements - */ - public void handleStatistics(S37PacketStatistics packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - boolean var2 = false; - StatBase var5; - int var6; - - for (Iterator var3 = packetIn.func_148974_c().entrySet().iterator(); var3.hasNext(); this.gameController.thePlayer.getStatFileWriter().func_150873_a(this.gameController.thePlayer, var5, var6)) - { - Entry var4 = (Entry)var3.next(); - var5 = (StatBase)var4.getKey(); - var6 = ((Integer)var4.getValue()).intValue(); - - if (var5.isAchievement() && var6 > 0) - { - if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().writeStat(var5) == 0) - { - Achievement var7 = (Achievement)var5; - this.gameController.guiAchievement.displayAchievement(var7); - this.gameController.getTwitchStream().func_152911_a(new MetadataAchievement(var7), 0L); - - if (var5 == AchievementList.openInventory) - { - this.gameController.gameSettings.showInventoryAchievementHint = false; - this.gameController.gameSettings.saveOptions(); - } - } - - var2 = true; - } - } - - if (!this.field_147308_k && !var2 && this.gameController.gameSettings.showInventoryAchievementHint) - { - this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.openInventory); - } - - this.field_147308_k = true; - - if (this.gameController.currentScreen instanceof IProgressMeter) - { - ((IProgressMeter)this.gameController.currentScreen).doneLoading(); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS37(); - } - - public void handleEntityEffect(S1DPacketEntityEffect packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149426_d()); - - if (var2 instanceof EntityLivingBase) - { - PotionEffect var3 = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); - var3.setPotionDurationMax(packetIn.func_149429_c()); - ((EntityLivingBase)var2).addPotionEffect(var3); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1D( - packetIn.func_149426_d(), - packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), - packetIn.func_179707_f()); - } - - public void func_175098_a(S42PacketCombatEvent packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.field_179775_c); - EntityLivingBase var3 = var2 instanceof EntityLivingBase ? (EntityLivingBase)var2 : null; - - if (packetIn.field_179776_a == S42PacketCombatEvent.Event.END_COMBAT) - { - long var4 = (long)(1000 * packetIn.field_179772_d / 20); - MetadataCombat var6 = new MetadataCombat(this.gameController.thePlayer, var3); - this.gameController.getTwitchStream().func_176026_a(var6, 0L - var4, 0L); - } - else if (packetIn.field_179776_a == S42PacketCombatEvent.Event.ENTITY_DIED) - { - Entity var7 = this.clientWorldController.getEntityByID(packetIn.field_179774_b); - - if (var7 instanceof EntityPlayer) - { - MetadataPlayerDeath var5 = new MetadataPlayerDeath((EntityPlayer)var7, var3); - var5.func_152807_a(packetIn.field_179773_e); - this.gameController.getTwitchStream().func_152911_a(var5, 0L); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS42( - packetIn.field_179776_a.name(), // event - packetIn.field_179772_d, // duration - packetIn.field_179775_c, // entityID - packetIn.field_179774_b, // playerID - packetIn.field_179773_e // message - ); - } - - public void func_175101_a(S41PacketServerDifficulty packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.theWorld.getWorldInfo().setDifficulty(packetIn.func_179831_b()); - this.gameController.theWorld.getWorldInfo().setDifficultyLocked(packetIn.func_179830_a()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS41(packetIn.func_179831_b().ordinal(), packetIn.func_179830_a()); - } - - public void func_175094_a(S43PacketCamera packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = packetIn.func_179780_a(this.clientWorldController); - - if (var2 != null) - { - this.gameController.func_175607_a(var2); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS43(var2.getEntityId()); - } - - public void func_175093_a(S44PacketWorldBorder packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - packetIn.func_179788_a(this.clientWorldController.getWorldBorder()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS44(); - } - - public void func_175099_a(S45PacketTitle packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - S45PacketTitle.Type var2 = packetIn.func_179807_a(); - String var3 = null; - String var4 = null; - String var5 = packetIn.func_179805_b() != null ? packetIn.func_179805_b().getFormattedText() : ""; - - switch (NetHandlerPlayClient.SwitchAction.field_178885_a[var2.ordinal()]) - { - case 1: - var3 = var5; - break; - - case 2: - var4 = var5; - break; - - case 3: - this.gameController.ingameGUI.func_175178_a("", "", -1, -1, -1); - this.gameController.ingameGUI.func_175177_a(); - return; - } - - this.gameController.ingameGUI.func_175178_a(var3, var4, packetIn.func_179806_c(), packetIn.func_179804_d(), packetIn.func_179803_e()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS45(var2.name(), var3, var4, packetIn.func_179806_c(), packetIn.func_179804_d(), packetIn.func_179803_e()); - } - - public void func_175100_a(S46PacketSetCompressionLevel packetIn) - { - if (!this.netManager.isLocalChannel()) - { - this.netManager.setCompressionTreshold(packetIn.func_179760_a()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS46(packetIn.func_179760_a()); - } - - public void func_175096_a(S47PacketPlayerListHeaderFooter packetIn) - { - this.gameController.ingameGUI.getTabList().setHeader(packetIn.func_179700_a().getFormattedText().length() == 0 ? null : packetIn.func_179700_a()); - this.gameController.ingameGUI.getTabList().setFooter(packetIn.func_179701_b().getFormattedText().length() == 0 ? null : packetIn.func_179701_b()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS47(packetIn.func_179700_a(), packetIn.func_179701_b()); - } - - public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149076_c()); - - if (var2 instanceof EntityLivingBase) - { - ((EntityLivingBase)var2).removePotionEffectClient(packetIn.func_149075_d()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS1E(packetIn.func_149076_c(), packetIn.func_149075_d()); - } - - public void handlePlayerListItem(S38PacketPlayerListItem packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Iterator var2 = packetIn.func_179767_a().iterator(); - - // PacketAnalysis - String actions = ""; - String uuids = ""; - - while (var2.hasNext()) - { - S38PacketPlayerListItem.AddPlayerData var3 = (S38PacketPlayerListItem.AddPlayerData)var2.next(); - - // PacketAnalysis - actions += packetIn.func_179768_b().name() + "\n"; - uuids += var3.func_179962_a().getId() + "\n"; - - if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) - { - this.playerInfoMap.remove(var3.func_179962_a().getId()); - } - else - { - NetworkPlayerInfo var4 = (NetworkPlayerInfo)this.playerInfoMap.get(var3.func_179962_a().getId()); - - if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) - { - var4 = new NetworkPlayerInfo(var3); - this.playerInfoMap.put(var4.func_178845_a().getId(), var4); - } - - if (var4 != null) - { - switch (NetHandlerPlayClient.SwitchAction.field_178884_b[packetIn.func_179768_b().ordinal()]) - { - case 1: - var4.func_178839_a(var3.func_179960_c()); - var4.func_178838_a(var3.func_179963_b()); - break; - - case 2: - var4.func_178839_a(var3.func_179960_c()); - break; - - case 3: - var4.func_178838_a(var3.func_179963_b()); - break; - - case 4: - var4.func_178859_a(var3.func_179961_d()); - } - } - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS38(uuids.split("\n"), actions.split("\n")); - } - - public void handleKeepAlive(S00PacketKeepAlive packetIn) - { - this.addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c())); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS00(packetIn.func_149134_c()); - } - - public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - EntityPlayerSP var2 = this.gameController.thePlayer; - var2.capabilities.isFlying = packetIn.isFlying(); - var2.capabilities.isCreativeMode = packetIn.isCreativeMode(); - var2.capabilities.disableDamage = packetIn.isInvulnerable(); - var2.capabilities.allowFlying = packetIn.isAllowFlying(); - var2.capabilities.setFlySpeed(packetIn.getFlySpeed()); - var2.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed()); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS39( - packetIn.isFlying(), packetIn.isCreativeMode(), - packetIn.isInvulnerable(), packetIn.isAllowFlying(), - packetIn.getFlySpeed(), packetIn.getWalkSpeed() - ); - } - - /** - * Displays the available command-completion options the server knows of - */ - public void handleTabComplete(S3APacketTabComplete packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - String[] var2 = packetIn.func_149630_c(); - - if (this.gameController.currentScreen instanceof GuiChat) - { - GuiChat var3 = (GuiChat)this.gameController.currentScreen; - var3.onAutocompleteResponse(var2); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS3A(packetIn.func_149630_c()); - } - - public void handleSoundEffect(S29PacketSoundEffect packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - this.gameController.theWorld.playSound(packetIn.func_149207_d(), packetIn.func_149211_e(), packetIn.func_149210_f(), packetIn.func_149212_c(), packetIn.func_149208_g(), packetIn.func_149209_h(), false); - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS29(packetIn.func_149207_d(), packetIn.func_149211_e(), packetIn.func_149210_f(), packetIn.func_149212_c(), packetIn.func_149208_g(), packetIn.func_149209_h()); - } - - public void func_175095_a(S48PacketResourcePackSend p_175095_1_) - { - final String var2 = p_175095_1_.func_179783_a(); - final String var3 = p_175095_1_.func_179784_b(); - - if (var2.startsWith("level://")) - { - String var4 = var2.substring("level://".length()); - File var5 = new File(this.gameController.mcDataDir, "saves"); - File var6 = new File(var5, var4); - - if (var6.isFile()) - { - this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.ACCEPTED)); - Futures.addCallback(this.gameController.getResourcePackRepository().func_177319_a(var6), new FutureCallback() - { - private static final String __OBFID = "CL_00000879"; - public void onSuccess(Object p_onSuccess_1_) - { - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED)); - } - public void onFailure(Throwable p_onFailure_1_) - { - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); - } - }); - } - else - { - this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); - } - } - else - { - if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().getResourceMode() == ServerData.ServerResourceMode.ENABLED) - { - this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.ACCEPTED)); - Futures.addCallback(this.gameController.getResourcePackRepository().func_180601_a(var2, var3), new FutureCallback() - { - private static final String __OBFID = "CL_00002624"; - public void onSuccess(Object p_onSuccess_1_) - { - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED)); - } - public void onFailure(Throwable p_onFailure_1_) - { - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); - } - }); - } - else if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().getResourceMode() != ServerData.ServerResourceMode.PROMPT) - { - this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.DECLINED)); - } - else - { - this.gameController.addScheduledTask(new Runnable() - { - private static final String __OBFID = "CL_00002623"; - public void run() - { - NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() - { - private static final String __OBFID = "CL_00002622"; - public void confirmClicked(boolean result, int id) - { - NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft(); - - if (result) - { - if (NetHandlerPlayClient.this.gameController.getCurrentServerData() != null) - { - NetHandlerPlayClient.this.gameController.getCurrentServerData().setResourceMode(ServerData.ServerResourceMode.ENABLED); - } - - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.ACCEPTED)); - Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_180601_a(var2, var3), new FutureCallback() - { - private static final String __OBFID = "CL_00002621"; - public void onSuccess(Object p_onSuccess_1_) - { - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED)); - } - public void onFailure(Throwable p_onFailure_1_) - { - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); - } - }); - } - else - { - if (NetHandlerPlayClient.this.gameController.getCurrentServerData() != null) - { - NetHandlerPlayClient.this.gameController.getCurrentServerData().setResourceMode(ServerData.ServerResourceMode.DISABLED); - } - - NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.DECLINED)); - } - - ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.getCurrentServerData()); - NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null); - } - }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0)); - } - }); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS48(var2, var3); - } - - public void func_175097_a(S49PacketUpdateEntityNBT pcaketIn) - { - PacketThreadUtil.func_180031_a(pcaketIn, this, this.gameController); - Entity var2 = pcaketIn.func_179764_a(this.clientWorldController); - - if (var2 != null) - { - var2.func_174834_g(pcaketIn.func_179763_a()); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS49(var2.getEntityId(), pcaketIn.func_179763_a()); - } - - /** - * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to - * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the - * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server - * resourcepack for the client to load. - */ - public void handleCustomPayload(S3FPacketCustomPayload packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if ("MC|TrList".equals(packetIn.getChannelName())) - { - PacketBuffer var2 = packetIn.getBufferData(); - - try - { - int var3 = var2.readInt(); - GuiScreen var4 = this.gameController.currentScreen; - - if (var4 != null && var4 instanceof GuiMerchant && var3 == this.gameController.thePlayer.openContainer.windowId) - { - IMerchant var5 = ((GuiMerchant)var4).getMerchant(); - MerchantRecipeList var6 = MerchantRecipeList.func_151390_b(var2); - var5.setRecipes(var6); - } - } - catch (IOException var10) - { - logger.error("Couldn\'t load trade info", var10); - } - finally - { - var2.release(); - } - } - else if ("MC|Brand".equals(packetIn.getChannelName())) - { - this.gameController.thePlayer.func_175158_f(packetIn.getBufferData().readStringFromBuffer(32767)); - } - else if ("MC|BOpen".equals(packetIn.getChannelName())) - { - ItemStack var12 = this.gameController.thePlayer.getCurrentEquippedItem(); - - if (var12 != null && var12.getItem() == Items.written_book) - { - this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, var12, false)); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS3F(packetIn.getChannelName()); - } - - /** - * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname - */ - public void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Scoreboard var2 = this.clientWorldController.getScoreboard(); - ScoreObjective var3; - - if (packetIn.func_149338_e() == 0) - { - var3 = var2.addScoreObjective(packetIn.func_149339_c(), IScoreObjectiveCriteria.DUMMY); - var3.setDisplayName(packetIn.func_149337_d()); - var3.func_178767_a(packetIn.func_179817_d()); - } - else - { - var3 = var2.getObjective(packetIn.func_149339_c()); - - if (packetIn.func_149338_e() == 1) - { - var2.func_96519_k(var3); - } - else if (packetIn.func_149338_e() == 2) - { - var3.setDisplayName(packetIn.func_149337_d()); - var3.func_178767_a(packetIn.func_179817_d()); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS3B( - packetIn.func_149337_d(), // name - packetIn.func_149339_c(), // type - packetIn.func_149338_e(), // mode - packetIn.func_179817_d().name() // renderType - ); - } - - /** - * Either updates the score with a specified value or removes the score for an objective - */ - public void handleUpdateScore(S3CPacketUpdateScore packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Scoreboard var2 = this.clientWorldController.getScoreboard(); - ScoreObjective var3 = var2.getObjective(packetIn.func_149321_d()); - - if (packetIn.func_180751_d() == S3CPacketUpdateScore.Action.CHANGE) - { - Score var4 = var2.getValueFromObjective(packetIn.func_149324_c(), var3); - var4.setScorePoints(packetIn.func_149323_e()); - } - else if (packetIn.func_180751_d() == S3CPacketUpdateScore.Action.REMOVE) - { - if (StringUtils.isNullOrEmpty(packetIn.func_149321_d())) - { - var2.func_178822_d(packetIn.func_149324_c(), (ScoreObjective)null); - } - else if (var3 != null) - { - var2.func_178822_d(packetIn.func_149324_c(), var3); - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS3C( - packetIn.func_149324_c(), // score name - packetIn.func_149321_d(), // objective name - packetIn.func_180751_d().name(), // action - packetIn.func_149323_e() // score value - ); - } - - /** - * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below - * name) - */ - public void handleDisplayScoreboard(S3DPacketDisplayScoreboard packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Scoreboard var2 = this.clientWorldController.getScoreboard(); - - if (packetIn.func_149370_d().length() == 0) - { - var2.setObjectiveInDisplaySlot(packetIn.func_149371_c(), (ScoreObjective)null); - } - else - { - ScoreObjective var3 = var2.getObjective(packetIn.func_149370_d()); - var2.setObjectiveInDisplaySlot(packetIn.func_149371_c(), var3); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS3D(packetIn.func_149371_c(), packetIn.func_149370_d()); - } - - /** - * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team- - * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled - */ - public void handleTeams(S3EPacketTeams packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Scoreboard var2 = this.clientWorldController.getScoreboard(); - ScorePlayerTeam var3; - - if (packetIn.func_149307_h() == 0) - { - var3 = var2.createTeam(packetIn.func_149312_c()); - } - else - { - var3 = var2.getTeam(packetIn.func_149312_c()); - } - - if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2) - { - var3.setTeamName(packetIn.func_149306_d()); - var3.setNamePrefix(packetIn.func_149311_e()); - var3.setNameSuffix(packetIn.func_149309_f()); - var3.func_178774_a(EnumChatFormatting.func_175744_a(packetIn.func_179813_h())); - var3.func_98298_a(packetIn.func_149308_i()); - Team.EnumVisible var4 = Team.EnumVisible.func_178824_a(packetIn.func_179814_i()); - - if (var4 != null) - { - var3.func_178772_a(var4); - } - } - - String var5; - Iterator var6; - - if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3) - { - var6 = packetIn.func_149310_g().iterator(); - - while (var6.hasNext()) - { - var5 = (String)var6.next(); - var2.func_151392_a(var5, packetIn.func_149312_c()); - } - } - - if (packetIn.func_149307_h() == 4) - { - var6 = packetIn.func_149310_g().iterator(); - - while (var6.hasNext()) - { - var5 = (String)var6.next(); - var2.removePlayerFromTeam(var5, var3); - } - } - - if (packetIn.func_149307_h() == 1) - { - var2.removeTeam(var3); - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS3E( - packetIn.func_149307_h(), // mode - packetIn.func_149312_c(), // team name - - packetIn.func_149306_d(), // team display name - packetIn.func_149311_e(), // prefix - packetIn.func_149309_f(), // suffix - packetIn.func_179813_h(), // chat formatting - packetIn.func_149308_i(), // friendly fire - packetIn.func_179814_i(), // name tag visibility - - packetIn.func_149310_g() // player names - ); - } - - /** - * Spawns a specified number of particles at the specified location with a randomized displacement according to - * specified bounds - */ - public void handleParticles(S2APacketParticles packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - - if (packetIn.func_149222_k() == 0) - { - double var2 = (double)(packetIn.func_149227_j() * packetIn.func_149221_g()); - double var4 = (double)(packetIn.func_149227_j() * packetIn.func_149224_h()); - double var6 = (double)(packetIn.func_149227_j() * packetIn.func_149223_i()); - - try - { - this.clientWorldController.spawnParticle(packetIn.func_179749_a(), packetIn.func_179750_b(), packetIn.func_149220_d(), packetIn.func_149226_e(), packetIn.func_149225_f(), var2, var4, var6, packetIn.func_179748_k()); - } - catch (Throwable var17) - { - logger.warn("Could not spawn particle effect " + packetIn.func_179749_a()); - } - } - else - { - for (int var18 = 0; var18 < packetIn.func_149222_k(); ++var18) - { - double var3 = this.avRandomizer.nextGaussian() * (double)packetIn.func_149221_g(); - double var5 = this.avRandomizer.nextGaussian() * (double)packetIn.func_149224_h(); - double var7 = this.avRandomizer.nextGaussian() * (double)packetIn.func_149223_i(); - double var9 = this.avRandomizer.nextGaussian() * (double)packetIn.func_149227_j(); - double var11 = this.avRandomizer.nextGaussian() * (double)packetIn.func_149227_j(); - double var13 = this.avRandomizer.nextGaussian() * (double)packetIn.func_149227_j(); - - try - { - this.clientWorldController.spawnParticle(packetIn.func_179749_a(), packetIn.func_179750_b(), packetIn.func_149220_d() + var3, packetIn.func_149226_e() + var5, packetIn.func_149225_f() + var7, var9, var11, var13, packetIn.func_179748_k()); - } - catch (Throwable var16) - { - logger.warn("Could not spawn particle effect " + packetIn.func_179749_a()); - return; - } - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS2A( - packetIn.func_179749_a().name(), // type - packetIn.func_149222_k(), // count - packetIn.func_179750_b(), // long distance - packetIn.func_149220_d(), packetIn.func_149226_e(), packetIn.func_149225_f(), // position - packetIn.func_149221_g(), packetIn.func_149224_h(), packetIn.func_149223_i(), // offset - packetIn.func_149227_j() // offset scale - ); - - } - - /** - * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player - * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie - * maxHealth and knockback resistance as well as reinforcement spawning chance. - */ - public void handleEntityProperties(S20PacketEntityProperties packetIn) - { - PacketThreadUtil.func_180031_a(packetIn, this, this.gameController); - Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149442_c()); - - if (var2 != null) - { - if (!(var2 instanceof EntityLivingBase)) - { - throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + var2 + ")"); - } - else - { - BaseAttributeMap var3 = ((EntityLivingBase)var2).getAttributeMap(); - Iterator var4 = packetIn.func_149441_d().iterator(); - - while (var4.hasNext()) - { - S20PacketEntityProperties.Snapshot var5 = (S20PacketEntityProperties.Snapshot)var4.next(); - IAttributeInstance var6 = var3.getAttributeInstanceByName(var5.func_151409_a()); - - if (var6 == null) - { - var6 = var3.registerAttribute(new RangedAttribute((IAttribute)null, var5.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE)); - } - - var6.setBaseValue(var5.func_151410_b()); - var6.removeAllModifiers(); - Iterator var7 = var5.func_151408_c().iterator(); - - while (var7.hasNext()) - { - AttributeModifier var8 = (AttributeModifier)var7.next(); - var6.applyModifier(var8); - } - } - } - } - - // PacketAnalysis - if(ServerPacketData.enabled) - ServerPacketData.displayS20(packetIn.func_149442_c(), null); - } - - /** - * Returns this the NetworkManager instance registered with this NetworkHandlerPlayClient - */ - public NetworkManager getNetworkManager() - { - return this.netManager; - } - - public Collection func_175106_d() - { - return this.playerInfoMap.values(); - } - - public NetworkPlayerInfo func_175102_a(UUID p_175102_1_) - { - return (NetworkPlayerInfo)this.playerInfoMap.get(p_175102_1_); - } - - public NetworkPlayerInfo func_175104_a(String p_175104_1_) - { - Iterator var2 = this.playerInfoMap.values().iterator(); - NetworkPlayerInfo var3; - - do - { - if (!var2.hasNext()) - { - return null; - } - - var3 = (NetworkPlayerInfo)var2.next(); - } - while (!var3.func_178845_a().getName().equals(p_175104_1_)); - - return var3; - } - - public GameProfile func_175105_e() - { - return this.field_175107_d; - } - - static final class SwitchAction - { - static final int[] field_178885_a; - - static final int[] field_178884_b = new int[S38PacketPlayerListItem.Action.values().length]; - private static final String __OBFID = "CL_00002620"; - - static - { - try - { - field_178884_b[S38PacketPlayerListItem.Action.ADD_PLAYER.ordinal()] = 1; - } - catch (NoSuchFieldError var7) - { - ; - } - - try - { - field_178884_b[S38PacketPlayerListItem.Action.UPDATE_GAME_MODE.ordinal()] = 2; - } - catch (NoSuchFieldError var6) - { - ; - } - - try - { - field_178884_b[S38PacketPlayerListItem.Action.UPDATE_LATENCY.ordinal()] = 3; - } - catch (NoSuchFieldError var5) - { - ; - } - - try - { - field_178884_b[S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME.ordinal()] = 4; - } - catch (NoSuchFieldError var4) - { - ; - } - - field_178885_a = new int[S45PacketTitle.Type.values().length]; - - try - { - field_178885_a[S45PacketTitle.Type.TITLE.ordinal()] = 1; - } - catch (NoSuchFieldError var3) - { - ; - } - - try - { - field_178885_a[S45PacketTitle.Type.SUBTITLE.ordinal()] = 2; - } - catch (NoSuchFieldError var2) - { - ; - } - - try - { - field_178885_a[S45PacketTitle.Type.RESET.ordinal()] = 3; - } - catch (NoSuchFieldError var1) - { - ; - } - } - } -} diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java b/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java deleted file mode 100644 index 29a862e..0000000 --- a/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ /dev/null @@ -1,2272 +0,0 @@ -package net.minecraft.client.renderer; - -import com.google.gson.JsonSyntaxException; - -import cubimod.Cubitick; - -import java.io.IOException; -import java.nio.FloatBuffer; -import java.util.List; -import java.util.Random; -import java.util.concurrent.Callable; - -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.MapItemRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.client.renderer.culling.ClippingHelperImpl; -import net.minecraft.client.renderer.culling.Frustrum; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.texture.TextureMap; -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.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.boss.BossStatus; -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.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MouseFilter; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.ReportedException; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; -import net.minecraft.world.WorldSettings; -import net.minecraft.world.biome.BiomeGenBase; - -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.GL11; -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 locationRainPng = new ResourceLocation("textures/environment/rain.png"); - private static final ResourceLocation locationSnowPng = 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 Minecraft mc; - private final IResourceManager resourceManager; - private 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 MouseFilter mouseFilterXAxis = new MouseFilter(); - private MouseFilter mouseFilterYAxis = new MouseFilter(); - private float thirdPersonDistance = 4.0F; - - /** Third person distance temp */ - private float thirdPersonDistanceTemp = 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 field_175074_C = true; - private boolean field_175073_D = true; - - /** 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 field_175075_L; - - /** Rain sound counter */ - private int rainSoundCounter; - private float[] field_175076_N = new float[1024]; - private float[] field_175077_O = new float[1024]; - - /** Fog color buffer */ - private FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16); - private float field_175080_Q; - private float field_175082_R; - private float field_175081_S; - - /** Fog color 2 */ - private float fogColor2; - - /** Fog color 1 */ - private float fogColor1; - private int field_175079_V = 0; - private boolean field_175078_W = false; - private double cameraZoom = 1.0D; - private double cameraYaw; - private double cameraPitch; - private ShaderGroup theShaderGroup; - private static final ResourceLocation[] shaderResourceLocations = 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 shaderCount = shaderResourceLocations.length; - private int shaderIndex; - private boolean field_175083_ad; - private int field_175084_ae; - private static final String __OBFID = "CL_00000947"; - - public EntityRenderer(Minecraft mcIn, IResourceManager p_i45076_2_) - { - this.shaderIndex = shaderCount; - this.field_175083_ad = false; - this.field_175084_ae = 0; - this.mc = mcIn; - this.resourceManager = p_i45076_2_; - 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 var3 = 0; var3 < 32; ++var3) - { - for (int var4 = 0; var4 < 32; ++var4) - { - float var5 = (float)(var4 - 16); - float var6 = (float)(var3 - 16); - float var7 = MathHelper.sqrt_float(var5 * var5 + var6 * var6); - this.field_175076_N[var3 << 5 | var4] = -var6 / var7; - this.field_175077_O[var3 << 5 | var4] = var5 / var7; - } - } - } - - public boolean isShaderActive() - { - return OpenGlHelper.shadersSupported && this.theShaderGroup != null; - } - - public void func_175071_c() - { - this.field_175083_ad = !this.field_175083_ad; - } - - public void func_175066_a(Entity p_175066_1_) - { - if (OpenGlHelper.shadersSupported) - { - if (this.theShaderGroup != null) - { - this.theShaderGroup.deleteShaderGroup(); - } - - this.theShaderGroup = null; - - if (p_175066_1_ instanceof EntityCreeper) - { - this.func_175069_a(new ResourceLocation("shaders/post/creeper.json")); - } - else if (p_175066_1_ instanceof EntitySpider) - { - this.func_175069_a(new ResourceLocation("shaders/post/spider.json")); - } - else if (p_175066_1_ instanceof EntityEnderman) - { - this.func_175069_a(new ResourceLocation("shaders/post/invert.json")); - } - } - } - - public void activateNextShader() - { - if (OpenGlHelper.shadersSupported) - { - if (this.mc.func_175606_aa() instanceof EntityPlayer) - { - if (this.theShaderGroup != null) - { - this.theShaderGroup.deleteShaderGroup(); - } - - this.shaderIndex = (this.shaderIndex + 1) % (shaderResourceLocations.length + 1); - - if (this.shaderIndex != shaderCount) - { - this.func_175069_a(shaderResourceLocations[this.shaderIndex]); - } - else - { - this.theShaderGroup = null; - } - } - } - } - - private void func_175069_a(ResourceLocation p_175069_1_) - { - try - { - this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), p_175069_1_); - this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); - this.field_175083_ad = true; - } - catch (IOException var3) - { - logger.warn("Failed to load shader: " + p_175069_1_, var3); - this.shaderIndex = shaderCount; - this.field_175083_ad = false; - } - catch (JsonSyntaxException var4) - { - logger.warn("Failed to load shader: " + p_175069_1_, var4); - this.shaderIndex = shaderCount; - this.field_175083_ad = false; - } - } - - public void onResourceManagerReload(IResourceManager p_110549_1_) - { - if (this.theShaderGroup != null) - { - this.theShaderGroup.deleteShaderGroup(); - } - - this.theShaderGroup = null; - - if (this.shaderIndex != shaderCount) - { - this.func_175069_a(shaderResourceLocations[this.shaderIndex]); - } - else - { - this.func_175066_a(this.mc.func_175606_aa()); - } - } - - /** - * Updates the entity renderer - */ - public void updateRenderer() - { - if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null) - { - ShaderLinkHelper.setNewStaticShaderLinkHelper(); - } - - this.updateFovModifierHand(); - this.updateTorchFlicker(); - this.fogColor2 = this.fogColor1; - this.thirdPersonDistanceTemp = this.thirdPersonDistance; - float var1; - float var2; - - if (this.mc.gameSettings.smoothCamera) - { - var1 = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; - var2 = var1 * var1 * var1 * 8.0F; - this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * var2); - this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * var2); - this.smoothCamPartialTicks = 0.0F; - this.smoothCamYaw = 0.0F; - this.smoothCamPitch = 0.0F; - } - else - { - this.smoothCamFilterX = 0.0F; - this.smoothCamFilterY = 0.0F; - this.mouseFilterXAxis.func_180179_a(); - this.mouseFilterYAxis.func_180179_a(); - } - - if (this.mc.func_175606_aa() == null) - { - this.mc.func_175607_a(this.mc.thePlayer); - } - - var1 = this.mc.theWorld.getLightBrightness(new BlockPos(this.mc.func_175606_aa())); - var2 = (float)this.mc.gameSettings.renderDistanceChunks / 32.0F; - float var3 = var1 * (1.0F - var2) + var2; - this.fogColor1 += (var3 - this.fogColor1) * 0.1F; - ++this.rendererUpdateCount; - this.itemRenderer.updateEquippedItem(); - this.addRainParticles(); - this.bossColorModifierPrev = this.bossColorModifier; - - if (BossStatus.hasColorModifier) - { - this.bossColorModifier += 0.05F; - - if (this.bossColorModifier > 1.0F) - { - this.bossColorModifier = 1.0F; - } - - BossStatus.hasColorModifier = false; - } - else if (this.bossColorModifier > 0.0F) - { - this.bossColorModifier -= 0.0125F; - } - } - - public ShaderGroup getShaderGroup() - { - return this.theShaderGroup; - } - - public void updateShaderGroupSize(int p_147704_1_, int p_147704_2_) - { - if (OpenGlHelper.shadersSupported) - { - if (this.theShaderGroup != null) - { - this.theShaderGroup.createBindFramebuffers(p_147704_1_, p_147704_2_); - } - - this.mc.renderGlobal.checkOcclusionQueryResult(p_147704_1_, p_147704_2_); - } - } - - /** - * Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime - */ - public void getMouseOver(float p_78473_1_) - { - Entity var2 = this.mc.func_175606_aa(); - - if (var2 != null) - { - if (this.mc.theWorld != null) - { - this.mc.mcProfiler.startSection("pick"); - this.mc.pointedEntity = null; - double var3 = (double)this.mc.playerController.getBlockReachDistance(); - this.mc.objectMouseOver = var2.func_174822_a(var3, p_78473_1_); - double var5 = var3; - Vec3 var7 = var2.func_174824_e(p_78473_1_); - - if (this.mc.playerController.extendedReach()) - { - var3 = 6.0D; - var5 = 6.0D; - } - else - { - if (var3 > 3.0D) - { - var5 = 3.0D; - } - - var3 = var5; - } - - if (this.mc.objectMouseOver != null) - { - var5 = this.mc.objectMouseOver.hitVec.distanceTo(var7); - } - - Vec3 var8 = var2.getLook(p_78473_1_); - Vec3 var9 = var7.addVector(var8.xCoord * var3, var8.yCoord * var3, var8.zCoord * var3); - this.pointedEntity = null; - Vec3 var10 = null; - float var11 = 1.0F; - List var12 = this.mc.theWorld.getEntitiesWithinAABBExcludingEntity(var2, var2.getEntityBoundingBox().addCoord(var8.xCoord * var3, var8.yCoord * var3, var8.zCoord * var3).expand((double)var11, (double)var11, (double)var11)); - double var13 = var5; - - for (int var15 = 0; var15 < var12.size(); ++var15) - { - Entity var16 = (Entity)var12.get(var15); - - if (var16.canBeCollidedWith()) - { - float var17 = var16.getCollisionBorderSize(); - AxisAlignedBB var18 = var16.getEntityBoundingBox().expand((double)var17, (double)var17, (double)var17); - MovingObjectPosition var19 = var18.calculateIntercept(var7, var9); - - if (var18.isVecInside(var7)) - { - if (0.0D < var13 || var13 == 0.0D) - { - this.pointedEntity = var16; - var10 = var19 == null ? var7 : var19.hitVec; - var13 = 0.0D; - } - } - else if (var19 != null) - { - double var20 = var7.distanceTo(var19.hitVec); - - if (var20 < var13 || var13 == 0.0D) - { - if (var16 == var2.ridingEntity) - { - if (var13 == 0.0D) - { - this.pointedEntity = var16; - var10 = var19.hitVec; - } - } - else - { - this.pointedEntity = var16; - var10 = var19.hitVec; - var13 = var20; - } - } - } - } - } - - if (this.pointedEntity != null && (var13 < var5 || this.mc.objectMouseOver == null)) - { - this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, var10); - - 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 var1 = 1.0F; - - if (this.mc.func_175606_aa() instanceof AbstractClientPlayer) - { - AbstractClientPlayer var2 = (AbstractClientPlayer)this.mc.func_175606_aa(); - var1 = var2.func_175156_o(); - } - - this.fovModifierHandPrev = this.fovModifierHand; - this.fovModifierHand += (var1 - 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 p_78481_1_, boolean p_78481_2_) - { - if (this.field_175078_W) - { - return 90.0F; - } - else - { - Entity var3 = this.mc.func_175606_aa(); - float var4 = 70.0F; - - if (p_78481_2_) - { - var4 = this.mc.gameSettings.fovSetting; - var4 *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * p_78481_1_; - } - - if (var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).getHealth() <= 0.0F) - { - float var5 = (float)((EntityLivingBase)var3).deathTime + p_78481_1_; - var4 /= (1.0F - 500.0F / (var5 + 500.0F)) * 2.0F + 1.0F; - } - - Block var6 = ActiveRenderInfo.func_180786_a(this.mc.theWorld, var3, p_78481_1_); - - if (var6.getMaterial() == Material.water) - { - var4 = var4 * 60.0F / 70.0F; - } - - return var4; - } - } - - private void hurtCameraEffect(float p_78482_1_) - { - if (this.mc.func_175606_aa() instanceof EntityLivingBase) - { - EntityLivingBase var2 = (EntityLivingBase)this.mc.func_175606_aa(); - float var3 = (float)var2.hurtTime - p_78482_1_; - float var4; - - if (var2.getHealth() <= 0.0F) - { - var4 = (float)var2.deathTime + p_78482_1_; - GlStateManager.rotate(40.0F - 8000.0F / (var4 + 200.0F), 0.0F, 0.0F, 1.0F); - } - - if (var3 < 0.0F) - { - return; - } - - var3 /= (float)var2.maxHurtTime; - var3 = MathHelper.sin(var3 * var3 * var3 * var3 * (float)Math.PI); - var4 = var2.attackedAtYaw; - GlStateManager.rotate(-var4, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-var3 * 14.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(var4, 0.0F, 1.0F, 0.0F); - } - } - - /** - * Setups all the GL settings for view bobbing. Args: partialTickTime - */ - private void setupViewBobbing(float p_78475_1_) - { - if (this.mc.func_175606_aa() instanceof EntityPlayer) - { - EntityPlayer var2 = (EntityPlayer)this.mc.func_175606_aa(); - float var3 = var2.distanceWalkedModified - var2.prevDistanceWalkedModified; - float var4 = -(var2.distanceWalkedModified + var3 * p_78475_1_); - float var5 = var2.prevCameraYaw + (var2.cameraYaw - var2.prevCameraYaw) * p_78475_1_; - float var6 = var2.prevCameraPitch + (var2.cameraPitch - var2.prevCameraPitch) * p_78475_1_; - GlStateManager.translate(MathHelper.sin(var4 * (float)Math.PI) * var5 * 0.5F, -Math.abs(MathHelper.cos(var4 * (float)Math.PI) * var5), 0.0F); - GlStateManager.rotate(MathHelper.sin(var4 * (float)Math.PI) * var5 * 3.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(Math.abs(MathHelper.cos(var4 * (float)Math.PI - 0.2F) * var5) * 5.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(var6, 1.0F, 0.0F, 0.0F); - } - } - - /** - * sets up player's eye (or camera in third person mode) - */ - private void orientCamera(float p_78467_1_) - { - Entity var2 = this.mc.func_175606_aa(); - float var3 = var2.getEyeHeight(); - double var4 = var2.prevPosX + (var2.posX - var2.prevPosX) * (double)p_78467_1_; - double var6 = var2.prevPosY + (var2.posY - var2.prevPosY) * (double)p_78467_1_ + (double)var3; - double var8 = var2.prevPosZ + (var2.posZ - var2.prevPosZ) * (double)p_78467_1_; - - if (var2 instanceof EntityLivingBase && ((EntityLivingBase)var2).isPlayerSleeping()) - { - var3 = (float)((double)var3 + 1.0D); - GlStateManager.translate(0.0F, 0.3F, 0.0F); - - if (!this.mc.gameSettings.debugCamEnable) - { - BlockPos var27 = new BlockPos(var2); - IBlockState var11 = this.mc.theWorld.getBlockState(var27); - Block var29 = var11.getBlock(); - - if (var29 == Blocks.bed) - { - int var30 = ((EnumFacing)var11.getValue(BlockBed.AGE)).getHorizontalIndex(); - GlStateManager.rotate((float)(var30 * 90), 0.0F, 1.0F, 0.0F); - } - - GlStateManager.rotate(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); - } - } - else if (this.mc.gameSettings.thirdPersonView > 0) - { - double var10 = (double)(this.thirdPersonDistanceTemp + (this.thirdPersonDistance - this.thirdPersonDistanceTemp) * p_78467_1_); - - if (this.mc.gameSettings.debugCamEnable) - { - GlStateManager.translate(0.0F, 0.0F, (float)(-var10)); - } - else - { - float var12 = var2.rotationYaw; - float var13 = var2.rotationPitch; - - if (this.mc.gameSettings.thirdPersonView == 2) - { - var13 += 180.0F; - } - - double var14 = (double)(-MathHelper.sin(var12 / 180.0F * (float)Math.PI) * MathHelper.cos(var13 / 180.0F * (float)Math.PI)) * var10; - double var16 = (double)(MathHelper.cos(var12 / 180.0F * (float)Math.PI) * MathHelper.cos(var13 / 180.0F * (float)Math.PI)) * var10; - double var18 = (double)(-MathHelper.sin(var13 / 180.0F * (float)Math.PI)) * var10; - - for (int var20 = 0; var20 < 8; ++var20) - { - float var21 = (float)((var20 & 1) * 2 - 1); - float var22 = (float)((var20 >> 1 & 1) * 2 - 1); - float var23 = (float)((var20 >> 2 & 1) * 2 - 1); - var21 *= 0.1F; - var22 *= 0.1F; - var23 *= 0.1F; - MovingObjectPosition var24 = this.mc.theWorld.rayTraceBlocks(new Vec3(var4 + (double)var21, var6 + (double)var22, var8 + (double)var23), new Vec3(var4 - var14 + (double)var21 + (double)var23, var6 - var18 + (double)var22, var8 - var16 + (double)var23)); - - if (var24 != null) - { - double var25 = var24.hitVec.distanceTo(new Vec3(var4, var6, var8)); - - if (var25 < var10) - { - var10 = var25; - } - } - } - - if (this.mc.gameSettings.thirdPersonView == 2) - { - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.rotate(var2.rotationPitch - var13, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(var2.rotationYaw - var12, 0.0F, 1.0F, 0.0F); - GlStateManager.translate(0.0F, 0.0F, (float)(-var10)); - GlStateManager.rotate(var12 - var2.rotationYaw, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(var13 - var2.rotationPitch, 1.0F, 0.0F, 0.0F); - } - } - else - { - GlStateManager.translate(0.0F, 0.0F, -0.1F); - } - - if (!this.mc.gameSettings.debugCamEnable) - { - GlStateManager.rotate(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F); - - if (var2 instanceof EntityAnimal) - { - EntityAnimal var28 = (EntityAnimal)var2; - GlStateManager.rotate(var28.prevRotationYawHead + (var28.rotationYawHead - var28.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); - } - else - { - GlStateManager.rotate(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); - } - } - - GlStateManager.translate(0.0F, -var3, 0.0F); - var4 = var2.prevPosX + (var2.posX - var2.prevPosX) * (double)p_78467_1_; - var6 = var2.prevPosY + (var2.posY - var2.prevPosY) * (double)p_78467_1_ + (double)var3; - var8 = var2.prevPosZ + (var2.posZ - var2.prevPosZ) * (double)p_78467_1_; - this.cloudFog = this.mc.renderGlobal.hasCloudFog(var4, var6, var8, p_78467_1_); - } - - /** - * sets up projection, view effects, camera position/rotation - */ - private void setupCameraTransform(float p_78479_1_, int p_78479_2_) - { - this.farPlaneDistance = (float)(this.mc.gameSettings.renderDistanceChunks * 16); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - float var3 = 0.07F; - - if (this.mc.gameSettings.anaglyph) - { - GlStateManager.translate((float)(-(p_78479_2_ * 2 - 1)) * var3, 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(p_78479_1_, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.field_180189_a); - GlStateManager.matrixMode(5888); - GlStateManager.loadIdentity(); - - if (this.mc.gameSettings.anaglyph) - { - GlStateManager.translate((float)(p_78479_2_ * 2 - 1) * 0.1F, 0.0F, 0.0F); - } - - this.hurtCameraEffect(p_78479_1_); - - if (this.mc.gameSettings.viewBobbing) - { - this.setupViewBobbing(p_78479_1_); - } - - float var4 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * p_78479_1_; - - if (var4 > 0.0F) - { - byte var5 = 20; - - if (this.mc.thePlayer.isPotionActive(Potion.confusion)) - { - var5 = 7; - } - - float var6 = 5.0F / (var4 * var4 + 5.0F) - var4 * 0.04F; - var6 *= var6; - GlStateManager.rotate(((float)this.rendererUpdateCount + p_78479_1_) * (float)var5, 0.0F, 1.0F, 1.0F); - GlStateManager.scale(1.0F / var6, 1.0F, 1.0F); - GlStateManager.rotate(-((float)this.rendererUpdateCount + p_78479_1_) * (float)var5, 0.0F, 1.0F, 1.0F); - } - - this.orientCamera(p_78479_1_); - - if (this.field_175078_W) - { - switch (this.field_175079_V) - { - 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 p_78476_1_, int p_78476_2_) - { - if (!this.field_175078_W) - { - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - float var3 = 0.07F; - - if (this.mc.gameSettings.anaglyph) - { - GlStateManager.translate((float)(-(p_78476_2_ * 2 - 1)) * var3, 0.0F, 0.0F); - } - - Project.gluPerspective(this.getFOVModifier(p_78476_1_, 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)(p_78476_2_ * 2 - 1) * 0.1F, 0.0F, 0.0F); - } - - GlStateManager.pushMatrix(); - this.hurtCameraEffect(p_78476_1_); - - if (this.mc.gameSettings.viewBobbing) - { - this.setupViewBobbing(p_78476_1_); - } - - boolean var4 = this.mc.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.func_175606_aa()).isPlayerSleeping(); - - if (this.mc.gameSettings.thirdPersonView == 0 && !var4 && !this.mc.gameSettings.hideGUI && !this.mc.playerController.enableEverythingIsScrewedUpMode()) - { - this.func_180436_i(); - this.itemRenderer.renderItemInFirstPerson(p_78476_1_); - this.func_175072_h(); - } - - GlStateManager.popMatrix(); - - if (this.mc.gameSettings.thirdPersonView == 0 && !var4) - { - this.itemRenderer.renderOverlays(p_78476_1_); - this.hurtCameraEffect(p_78476_1_); - } - - if (this.mc.gameSettings.viewBobbing) - { - this.setupViewBobbing(p_78476_1_); - } - } - } - - public void func_175072_h() - { - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.func_179090_x(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - } - - public void func_180436_i() - { - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.matrixMode(5890); - GlStateManager.loadIdentity(); - float var1 = 0.00390625F; - GlStateManager.scale(var1, var1, var1); - GlStateManager.translate(8.0F, 8.0F, 8.0F); - GlStateManager.matrixMode(5888); - this.mc.getTextureManager().bindTexture(this.locationLightMap); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.func_179098_w(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - } - - /** - * Recompute a random value that is applied to block color in updateLightmap() - */ - private void updateTorchFlicker() - { - this.field_175075_L = (float)((double)this.field_175075_L + (Math.random() - Math.random()) * Math.random() * Math.random()); - this.field_175075_L = (float)((double)this.field_175075_L * 0.9D); - this.torchFlickerX += (this.field_175075_L - this.torchFlickerX) * 1.0F; - this.lightmapUpdateNeeded = true; - } - - private void updateLightmap(float p_78472_1_) - { - if (this.lightmapUpdateNeeded) - { - this.mc.mcProfiler.startSection("lightTex"); - WorldClient var2 = this.mc.theWorld; - - if (var2 != null) - { - for (int var3 = 0; var3 < 256; ++var3) - { - float var4 = var2.getSunBrightness(1.0F) * 0.95F + 0.05F; - float var5 = var2.provider.getLightBrightnessTable()[var3 / 16] * var4; - float var6 = var2.provider.getLightBrightnessTable()[var3 % 16] * (this.torchFlickerX * 0.1F + 1.5F); - - if (var2.func_175658_ac() > 0) - { - var5 = var2.provider.getLightBrightnessTable()[var3 / 16]; - } - - float var7 = var5 * (var2.getSunBrightness(1.0F) * 0.65F + 0.35F); - float var8 = var5 * (var2.getSunBrightness(1.0F) * 0.65F + 0.35F); - float var11 = var6 * ((var6 * 0.6F + 0.4F) * 0.6F + 0.4F); - float var12 = var6 * (var6 * var6 * 0.6F + 0.4F); - float var13 = var7 + var6; - float var14 = var8 + var11; - float var15 = var5 + var12; - var13 = var13 * 0.96F + 0.03F; - var14 = var14 * 0.96F + 0.03F; - var15 = var15 * 0.96F + 0.03F; - float var16; - - if (this.bossColorModifier > 0.0F) - { - var16 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * p_78472_1_; - var13 = var13 * (1.0F - var16) + var13 * 0.7F * var16; - var14 = var14 * (1.0F - var16) + var14 * 0.6F * var16; - var15 = var15 * (1.0F - var16) + var15 * 0.6F * var16; - } - - if (var2.provider.getDimensionId() == 1) - { - var13 = 0.22F + var6 * 0.75F; - var14 = 0.28F + var11 * 0.75F; - var15 = 0.25F + var12 * 0.75F; - } - - float var17; - - if (this.mc.thePlayer.isPotionActive(Potion.nightVision)) - { - var16 = this.func_180438_a(this.mc.thePlayer, p_78472_1_); - var17 = 1.0F / var13; - - if (var17 > 1.0F / var14) - { - var17 = 1.0F / var14; - } - - if (var17 > 1.0F / var15) - { - var17 = 1.0F / var15; - } - - var13 = var13 * (1.0F - var16) + var13 * var17 * var16; - var14 = var14 * (1.0F - var16) + var14 * var17 * var16; - var15 = var15 * (1.0F - var16) + var15 * var17 * var16; - } - - if (var13 > 1.0F) - { - var13 = 1.0F; - } - - if (var14 > 1.0F) - { - var14 = 1.0F; - } - - if (var15 > 1.0F) - { - var15 = 1.0F; - } - - var16 = this.mc.gameSettings.gammaSetting; - var17 = 1.0F - var13; - float var18 = 1.0F - var14; - float var19 = 1.0F - var15; - var17 = 1.0F - var17 * var17 * var17 * var17; - var18 = 1.0F - var18 * var18 * var18 * var18; - var19 = 1.0F - var19 * var19 * var19 * var19; - var13 = var13 * (1.0F - var16) + var17 * var16; - var14 = var14 * (1.0F - var16) + var18 * var16; - var15 = var15 * (1.0F - var16) + var19 * var16; - var13 = var13 * 0.96F + 0.03F; - var14 = var14 * 0.96F + 0.03F; - var15 = var15 * 0.96F + 0.03F; - - if (var13 > 1.0F) - { - var13 = 1.0F; - } - - if (var14 > 1.0F) - { - var14 = 1.0F; - } - - if (var15 > 1.0F) - { - var15 = 1.0F; - } - - if (var13 < 0.0F) - { - var13 = 0.0F; - } - - if (var14 < 0.0F) - { - var14 = 0.0F; - } - - if (var15 < 0.0F) - { - var15 = 0.0F; - } - - short var20 = 255; - int var21 = (int)(var13 * 255.0F); - int var22 = (int)(var14 * 255.0F); - int var23 = (int)(var15 * 255.0F); - this.lightmapColors[var3] = var20 << 24 | var21 << 16 | var22 << 8 | var23; - } - - this.lightmapTexture.updateDynamicTexture(); - this.lightmapUpdateNeeded = false; - this.mc.mcProfiler.endSection(); - } - } - } - - private float func_180438_a(EntityLivingBase p_180438_1_, float p_180438_2_) - { - int var3 = p_180438_1_.getActivePotionEffect(Potion.nightVision).getDuration(); - return var3 > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)var3 - p_180438_2_) * (float)Math.PI * 0.2F) * 0.3F; - } - - /** - * Will update any inputs that effect the camera angle (mouse) and then render the world and GUI - */ - public void updateCameraAndRender(float p_78480_1_) - { - boolean var2 = Display.isActive(); - - if (!var2 && 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 (var2 && Minecraft.isRunningOnMac && this.mc.inGameHasFocus && !Mouse.isInsideWindow()) - { - Mouse.setGrabbed(false); - Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2); - Mouse.setGrabbed(true); - } - - if (this.mc.inGameHasFocus && var2) - { - this.mc.mouseHelper.mouseXYChange(); - float var3 = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; - float var4 = var3 * var3 * var3 * 8.0F; - float var5 = (float)this.mc.mouseHelper.deltaX * var4; - float var6 = (float)this.mc.mouseHelper.deltaY * var4; - byte var7 = 1; - - if (this.mc.gameSettings.invertMouse) - { - var7 = -1; - } - - if (this.mc.gameSettings.smoothCamera) - { - this.smoothCamYaw += var5; - this.smoothCamPitch += var6; - float var8 = p_78480_1_ - this.smoothCamPartialTicks; - this.smoothCamPartialTicks = p_78480_1_; - var5 = this.smoothCamFilterX * var8; - var6 = this.smoothCamFilterY * var8; - this.mc.thePlayer.setAngles(var5, var6 * (float)var7); - } - else - { - this.smoothCamYaw = 0.0F; - this.smoothCamPitch = 0.0F; - this.mc.thePlayer.setAngles(var5, var6 * (float)var7); - } - } - - this.mc.mcProfiler.endSection(); - - if (!this.mc.skipRenderWorld) - { - anaglyphEnable = this.mc.gameSettings.anaglyph; - final ScaledResolution var13 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); - int var14 = var13.getScaledWidth(); - int var15 = var13.getScaledHeight(); - final int var16 = Mouse.getX() * var14 / this.mc.displayWidth; - final int var17 = var15 - Mouse.getY() * var15 / this.mc.displayHeight - 1; - int var18 = this.mc.gameSettings.limitFramerate; - - if (this.mc.theWorld != null) - { - this.mc.mcProfiler.startSection("level"); - int var9 = Math.max(Minecraft.func_175610_ah(), 30); - this.renderWorld(p_78480_1_, this.renderEndNanoTime + (long)(1000000000 / var9)); - - if (OpenGlHelper.shadersSupported) - { - this.mc.renderGlobal.func_174975_c(); - - if (this.theShaderGroup != null && this.field_175083_ad) - { - GlStateManager.matrixMode(5890); - GlStateManager.pushMatrix(); - GlStateManager.loadIdentity(); - this.theShaderGroup.loadShaderGroup(p_78480_1_); - 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.func_175180_a(p_78480_1_); - } - - 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(var16, var17, p_78480_1_); - } - catch (Throwable var12) - { - CrashReport var10 = CrashReport.makeCrashReport(var12, "Rendering screen"); - CrashReportCategory var11 = var10.makeCategory("Screen render details"); - var11.addCrashSectionCallable("Screen name", new Callable() - { - private static final String __OBFID = "CL_00000948"; - public String call() - { - return EntityRenderer.this.mc.currentScreen.getClass().getCanonicalName(); - } - }); - var11.addCrashSectionCallable("Mouse location", new Callable() - { - private static final String __OBFID = "CL_00000950"; - public String call() - { - return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", new Object[] {Integer.valueOf(var16), Integer.valueOf(var17), Integer.valueOf(Mouse.getX()), Integer.valueOf(Mouse.getY())}); - } - }); - var11.addCrashSectionCallable("Screen size", new Callable() - { - private static final String __OBFID = "CL_00000951"; - public String call() - { - return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", new Object[] {Integer.valueOf(var13.getScaledWidth()), Integer.valueOf(var13.getScaledHeight()), Integer.valueOf(EntityRenderer.this.mc.displayWidth), Integer.valueOf(EntityRenderer.this.mc.displayHeight), Integer.valueOf(var13.getScaleFactor())}); - } - }); - throw new ReportedException(var10); - } - } - } - } - - public void func_152430_c(float p_152430_1_) - { - this.setupOverlayRendering(); - this.mc.ingameGUI.func_180478_c(new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight)); - } - - private boolean func_175070_n() - { - if (!this.field_175073_D) - { - return false; - } - else - { - Entity var1 = this.mc.func_175606_aa(); - boolean var2 = var1 instanceof EntityPlayer && !this.mc.gameSettings.hideGUI; - - if (var2 && !((EntityPlayer)var1).capabilities.allowEdit) - { - ItemStack var3 = ((EntityPlayer)var1).getCurrentEquippedItem(); - - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos var4 = this.mc.objectMouseOver.func_178782_a(); - Block var5 = this.mc.theWorld.getBlockState(var4).getBlock(); - - if (this.mc.playerController.func_178889_l() == WorldSettings.GameType.SPECTATOR) - { - var2 = var5.hasTileEntity() && this.mc.theWorld.getTileEntity(var4) instanceof IInventory; - } - else - { - var2 = var3 != null && (var3.canDestroy(var5) || var3.canPlaceOn(var5)); - } - } - } - - return var2; - } - } - - private void func_175067_i(float p_175067_1_) - { - if (this.mc.gameSettings.showDebugInfo && !this.mc.gameSettings.hideGUI && !this.mc.thePlayer.func_175140_cp() && !this.mc.gameSettings.field_178879_v) - { - Entity var2 = this.mc.func_175606_aa(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GL11.glLineWidth(1.0F); - GlStateManager.func_179090_x(); - GlStateManager.depthMask(false); - GlStateManager.pushMatrix(); - GlStateManager.matrixMode(5888); - GlStateManager.loadIdentity(); - this.orientCamera(p_175067_1_); - GlStateManager.translate(0.0F, var2.getEyeHeight(), 0.0F); - RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.005D, 1.0E-4D, 1.0E-4D), -65536); - RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 1.0E-4D, 0.005D), -16776961); - RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 0.0033D, 1.0E-4D), -16711936); - GlStateManager.popMatrix(); - GlStateManager.depthMask(true); - GlStateManager.func_179098_w(); - GlStateManager.disableBlend(); - } - } - - public void renderWorld(float p_78471_1_, long p_78471_2_) - { - this.updateLightmap(p_78471_1_); - - if (this.mc.func_175606_aa() == null) - { - this.mc.func_175607_a(this.mc.thePlayer); - } - - this.getMouseOver(p_78471_1_); - 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.func_175068_a(0, p_78471_1_, p_78471_2_); - else this.func_175068_a_Async(0, mc.timer.renderPartialTicks, mc.timerWorld.renderPartialTicks, p_78471_2_); - anaglyphField = 1; - GlStateManager.colorMask(true, false, false, false); - if(Cubitick.synctick) this.func_175068_a(1, p_78471_1_, p_78471_2_); - else this.func_175068_a_Async(1, mc.timer.renderPartialTicks, mc.timerWorld.renderPartialTicks, p_78471_2_); - GlStateManager.colorMask(true, true, true, false); - } - else - { - if(Cubitick.synctick) this.func_175068_a(2, p_78471_1_, p_78471_2_); - else this.func_175068_a_Async(2, mc.timer.renderPartialTicks, mc.timerWorld.renderPartialTicks, p_78471_2_); - } - - this.mc.mcProfiler.endSection(); - } - - private void func_175068_a(int p_175068_1_, float p_175068_2_, long p_175068_3_) - { - RenderGlobal var5 = this.mc.renderGlobal; - EffectRenderer var6 = this.mc.effectRenderer; - boolean var7 = this.func_175070_n(); - GlStateManager.enableCull(); - this.mc.mcProfiler.endStartSection("clear"); - GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); - this.updateFogColor(p_175068_2_); - GlStateManager.clear(16640); - this.mc.mcProfiler.endStartSection("camera"); - this.setupCameraTransform(p_175068_2_, p_175068_1_); - ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); - this.mc.mcProfiler.endStartSection("frustum"); - ClippingHelperImpl.getInstance(); - this.mc.mcProfiler.endStartSection("culling"); - Frustrum var8 = new Frustrum(); - Entity var9 = this.mc.func_175606_aa(); - double var10 = var9.lastTickPosX + (var9.posX - var9.lastTickPosX) * (double)p_175068_2_; - double var12 = var9.lastTickPosY + (var9.posY - var9.lastTickPosY) * (double)p_175068_2_; - double var14 = var9.lastTickPosZ + (var9.posZ - var9.lastTickPosZ) * (double)p_175068_2_; - var8.setPosition(var10, var12, var14); - - if (this.mc.gameSettings.renderDistanceChunks >= 4) - { - this.setupFog(-1, p_175068_2_); - this.mc.mcProfiler.endStartSection("sky"); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - Project.gluPerspective(this.getFOVModifier(p_175068_2_, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); - GlStateManager.matrixMode(5888); - var5.func_174976_a(p_175068_2_, p_175068_1_); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - Project.gluPerspective(this.getFOVModifier(p_175068_2_, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.field_180189_a); - GlStateManager.matrixMode(5888); - } - - this.setupFog(0, p_175068_2_); - GlStateManager.shadeModel(7425); - - if (var9.posY + (double)var9.getEyeHeight() < 128.0D) - { - this.func_180437_a(var5, p_175068_2_, p_175068_1_); - } - - this.mc.mcProfiler.endStartSection("prepareterrain"); - this.setupFog(0, p_175068_2_); - this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - RenderHelper.disableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("terrain_setup"); - var5.func_174970_a(var9, (double)p_175068_2_, var8, this.field_175084_ae++, this.mc.thePlayer.func_175149_v()); - - if (p_175068_1_ == 0 || p_175068_1_ == 2) - { - this.mc.mcProfiler.endStartSection("updatechunks"); - this.mc.renderGlobal.func_174967_a(p_175068_3_); - } - - this.mc.mcProfiler.endStartSection("terrain"); - GlStateManager.matrixMode(5888); - GlStateManager.pushMatrix(); - GlStateManager.disableAlpha(); - var5.func_174977_a(EnumWorldBlockLayer.SOLID, (double)p_175068_2_, p_175068_1_, var9); - GlStateManager.enableAlpha(); - var5.func_174977_a(EnumWorldBlockLayer.CUTOUT_MIPPED, (double)p_175068_2_, p_175068_1_, var9); - this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).func_174936_b(false, false); - var5.func_174977_a(EnumWorldBlockLayer.CUTOUT, (double)p_175068_2_, p_175068_1_, var9); - this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).func_174935_a(); - GlStateManager.shadeModel(7424); - GlStateManager.alphaFunc(516, 0.1F); - EntityPlayer var16; - - if (!this.field_175078_W) - { - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); - var5.func_180446_a(var9, var8, p_175068_2_); - RenderHelper.disableStandardItemLighting(); - this.func_175072_h(); - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - - if (this.mc.objectMouseOver != null && var9.isInsideOfMaterial(Material.water) && var7) - { - var16 = (EntityPlayer)var9; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); - var5.drawSelectionBox(var16, this.mc.objectMouseOver, 0, p_175068_2_); - GlStateManager.enableAlpha(); - } - } - - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - - if (var7 && this.mc.objectMouseOver != null && !var9.isInsideOfMaterial(Material.water)) - { - var16 = (EntityPlayer)var9; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); - var5.drawSelectionBox(var16, this.mc.objectMouseOver, 0, p_175068_2_); - GlStateManager.enableAlpha(); - } - - this.mc.mcProfiler.endStartSection("destroyProgress"); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); - var5.func_174981_a(Tessellator.getInstance(), Tessellator.getInstance().getWorldRenderer(), var9, p_175068_2_); - GlStateManager.disableBlend(); - - if (!this.field_175078_W) - { - this.func_180436_i(); - this.mc.mcProfiler.endStartSection("litParticles"); - var6.renderLitParticles(var9, p_175068_2_); - RenderHelper.disableStandardItemLighting(); - this.setupFog(0, p_175068_2_); - this.mc.mcProfiler.endStartSection("particles"); - var6.renderParticles(var9, p_175068_2_); - this.func_175072_h(); - } - - GlStateManager.depthMask(false); - GlStateManager.enableCull(); - this.mc.mcProfiler.endStartSection("weather"); - this.renderRainSnow(p_175068_2_); - GlStateManager.depthMask(true); - var5.func_180449_a(var9, p_175068_2_); - GlStateManager.disableBlend(); - GlStateManager.enableCull(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.alphaFunc(516, 0.1F); - this.setupFog(0, p_175068_2_); - GlStateManager.enableBlend(); - GlStateManager.depthMask(false); - this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - GlStateManager.shadeModel(7425); - - if (this.mc.gameSettings.fancyGraphics) - { - this.mc.mcProfiler.endStartSection("translucent"); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - var5.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, var9); - GlStateManager.disableBlend(); - } - else - { - this.mc.mcProfiler.endStartSection("translucent"); - var5.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, var9); - } - - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); - GlStateManager.disableBlend(); - GlStateManager.disableFog(); - - if (var9.posY + (double)var9.getEyeHeight() >= 128.0D) - { - this.mc.mcProfiler.endStartSection("aboveClouds"); - this.func_180437_a(var5, p_175068_2_, p_175068_1_); - } - - this.mc.mcProfiler.endStartSection("hand"); - - if (this.field_175074_C) - { - GlStateManager.clear(256); - this.renderHand(p_175068_2_, p_175068_1_); - this.func_175067_i(p_175068_2_); - } - } - - // Cubitick: clone of func_175068_a(), adapted to work with separate player and world tick interpolations - private void func_175068_a_Async(int p_175068_1_, float ptick, float wtick, long p_175068_3_) - { - RenderGlobal var5 = this.mc.renderGlobal; - EffectRenderer var6 = this.mc.effectRenderer; - boolean var7 = this.func_175070_n(); - 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, p_175068_1_); - ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); - this.mc.mcProfiler.endStartSection("frustum"); - ClippingHelperImpl.getInstance(); - this.mc.mcProfiler.endStartSection("culling"); - Frustrum var8 = new Frustrum(); - Entity var9 = this.mc.func_175606_aa(); - double var10 = var9.lastTickPosX + (var9.posX - var9.lastTickPosX) * (double)ptick; - double var12 = var9.lastTickPosY + (var9.posY - var9.lastTickPosY) * (double)ptick; - double var14 = var9.lastTickPosZ + (var9.posZ - var9.lastTickPosZ) * (double)ptick; - var8.setPosition(var10, var12, var14); - - // Cubitick: save lastTickPos of the player so that it can be temporarily altered later on - double lx = var9.lastTickPosX; - double ly = var9.lastTickPosY; - double lz = var9.lastTickPosZ; - - 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); - var5.func_174976_a(ptick, p_175068_1_); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - Project.gluPerspective(this.getFOVModifier(ptick, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.field_180189_a); - GlStateManager.matrixMode(5888); - } - - this.setupFog(0, ptick); - GlStateManager.shadeModel(7425); - - if (var9.posY + (double)var9.getEyeHeight() < 128.0D) - { - this.func_180437_a(var5, ptick, p_175068_1_); - } - - this.mc.mcProfiler.endStartSection("prepareterrain"); - this.setupFog(0, ptick); - this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - RenderHelper.disableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("terrain_setup"); - var5.func_174970_a(var9, (double)ptick, var8, this.field_175084_ae++, this.mc.thePlayer.func_175149_v()); - - if (p_175068_1_ == 0 || p_175068_1_ == 2) - { - this.mc.mcProfiler.endStartSection("updatechunks"); - this.mc.renderGlobal.func_174967_a(p_175068_3_); - } - - this.mc.mcProfiler.endStartSection("terrain"); - GlStateManager.matrixMode(5888); - GlStateManager.pushMatrix(); - GlStateManager.disableAlpha(); - var5.func_174977_a(EnumWorldBlockLayer.SOLID, (double)ptick, p_175068_1_, var9); - GlStateManager.enableAlpha(); - var5.func_174977_a(EnumWorldBlockLayer.CUTOUT_MIPPED, (double)ptick, p_175068_1_, var9); - this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).func_174936_b(false, false); - var5.func_174977_a(EnumWorldBlockLayer.CUTOUT, (double)ptick, p_175068_1_, var9); - this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).func_174935_a(); - GlStateManager.shadeModel(7424); - GlStateManager.alphaFunc(516, 0.1F); - EntityPlayer var16; - - if (!this.field_175078_W) - { - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); - - // Cubitick - var9.lastTickPosX = var9.posX - (var9.posX-lx)*(1.0-ptick)/(1.0-wtick); - var9.lastTickPosY = var9.posY - (var9.posY-ly)*(1.0-ptick)/(1.0-wtick); - var9.lastTickPosZ = var9.posZ - (var9.posZ-lz)*(1.0-ptick)/(1.0-wtick); - - var5.func_180446_a(var9, var8, wtick); - - var9.lastTickPosX = lx; - var9.lastTickPosY = ly; - var9.lastTickPosZ = lz; - - RenderHelper.disableStandardItemLighting(); - this.func_175072_h(); - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - - if (this.mc.objectMouseOver != null && var9.isInsideOfMaterial(Material.water) && var7) - { - var16 = (EntityPlayer)var9; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); - var5.drawSelectionBox(var16, this.mc.objectMouseOver, 0, ptick); - GlStateManager.enableAlpha(); - } - } - - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - - if (var7 && this.mc.objectMouseOver != null && !var9.isInsideOfMaterial(Material.water)) - { - var16 = (EntityPlayer)var9; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); - var5.drawSelectionBox(var16, this.mc.objectMouseOver, 0, ptick); - GlStateManager.enableAlpha(); - } - - // Cubitick - var9.lastTickPosX = var9.posX - (var9.posX-lx)*(1.0-ptick)/(1.0-wtick); - var9.lastTickPosY = var9.posY - (var9.posY-ly)*(1.0-ptick)/(1.0-wtick); - var9.lastTickPosZ = var9.posZ - (var9.posZ-lz)*(1.0-ptick)/(1.0-wtick); - - this.mc.mcProfiler.endStartSection("destroyProgress"); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); - var5.func_174981_a(Tessellator.getInstance(), Tessellator.getInstance().getWorldRenderer(), var9, wtick); - GlStateManager.disableBlend(); - - if (!this.field_175078_W) - { - this.func_180436_i(); - this.mc.mcProfiler.endStartSection("litParticles"); - var6.renderLitParticles(var9, wtick); - RenderHelper.disableStandardItemLighting(); - this.setupFog(0, wtick); - this.mc.mcProfiler.endStartSection("particles"); - var6.renderParticles(var9, wtick); - this.func_175072_h(); - } - - // Cubitick - var9.lastTickPosX = lx; - var9.lastTickPosY = ly; - var9.lastTickPosZ = lz; - - GlStateManager.depthMask(false); - GlStateManager.enableCull(); - this.mc.mcProfiler.endStartSection("weather"); - this.renderRainSnow(wtick); - GlStateManager.depthMask(true); - var5.func_180449_a(var9, ptick); - GlStateManager.disableBlend(); - GlStateManager.enableCull(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.alphaFunc(516, 0.1F); - this.setupFog(0, ptick); - GlStateManager.enableBlend(); - GlStateManager.depthMask(false); - this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - GlStateManager.shadeModel(7425); - - if (this.mc.gameSettings.fancyGraphics) - { - this.mc.mcProfiler.endStartSection("translucent"); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - var5.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)ptick, p_175068_1_, var9); - GlStateManager.disableBlend(); - } - else - { - this.mc.mcProfiler.endStartSection("translucent"); - var5.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)ptick, p_175068_1_, var9); - } - - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); - GlStateManager.disableBlend(); - GlStateManager.disableFog(); - - if (var9.posY + (double)var9.getEyeHeight() >= 128.0D) - { - this.mc.mcProfiler.endStartSection("aboveClouds"); - this.func_180437_a(var5, ptick, p_175068_1_); - } - - this.mc.mcProfiler.endStartSection("hand"); - - if (this.field_175074_C) - { - GlStateManager.clear(256); - this.renderHand(ptick, p_175068_1_); - this.func_175067_i(ptick); - } - } - - private void func_180437_a(RenderGlobal p_180437_1_, float p_180437_2_, int p_180437_3_) - { - if (this.mc.gameSettings.shouldRenderClouds()) - { - this.mc.mcProfiler.endStartSection("clouds"); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - Project.gluPerspective(this.getFOVModifier(p_180437_2_, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F); - GlStateManager.matrixMode(5888); - GlStateManager.pushMatrix(); - this.setupFog(0, p_180437_2_); - p_180437_1_.func_180447_b(p_180437_2_, p_180437_3_); - GlStateManager.disableFog(); - GlStateManager.popMatrix(); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - Project.gluPerspective(this.getFOVModifier(p_180437_2_, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * MathHelper.field_180189_a); - GlStateManager.matrixMode(5888); - } - } - - private void addRainParticles() - { - float var1 = this.mc.theWorld.getRainStrength(1.0F); - - if (!this.mc.gameSettings.fancyGraphics) - { - var1 /= 2.0F; - } - - if (var1 != 0.0F) - { - this.random.setSeed((long)this.rendererUpdateCount * 312987231L); - Entity var2 = this.mc.func_175606_aa(); - WorldClient var3 = this.mc.theWorld; - BlockPos var4 = new BlockPos(var2); - byte var5 = 10; - double var6 = 0.0D; - double var8 = 0.0D; - double var10 = 0.0D; - int var12 = 0; - int var13 = (int)(100.0F * var1 * var1); - - if (this.mc.gameSettings.particleSetting == 1) - { - var13 >>= 1; - } - else if (this.mc.gameSettings.particleSetting == 2) - { - var13 = 0; - } - - for (int var14 = 0; var14 < var13; ++var14) - { - BlockPos var15 = var3.func_175725_q(var4.add(this.random.nextInt(var5) - this.random.nextInt(var5), 0, this.random.nextInt(var5) - this.random.nextInt(var5))); - BiomeGenBase var16 = var3.getBiomeGenForCoords(var15); - BlockPos var17 = var15.offsetDown(); - Block var18 = var3.getBlockState(var17).getBlock(); - - if (var15.getY() <= var4.getY() + var5 && var15.getY() >= var4.getY() - var5 && var16.canSpawnLightningBolt() && var16.func_180626_a(var15) >= 0.15F) - { - float var19 = this.random.nextFloat(); - float var20 = this.random.nextFloat(); - - if (var18.getMaterial() == Material.lava) - { - this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)((float)var15.getX() + var19), (double)((float)var15.getY() + 0.1F) - var18.getBlockBoundsMinY(), (double)((float)var15.getZ() + var20), 0.0D, 0.0D, 0.0D, new int[0]); - } - else if (var18.getMaterial() != Material.air) - { - var18.setBlockBoundsBasedOnState(var3, var17); - ++var12; - - if (this.random.nextInt(var12) == 0) - { - var6 = (double)((float)var17.getX() + var19); - var8 = (double)((float)var17.getY() + 0.1F) + var18.getBlockBoundsMaxY() - 1.0D; - var10 = (double)((float)var17.getZ() + var20); - } - - this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)((float)var17.getX() + var19), (double)((float)var17.getY() + 0.1F) + var18.getBlockBoundsMaxY(), (double)((float)var17.getZ() + var20), 0.0D, 0.0D, 0.0D, new int[0]); - } - } - } - - if (var12 > 0 && this.random.nextInt(3) < this.rainSoundCounter++) - { - this.rainSoundCounter = 0; - - if (var8 > (double)(var4.getY() + 1) && var3.func_175725_q(var4).getY() > MathHelper.floor_float((float)var4.getY())) - { - this.mc.theWorld.playSound(var6, var8, var10, "ambient.weather.rain", 0.1F, 0.5F, false); - } - else - { - this.mc.theWorld.playSound(var6, var8, var10, "ambient.weather.rain", 0.2F, 1.0F, false); - } - } - } - } - - /** - * Render rain and snow - */ - protected void renderRainSnow(float p_78474_1_) - { - float var2 = this.mc.theWorld.getRainStrength(p_78474_1_); - - if (var2 > 0.0F) - { - this.func_180436_i(); - Entity var3 = this.mc.func_175606_aa(); - WorldClient var4 = this.mc.theWorld; - int var5 = MathHelper.floor_double(var3.posX); - int var6 = MathHelper.floor_double(var3.posY); - int var7 = MathHelper.floor_double(var3.posZ); - Tessellator var8 = Tessellator.getInstance(); - WorldRenderer var9 = var8.getWorldRenderer(); - GlStateManager.disableCull(); - GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.alphaFunc(516, 0.1F); - double var10 = var3.lastTickPosX + (var3.posX - var3.lastTickPosX) * (double)p_78474_1_; - double var12 = var3.lastTickPosY + (var3.posY - var3.lastTickPosY) * (double)p_78474_1_; - double var14 = var3.lastTickPosZ + (var3.posZ - var3.lastTickPosZ) * (double)p_78474_1_; - int var16 = MathHelper.floor_double(var12); - byte var17 = 5; - - if (this.mc.gameSettings.fancyGraphics) - { - var17 = 10; - } - - byte var18 = -1; - float var19 = (float)this.rendererUpdateCount + p_78474_1_; - - if (this.mc.gameSettings.fancyGraphics) - { - var17 = 10; - } - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - - for (int var20 = var7 - var17; var20 <= var7 + var17; ++var20) - { - for (int var21 = var5 - var17; var21 <= var5 + var17; ++var21) - { - int var22 = (var20 - var7 + 16) * 32 + var21 - var5 + 16; - float var23 = this.field_175076_N[var22] * 0.5F; - float var24 = this.field_175077_O[var22] * 0.5F; - BlockPos var25 = new BlockPos(var21, 0, var20); - BiomeGenBase var26 = var4.getBiomeGenForCoords(var25); - - if (var26.canSpawnLightningBolt() || var26.getEnableSnow()) - { - int var27 = var4.func_175725_q(var25).getY(); - int var28 = var6 - var17; - int var29 = var6 + var17; - - if (var28 < var27) - { - var28 = var27; - } - - if (var29 < var27) - { - var29 = var27; - } - - float var30 = 1.0F; - int var31 = var27; - - if (var27 < var16) - { - var31 = var16; - } - - if (var28 != var29) - { - this.random.setSeed((long)(var21 * var21 * 3121 + var21 * 45238971 ^ var20 * var20 * 418711 + var20 * 13761)); - float var32 = var26.func_180626_a(new BlockPos(var21, var28, var20)); - float var33; - double var36; - - if (var4.getWorldChunkManager().getTemperatureAtHeight(var32, var27) >= 0.15F) - { - if (var18 != 0) - { - if (var18 >= 0) - { - var8.draw(); - } - - var18 = 0; - this.mc.getTextureManager().bindTexture(locationRainPng); - var9.startDrawingQuads(); - } - - var33 = ((float)(this.rendererUpdateCount + var21 * var21 * 3121 + var21 * 45238971 + var20 * var20 * 418711 + var20 * 13761 & 31) + p_78474_1_) / 32.0F * (3.0F + this.random.nextFloat()); - double var34 = (double)((float)var21 + 0.5F) - var3.posX; - var36 = (double)((float)var20 + 0.5F) - var3.posZ; - float var38 = MathHelper.sqrt_double(var34 * var34 + var36 * var36) / (float)var17; - float var39 = 1.0F; - var9.func_178963_b(var4.getCombinedLight(new BlockPos(var21, var31, var20), 0)); - var9.func_178960_a(var39, var39, var39, ((1.0F - var38 * var38) * 0.5F + 0.5F) * var2); - var9.setTranslation(-var10 * 1.0D, -var12 * 1.0D, -var14 * 1.0D); - var9.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var28, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var30), (double)((float)var28 * var30 / 4.0F + var33 * var30)); - var9.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var28, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var30), (double)((float)var28 * var30 / 4.0F + var33 * var30)); - var9.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var29, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var30), (double)((float)var29 * var30 / 4.0F + var33 * var30)); - var9.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var29, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var30), (double)((float)var29 * var30 / 4.0F + var33 * var30)); - var9.setTranslation(0.0D, 0.0D, 0.0D); - } - else - { - if (var18 != 1) - { - if (var18 >= 0) - { - var8.draw(); - } - - var18 = 1; - this.mc.getTextureManager().bindTexture(locationSnowPng); - var9.startDrawingQuads(); - } - - var33 = ((float)(this.rendererUpdateCount & 511) + p_78474_1_) / 512.0F; - float var42 = this.random.nextFloat() + var19 * 0.01F * (float)this.random.nextGaussian(); - float var35 = this.random.nextFloat() + var19 * (float)this.random.nextGaussian() * 0.001F; - var36 = (double)((float)var21 + 0.5F) - var3.posX; - double var43 = (double)((float)var20 + 0.5F) - var3.posZ; - float var40 = MathHelper.sqrt_double(var36 * var36 + var43 * var43) / (float)var17; - float var41 = 1.0F; - var9.func_178963_b((var4.getCombinedLight(new BlockPos(var21, var31, var20), 0) * 3 + 15728880) / 4); - var9.func_178960_a(var41, var41, var41, ((1.0F - var40 * var40) * 0.3F + 0.5F) * var2); - var9.setTranslation(-var10 * 1.0D, -var12 * 1.0D, -var14 * 1.0D); - var9.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var28, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var30 + var42), (double)((float)var28 * var30 / 4.0F + var33 * var30 + var35)); - var9.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var28, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var30 + var42), (double)((float)var28 * var30 / 4.0F + var33 * var30 + var35)); - var9.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var29, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var30 + var42), (double)((float)var29 * var30 / 4.0F + var33 * var30 + var35)); - var9.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var29, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var30 + var42), (double)((float)var29 * var30 / 4.0F + var33 * var30 + var35)); - var9.setTranslation(0.0D, 0.0D, 0.0D); - } - } - } - } - } - - if (var18 >= 0) - { - var8.draw(); - } - - GlStateManager.enableCull(); - GlStateManager.disableBlend(); - GlStateManager.alphaFunc(516, 0.1F); - this.func_175072_h(); - } - } - - /** - * Setup orthogonal projection for rendering GUI screen overlays - */ - public void setupOverlayRendering() - { - ScaledResolution var1 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); - GlStateManager.clear(256); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0.0D, var1.getScaledWidth_double(), var1.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 p_78466_1_) - { - WorldClient var2 = this.mc.theWorld; - Entity var3 = this.mc.func_175606_aa(); - float var4 = 0.25F + 0.75F * (float)this.mc.gameSettings.renderDistanceChunks / 32.0F; - var4 = 1.0F - (float)Math.pow((double)var4, 0.25D); - Vec3 var5 = var2.getSkyColor(this.mc.func_175606_aa(), p_78466_1_); - float var6 = (float)var5.xCoord; - float var7 = (float)var5.yCoord; - float var8 = (float)var5.zCoord; - Vec3 var9 = var2.getFogColor(p_78466_1_); - this.field_175080_Q = (float)var9.xCoord; - this.field_175082_R = (float)var9.yCoord; - this.field_175081_S = (float)var9.zCoord; - float var13; - - if (this.mc.gameSettings.renderDistanceChunks >= 4) - { - double var10 = -1.0D; - Vec3 var12 = MathHelper.sin(var2.getCelestialAngleRadians(p_78466_1_)) > 0.0F ? new Vec3(var10, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D); - var13 = (float)var3.getLook(p_78466_1_).dotProduct(var12); - - if (var13 < 0.0F) - { - var13 = 0.0F; - } - - if (var13 > 0.0F) - { - float[] var14 = var2.provider.calcSunriseSunsetColors(var2.getCelestialAngle(p_78466_1_), p_78466_1_); - - if (var14 != null) - { - var13 *= var14[3]; - this.field_175080_Q = this.field_175080_Q * (1.0F - var13) + var14[0] * var13; - this.field_175082_R = this.field_175082_R * (1.0F - var13) + var14[1] * var13; - this.field_175081_S = this.field_175081_S * (1.0F - var13) + var14[2] * var13; - } - } - } - - this.field_175080_Q += (var6 - this.field_175080_Q) * var4; - this.field_175082_R += (var7 - this.field_175082_R) * var4; - this.field_175081_S += (var8 - this.field_175081_S) * var4; - float var19 = var2.getRainStrength(p_78466_1_); - float var11; - float var20; - - if (var19 > 0.0F) - { - var11 = 1.0F - var19 * 0.5F; - var20 = 1.0F - var19 * 0.4F; - this.field_175080_Q *= var11; - this.field_175082_R *= var11; - this.field_175081_S *= var20; - } - - var11 = var2.getWeightedThunderStrength(p_78466_1_); - - if (var11 > 0.0F) - { - var20 = 1.0F - var11 * 0.5F; - this.field_175080_Q *= var20; - this.field_175082_R *= var20; - this.field_175081_S *= var20; - } - - Block var21 = ActiveRenderInfo.func_180786_a(this.mc.theWorld, var3, p_78466_1_); - - if (this.cloudFog) - { - Vec3 var22 = var2.getCloudColour(p_78466_1_); - this.field_175080_Q = (float)var22.xCoord; - this.field_175082_R = (float)var22.yCoord; - this.field_175081_S = (float)var22.zCoord; - } - else if (var21.getMaterial() == Material.water) - { - var13 = (float)EnchantmentHelper.func_180319_a(var3) * 0.2F; - - if (var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).isPotionActive(Potion.waterBreathing)) - { - var13 = var13 * 0.3F + 0.6F; - } - - this.field_175080_Q = 0.02F + var13; - this.field_175082_R = 0.02F + var13; - this.field_175081_S = 0.2F + var13; - } - else if (var21.getMaterial() == Material.lava) - { - this.field_175080_Q = 0.6F; - this.field_175082_R = 0.1F; - this.field_175081_S = 0.0F; - } - - var13 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * p_78466_1_; - this.field_175080_Q *= var13; - this.field_175082_R *= var13; - this.field_175081_S *= var13; - double var23 = (var3.lastTickPosY + (var3.posY - var3.lastTickPosY) * (double)p_78466_1_) * var2.provider.getVoidFogYFactor(); - - if (var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).isPotionActive(Potion.blindness)) - { - int var16 = ((EntityLivingBase)var3).getActivePotionEffect(Potion.blindness).getDuration(); - - if (var16 < 20) - { - var23 *= (double)(1.0F - (float)var16 / 20.0F); - } - else - { - var23 = 0.0D; - } - } - - if (var23 < 1.0D) - { - if (var23 < 0.0D) - { - var23 = 0.0D; - } - - var23 *= var23; - this.field_175080_Q = (float)((double)this.field_175080_Q * var23); - this.field_175082_R = (float)((double)this.field_175082_R * var23); - this.field_175081_S = (float)((double)this.field_175081_S * var23); - } - - float var24; - - if (this.bossColorModifier > 0.0F) - { - var24 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * p_78466_1_; - this.field_175080_Q = this.field_175080_Q * (1.0F - var24) + this.field_175080_Q * 0.7F * var24; - this.field_175082_R = this.field_175082_R * (1.0F - var24) + this.field_175082_R * 0.6F * var24; - this.field_175081_S = this.field_175081_S * (1.0F - var24) + this.field_175081_S * 0.6F * var24; - } - - float var17; - - if (var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).isPotionActive(Potion.nightVision)) - { - var24 = this.func_180438_a((EntityLivingBase)var3, p_78466_1_); - var17 = 1.0F / this.field_175080_Q; - - if (var17 > 1.0F / this.field_175082_R) - { - var17 = 1.0F / this.field_175082_R; - } - - if (var17 > 1.0F / this.field_175081_S) - { - var17 = 1.0F / this.field_175081_S; - } - - this.field_175080_Q = this.field_175080_Q * (1.0F - var24) + this.field_175080_Q * var17 * var24; - this.field_175082_R = this.field_175082_R * (1.0F - var24) + this.field_175082_R * var17 * var24; - this.field_175081_S = this.field_175081_S * (1.0F - var24) + this.field_175081_S * var17 * var24; - } - - if (this.mc.gameSettings.anaglyph) - { - var24 = (this.field_175080_Q * 30.0F + this.field_175082_R * 59.0F + this.field_175081_S * 11.0F) / 100.0F; - var17 = (this.field_175080_Q * 30.0F + this.field_175082_R * 70.0F) / 100.0F; - float var18 = (this.field_175080_Q * 30.0F + this.field_175081_S * 70.0F) / 100.0F; - this.field_175080_Q = var24; - this.field_175082_R = var17; - this.field_175081_S = var18; - } - - GlStateManager.clearColor(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 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 p_78468_1_, float p_78468_2_) - { - Entity var3 = this.mc.func_175606_aa(); - boolean var4 = false; - - if (var3 instanceof EntityPlayer) - { - var4 = ((EntityPlayer)var3).capabilities.isCreativeMode; - } - - GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 1.0F)); - GL11.glNormal3f(0.0F, -1.0F, 0.0F); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Block var5 = ActiveRenderInfo.func_180786_a(this.mc.theWorld, var3, p_78468_2_); - float var6; - - if (var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).isPotionActive(Potion.blindness)) - { - var6 = 5.0F; - int var7 = ((EntityLivingBase)var3).getActivePotionEffect(Potion.blindness).getDuration(); - - if (var7 < 20) - { - var6 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)var7 / 20.0F); - } - - GlStateManager.setFog(9729); - - if (p_78468_1_ == -1) - { - GlStateManager.setFogStart(0.0F); - GlStateManager.setFogEnd(var6 * 0.8F); - } - else - { - GlStateManager.setFogStart(var6 * 0.25F); - GlStateManager.setFogEnd(var6); - } - - if (GLContext.getCapabilities().GL_NV_fog_distance) - { - GL11.glFogi(34138, 34139); - } - } - else if (this.cloudFog) - { - GlStateManager.setFog(2048); - GlStateManager.setFogDensity(0.1F); - } - else if (var5.getMaterial() == Material.water) - { - GlStateManager.setFog(2048); - - if (var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).isPotionActive(Potion.waterBreathing)) - { - GlStateManager.setFogDensity(0.01F); - } - else - { - GlStateManager.setFogDensity(0.1F - (float)EnchantmentHelper.func_180319_a(var3) * 0.03F); - } - } - else if (var5.getMaterial() == Material.lava) - { - GlStateManager.setFog(2048); - GlStateManager.setFogDensity(2.0F); - } - else - { - var6 = this.farPlaneDistance; - GlStateManager.setFog(9729); - - if (p_78468_1_ == -1) - { - GlStateManager.setFogStart(0.0F); - GlStateManager.setFogEnd(var6); - } - else - { - GlStateManager.setFogStart(var6 * 0.75F); - GlStateManager.setFogEnd(var6); - } - - if (GLContext.getCapabilities().GL_NV_fog_distance) - { - GL11.glFogi(34138, 34139); - } - - if (this.mc.theWorld.provider.doesXZShowFog((int)var3.posX, (int)var3.posZ)) - { - GlStateManager.setFogStart(var6 * 0.05F); - GlStateManager.setFogEnd(Math.min(var6, 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 p_78469_1_, float p_78469_2_, float p_78469_3_, float p_78469_4_) - { - this.fogColorBuffer.clear(); - this.fogColorBuffer.put(p_78469_1_).put(p_78469_2_).put(p_78469_3_).put(p_78469_4_); - this.fogColorBuffer.flip(); - return this.fogColorBuffer; - } - - public MapItemRenderer getMapItemRenderer() - { - return this.theMapItemRenderer; - } -} diff --git a/src/minecraft/net/minecraft/command/ServerCommandManager.java b/src/minecraft/net/minecraft/command/ServerCommandManager.java deleted file mode 100644 index e0ef286..0000000 --- a/src/minecraft/net/minecraft/command/ServerCommandManager.java +++ /dev/null @@ -1,168 +0,0 @@ -package net.minecraft.command; - -import java.util.Iterator; - -import net.minecraft.command.common.CommandReplaceItem; -import net.minecraft.command.server.CommandAchievement; -import net.minecraft.command.server.CommandBanIp; -import net.minecraft.command.server.CommandBanPlayer; -import net.minecraft.command.server.CommandBlockLogic; -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.server.MinecraftServer; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import cubimod.command.CommandRerender; -import cubimod.command.CommandTickSync; -import cubimod.command.CommandTickrate; - -public class ServerCommandManager extends CommandHandler implements IAdminCommand -{ - private static final String __OBFID = "CL_00000922"; - - public ServerCommandManager() - { - 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 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()); - - // Cubitick - this.registerCommand(new CommandTickrate()); - this.registerCommand(new CommandTickSync()); - this.registerCommand(new CommandRerender()); - - if (MinecraftServer.getServer().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.setAdminCommander(this); - } - - public void notifyOperators(ICommandSender sender, ICommand command, int p_152372_3_, String msgFormat, Object ... msgParams) - { - boolean var6 = true; - MinecraftServer var7 = MinecraftServer.getServer(); - - if (!sender.sendCommandFeedback()) - { - var6 = false; - } - - ChatComponentTranslation var8 = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)}); - var8.getChatStyle().setColor(EnumChatFormatting.GRAY); - var8.getChatStyle().setItalic(Boolean.valueOf(true)); - - if (var6) - { - Iterator var9 = var7.getConfigurationManager().playerEntityList.iterator(); - - while (var9.hasNext()) - { - EntityPlayer var10 = (EntityPlayer)var9.next(); - - if (var10 != sender && var7.getConfigurationManager().canSendCommands(var10.getGameProfile()) && command.canCommandSenderUseCommand(sender)) - { - var10.addChatMessage(var8); - } - } - } - - if (sender != var7 && var7.worldServers[0].getGameRules().getGameRuleBooleanValue("logAdminCommands")) - { - var7.addChatMessage(var8); - } - - boolean var11 = var7.worldServers[0].getGameRules().getGameRuleBooleanValue("sendCommandFeedback"); - - if (sender instanceof CommandBlockLogic) - { - var11 = ((CommandBlockLogic)sender).func_175571_m(); - } - - if ((p_152372_3_ & 1) != 1 && var11) - { - sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams)); - } - } -} diff --git a/src/minecraft/net/minecraft/server/MinecraftServer.java b/src/minecraft/net/minecraft/server/MinecraftServer.java deleted file mode 100644 index 1deef53..0000000 --- a/src/minecraft/net/minecraft/server/MinecraftServer.java +++ /dev/null @@ -1,1593 +0,0 @@ -package net.minecraft.server; - -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; -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.net.Proxy; -import java.security.KeyPair; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -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 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.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.S03PacketTimeUpdate; -import net.minecraft.profiler.IPlayerUsage; -import net.minecraft.profiler.PlayerUsageSnooper; -import net.minecraft.profiler.Profiler; -import net.minecraft.server.gui.IUpdatePlayerListBox; -import net.minecraft.server.management.PlayerProfileCache; -import net.minecraft.server.management.ServerConfigurationManager; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.IProgressUpdate; -import net.minecraft.util.IThreadListener; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ReportedException; -import net.minecraft.util.Vec3; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.MinecraftException; -import net.minecraft.world.World; -import net.minecraft.world.WorldManager; -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; - -public abstract class MinecraftServer implements ICommandSender, Runnable, IThreadListener, IPlayerUsage -{ - // Cubitick: msToTick = milliseconds until server ticks - public static long msToTick; - - private static final Logger logger = LogManager.getLogger(); - public static final File USER_CACHE_FILE = new File("usercache.json"); - - /** Instance of Minecraft Server. */ - private static MinecraftServer mcServer; - private final ISaveFormat anvilConverterForAnvilFile; - - /** The PlayerUsageSnooper instance. */ - private final PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("server", this, getCurrentTimeMillis()); - private final File anvilFile; - - /** List of names of players who are online. */ - private final List playersOnline = Lists.newArrayList(); - private 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(); - - /** The server's port. */ - private int serverPort = -1; - - /** The server world instances. */ - public WorldServer[] worldServers; - - /** The ServerConfigurationManager instance. */ - private ServerConfigurationManager serverConfigManager; - - /** - * 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 = 0; - 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; - - /** - * If true, there is no need to save chunks or stop the server, because that is already being done. - */ - private boolean worldIsBeingDeleted; - - /** 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 long nanoTimeSinceStatusRefresh = 0L; - private final GameProfileRepository profileRepo; - private final PlayerProfileCache profileCache; - protected final Queue futureTaskQueue = Queues.newArrayDeque(); - private Thread serverThread; - private long currentTime = getCurrentTimeMillis(); - private static final String __OBFID = "CL_00001462"; - - public MinecraftServer(Proxy p_i46053_1_, File p_i46053_2_) - { - this.serverProxy = p_i46053_1_; - mcServer = this; - this.anvilFile = null; - this.networkSystem = null; - this.profileCache = new PlayerProfileCache(this, p_i46053_2_); - this.commandManager = null; - this.anvilConverterForAnvilFile = null; - this.authService = new YggdrasilAuthenticationService(p_i46053_1_, UUID.randomUUID().toString()); - this.sessionService = this.authService.createMinecraftSessionService(); - this.profileRepo = this.authService.createProfileRepository(); - } - - public MinecraftServer(File workDir, Proxy proxy, File profileCacheDir) - { - this.serverProxy = proxy; - mcServer = this; - this.anvilFile = workDir; - this.networkSystem = new NetworkSystem(this); - this.profileCache = new PlayerProfileCache(this, profileCacheDir); - this.commandManager = this.createNewCommandManager(); - this.anvilConverterForAnvilFile = new AnvilSaveConverter(workDir); - this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); - this.sessionService = this.authService.createMinecraftSessionService(); - this.profileRepo = this.authService.createProfileRepository(); - } - - protected ServerCommandManager createNewCommandManager() - { - return new ServerCommandManager(); - } - - // Cubitick: used in the GuiChat class to interrupt the server's sleep - public static void interruptTickSleep() - { - MinecraftServer mcs = getServer(); - if(mcs == null) { - logger.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. - */ - protected abstract boolean startServer() throws IOException; - - protected void convertMapIfNeeded(String worldNameIn) - { - if (this.getActiveAnvilConverter().isOldMapFormat(worldNameIn)) - { - logger.info("Converting map!"); - this.setUserMessage("menu.convertingLevel"); - this.getActiveAnvilConverter().convertMapFormat(worldNameIn, new IProgressUpdate() - { - private long startTime = System.currentTimeMillis(); - private static final String __OBFID = "CL_00001417"; - public void displaySavingString(String message) {} - public void resetProgressAndMessage(String p_73721_1_) {} - public void setLoadingProgress(int progress) - { - if (System.currentTimeMillis() - this.startTime >= 1000L) - { - this.startTime = System.currentTimeMillis(); - MinecraftServer.logger.info("Converting... " + 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; - } - - protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) - { - this.convertMapIfNeeded(p_71247_1_); - this.setUserMessage("menu.loadingLevel"); - this.worldServers = new WorldServer[3]; - this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), var7); - WorldInfo var9 = var7.loadWorldInfo(); - WorldSettings var8; - - if (var9 == null) - { - if (this.isDemo()) - { - var8 = DemoWorldServer.demoWorldSettings; - } - else - { - var8 = new WorldSettings(seed, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), type); - var8.setWorldName(p_71247_6_); - - if (this.enableBonusChest) - { - var8.enableBonusChest(); - } - } - - var9 = new WorldInfo(var8, p_71247_2_); - } - else - { - var9.setWorldName(p_71247_2_); - var8 = new WorldSettings(var9); - } - - for (int var10 = 0; var10 < this.worldServers.length; ++var10) - { - byte var11 = 0; - - if (var10 == 1) - { - var11 = -1; - } - - if (var10 == 2) - { - var11 = 1; - } - - if (var10 == 0) - { - if (this.isDemo()) - { - this.worldServers[var10] = (WorldServer)(new DemoWorldServer(this, var7, var9, var11, this.theProfiler)).init(); - } - else - { - this.worldServers[var10] = (WorldServer)(new WorldServer(this, var7, var9, var11, this.theProfiler)).init(); - } - - this.worldServers[var10].initialize(var8); - } - else - { - this.worldServers[var10] = (WorldServer)(new WorldServerMulti(this, var7, var11, this.worldServers[0], this.theProfiler)).init(); - } - - this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10])); - - if (!this.isSinglePlayer()) - { - this.worldServers[var10].getWorldInfo().setGameType(this.getGameType()); - } - } - - this.serverConfigManager.setPlayerManager(this.worldServers); - this.setDifficultyForAllWorlds(this.getDifficulty()); - this.initialWorldChunkLoad(); - } - - protected void initialWorldChunkLoad() - { - boolean var1 = true; - boolean var2 = true; - boolean var3 = true; - boolean var4 = true; - int var5 = 0; - this.setUserMessage("menu.generatingTerrain"); - byte var6 = 0; - logger.info("Preparing start region for level " + var6); - WorldServer var7 = this.worldServers[var6]; - BlockPos var8 = var7.getSpawnPoint(); - long var9 = getCurrentTimeMillis(); - - for (int var11 = -192; var11 <= 192 && this.isServerRunning(); var11 += 16) - { - for (int var12 = -192; var12 <= 192 && this.isServerRunning(); var12 += 16) - { - long var13 = getCurrentTimeMillis(); - - if (var13 - var9 > 1000L) - { - this.outputPercentRemaining("Preparing spawn area", var5 * 100 / 625); - var9 = var13; - } - - ++var5; - var7.theChunkProviderServer.loadChunk(var8.getX() + var11 >> 4, var8.getZ() + var12 >> 4); - } - } - - this.clearCurrentTask(); - } - - protected void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) - { - File var3 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip"); - - if (var3.isFile()) - { - this.setResourcePack("level://" + worldNameIn + "/" + var3.getName(), ""); - } - } - - public abstract boolean canStructuresSpawn(); - - public abstract WorldSettings.GameType getGameType(); - - /** - * Get the server's difficulty - */ - public abstract EnumDifficulty getDifficulty(); - - /** - * Defaults to false. - */ - public abstract boolean isHardcore(); - - public abstract int getOpPermissionLevel(); - - /** - * Used to display a percent remaining given text and the percentage. - */ - protected void outputPercentRemaining(String message, int percent) - { - this.currentTask = message; - this.percentDone = percent; - logger.info(message + ": " + 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. - */ - protected void saveAllWorlds(boolean dontLog) - { - if (!this.worldIsBeingDeleted) - { - WorldServer[] var2 = this.worldServers; - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - WorldServer var5 = var2[var4]; - - if (var5 != null) - { - if (!dontLog) - { - logger.info("Saving chunks for level \'" + var5.getWorldInfo().getWorldName() + "\'/" + var5.provider.getDimensionName()); - } - - try - { - var5.saveAllChunks(true, (IProgressUpdate)null); - } - catch (MinecraftException var7) - { - logger.warn(var7.getMessage()); - } - } - } - } - } - - /** - * Saves all necessary data as preparation for stopping the server. - */ - public void stopServer() - { - if (!this.worldIsBeingDeleted) - { - logger.info("Stopping server"); - - if (this.getNetworkSystem() != null) - { - this.getNetworkSystem().terminateEndpoints(); - } - - if (this.serverConfigManager != null) - { - logger.info("Saving players"); - this.serverConfigManager.saveAllPlayerData(); - this.serverConfigManager.removeAllPlayers(); - } - - if (this.worldServers != null) - { - logger.info("Saving worlds"); - this.saveAllWorlds(false); - - for (int var1 = 0; var1 < this.worldServers.length; ++var1) - { - WorldServer var2 = this.worldServers[var1]; - var2.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; - } - - protected void func_175585_v() - { - mcServer = this; - } - - public void run() - { - try - { - if (this.startServer()) - { - this.currentTime = getCurrentTimeMillis(); - long var1 = 0L; - this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); - this.statusResponse.setProtocolVersionInfo(new ServerStatusResponse.MinecraftProtocolVersionIdentifier("1.8", 47)); - this.addFaviconToStatusResponse(this.statusResponse); - - while (this.serverRunning) - { - long var48 = getCurrentTimeMillis(); - long var5 = var48 - this.currentTime; - - // Cubitick: adjusted some timings - if (var5 > 100*Cubitick.getTickms() && this.currentTime - this.timeOfLastWarning >= 15000L) - { - logger.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(var5), Long.valueOf(var5 / 50L)}); - var5 = (long)(100*Cubitick.getTickms()); - this.timeOfLastWarning = this.currentTime; - } - - if (var5 < 0L) - { - logger.warn("Time ran backwards! Did the system time change?"); - var5 = 0L; - } - - var1 += var5; - this.currentTime = var48; - - if (this.worldServers[0].areAllPlayersAsleep()) - { - this.tick(); - var1 = 0L; - } - else - { - // Cubitick - while (var1 > Cubitick.getTickms()) - { - var1 -= Cubitick.getTickms(); - this.tick(); - } - } - - // Cubitick - // *************** The Tickrate Magic Happens Here *************** - // original line: Thread.sleep(Math.max(1L, 50L - var1)); - - msToTick = (long)(Cubitick.getTickms() - var1); - 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.futureTaskQueue) - { - while (!this.futureTaskQueue.isEmpty()) - { - try - { - ((FutureTask)this.futureTaskQueue.poll()).run(); - } - catch (Throwable var9) - { - logger.fatal(var9); - } - } - } - } - - this.serverIsRunning = true; - } - } - else - { - this.finalTick((CrashReport)null); - } - } - catch (Throwable var46) - { - logger.error("Encountered an unexpected exception", var46); - CrashReport var2 = null; - - if (var46 instanceof ReportedException) - { - var2 = this.addServerInfoToCrashReport(((ReportedException)var46).getCrashReport()); - } - else - { - var2 = this.addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", var46)); - } - - File var3 = new File(new File(this.getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt"); - - if (var2.saveToFile(var3)) - { - logger.error("This crash report has been saved to: " + var3.getAbsolutePath()); - } - else - { - logger.error("We were unable to save this crash report to disk."); - } - - this.finalTick(var2); - } - finally - { - try - { - this.stopServer(); - this.serverStopped = true; - } - catch (Throwable var44) - { - logger.error("Exception stopping the server", var44); - } - finally - { - this.systemExitNow(); - } - } - } - - private void addFaviconToStatusResponse(ServerStatusResponse response) - { - File var2 = this.getFile("server-icon.png"); - - if (var2.isFile()) - { - ByteBuf var3 = Unpooled.buffer(); - - try - { - BufferedImage var4 = ImageIO.read(var2); - Validate.validState(var4.getWidth() == 64, "Must be 64 pixels wide", new Object[0]); - Validate.validState(var4.getHeight() == 64, "Must be 64 pixels high", new Object[0]); - ImageIO.write(var4, "PNG", new ByteBufOutputStream(var3)); - ByteBuf var5 = Base64.encode(var3); - response.setFavicon("data:image/png;base64," + var5.toString(Charsets.UTF_8)); - } - catch (Exception var9) - { - logger.error("Couldn\'t load server icon", var9); - } - finally - { - var3.release(); - } - } - } - - public File getDataDirectory() - { - return new File("."); - } - - /** - * Called on exit from the main run() loop. - */ - protected void finalTick(CrashReport report) {} - - /** - * Directly calls System.exit(0), instantly killing the program. - */ - protected void systemExitNow() {} - - /** - * Main function called by run() every loop. - */ - public void tick() - { - long var1 = System.nanoTime(); - ++this.tickCounter; - - if (this.startProfiling) - { - this.startProfiling = false; - this.theProfiler.profilingEnabled = true; - this.theProfiler.clearProfiling(); - } - - this.theProfiler.startSection("root"); - this.updateTimeLightAndEntities(); - - if (var1 - this.nanoTimeSinceStatusRefresh >= 5000000000L) - { - this.nanoTimeSinceStatusRefresh = var1; - this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount())); - GameProfile[] var3 = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)]; - int var4 = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - var3.length); - - for (int var5 = 0; var5 < var3.length; ++var5) - { - var3[var5] = ((EntityPlayerMP)this.serverConfigManager.playerEntityList.get(var4 + var5)).getGameProfile(); - } - - Collections.shuffle(Arrays.asList(var3)); - this.statusResponse.getPlayerCountData().setPlayers(var3); - } - - if (this.tickCounter % 900 == 0) - { - this.theProfiler.startSection("save"); - this.serverConfigManager.saveAllPlayerData(); - this.saveAllWorlds(true); - this.theProfiler.endSection(); - } - - this.theProfiler.startSection("tallying"); - this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - var1; - 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"); - Queue var1 = this.futureTaskQueue; - - synchronized (this.futureTaskQueue) - { - while (!this.futureTaskQueue.isEmpty()) - { - try - { - ((FutureTask)this.futureTaskQueue.poll()).run(); - } - catch (Throwable var9) - { - logger.fatal(var9); - } - } - } - - this.theProfiler.endStartSection("levels"); - int var11; - - for (var11 = 0; var11 < this.worldServers.length; ++var11) - { - long var2 = System.nanoTime(); - - if (var11 == 0 || this.getAllowNether()) - { - WorldServer var4 = this.worldServers[var11]; - this.theProfiler.startSection(var4.getWorldInfo().getWorldName()); - - if (this.tickCounter % 20 == 0) - { - this.theProfiler.startSection("timeSync"); - this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(var4.getTotalWorldTime(), var4.getWorldTime(), var4.getGameRules().getGameRuleBooleanValue("doDaylightCycle")), var4.provider.getDimensionId()); - this.theProfiler.endSection(); - } - - this.theProfiler.startSection("tick"); - CrashReport var6; - - try - { - var4.tick(); - } - catch (Throwable var8) - { - var6 = CrashReport.makeCrashReport(var8, "Exception ticking world"); - var4.addWorldInfoToCrashReport(var6); - throw new ReportedException(var6); - } - - try - { - var4.updateEntities(); - } - catch (Throwable var7) - { - var6 = CrashReport.makeCrashReport(var7, "Exception ticking world entities"); - var4.addWorldInfoToCrashReport(var6); - throw new ReportedException(var6); - } - - this.theProfiler.endSection(); - this.theProfiler.startSection("tracker"); - var4.getEntityTracker().updateTrackedEntities(); - this.theProfiler.endSection(); - this.theProfiler.endSection(); - } - - this.timeOfLastDimensionTick[var11][this.tickCounter % 100] = System.nanoTime() - var2; - } - - this.theProfiler.endStartSection("connection"); - this.getNetworkSystem().networkTick(); - this.theProfiler.endStartSection("players"); - this.serverConfigManager.onTick(); - this.theProfiler.endStartSection("tickables"); - - for (var11 = 0; var11 < this.playersOnline.size(); ++var11) - { - ((IUpdatePlayerListBox)this.playersOnline.get(var11)).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) - { - logger.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.8"; - } - - /** - * Returns the number of players currently on the server. - */ - public int getCurrentPlayerCount() - { - return this.serverConfigManager.getCurrentPlayerCount(); - } - - /** - * Returns the maximum number of players allowed on the server. - */ - public int getMaxPlayers() - { - return this.serverConfigManager.getMaxPlayers(); - } - - /** - * Returns an array of the usernames of all the connected players. - */ - public String[] getAllUsernames() - { - return this.serverConfigManager.getAllUsernames(); - } - - /** - * Returns an array of the GameProfiles of all the connected players - */ - public GameProfile[] getGameProfiles() - { - return this.serverConfigManager.getAllProfiles(); - } - - public String getServerModName() - { - return "vanilla"; - } - - /** - * Adds the server info, including from theWorldServer, to the crash report. - */ - public CrashReport addServerInfoToCrashReport(CrashReport report) - { - report.getCategory().addCrashSectionCallable("Profiler Position", new Callable() - { - private static final String __OBFID = "CL_00001418"; - public String func_179879_a() - { - return MinecraftServer.this.theProfiler.profilingEnabled ? MinecraftServer.this.theProfiler.getNameOfLastSection() : "N/A (disabled)"; - } - public Object call() - { - return this.func_179879_a(); - } - }); - - if (this.serverConfigManager != null) - { - report.getCategory().addCrashSectionCallable("Player Count", new Callable() - { - private static final String __OBFID = "CL_00001419"; - public String call() - { - return MinecraftServer.this.serverConfigManager.getCurrentPlayerCount() + " / " + MinecraftServer.this.serverConfigManager.getMaxPlayers() + "; " + MinecraftServer.this.serverConfigManager.playerEntityList; - } - }); - } - - return report; - } - - public List func_180506_a(ICommandSender p_180506_1_, String p_180506_2_, BlockPos p_180506_3_) - { - ArrayList var4 = Lists.newArrayList(); - - if (p_180506_2_.startsWith("/")) - { - p_180506_2_ = p_180506_2_.substring(1); - boolean var11 = !p_180506_2_.contains(" "); - List var12 = this.commandManager.getTabCompletionOptions(p_180506_1_, p_180506_2_, p_180506_3_); - - if (var12 != null) - { - Iterator var13 = var12.iterator(); - - while (var13.hasNext()) - { - String var14 = (String)var13.next(); - - if (var11) - { - var4.add("/" + var14); - } - else - { - var4.add(var14); - } - } - } - - return var4; - } - else - { - String[] var5 = p_180506_2_.split(" ", -1); - String var6 = var5[var5.length - 1]; - String[] var7 = this.serverConfigManager.getAllUsernames(); - int var8 = var7.length; - - for (int var9 = 0; var9 < var8; ++var9) - { - String var10 = var7[var9]; - - if (CommandBase.doesStringStartWith(var6, var10)) - { - var4.add(var10); - } - } - - return var4; - } - } - - /** - * Gets mcServer. - */ - public static MinecraftServer getServer() - { - return mcServer; - } - - public boolean func_175578_N() - { - return this.anvilFile != null; - } - - /** - * Gets the name of this command sender (usually username, but possibly "Rcon") - */ - public String getName() - { - return "Server"; - } - - /** - * Notifies this sender of some sort of information. This is for messages intended to display to the user. Used - * for typical output (like "you asked for whether or not this game rule is set, so here's your answer"), warnings - * (like "I fetched this block for you by ID, but I'd like you to know that every time you do this, I die a little - * inside"), and errors (like "it's not called iron_pixacke, silly"). - */ - public void addChatMessage(IChatComponent message) - { - logger.info(message.getUnformattedText()); - } - - /** - * Returns true if the command sender is allowed to use the given command. - */ - public boolean canCommandSenderUseCommand(int permissionLevel, String command) - { - 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 p_71246_1_) - { - this.worldName = p_71246_1_; - } - - public String getWorldName() - { - return this.worldName; - } - - public void setKeyPair(KeyPair keyPair) - { - this.serverKeyPair = keyPair; - } - - public void setDifficultyForAllWorlds(EnumDifficulty difficulty) - { - for (int var2 = 0; var2 < this.worldServers.length; ++var2) - { - WorldServer var3 = this.worldServers[var2]; - - if (var3 != null) - { - if (var3.getWorldInfo().isHardcoreModeEnabled()) - { - var3.getWorldInfo().setDifficulty(EnumDifficulty.HARD); - var3.setAllowedSpawnTypes(true, true); - } - else if (this.isSinglePlayer()) - { - var3.getWorldInfo().setDifficulty(difficulty); - var3.setAllowedSpawnTypes(var3.getDifficulty() != EnumDifficulty.PEACEFUL, true); - } - else - { - var3.getWorldInfo().setDifficulty(difficulty); - var3.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals); - } - } - } - } - - protected 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; - } - - /** - * WARNING : directly calls - * getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName()); - */ - public void deleteWorldAndStopServer() - { - this.worldIsBeingDeleted = true; - this.getActiveAnvilConverter().flushCache(); - - for (int var1 = 0; var1 < this.worldServers.length; ++var1) - { - WorldServer var2 = this.worldServers[var1]; - - if (var2 != null) - { - var2.flush(); - } - } - - this.getActiveAnvilConverter().deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName()); - this.initiateShutdown(); - } - - 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(PlayerUsageSnooper playerSnooper) - { - playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false)); - playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0)); - - if (this.serverConfigManager != null) - { - playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount())); - playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers())); - playerSnooper.addClientStat("players_seen", Integer.valueOf(this.serverConfigManager.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 var2 = 0; - - if (this.worldServers != null) - { - for (int var3 = 0; var3 < this.worldServers.length; ++var3) - { - if (this.worldServers[var3] != null) - { - WorldServer var4 = this.worldServers[var3]; - WorldInfo var5 = var4.getWorldInfo(); - playerSnooper.addClientStat("world[" + var2 + "][dimension]", Integer.valueOf(var4.provider.getDimensionId())); - playerSnooper.addClientStat("world[" + var2 + "][mode]", var5.getGameType()); - playerSnooper.addClientStat("world[" + var2 + "][difficulty]", var4.getDifficulty()); - playerSnooper.addClientStat("world[" + var2 + "][hardcore]", Boolean.valueOf(var5.isHardcoreModeEnabled())); - playerSnooper.addClientStat("world[" + var2 + "][generator_name]", var5.getTerrainType().getWorldTypeName()); - playerSnooper.addClientStat("world[" + var2 + "][generator_version]", Integer.valueOf(var5.getTerrainType().getGeneratorVersion())); - playerSnooper.addClientStat("world[" + var2 + "][height]", Integer.valueOf(this.buildLimit)); - playerSnooper.addClientStat("world[" + var2 + "][chunks_loaded]", Integer.valueOf(var4.getChunkProvider().getLoadedChunkCount())); - ++var2; - } - } - } - - playerSnooper.addClientStat("worlds", Integer.valueOf(var2)); - } - - public void addServerTypeToSnooper(PlayerUsageSnooper 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; - } - - 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 ServerConfigurationManager getConfigurationManager() - { - return this.serverConfigManager; - } - - public void setConfigManager(ServerConfigurationManager configManager) - { - this.serverConfigManager = configManager; - } - - /** - * Sets the game type for all worlds. - */ - public void setGameType(WorldSettings.GameType gameMode) - { - for (int var2 = 0; var2 < this.worldServers.length; ++var2) - { - getServer().worldServers[var2].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(WorldSettings.GameType type, boolean allowCheats); - - public int getTickCounter() - { - return this.tickCounter; - } - - public void enableProfiling() - { - this.startProfiling = true; - } - - public PlayerUsageSnooper getPlayerUsageSnooper() - { - return this.usageSnooper; - } - - public BlockPos getPosition() - { - return BlockPos.ORIGIN; - } - - public Vec3 getPositionVector() - { - return new Vec3(0.0D, 0.0D, 0.0D); - } - - public World getEntityWorld() - { - return this.worldServers[0]; - } - - public Entity getCommandSenderEntity() - { - return null; - } - - /** - * Return the spawn protection area's size. - */ - public int getSpawnProtectionSize() - { - return 16; - } - - 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; - } - - public IChatComponent getDisplayName() - { - return new ChatComponentText(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; - } - - public Entity getEntityFromUuid(UUID uuid) - { - WorldServer[] var2 = this.worldServers; - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - WorldServer var5 = var2[var4]; - - if (var5 != null) - { - Entity var6 = var5.getEntityFromUuid(uuid); - - if (var6 != null) - { - return var6; - } - } - } - - return null; - } - - public boolean sendCommandFeedback() - { - return getServer().worldServers[0].getGameRules().getGameRuleBooleanValue("sendCommandFeedback"); - } - - public void func_174794_a(CommandResultStats.Type p_174794_1_, int p_174794_2_) {} - - public int getMaxWorldSize() - { - return 29999984; - } - - public ListenableFuture callFromMainThread(Callable callable) - { - Validate.notNull(callable); - - if (!this.isCallingFromMinecraftThread()) - { - ListenableFutureTask var2 = ListenableFutureTask.create(callable); - Queue var3 = this.futureTaskQueue; - - synchronized (this.futureTaskQueue) - { - this.futureTaskQueue.add(var2); - return var2; - } - } - else - { - try - { - return Futures.immediateFuture(callable.call()); - } - catch (Exception var6) - { - return Futures.immediateFailedCheckedFuture(var6); - } - } - } - - 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 getNetworkCompressionTreshold() - { - return 256; - } -}