From 09fbf747ae6ef2944524a61a547e8c34801b1d7a Mon Sep 17 00:00:00 2001 From: catfoolyou Date: Fri, 31 Jan 2025 10:52:44 -0500 Subject: [PATCH] Fix some things --- .gradle/8.0/fileHashes/fileHashes.bin | Bin 1960423 -> 1960423 bytes .gradle/8.0/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../8.0/fileHashes/resourceHashesCache.bin | Bin 893894 -> 894574 bytes .../buildOutputCleanup.lock | Bin 17 -> 17 bytes .../minecraft/src/ChatAllowedCharacters.java | 2 +- .../minecraft/src/DefaultResourcePack.java | 8 +- .../net/minecraft/src/EffectRenderer.java | 4 +- .../net/minecraft/src/EntityFootStepFX.java | 5 +- .../minecraft/src/EntityLargeExplodeFX.java | 5 +- .../java/net/minecraft/src/GameSettings.java | 30 +- .../java/net/minecraft/src/GuiIngameMenu.java | 2 +- .../java/net/minecraft/src/GuiOptions.java | 2 +- .../java/net/minecraft/src/GuiShareToLan.java | 2 +- .../net/minecraft/src/GuiSlotLanguage.java | 2 +- .../java/net/minecraft/src/Minecraft.java | 657 ++++++++---------- .../java/net/minecraft/src/RenderGlobal.java | 8 +- .../java/net/minecraft/src/RenderManager.java | 2 +- .../src/ResourcePackRepositoryEntry.java | 8 +- .../java/net/minecraft/src/SoundManager.java | 79 ++- .../java/net/minecraft/src/SoundPool.java | 2 +- .../net/minecraft/src/TileEntityRenderer.java | 4 +- .../src/TileEntitySpecialRenderer.java | 2 +- 22 files changed, 417 insertions(+), 407 deletions(-) diff --git a/.gradle/8.0/fileHashes/fileHashes.bin b/.gradle/8.0/fileHashes/fileHashes.bin index a2b8a3e73164ffdfdf2d9db9c7f1d9280a6d54a7..f3dd5853706dd70f55d78d985db6b2c131e9e1e8 100644 GIT binary patch delta 796 zcmaEUx%~O%@`e`17N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj57LgXw z7O@ubEfP%Mm9L`CcE8$~|w+O_;uVBfr%4Q{N;u2gt7xeP&y==*|56n;x4#RSW8X zO=H+<12K(bdZW64@b>lYl7|@OKP^6V>&X3>A5A+}O=&%QG99dx<8d-rDP!OChn_&C zi#;X3n@F@V)V;gS`g{Jf*;h9Um-c-I+x)KN`*cAKDXHye>LhOovg~Ew{dc4M2@!rQ%nN~Rbo-2SP&AX)v> z&l?uaC-=@ibPTMN=id&9(%^{g=e4CiJ4h%eZTwhR;{VEF)&@4wW$GGWSG;ZhKK6=aih*G}kjeCJ1x?+}84!gwC zH9J-+`Wan1^n3jQ>FX-M*apTrXY7i}g^Q%NyDgF`bdpca3A20lCAoXyuCmAb3$0&) zm9V|EfS4vQy-@+^#+Of|9F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj57LgXw z7O@ubEfP%MBz8>N#yn%Knsmap-^)wha(`rCV4Sk2*|>eWb`FQsbdzrqDG~{jCm(wK zKcKPFJ+Qku`AZE*$&SchhSTl!q@}i>`X;eCK;qag2KC@6F}p9%_4=`~N=pNzW_xnp zjp+q<1*NvHcb7cGD1RaD+o|o<6V-VPPfnBx&3FK|>g>%-1`uHEo8FknCcJ&Ir{s4N z`2*%kYfh}Q=aS!QtF@)*_ZG0y5_TQ1QU;#sh28?f+t1WV-V$Wlo}AA$-SIuM)b=A2 zBttXg`=0$evNdMrg^5#i9m2Ky?t-;G{C*aqRbl$Vt31Nny?;uk7|GwQD}3s-;71`> z+$p=r2TNCglmd-YhA8!!e$f}G^r5!YLkEdD_YU9vy2x~O%WUl^ak*%5sDt#U^ML&K zB}eL(nEchUo<7+mrPIgzMY4EinH+%_m-h)`T-|iVryRoDTBKT-A_?sV*joEw4?rMN)R`ICGOlf7ZM|g;0xSrfVq+ zNo_Ccl422%_p|yMb7XcwbzG(X)P>(C9|x(~p>+Hl#A3ebhULJ}S}{v1hh1WE;p(HJ zTUTFlv)y82qcp!C>c(Hw{jae}ZFgHFRp=y<5$&ejw!xQ~JNCr74TXC9;c9-r7M0rm z@`=DH9Hfi4P^SjrF+w z{xm++k>A!-4^~>jt~=dvJJ8DHPg0A-%OF0ut2hRg$2i|+cO|m=0oFKc6y)( z&hnp-pxP-SnIAkmQE?_2G2-J1oAU5+(PuwUb+IoA zMAh{u304W6)^<$}Wg^<5NmC*olSU8?64iL75{zt@z5h8gzw^g$KIeD7XXfTZ243T;)akyh@=qmXrp%MkI=R2hps2LjR4Z1z|B@Qw5q@mXIH z9Rx?G%GqNWNX?6=VWWr|j#dDGRNNvb6`uLG+iT=zHa#y3Jy_(-3E+o(NcctitGlvS zsEvuOvOp?&gk!a0uz@nYurN(HaHVR)%2G<7jYb20m@7voUwP@dM9*_s-L89vloIR@ zQ;>ayETSeq0+y~1R*+sEwl0ADs2&?92MImoH^iyL6h@$1PD+59J0R>I2p%Eh zKCHrmr|{edb1u+&7B$adOajQ|WDHZSU0z}a?|=amV2=;-;FrfP=k9ggQga!B^gQsd zO+c!gEMx6(DlQt&0qtl$8Xv@A06S)BTBnQF0Z4HQmzsmqa%yFj%sq+KpU}J*bu8ghKJb>4_i#FkCO6|(P>dA)+-wXkjU?w3Y+a>!E3zHs+M4Y= zlt5jtx%Oiq94-7s{4C@J+Kr)+8){hBi>eohJ4{|@)T9)X(Wgf#vIbQ|_E0_BlIg^ZLz0*o`%+WVT^IkgusQdNH!Dduz-DqMA9WHbYfy|9!qrtAAIZ#=F&N z75*iW#wGFNyG71~()w;ac_P+rI<{?=3KFq}@P)VYctLItyWzq2P29R+%G-q@a9sW6 zfO+_}VfR)%+vF&}^G*&c zr0PgyQ#$3C$rixM1H;VK*&sYuqc65Hy^TuxoDlK~-aqP>mEtHKGf0l>w4!2913~Dz z@A$)+y|>7rBVOWf`wK^RXFj|#p?u4;?&8Q79jSk6B%AFPY@6D1Q!Xh(NylGY%M>2% H-WLA@EP}Sn delta 504 zcmXYrPe{{Y9LD|r{=M(}Thq+eBvOGB}$Th>oV)m z*dbqMSd1=d7sm!q1?9-dOG%1GF(EzqCzyXCa+j#K4$tYs^Ld`ihv56^pk1WP?er6| zc3KX|3q9l`A>S65AE_R4tZ1S80uAqO`N`>?9ud0gYo!@d}?z`F53JIhT=-X zPY=N#C{aQpt#A)A&y{hmiw6CjDt8yfadZ`xFF$AjzGrH)17{2Bw)Y>l5^~ASdEi&$Dq3Zi66j%<6ND`sC|Nj?R>w(_!a~m2>2j z@eSh^svE{q3$|3Yu2Gll4mr<*1RDs_4(^;{y$)=4vm*vVQ8smeq8Y0szugdx$X;i+ z-L!>$DOPR4p+{_dKaJ(BIMwk{u=OS?qivdv`0#O!RRv}9)=jmJkNsk;A(}xXz-Jo~ z>g4x5)R(s=v>KN27{5y|@IA(7Ip(kOelJDyR>`QB^)z>dDTlT)A9G=GllM1MN8VcH z|J@ETFhv;@W<-)9{8{)8)}EP|{4D}yx`@hG^VMFIDrQNQhexRu6WiuXR-0(5Ia1to M{LL{3;;O!1atrZ literal 17 VcmZSH;5Bjcn=huq3}C?a9soJx1z!LF diff --git a/src/main/java/net/minecraft/src/ChatAllowedCharacters.java b/src/main/java/net/minecraft/src/ChatAllowedCharacters.java index e7ff876..13a1738 100644 --- a/src/main/java/net/minecraft/src/ChatAllowedCharacters.java +++ b/src/main/java/net/minecraft/src/ChatAllowedCharacters.java @@ -19,7 +19,7 @@ public class ChatAllowedCharacters * Load the font.txt resource file, that is on UTF-8 format. This file contains the characters that minecraft can * render Strings on screen. */ - private static String getAllowedCharacters() + static String getAllowedCharacters() { String var0 = ""; diff --git a/src/main/java/net/minecraft/src/DefaultResourcePack.java b/src/main/java/net/minecraft/src/DefaultResourcePack.java index 24951c2..7deec7b 100644 --- a/src/main/java/net/minecraft/src/DefaultResourcePack.java +++ b/src/main/java/net/minecraft/src/DefaultResourcePack.java @@ -44,14 +44,14 @@ public class DefaultResourcePack implements ResourcePack } else { - //throw new FileNotFoundException(par1TextureLocation.getResourcePath()); + throw new FileNotFoundException("Something is fuck: " + par1TextureLocation.toString() + "I have no idea what the hell this is"); // FIX THIS SHIT } } } private InputStream getResourceStream(TextureLocation par1TextureLocation) { - return DefaultResourcePack.class.getResourceAsStream("/assets/minecraft/" + par1TextureLocation.getResourcePath()); + return DefaultResourcePack.class.getResourceAsStream("/assets/minecraft/" + par1TextureLocation); } public void addResourceFile(String par1Str, File par2File) @@ -90,12 +90,12 @@ public class DefaultResourcePack implements ResourcePack public MetadataSection getPackMetadata(MetadataSerializer par1MetadataSerializer, String par2Str) throws IOException { - return AbstractResourcePack.readMetadata(par1MetadataSerializer, DefaultResourcePack.class.getResourceAsStream("/" + (new TextureLocation("pack.mcmeta")).getResourcePath()), par2Str); + return AbstractResourcePack.readMetadata(par1MetadataSerializer, DefaultResourcePack.class.getResourceAsStream("/" + (new TextureLocation("pack.mcmeta"))), par2Str); } public BufferedImage getPackImage() throws IOException { - return ImageIO.read(DefaultResourcePack.class.getResourceAsStream("/" + (new TextureLocation("pack.png")).getResourcePath())); + return ImageIO.read(DefaultResourcePack.class.getResourceAsStream("/" + (new TextureLocation("pack.png")))); } public String getPackName() diff --git a/src/main/java/net/minecraft/src/EffectRenderer.java b/src/main/java/net/minecraft/src/EffectRenderer.java index b0afa4f..d44e9ac 100644 --- a/src/main/java/net/minecraft/src/EffectRenderer.java +++ b/src/main/java/net/minecraft/src/EffectRenderer.java @@ -15,12 +15,12 @@ public class EffectRenderer /** Reference to the World object. */ protected World worldObj; private List[] fxLayers = new List[4]; - private TextureManager renderer; + private RenderEngine renderer; /** RNG. */ private Random rand = new Random(); - public EffectRenderer(World par1World, TextureManager par2TextureManager) + public EffectRenderer(World par1World, RenderEngine par2TextureManager) { if (par1World != null) { diff --git a/src/main/java/net/minecraft/src/EntityFootStepFX.java b/src/main/java/net/minecraft/src/EntityFootStepFX.java index a317d20..90341ec 100644 --- a/src/main/java/net/minecraft/src/EntityFootStepFX.java +++ b/src/main/java/net/minecraft/src/EntityFootStepFX.java @@ -1,6 +1,7 @@ package net.minecraft.src; import net.lax1dude.eaglercraft.TextureLocation; +import net.lax1dude.eaglercraft.adapter.Tessellator; import org.lwjgl.opengl.GL11; public class EntityFootStepFX extends EntityFX @@ -8,9 +9,9 @@ public class EntityFootStepFX extends EntityFX private static final TextureLocation field_110126_a = new TextureLocation("textures/particle/footprint.png"); private int footstepAge; private int footstepMaxAge; - private TextureManager currentFootSteps; + private RenderEngine currentFootSteps; - public EntityFootStepFX(TextureManager par1TextureManager, World par2World, double par3, double par5, double par7) + public EntityFootStepFX(RenderEngine par1TextureManager, World par2World, double par3, double par5, double par7) { super(par2World, par3, par5, par7, 0.0D, 0.0D, 0.0D); this.currentFootSteps = par1TextureManager; diff --git a/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java b/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java index 0868d01..77d6a69 100644 --- a/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java +++ b/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java @@ -1,6 +1,7 @@ package net.minecraft.src; import net.lax1dude.eaglercraft.TextureLocation; +import net.lax1dude.eaglercraft.adapter.Tessellator; import org.lwjgl.opengl.GL11; public class EntityLargeExplodeFX extends EntityFX @@ -10,10 +11,10 @@ public class EntityLargeExplodeFX extends EntityFX private int field_70584_aq; /** The Rendering Engine. */ - private TextureManager theRenderEngine; + private RenderEngine theRenderEngine; private float field_70582_as; - public EntityLargeExplodeFX(TextureManager par1TextureManager, World par2World, double par3, double par5, double par7, double par9, double par11, double par13) + public EntityLargeExplodeFX(RenderEngine par1TextureManager, World par2World, double par3, double par5, double par7, double par9, double par11, double par13) { super(par2World, par3, par5, par7, 0.0D, 0.0D, 0.0D); this.theRenderEngine = par1TextureManager; diff --git a/src/main/java/net/minecraft/src/GameSettings.java b/src/main/java/net/minecraft/src/GameSettings.java index 802ac70..37da2e6 100644 --- a/src/main/java/net/minecraft/src/GameSettings.java +++ b/src/main/java/net/minecraft/src/GameSettings.java @@ -151,6 +151,8 @@ public class GameSettings public boolean adderall = false; + public boolean showCoordinates; + public GameSettings(Minecraft par1Minecraft, File par2File) { this.keyBindings = new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand}; @@ -164,6 +166,30 @@ public class GameSettings this.loadOptions(); } + public GameSettings(Minecraft par1Minecraft) { + this.keyBindings = new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, + this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock}; + this.difficulty = 1; + this.hideGUI = false; + this.thirdPersonView = 0; + this.showDebugInfo = false; + this.showDebugProfilerChart = true; + this.showCoordinates = true; + this.lastServer = ""; + this.noclip = false; + this.smoothCamera = false; + this.debugCamEnable = false; + this.noclipRate = 1.0F; + this.debugCamRate = 1.0F; + this.fovSetting = 0.0F; + this.gammaSetting = 1.0F; + this.guiScale = 3; + this.particleSetting = 0; + this.language = "en_US"; + this.mc = par1Minecraft; + this.loadOptions(); + } + public GameSettings() { this.keyBindings = new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand}; @@ -330,8 +356,8 @@ public class GameSettings if (par1EnumOptions == EnumOptions.ANAGLYPH) { - this.anaglyph = !this.anaglyph; - this.mc.refreshResources(); + //this.anaglyph = !this.anaglyph; + //this.mc.refreshResources(); } if (par1EnumOptions == EnumOptions.FRAMERATE_LIMIT) diff --git a/src/main/java/net/minecraft/src/GuiIngameMenu.java b/src/main/java/net/minecraft/src/GuiIngameMenu.java index bac5bde..88bf2ed 100644 --- a/src/main/java/net/minecraft/src/GuiIngameMenu.java +++ b/src/main/java/net/minecraft/src/GuiIngameMenu.java @@ -30,7 +30,7 @@ public class GuiIngameMenu extends GuiScreen this.buttonList.add(var3 = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + var1, 98, 20, I18n.getString("menu.shareToLan"))); this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + var1, 98, 20, I18n.getString("gui.achievements"))); this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + var1, 98, 20, I18n.getString("gui.stats"))); - var3.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); + var3.enabled = false; } /** diff --git a/src/main/java/net/minecraft/src/GuiOptions.java b/src/main/java/net/minecraft/src/GuiOptions.java index 87bbe23..57f0045 100644 --- a/src/main/java/net/minecraft/src/GuiOptions.java +++ b/src/main/java/net/minecraft/src/GuiOptions.java @@ -119,7 +119,7 @@ public class GuiOptions extends GuiScreen if (par1GuiButton.id == 105) { this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiScreenTemporaryResourcePackSelect(this, this.options)); + //this.mc.displayGuiScreen(new GuiScreenTemporaryResourcePackSelect(this, this.options)); } } } diff --git a/src/main/java/net/minecraft/src/GuiShareToLan.java b/src/main/java/net/minecraft/src/GuiShareToLan.java index 1eb84f7..117eadc 100644 --- a/src/main/java/net/minecraft/src/GuiShareToLan.java +++ b/src/main/java/net/minecraft/src/GuiShareToLan.java @@ -84,7 +84,7 @@ public class GuiShareToLan extends GuiScreen else if (par1GuiButton.id == 101) { this.mc.displayGuiScreen((GuiScreen)null); - String var2 = this.mc.getIntegratedServer().shareToLAN(EnumGameType.getByName(this.gameMode), this.allowCommands); + String var2 = null; // this.mc.getIntegratedServer().shareToLAN(EnumGameType.getByName(this.gameMode), this.allowCommands); ChatMessageComponent var3; if (var2 != null) diff --git a/src/main/java/net/minecraft/src/GuiSlotLanguage.java b/src/main/java/net/minecraft/src/GuiSlotLanguage.java index 9952e34..db0ad99 100644 --- a/src/main/java/net/minecraft/src/GuiSlotLanguage.java +++ b/src/main/java/net/minecraft/src/GuiSlotLanguage.java @@ -46,7 +46,7 @@ class GuiSlotLanguage extends GuiSlot Language var3 = (Language)this.field_77253_h.get(this.field_77251_g.get(par1)); GuiLanguage.func_135011_a(this.languageGui).setCurrentLanguage(var3); GuiLanguage.getGameSettings(this.languageGui).language = var3.getLanguageCode(); - this.languageGui.mc.refreshResources(); + //this.languageGui.mc.refreshResources(); // FIX THIS SHIT this.languageGui.fontRenderer.setUnicodeFlag(GuiLanguage.func_135011_a(this.languageGui).isCurrentLocaleUnicode()); this.languageGui.fontRenderer.setBidiFlag(GuiLanguage.func_135011_a(this.languageGui).isCurrentLanguageBidirectional()); GuiLanguage.getDoneButton(this.languageGui).displayString = I18n.getString("gui.done"); diff --git a/src/main/java/net/minecraft/src/Minecraft.java b/src/main/java/net/minecraft/src/Minecraft.java index 8a61302..7b793d9 100644 --- a/src/main/java/net/minecraft/src/Minecraft.java +++ b/src/main/java/net/minecraft/src/Minecraft.java @@ -1,15 +1,7 @@ package net.minecraft.src; -import net.lax1dude.eaglercraft.DefaultSkinRenderer; -import net.lax1dude.eaglercraft.EaglerAdapter; -import net.lax1dude.eaglercraft.EaglerProfile; -import net.lax1dude.eaglercraft.GuiScreenEditProfile; -import net.lax1dude.eaglercraft.GuiScreenSingleplayerConnecting; -import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading; -import net.lax1dude.eaglercraft.GuiScreenVSyncWarning; -//import net.lax1dude.eaglercraft.IntegratedServer; -import net.lax1dude.eaglercraft.IntegratedServerLAN; -import net.lax1dude.eaglercraft.WorkerNetworkManager; +import net.lax1dude.eaglercraft.*; +import net.lax1dude.eaglercraft.IntegratedServer; import net.lax1dude.eaglercraft.adapter.Tessellator; import net.lax1dude.eaglercraft.glemu.FixedFunctionShader; import com.google.common.collect.Lists; @@ -18,6 +10,7 @@ import java.io.File; import java.io.IOException; import java.net.Proxy; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -44,14 +37,9 @@ import org.lwjgl.util.glu.GLU; public class Minecraft implements IPlayerUsage { - private static final TextureLocation locationMojangPng = new TextureLocation("textures/gui/title/mojang.png"); - public static final boolean isRunningOnMac = Util.getOSType() == EnumOS.MACOS; - /** 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 ILogAgent mcLogAgent; - private final File fileResourcepacks; private ServerData currentServerData; /** The RenderEngine instance used by Minecraft */ @@ -86,7 +74,6 @@ public class Minecraft implements IPlayerUsage public EntityLivingBase renderViewEntity; public EntityLivingBase pointedEntityLiving; public EffectRenderer effectRenderer; - private final Session session; private boolean isGamePaused; /** The font renderer used for displaying and measuring text. */ @@ -127,9 +114,7 @@ public class Minecraft implements IPlayerUsage /** Mouse helper instance. */ public MouseHelper mouseHelper; public TexturePackList texturePackList; - public final File mcDataDir; - private final File fileAssets; - private final String launchedVersion; + private ISaveFormat saveLoader; /** @@ -184,6 +169,11 @@ public class Minecraft implements IPlayerUsage */ volatile boolean running = true; + public int chunkUpdates = 0; + public int chunkGeometryUpdates = 0; + public static int debugChunkUpdates = 0; + public static int debugChunkGeometryUpdates = 0; + /** String that shows the debug information */ public String debug = ""; @@ -194,9 +184,17 @@ public class Minecraft implements IPlayerUsage int fpsCounter; long prevFrameTime = -1L; + long secondTimer = 0l; + /** Profiler currently displayed in the debug screen pie chart */ private String debugProfilerName = "root"; + private int messageOnLoginCounter = 0; + + public boolean lanState = false; + public boolean yeeState = false; + public boolean checkGLErrors = false; + public Minecraft() { this.tempDisplayHeight = 480; @@ -242,170 +240,252 @@ public class Minecraft implements IPlayerUsage /** * Starts the game: initializes the canvas, the title, the settings, etcetera. */ - private void startGame() throws LWJGLException - { - this.gameSettings = new GameSettings(this, this.mcDataDir); - - if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) - { - this.displayWidth = this.gameSettings.overrideWidth; - this.displayHeight = this.gameSettings.overrideHeight; - } - - if (this.fullscreen) - { - Display.setFullscreen(true); - 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.displayWidth, this.displayHeight)); - } - - Display.setResizable(true); - Display.setTitle("Minecraft 1.6.4"); - this.getLogAgent().logInfo("LWJGL Version: " + Sys.getVersion()); - - /*if (Util.getOSType() != EnumOS.MACOS) - { - try - { - Display.setIcon(new ByteBuffer[] {this.readImage(new File(this.fileAssets, "/icons/icon_16x16.png")), this.readImage(new File(this.fileAssets, "/icons/icon_32x32.png"))}); - } - catch (IOException var5) - { - var5.printStackTrace(); - } - }*/ - - try - { - Display.create((new PixelFormat()).withDepthBits(24)); - } - catch (LWJGLException var4) - { - var4.printStackTrace(); - - try - { - Thread.sleep(1000L); - } - catch (InterruptedException var3) - { - ; - } - - if (this.fullscreen) - { - this.updateDisplayMode(); - } - - Display.create(); - } - + public void startGame() { OpenGlHelper.initializeTextures(); - this.guiAchievement = new GuiAchievement(this); - 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); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); - this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, 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.sndManager = new SoundManager(this.mcResourceManager, this.gameSettings, this.fileAssets); - this.mcResourceManager.registerReloadListener(this.sndManager); - this.loadScreen(); - this.fontRenderer = new FontRenderer(this.gameSettings, new TextureLocation("textures/font/ascii.png"), this.renderEngine, false); + TextureManager.init(); + this.gameSettings = new GameSettings(this); + this.texturePackList = new TexturePackList(this); + this.renderEngine = new RenderEngine(this.texturePackList, this.gameSettings); - if (this.gameSettings.language != null) - { - this.fontRenderer.setUnicodeFlag(this.mcLanguageManager.isCurrentLocaleUnicode()); - this.fontRenderer.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional()); + this.loadScreen(); + + ChatAllowedCharacters.getAllowedCharacters(); + this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine, false); + this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, "/font/alternate.png", this.renderEngine, false); + + if (this.gameSettings.language != null) { + //StringTranslate.getInstance().setLanguage(this.gameSettings.language, false); + //this.fontRenderer.setUnicodeFlag(StringTranslate.getInstance().isUnicode()); + //this.fontRenderer.setBidiFlag(StringTranslate.isBidirectional(this.gameSettings.language)); } - this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new TextureLocation("textures/font/ascii_sga.png"), this.renderEngine, false); - this.mcResourceManager.registerReloadListener(this.fontRenderer); - this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer); - this.mcResourceManager.registerReloadListener(new GrassColorReloadListener()); - this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener()); - RenderManager.instance.itemRenderer = new ItemRenderer(this); + this.loadScreen(); + + ColorizerGrass.setGrassBiomeColorizer(this.renderEngine.getTextureContents("/misc/grasscolor.png")); + ColorizerFoliage.setFoliageBiomeColorizer(this.renderEngine.getTextureContents("/misc/foliagecolor.png")); this.entityRenderer = new EntityRenderer(this); - this.statFileWriter = new StatFileWriter(this.session, this.mcDataDir); + RenderManager.instance = new RenderManager(); + RenderManager.instance.itemRenderer = new ItemRenderer(this); AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this)); this.mouseHelper = new MouseHelper(); this.checkGLError("Pre startup"); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glClearDepth(1.0D); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthFunc(GL11.GL_LEQUAL); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - GL11.glCullFace(GL11.GL_BACK); - GL11.glMatrixMode(GL11.GL_PROJECTION); - GL11.glLoadIdentity(); - GL11.glMatrixMode(GL11.GL_MODELVIEW); + EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); + EaglerAdapter.glShadeModel(EaglerAdapter.GL_SMOOTH); + EaglerAdapter.glClearDepth(1.0F); + EaglerAdapter.glEnable(EaglerAdapter.GL_DEPTH_TEST); + EaglerAdapter.glDepthFunc(EaglerAdapter.GL_LEQUAL); + EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST); + EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.1F); + EaglerAdapter.glCullFace(EaglerAdapter.GL_BACK); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION); + EaglerAdapter.glLoadIdentity(); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW); this.checkGLError("Startup"); - this.renderGlobal = new RenderGlobal(this); - this.renderEngine.loadTextureMap(TextureMap.locationBlocksTexture, new TextureMap(0, "textures/blocks")); - this.renderEngine.loadTextureMap(TextureMap.locationItemsTexture, new TextureMap(1, "textures/items")); - GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); + this.sndManager.loadSoundSettings(this.gameSettings); + this.renderGlobal = new RenderGlobal(this, this.renderEngine); + this.renderEngine.refreshTextureMaps(); + EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight); this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); + this.checkGLError("Post startup"); + this.guiAchievement = new GuiAchievement(this); this.ingameGUI = new GuiIngame(this); - if (this.serverName != null) - { - this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); + ScaledResolution var2 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + int var3 = var2.getScaledWidth(); + int var4 = var2.getScaledHeight(); + + EaglerAdapter.anisotropicPatch(EaglerAdapter.glNeedsAnisotropicFix()); + + EaglerProfile.loadFromStorage(); + + this.sndManager.playTheTitleMusic(); + showIntroAnimation(); + + String s = EaglerAdapter.getServerToJoinOnLaunch(); + GuiScreen scr; + + if(s != null) { + scr = new GuiScreenEditProfile(new GuiConnecting(new GuiMainMenu(), this, new ServerData("Eaglercraft Server", s, false))); + }else { + scr = new GuiScreenEditProfile(new GuiMainMenu()); } - else - { - this.displayGuiScreen(new GuiMainMenu()); + + if(!gameSettings.enableVsync && !gameSettings.hideVsyncWarning) { + scr = new GuiScreenVSyncWarning(scr); } + displayGuiScreen(scr); + this.loadingScreen = new LoadingScreenRenderer(this); - if (this.gameSettings.fullScreen && !this.fullscreen) - { + if (this.gameSettings.fullScreen && !this.fullscreen) { this.toggleFullscreen(); } + + byte[] b = EaglerAdapter.loadResourceBytes("adderall"); + yeeState = b != null && (new String(b, StandardCharsets.UTF_8)).hashCode() == 508925104; } - public void refreshResources() - { - ArrayList var1 = Lists.newArrayList(this.defaultResourcePacks); - Iterator var2 = this.mcResourcePackRepository.getRepositoryEntries().iterator(); + private void showIntroAnimation() { + ScaledResolution var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + EaglerAdapter.glClearColor(1.0F, 1.0F, 1.0F, 1.0F); + EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW); + EaglerAdapter.glLoadIdentity(); + EaglerAdapter.glTranslatef(0.0F, 0.0F, -2000.0F); + EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight); + EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING); + EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); + EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND); + EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA); + EaglerAdapter.glDisable(EaglerAdapter.GL_FOG); + EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - while (var2.hasNext()) - { - ResourcePackRepositoryEntry var3 = (ResourcePackRepositoryEntry)var2.next(); - var1.add(var3.getResourcePack()); + long t1 = EaglerAdapter.steadyTimeMillis(); + for(int i = 0; i < 20; i++) { + this.displayWidth = EaglerAdapter.getCanvasWidth(); + this.displayHeight = EaglerAdapter.getCanvasHeight(); + EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight); + var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION); + EaglerAdapter.glLoadIdentity(); + EaglerAdapter.glOrtho(0.0F, var1.getScaledWidth(), var1.getScaledHeight(), 0.0F, 1000.0F, 3000.0F); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW); + + float f = ((float)(EaglerAdapter.steadyTimeMillis() - t1) / 333f); + + EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT); + EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, MathHelper.clamp_float(1.0f - f, 0.0F, 1.0F)); + this.renderEngine.bindTexture("%clamp%/title/eagtek.png"); + EaglerAdapter.glPushMatrix(); + float f1 = 1.0f + 0.025f * f * f; + EaglerAdapter.glTranslatef((var1.getScaledWidth() - 256) / 2, (var1.getScaledHeight() - 256) / 2, 0.0f); + EaglerAdapter.glTranslatef(-128.0f * (f1 - 1.0f), -128.0f * (f1 - 1.0f) , 0.0f); + EaglerAdapter.glScalef(f1, f1, 1.0f); + this.scaledTessellator(0, 0, 0, 0, 256, 256); + EaglerAdapter.glPopMatrix(); + + EaglerAdapter.glFlush(); + updateDisplay(); + + long t = t1 + 17 + 17*i - EaglerAdapter.steadyTimeMillis(); + if(t > 0) { + EaglerAdapter.sleep((int)t); + } } - this.mcLanguageManager.parseLanguageMetadata(var1); - this.mcResourceManager.reloadResources(var1); + t1 = EaglerAdapter.steadyTimeMillis(); + for(int i = 0; i < 20; i++) { + this.displayWidth = EaglerAdapter.getCanvasWidth(); + this.displayHeight = EaglerAdapter.getCanvasHeight(); + EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight); + var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION); + EaglerAdapter.glLoadIdentity(); + EaglerAdapter.glOrtho(0.0F, var1.getScaledWidth(), var1.getScaledHeight(), 0.0F, 1000.0F, 3000.0F); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW); - if (this.renderGlobal != null) - { - this.renderGlobal.loadRenderers(); + float f = ((float)(EaglerAdapter.steadyTimeMillis() - t1) / 333f); + + EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT); + EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, MathHelper.clamp_float(f, 0.0F, 1.0F)); + this.renderEngine.bindTexture("%blur%/title/mojang.png"); + EaglerAdapter.glPushMatrix(); + float f1 = 0.875f + 0.025f * (float)Math.sqrt(f); + EaglerAdapter.glTranslatef((var1.getScaledWidth() - 256) / 2, (var1.getScaledHeight() - 256) / 2, 0.0f); + EaglerAdapter.glTranslatef(-128.0f * (f1 - 1.0f), -128.0f * (f1 - 1.0f) , 0.0f); + EaglerAdapter.glScalef(f1, f1, 1.0f); + this.scaledTessellator(0, 0, 0, 0, 256, 256); + EaglerAdapter.glPopMatrix(); + + EaglerAdapter.glFlush(); + updateDisplay(); + + long t = t1 + 17 + 17*i - EaglerAdapter.steadyTimeMillis(); + if(t > 0) { + EaglerAdapter.sleep((int)t); + } } + + EaglerAdapter.sleep(1600); + + t1 = EaglerAdapter.steadyTimeMillis(); + for(int i = 0; i < 21; i++) { + this.displayWidth = EaglerAdapter.getCanvasWidth(); + this.displayHeight = EaglerAdapter.getCanvasHeight(); + EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight); + var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + + float f = ((float)(EaglerAdapter.steadyTimeMillis() - t1) / 340f); + + EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT); + EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, MathHelper.clamp_float((1.0f - f), 0.0F, 1.0F)); + this.renderEngine.bindTexture("%blur%/title/mojang.png"); + EaglerAdapter.glPushMatrix(); + float f1 = 0.9f + 0.025f * f * f; + EaglerAdapter.glTranslatef((var1.getScaledWidth() - 256) / 2, (var1.getScaledHeight() - 256) / 2, 0.0f); + EaglerAdapter.glTranslatef(-128.0f * (f1 - 1.0f), -128.0f * (f1 - 1.0f) , 0.0f); + EaglerAdapter.glScalef(f1, f1, 1.0f); + this.scaledTessellator(0, 0, 0, 0, 256, 256); + EaglerAdapter.glPopMatrix(); + + EaglerAdapter.glFlush(); + updateDisplay(); + + long t = t1 + 17 + 17*i - EaglerAdapter.steadyTimeMillis(); + if(t > 0) { + EaglerAdapter.sleep((int)t); + } + } + + EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT); + EaglerAdapter.glFlush(); + updateDisplay(); + + EaglerAdapter.sleep(100); + + EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); + EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST); + EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.1F); + + while(EaglerAdapter.keysNext()); + while(EaglerAdapter.mouseNext()); + } + + /** + * Displays a new screen. + */ + private void loadScreen() { + this.displayWidth = EaglerAdapter.getCanvasWidth(); + this.displayHeight = EaglerAdapter.getCanvasHeight(); + ScaledResolution var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + EaglerAdapter.glColorMask(true, true, true, true); + EaglerAdapter.glClearColor(1.0F, 1.0F, 1.0F, 1.0F); + EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION); + EaglerAdapter.glLoadIdentity(); + EaglerAdapter.glOrtho(0.0F, var1.getScaledWidth(), var1.getScaledHeight(), 0.0F, 1000.0F, 3000.0F); + EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW); + EaglerAdapter.glLoadIdentity(); + EaglerAdapter.glTranslatef(0.0F, 0.0F, -2000.0F); + EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight); + EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT); + EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING); + EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); + EaglerAdapter.glDisable(EaglerAdapter.GL_FOG); + EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.renderEngine.bindTexture("%clamp%/title/eagtek.png"); + short var3 = 256; + short var4 = 256; + this.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); + EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING); + EaglerAdapter.glDisable(EaglerAdapter.GL_FOG); + EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST); + EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.1F); + EaglerAdapter.glFlush(); + updateDisplay(); + EaglerAdapter.optimize(); } private void addDefaultResourcePack() @@ -485,41 +565,6 @@ public class Minecraft implements IPlayerUsage /** * Displays a new screen. */ - private void loadScreen() throws LWJGLException - { - ScaledResolution var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); - GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); - GL11.glMatrixMode(GL11.GL_PROJECTION); - GL11.glLoadIdentity(); - GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glLoadIdentity(); - GL11.glTranslatef(0.0F, 0.0F, -2000.0F); - GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); - GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_FOG); - this.renderEngine.bindTexture(locationMojangPng); - Tessellator var2 = Tessellator.instance; - var2.startDrawingQuads(); - var2.setColorOpaque_I(16777215); - var2.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); - var2.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); - var2.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); - var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - var2.draw(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - var2.setColorOpaque_I(16777215); - short var3 = 256; - short var4 = 256; - this.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_FOG); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - Display.update(); - } /** * Loads Tessellator with a scaled resolution @@ -652,197 +697,93 @@ public class Minecraft implements IPlayerUsage 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; - } - - try - { - while (this.running) - { - if (this.running) - { - if (this.hasCrashed && this.crashReporter != null) - { - this.displayCrashReport(this.crashReporter); - return; - } - - if (this.refreshTexturePacksScheduled) - { - this.refreshTexturePacksScheduled = false; - this.refreshResources(); - } - - try - { - this.runGameLoop(); - } - catch (OutOfMemoryError var10) - { - this.freeMemory(); - this.displayGuiScreen(new GuiMemoryErrorScreen()); - System.gc(); - } - - continue; - } - } - } - catch (MinecraftError var12) - { - } - catch (ReportedException var13) - { - this.addGraphicsAndWorldToCrashReport(var13.getCrashReport()); - this.freeMemory(); - var13.printStackTrace(); - this.displayCrashReport(var13.getCrashReport()); - } - catch (Throwable var14) - { - var2 = this.addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", var14)); - this.freeMemory(); - var14.printStackTrace(); - this.displayCrashReport(var2); - } - finally - { - this.shutdownMinecraftApplet(); + this.startGame(); + while (this.running) { + this.runGameLoop(); } + EaglerAdapter.destroyContext(); + EaglerAdapter.exit(); } /** * Called repeatedly from run() */ - private void runGameLoop() - { + private void runGameLoop() { + if (this.refreshTexturePacksScheduled) { + this.refreshTexturePacksScheduled = false; + this.renderEngine.refreshTextures(); + } + AxisAlignedBB.getAABBPool().cleanPool(); - if (this.theWorld != null) - { + if (this.theWorld != null) { this.theWorld.getWorldVec3Pool().clear(); } - this.mcProfiler.startSection("root"); - - if (Display.isCloseRequested()) - { + if (EaglerAdapter.shouldShutdown()) { this.shutdown(); } - if (this.isGamePaused && this.theWorld != null) - { + if (this.isGamePaused && this.theWorld != null) { float var1 = this.timer.renderPartialTicks; this.timer.updateTimer(); this.timer.renderPartialTicks = var1; - } - else - { + } else { this.timer.updateTimer(); } long var6 = System.nanoTime(); - this.mcProfiler.startSection("tick"); - for (int var3 = 0; var3 < this.timer.elapsedTicks; ++var3) - { + for (int var3 = 0; var3 < this.timer.elapsedTicks; ++var3) { this.runTick(); } - this.mcProfiler.endStartSection("preRenderErrors"); + IntegratedServer.processICP(); + long var7 = System.nanoTime() - var6; this.checkGLError("Pre render"); RenderBlocks.fancyGrass = this.gameSettings.fancyGraphics; - this.mcProfiler.endStartSection("sound"); this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks); - if (!this.isGamePaused) - { + if (!this.isGamePaused) { this.sndManager.func_92071_g(); } - this.mcProfiler.endSection(); - this.mcProfiler.startSection("render"); - this.mcProfiler.startSection("display"); - GL11.glEnable(GL11.GL_TEXTURE_2D); + EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); - if (!Keyboard.isKeyDown(65)) - { - Display.update(); + if (!EaglerAdapter.isKeyDown(65)) { + updateDisplay(); } - if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) - { + if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) { this.gameSettings.thirdPersonView = 0; } - this.mcProfiler.endSection(); + EaglerAdapter.glClearStack(); - if (!this.skipRenderWorld) - { - this.mcProfiler.endStartSection("gameRenderer"); + if (!this.skipRenderWorld) { this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); - this.mcProfiler.endSection(); } - GL11.glFlush(); - this.mcProfiler.endSection(); + EaglerAdapter.glFlush(); - if (!Display.isActive() && this.fullscreen) - { - this.toggleFullscreen(); - } + //if (!EaglerAdapter.isFocused() && this.fullscreen) { + // this.toggleFullscreen(); + //} - if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) - { - if (!this.mcProfiler.profilingEnabled) - { - this.mcProfiler.clearProfiling(); - } - - this.mcProfiler.profilingEnabled = true; - this.displayDebugInfo(var7); - } - else - { - this.mcProfiler.profilingEnabled = false; - this.prevFrameTime = System.nanoTime(); - } + this.prevFrameTime = System.nanoTime(); this.guiAchievement.updateAchievementWindow(); - this.mcProfiler.startSection("root"); - Thread.yield(); - if (Keyboard.isKeyDown(65)) - { - Display.update(); - } + if (!this.fullscreen && (EaglerAdapter.getCanvasWidth() != this.displayWidth || EaglerAdapter.getCanvasHeight() != this.displayHeight)) { + this.displayWidth = EaglerAdapter.getCanvasWidth(); + this.displayHeight = EaglerAdapter.getCanvasHeight(); - this.screenshotListener(); - - if (!this.fullscreen && Display.wasResized()) - { - this.displayWidth = Display.getWidth(); - this.displayHeight = Display.getHeight(); - - if (this.displayWidth <= 0) - { + if (this.displayWidth <= 0) { this.displayWidth = 1; } - if (this.displayHeight <= 0) - { + if (this.displayHeight <= 0) { this.displayHeight = 1; } @@ -850,36 +791,27 @@ public class Minecraft implements IPlayerUsage } this.checkGLError("Post render"); + EaglerAdapter.optimize(); ++this.fpsCounter; - boolean var5 = this.isGamePaused; - this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic(); + //boolean var5 = this.isGamePaused; + //this.isGamePaused = false; - if (this.isIntegratedServerRunning() && this.thePlayer != null && this.thePlayer.sendQueue != null && this.isGamePaused != var5) - { - ((MemoryConnection)this.thePlayer.sendQueue.getNetManager()).setGamePaused(this.isGamePaused); + if(EaglerAdapter.steadyTimeMillis() - secondTimer > 1000l) { + debugFPS = fpsCounter; + fpsCounter = 0; + debugChunkUpdates = chunkUpdates; + chunkUpdates = 0; + debugChunkGeometryUpdates = chunkGeometryUpdates; + chunkGeometryUpdates = 0; + secondTimer = EaglerAdapter.steadyTimeMillis(); } - while (getSystemTime() >= this.debugUpdateTime + 1000L) - { - debugFPS = this.fpsCounter; - this.debug = debugFPS + " fps, " + WorldRenderer.chunksUpdated + " chunk updates"; - WorldRenderer.chunksUpdated = 0; - this.debugUpdateTime += 1000L; - this.fpsCounter = 0; - this.usageSnooper.addMemoryStatsToSnooper(); + /*if(isGonnaTakeDatScreenShot) { + isGonnaTakeDatScreenShot = false; + EaglerAdapter.saveScreenshot(); + }*/ - if (!this.usageSnooper.isSnooperRunning()) - { - this.usageSnooper.startSnooper(); - } - } - - this.mcProfiler.endSection(); - - if (this.getLimitFramerate() > 0) - { - Display.sync(EntityRenderer.performanceToFps(this.getLimitFramerate())); - } + EaglerAdapter.doJavascriptCoroutines(); } private int getLimitFramerate() @@ -1342,6 +1274,19 @@ public class Minecraft implements IPlayerUsage } } + public void updateDisplay() { + if(gameSettings.enableVsync) { + EaglerAdapter.updateDisplay(0, true); + }else { + int i = this.func_90020_K(); + EaglerAdapter.updateDisplay(i > 0 ? EntityRenderer.performanceToFps(i) : 0, false); + } + } + + private int func_90020_K() { + return this.currentScreen != null && this.currentScreen instanceof GuiMainMenu ? 2 : this.gameSettings.limitFramerate; + } + /** * Runs the current tick. */ @@ -2037,7 +1982,7 @@ public class Minecraft implements IPlayerUsage */ public final boolean isDemo() { - return this.isDemo; + return false; } /** diff --git a/src/main/java/net/minecraft/src/RenderGlobal.java b/src/main/java/net/minecraft/src/RenderGlobal.java index c492fd9..258b488 100644 --- a/src/main/java/net/minecraft/src/RenderGlobal.java +++ b/src/main/java/net/minecraft/src/RenderGlobal.java @@ -25,7 +25,7 @@ public class RenderGlobal implements IWorldAccess private WorldClient theWorld; /** The RenderEngine instance used by RenderGlobal */ - private final TextureManager renderEngine; + private final RenderEngine renderEngine; private List worldRenderersToUpdate = new ArrayList(); private WorldRenderer[] sortedWorldRenderers; private WorldRenderer[] worldRenderers; @@ -155,10 +155,10 @@ public class RenderGlobal implements IWorldAccess */ int frustumCheckOffset; - public RenderGlobal(Minecraft par1Minecraft) + public RenderGlobal(Minecraft par1Minecraft, RenderEngine renderEngine) { this.mc = par1Minecraft; - this.renderEngine = par1Minecraft.getTextureManager(); + this.renderEngine = renderEngine; byte var2 = 34; byte var3 = 32; this.glRenderListBase = GLAllocation.generateDisplayLists(var2 * var2 * var3 * 3); @@ -400,7 +400,7 @@ public class RenderGlobal implements IWorldAccess else { this.theWorld.theProfiler.startSection("prepare"); - TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); + TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); this.countEntitiesTotal = 0; this.countEntitiesRendered = 0; diff --git a/src/main/java/net/minecraft/src/RenderManager.java b/src/main/java/net/minecraft/src/RenderManager.java index dddadfe..c2de815 100644 --- a/src/main/java/net/minecraft/src/RenderManager.java +++ b/src/main/java/net/minecraft/src/RenderManager.java @@ -39,7 +39,7 @@ public class RenderManager public double viewerPosZ; public static boolean field_85095_o; - private RenderManager() + RenderManager() { this.entityRenderMap.put(EntityCaveSpider.class, new RenderCaveSpider()); this.entityRenderMap.put(EntitySpider.class, new RenderSpider()); diff --git a/src/main/java/net/minecraft/src/ResourcePackRepositoryEntry.java b/src/main/java/net/minecraft/src/ResourcePackRepositoryEntry.java index 6f069d7..6a1205a 100644 --- a/src/main/java/net/minecraft/src/ResourcePackRepositoryEntry.java +++ b/src/main/java/net/minecraft/src/ResourcePackRepositoryEntry.java @@ -12,7 +12,7 @@ public class ResourcePackRepositoryEntry private ResourcePack reResourcePack; private PackMetadataSection rePackMetadataSection; private BufferedImage texturePackIcon; - private TextureLocation locationTexturePackIcon; + //private TextureLocation locationTexturePackIcon; final ResourcePackRepository reResourcePackRepository; @@ -44,14 +44,14 @@ public class ResourcePackRepositoryEntry this.closeResourcePack(); } - public void bindTexturePackIcon(TextureManager par1TextureManager) + public void bindTexturePackIcon(TextureManager par1TextureManager) // FIX THIS SHIT { - if (this.locationTexturePackIcon == null) + /*if (this.locationTexturePackIcon == null) { this.locationTexturePackIcon = par1TextureManager.getDynamicTextureLocation("texturepackicon", new DynamicTexture(this.texturePackIcon)); } - par1TextureManager.bindTexture(this.locationTexturePackIcon); + par1TextureManager.bindTexture(this.locationTexturePackIcon);*/ } public void closeResourcePack() diff --git a/src/main/java/net/minecraft/src/SoundManager.java b/src/main/java/net/minecraft/src/SoundManager.java index ed2fb94..81e933f 100644 --- a/src/main/java/net/minecraft/src/SoundManager.java +++ b/src/main/java/net/minecraft/src/SoundManager.java @@ -1,13 +1,10 @@ package net.minecraft.src; import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import java.util.Set; +import java.io.IOException; +import java.util.*; + +import net.lax1dude.eaglercraft.EaglerAdapter; import org.apache.commons.io.FileUtils; import paulscode.sound.SoundSystem; import paulscode.sound.SoundSystemConfig; @@ -41,7 +38,7 @@ public class SoundManager implements ResourceManagerReloadListener private int latestSoundID; /** A reference to the game settings. */ - private final GameSettings options; + private GameSettings options; private final File fileAssets; /** Identifiers of all currently playing sounds. Type: HashSet */ @@ -52,6 +49,8 @@ public class SoundManager implements ResourceManagerReloadListener private Random rand = new Random(); private int ticksBeforeMusic; + private HashMap sounddefinitions; + public SoundManager(ResourceManager par1ResourceManager, GameSettings par2GameSettings, File par3File) { this.ticksBeforeMusic = this.rand.nextInt(12000); @@ -60,6 +59,7 @@ public class SoundManager implements ResourceManagerReloadListener this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true); this.soundPoolStreaming = new SoundPool(par1ResourceManager, "records", false); this.soundPoolMusic = new SoundPool(par1ResourceManager, "music", true); + this.sounddefinitions = null; try { @@ -76,6 +76,32 @@ public class SoundManager implements ResourceManagerReloadListener this.loadSounds(); } + public void loadSoundSettings(GameSettings par1GameSettings){ + this.options = par1GameSettings; + EaglerAdapter.setMusicVolume(options.musicVolume); + EaglerAdapter.setMasterVolume(options.soundVolume); + if(this.sounddefinitions == null) { + this.sounddefinitions = new HashMap(); + for(int j = 0; j < 2; ++j) { + byte[] b = EaglerAdapter.loadResourceBytes("/sounds/sounds.dat" + (j == 1 ? "x" : "")); + if(b != null) { + try { + NBTTagCompound file = CompressedStreamTools.readUncompressed(b); + if(j == 0) EaglerAdapter.setPlaybackOffsetDelay(file.hasKey("playbackOffset") ? file.getFloat("playbackOffset") : 0.03f); + NBTTagList l = file.getTagList("sounds"); + int c = l.tagCount(); + for(int i = 0; i < c; i++) { + NBTTagCompound cc = (NBTTagCompound)l.tagAt(i); + this.sounddefinitions.put(cc.getString("e"), (int)cc.getByte("c") & 0xFF); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + public void onResourceManagerReload(ResourceManager par1ResourceManager) { this.stopAllSounds(); @@ -158,21 +184,13 @@ public class SoundManager implements ResourceManagerReloadListener /** * Called when one of the sound level options has changed. */ - public void onSoundOptionsChanged() + public void onSoundOptionsChanged() // FIX THIS (maybe) { - if (this.loaded) - { - if (this.options.musicVolume == 0.0F) - { - this.sndSystem.stop("BgMusic"); - this.sndSystem.stop("streaming"); - } - else - { - this.sndSystem.setVolume("BgMusic", this.options.musicVolume); - this.sndSystem.setVolume("streaming", this.options.musicVolume); - } + EaglerAdapter.setMusicVolume(options.musicVolume); + if(options.musicVolume > 0.0f) { + EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume); } + EaglerAdapter.setMasterVolume(options.soundVolume); } /** @@ -593,4 +611,23 @@ public class SoundManager implements ResourceManagerReloadListener { return par0SoundManager.loaded = par1; } + + private int titleMusic = -1; + + public void playTheTitleMusic() { + if(titleMusic == -1 || !EaglerAdapter.isPlaying(titleMusic)) { + if(this.options.musicVolume > 0.0f) { + titleMusic = EaglerAdapter.beginPlaybackStatic("/sounds/gta.mp3", 1.0f, 1.0f, true); + EaglerAdapter.fireTitleMusicEvent(true, this.options.musicVolume); + } + } + } + + public void stopTheTitleMusic() { + if(EaglerAdapter.isPlaying(titleMusic)) { + EaglerAdapter.endSound(titleMusic); + EaglerAdapter.fireTitleMusicEvent(false, this.options.musicVolume); + } + titleMusic = -1; + } } diff --git a/src/main/java/net/minecraft/src/SoundPool.java b/src/main/java/net/minecraft/src/SoundPool.java index ee23789..0c31bab 100644 --- a/src/main/java/net/minecraft/src/SoundPool.java +++ b/src/main/java/net/minecraft/src/SoundPool.java @@ -70,7 +70,7 @@ public class SoundPool private URL func_110654_c(String par1Str) throws MalformedURLException { TextureLocation var2 = new TextureLocation(par1Str); - String var3 = String.format("%s:%s:%s/%s", new Object[] {"mcsounddomain", var2.getResourceDomain(), this.soundType, var2.getResourcePath()}); + String var3 = String.format("%s:%s:%s/%s", new Object[] {"mcsounddomain", var2, this.soundType, var2}); SoundPoolProtocolHandler var4 = new SoundPoolProtocolHandler(this); return new URL((URL)null, var3, var4); } diff --git a/src/main/java/net/minecraft/src/TileEntityRenderer.java b/src/main/java/net/minecraft/src/TileEntityRenderer.java index 1d2580b..1ba7a20 100644 --- a/src/main/java/net/minecraft/src/TileEntityRenderer.java +++ b/src/main/java/net/minecraft/src/TileEntityRenderer.java @@ -28,7 +28,7 @@ public class TileEntityRenderer public static double staticPlayerZ; /** The RenderEngine instance used by the TileEntityRenderer */ - public TextureManager renderEngine; + public RenderEngine renderEngine; /** Reference to the World object. */ public World worldObj; @@ -103,7 +103,7 @@ public class TileEntityRenderer * bound EntityLiving's interpolated pitch, yaw and position. Args: world, renderengine, fontrenderer, entityliving, * partialTickTime */ - public void cacheActiveRenderInfo(World par1World, TextureManager par2TextureManager, FontRenderer par3FontRenderer, EntityLivingBase par4EntityLivingBase, float par5) + public void cacheActiveRenderInfo(World par1World, RenderEngine par2TextureManager, FontRenderer par3FontRenderer, EntityLivingBase par4EntityLivingBase, float par5) { if (this.worldObj != par1World) { diff --git a/src/main/java/net/minecraft/src/TileEntitySpecialRenderer.java b/src/main/java/net/minecraft/src/TileEntitySpecialRenderer.java index bbf8e63..72bad2e 100644 --- a/src/main/java/net/minecraft/src/TileEntitySpecialRenderer.java +++ b/src/main/java/net/minecraft/src/TileEntitySpecialRenderer.java @@ -13,7 +13,7 @@ public abstract class TileEntitySpecialRenderer protected void bindTexture(TextureLocation par1TextureLocation) { - TextureManager var2 = this.tileEntityRenderer.renderEngine; + RenderEngine var2 = this.tileEntityRenderer.renderEngine; if (var2 != null) {