diff --git a/bin/World Downloader [1.7.2] 20140118.zip b/bin/World Downloader [1.7.2] 20140118.zip deleted file mode 100755 index d2391d8..0000000 Binary files a/bin/World Downloader [1.7.2] 20140118.zip and /dev/null differ diff --git a/bin/World Downloader [1.7.2] 20140426.zip b/bin/World Downloader [1.7.2] 20140426.zip new file mode 100644 index 0000000..b239c77 Binary files /dev/null and b/bin/World Downloader [1.7.2] 20140426.zip differ diff --git a/bin/biv.class b/bin/biv.class index 721a4f4..28b6a75 100755 Binary files a/bin/biv.class and b/bin/biv.class differ diff --git a/bin/biw.class b/bin/biw.class index 98fa3c7..4029686 100755 Binary files a/bin/biw.class and b/bin/biw.class differ diff --git a/bin/biz.class b/bin/biz.class index 0f1c397..62232b8 100755 Binary files a/bin/biz.class and b/bin/biz.class differ diff --git a/bin/bja.class b/bin/bja.class index f09fe55..f27afa3 100755 Binary files a/bin/bja.class and b/bin/bja.class differ diff --git a/bin/bjb.class b/bin/bjb.class index 6a1d68b..f09d68f 100755 Binary files a/bin/bjb.class and b/bin/bjb.class differ diff --git a/bin/bjc.class b/bin/bjc.class index 79ee4d0..c8fc8f3 100755 Binary files a/bin/bjc.class and b/bin/bjc.class differ diff --git a/bin/bjd.class b/bin/bjd.class index 2d1a373..1f99034 100755 Binary files a/bin/bjd.class and b/bin/bjd.class differ diff --git a/bin/net/minecraft/wdl/ChunkProviderWDL.class b/bin/net/minecraft/wdl/ChunkProviderWDL.class new file mode 100644 index 0000000..37c015a Binary files /dev/null and b/bin/net/minecraft/wdl/ChunkProviderWDL.class differ diff --git a/bin/net/minecraft/wdl/WDL.class b/bin/net/minecraft/wdl/WDL.class index 851f14a..f56ab22 100755 Binary files a/bin/net/minecraft/wdl/WDL.class and b/bin/net/minecraft/wdl/WDL.class differ diff --git a/src/ChunkProviderWDL.java b/src/ChunkProviderWDL.java new file mode 100644 index 0000000..7c60ba9 --- /dev/null +++ b/src/ChunkProviderWDL.java @@ -0,0 +1,289 @@ +package net.minecraft.wdl; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ChunkProviderClient; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.LongHashMap; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraft.world.WorldProviderSurface; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.EmptyChunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; + +public class ChunkProviderWDL implements IChunkProvider{ + + Minecraft mc; + World worldObj; + + private static final Logger logger = LogManager.getLogger(); + + /** + * The completely empty chunk used by ChunkProviderClient when chunkMapping doesn't contain the requested + * coordinates. + */ + private Chunk blankChunk; + + /** + * The mapping between ChunkCoordinates and Chunks that ChunkProviderClient would maintain. + * ie what we get from the server. WDL steals this one to save + */ + private LongHashMap chunkMappingStandard = new LongHashMap(); + + /** + * The mapping between ChunkCoordinates and Chunks that ChunkProviderWDL maintains. + * can include chunks loaded from disk as well as what's been received from the server + */ + private LongHashMap chunkMapping = new LongHashMap(); + + /** + * This may have been intended to be an iterable version of all currently loaded chunks (MultiplayerChunkCache), + * with identical contents to chunkMapping's values. However it is never actually added to. + */ + private List chunkListing = new ArrayList(); + + int lastPlayerChunkX = 0; + int lastPlayerChunkZ = 0; + int deleteRange = 16; + private final Object chunkLock = new Object(); + + public ChunkProviderWDL(World world) { + this.blankChunk = new EmptyChunk(world, 0, 0); + this.mc = Minecraft.getMinecraft(); + this.worldObj = world; + } + + /** + * Checks to see if a chunk exists at x, y + */ + @Override + public boolean chunkExists(int par1, int par2) + { + return true; + } + + public void unloadChunk(int chunkX, int chunkZ) { + Chunk chunk = this.provideChunk(chunkX, chunkZ); + if (!chunk.isEmpty()) { + chunk.onChunkUnload(); + synchronized (chunkLock) { + this.chunkListing.remove(chunk); + } + } + this.chunkMappingStandard.remove(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)); // delete from standard chunk map + if (Math.abs(chunkX - lastPlayerChunkX) > deleteRange || Math.abs(chunkZ - lastPlayerChunkZ) > deleteRange) { // also out of our render range, delete from our distance based chunk map too + synchronized (chunkLock) { + this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)); + } + } + + } + + public void unloadStoredChunk(int chunkX, int chunkZ) { + Chunk chunkStandard = (Chunk)this.chunkMappingStandard.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)); + Chunk chunk = this.provideChunk(chunkX, chunkZ); + + if (!chunk.isEmpty() && chunkStandard == null) // not a chunk that would have been stored by vanilla ChunkProviderClient + { + chunk.onChunkUnload(); + } + + if (chunkStandard == null) { // remove from our distance based mapping if it isn't in the standard mapping + synchronized (chunkLock) { + this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)); + } + } + } + + @Override + public Chunk loadChunk(int chunkX, int chunkZ) { + Chunk chunk = new Chunk(this.worldObj, chunkX, chunkZ); + synchronized (chunkLock) { + this.chunkMappingStandard.add(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ), chunk); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ), chunk); + this.chunkListing.add(chunk); + } + chunk.isChunkLoaded = true; + return chunk; + } + + public Chunk loadStoredChunk(int chunkX, int chunkZ) { + Chunk chunk = provideChunk(chunkX, chunkZ); + if (chunk.isEmpty()) { // only load if it isn't loaded already + IChunkLoader chunkloader = null; + if (mc.isIntegratedServerRunning()) { // get chunkLoader for singleplayer world + WorldServer worldServer = mc.getIntegratedServer().worldServerForDimension(mc.thePlayer.dimension); + chunkloader = worldServer.getSaveHandler().getChunkLoader(worldServer.provider); + } + else { // try to get WDL chunkloader + chunkloader = (WDL.downloading)?WDL.chunkLoader:null; // only use WDL chunkLoader if it is downloading. Otherwise no guarantee it is using current world/name/etc + } + if (chunkloader != null) { // if there is a chunkloader + try { + chunk = chunkloader.loadChunk(worldObj, chunkX, chunkZ); // load chunk from storage + if (chunk != null) { + synchronized (chunkLock) { + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ), chunk); + } + chunk.isChunkLoaded = true; + this.worldObj.markBlockRangeForRenderUpdate(chunkX << 4, 0, chunkX << 4, (chunkX << 4) + 15, 256, (chunkZ << 4) + 15); + if (!(this.worldObj.provider instanceof WorldProviderSurface)) { + chunk.resetRelightChecks(); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return chunk; + } + + @Override + public Chunk provideChunk(int chunkX, int chunkZ) { + synchronized (chunkLock) { + Chunk var3 = (Chunk)this.chunkMapping.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)); + return var3 == null ? this.blankChunk : var3; + } + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + @Override + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + @Override + public void saveExtraData() {} + + /** + * called once per tick. Can use for loading and unloading stored chunks + */ + @Override + public boolean unloadQueuedChunks() { + int playerChunkX = this.mc.thePlayer.chunkCoordX; + int playerChunkZ = this.mc.thePlayer.chunkCoordZ; + + if (playerChunkX != lastPlayerChunkX || playerChunkZ != lastPlayerChunkZ) { + int offsetX = Math.abs(playerChunkX - lastPlayerChunkX); + int offsetZ = Math.abs(playerChunkZ - lastPlayerChunkZ); + lastPlayerChunkX = playerChunkX; + lastPlayerChunkZ = playerChunkZ; + final int range = this.mc.gameSettings.renderDistanceChunks; + final long startTime = System.nanoTime(); + new Thread(new Runnable() { // load in a thread so we aren't blocking, particularly for giant texture packs + public void run() { + for (int t = lastPlayerChunkX - range; t <= lastPlayerChunkX + range; t++) { + for (int s = lastPlayerChunkZ - range; s <= lastPlayerChunkZ + range; s++) { + loadStoredChunk(t, s); + } + } + } + }, "WDL Load Stored Chunks Thread").start(); + System.out.println(System.nanoTime()-startTime); + + for (int t = lastPlayerChunkX - deleteRange - offsetX; t <= lastPlayerChunkX + deleteRange + offsetX; t++) { + for (int s = 1; s <= offsetZ; s++) { + this.unloadStoredChunk(t, lastPlayerChunkZ + deleteRange + s); + this.unloadStoredChunk(t, lastPlayerChunkZ - deleteRange - s); + } + } + for (int t = 1; t <= offsetX; t++) { + for (int s = lastPlayerChunkZ - deleteRange - offsetZ; s <= lastPlayerChunkZ + deleteRange + offsetZ; s++) { + this.unloadStoredChunk(lastPlayerChunkX + deleteRange + t, s); + this.unloadStoredChunk(lastPlayerChunkX - deleteRange - t, s); + } + } + } + + long var1 = System.currentTimeMillis(); + synchronized (chunkLock) { + Iterator var3 = this.chunkListing.iterator(); + + while (var3.hasNext()) + { + Chunk var4 = (Chunk)var3.next(); + var4.func_150804_b(System.currentTimeMillis() - var1 > 5L); + } + } + + if (System.currentTimeMillis() - var1 > 100L) + { + logger.info("Warning: Clientside chunk ticking took {} ms", new Object[] {Long.valueOf(System.currentTimeMillis() - var1)}); + } + + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + @Override + public boolean canSave() + { + return false; + } + + /** + * Populates chunk with ores etc etc + */ + @Override + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {} + + /** + * Converts the instance data to a readable string. + */ + @Override + public String makeString() + { + synchronized (chunkLock) { + return "MultiplayerChunkCache: " + this.chunkMapping.getNumHashElements() + ", " + this.chunkListing.size(); + } + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + @Override + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + return null; + } + + @Override + public ChunkPosition findClosestStructure(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) + { + return null; + } + + @Override + public int getLoadedChunkCount() + { + return this.chunkListing.size(); + } + + @Override + public void recreateStructures(int par1, int par2) {} + + +} diff --git a/src/GuiIngameMenu.java b/src/GuiIngameMenu.java index 3f8856e..4e4d4db 100755 --- a/src/GuiIngameMenu.java +++ b/src/GuiIngameMenu.java @@ -51,9 +51,9 @@ public void initGui() GuiButton wdlOptions = new GuiButton(51, this.width / 2 + 71, this.height / 4 + 72 + var1, 28, 20, "..."); this.buttonList.add(wdlOptions); wdlOptions.enabled = (!WDL.downloading || (WDL.downloading && !WDL.saving)); - ((GuiButton)this.buttonList.get(0)).field_146129_i = this.height / 4 + 144 + var1; - ((GuiButton)this.buttonList.get(2)).field_146129_i = this.height / 4 + 120 + var1; - ((GuiButton)this.buttonList.get(3)).field_146129_i = this.height / 4 + 120 + var1; + ((GuiButton)this.buttonList.get(0)).yPosition = this.height / 4 + 144 + var1; + ((GuiButton)this.buttonList.get(2)).yPosition = this.height / 4 + 120 + var1; + ((GuiButton)this.buttonList.get(3)).yPosition = this.height / 4 + 120 + var1; } /* <<< WDL */ @@ -91,11 +91,11 @@ protected void actionPerformed(GuiButton p_146284_1_) break; case 5: - this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.func_146107_m())); + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); break; case 6: - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.func_146107_m())); + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); break; case 7: diff --git a/src/GuiWDLPlayer.java b/src/GuiWDLPlayer.java index aaa0df7..0888acd 100755 --- a/src/GuiWDLPlayer.java +++ b/src/GuiWDLPlayer.java @@ -48,9 +48,9 @@ public void initGui() this.posX = new GuiTextField(this.fontRendererObj, var1 - 87, var3, 50, 16); this.posY = new GuiTextField(this.fontRendererObj, var1 - 19, var3, 50, 16); this.posZ = new GuiTextField(this.fontRendererObj, var1 + 48, var3, 50, 16); - this.posX.func_146203_f(7); - this.posY.func_146203_f(7); - this.posZ.func_146203_f(7); + this.posX.setMaxStringLength(7); + this.posY.setMaxStringLength(7); + this.posZ.setMaxStringLength(7); var3 += 18; this.pickPosBtn = new GuiButton(4, var1 - 0, var3, 100, 20, "Current position"); this.buttonList.add(this.pickPosBtn); @@ -217,7 +217,7 @@ private void updatePlayerPos(boolean var1) { String var2 = WDL.worldProps.getProperty("PlayerPos"); this.showPosFields = false; - this.pickPosBtn.field_146125_m = false; + this.pickPosBtn.visible = false; if (var2.equals("keep")) { @@ -242,7 +242,7 @@ else if (var2.equals("xyz")) { this.playerPosBtn.displayString = "Player Position:"; this.showPosFields = true; - this.pickPosBtn.field_146125_m = true; + this.pickPosBtn.visible = true; } } } diff --git a/src/GuiWDLWorld.java b/src/GuiWDLWorld.java index eefe35b..a814e19 100755 --- a/src/GuiWDLWorld.java +++ b/src/GuiWDLWorld.java @@ -53,9 +53,9 @@ public void initGui() this.spawnX = new GuiTextField(this.fontRendererObj, var1 - 87, var3, 50, 16); this.spawnY = new GuiTextField(this.fontRendererObj, var1 - 19, var3, 50, 16); this.spawnZ = new GuiTextField(this.fontRendererObj, var1 + 48, var3, 50, 16); - this.spawnX.func_146203_f(7); - this.spawnY.func_146203_f(7); - this.spawnZ.func_146203_f(7); + this.spawnX.setMaxStringLength(7); + this.spawnY.setMaxStringLength(7); + this.spawnZ.setMaxStringLength(7); var3 += 18; this.pickSpawnBtn = new GuiButton(5, var1 - 0, var3, 100, 20, "Current position"); this.buttonList.add(this.pickSpawnBtn); @@ -364,7 +364,7 @@ private void updateSpawn(boolean var1) { String var2 = WDL.worldProps.getProperty("Spawn"); this.showSpawnFields = false; - this.pickSpawnBtn.field_146125_m = false; + this.pickSpawnBtn.visible = false; if (var2.equals("auto")) { @@ -401,7 +401,7 @@ else if (var2.equals("xyz")) { this.spawnBtn.displayString = "Spawn Position:"; this.showSpawnFields = true; - this.pickSpawnBtn.field_146125_m = true; + this.pickSpawnBtn.visible = true; } } } diff --git a/src/NetHandlerPlayClient.java b/src/NetHandlerPlayClient.java index 2040ed8..bfcbe1b 100755 --- a/src/NetHandlerPlayClient.java +++ b/src/NetHandlerPlayClient.java @@ -280,7 +280,7 @@ public void handleJoinGame(S01PacketJoinGame p_147282_1_) { this.gameController.playerController = new PlayerControllerMP(this.gameController, this); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.gameController.mcProfiler); - this.clientWorldController.isClient = true; + this.clientWorldController.isClientWorld = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147282_1_.func_149194_f(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); @@ -828,7 +828,7 @@ public void handleChat(S02PacketChat p_147251_1_) WDL.handleServerSeedMessage(var2); /* <<< WDL */ - this.gameController.ingameGUI.getChatGUI().func_146227_a(p_147251_1_.func_148915_c()); + this.gameController.ingameGUI.getChatGUI().printChatMessage(p_147251_1_.func_148915_c()); } /** @@ -997,6 +997,9 @@ public void handleEntityStatus(S19PacketEntityStatus p_147236_1_) } } + /** + * Recieves player health from the server and then proceeds to set it locally on the client. + */ public void handleUpdateHealth(S06PacketUpdateHealth p_147249_1_) { this.gameController.thePlayer.setPlayerSPHealth(p_147249_1_.func_149332_c()); @@ -1009,6 +1012,9 @@ public void handleSetExperience(S1FPacketSetExperience p_147295_1_) this.gameController.thePlayer.setXPStats(p_147295_1_.func_149397_c(), p_147295_1_.func_149396_d(), p_147295_1_.func_149395_e()); } + /** + * respawns the player + */ public void handleRespawn(S07PacketRespawn p_147280_1_) { if (p_147280_1_.func_149082_c() != this.gameController.thePlayer.dimension) @@ -1017,7 +1023,7 @@ public void handleRespawn(S07PacketRespawn p_147280_1_) Scoreboard var2 = this.clientWorldController.getScoreboard(); this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147280_1_.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), p_147280_1_.func_149080_f()), p_147280_1_.func_149082_c(), p_147280_1_.func_149081_d(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(var2); - this.clientWorldController.isClient = true; + this.clientWorldController.isClientWorld = true; this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = p_147280_1_.func_149082_c(); this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); @@ -1249,9 +1255,9 @@ public void handleSignEditorOpen(S36PacketSignEditorOpen p_147268_1_) { var2 = new TileEntitySign(); ((TileEntity)var2).setWorldObj(this.clientWorldController); - ((TileEntity)var2).field_145851_c = p_147268_1_.func_149129_c(); - ((TileEntity)var2).field_145848_d = p_147268_1_.func_149128_d(); - ((TileEntity)var2).field_145849_e = p_147268_1_.func_149127_e(); + ((TileEntity)var2).xCoord = p_147268_1_.func_149129_c(); + ((TileEntity)var2).yCoord = p_147268_1_.func_149128_d(); + ((TileEntity)var2).zCoord = p_147268_1_.func_149127_e(); } this.gameController.thePlayer.func_146100_a((TileEntity)var2); @@ -1276,10 +1282,10 @@ public void handleUpdateSign(S33PacketUpdateSign p_147248_1_) { for (int var5 = 0; var5 < 4; ++var5) { - var4.field_145915_a[var5] = p_147248_1_.func_149347_f()[var5]; + var4.signText[var5] = p_147248_1_.func_149347_f()[var5]; } - var4.onInventoryChanged(); + var4.markDirty(); } var2 = true; @@ -1298,31 +1304,31 @@ public void handleUpdateSign(S33PacketUpdateSign p_147248_1_) */ public void handleUpdateTileEntity(S35PacketUpdateTileEntity p_147273_1_) { - if (this.gameController.theWorld.blockExists(p_147273_1_.func_148856_c(), p_147273_1_.func_148855_d(), p_147273_1_.func_148854_e())) + if (this.gameController.theWorld.blockExists(p_147273_1_.getX(), p_147273_1_.getY(), p_147273_1_.getZ())) { - TileEntity var2 = this.gameController.theWorld.getTileEntity(p_147273_1_.func_148856_c(), p_147273_1_.func_148855_d(), p_147273_1_.func_148854_e()); + TileEntity var2 = this.gameController.theWorld.getTileEntity(p_147273_1_.getX(), p_147273_1_.getY(), p_147273_1_.getZ()); if (var2 != null) { - if (p_147273_1_.func_148853_f() == 1 && var2 instanceof TileEntityMobSpawner) + if (p_147273_1_.getMetadata() == 1 && var2 instanceof TileEntityMobSpawner) { - var2.readFromNBT(p_147273_1_.func_148857_g()); + var2.readFromNBT(p_147273_1_.getNbtCompound()); } - else if (p_147273_1_.func_148853_f() == 2 && var2 instanceof TileEntityCommandBlock) + else if (p_147273_1_.getMetadata() == 2 && var2 instanceof TileEntityCommandBlock) { - var2.readFromNBT(p_147273_1_.func_148857_g()); + var2.readFromNBT(p_147273_1_.getNbtCompound()); } - else if (p_147273_1_.func_148853_f() == 3 && var2 instanceof TileEntityBeacon) + else if (p_147273_1_.getMetadata() == 3 && var2 instanceof TileEntityBeacon) { - var2.readFromNBT(p_147273_1_.func_148857_g()); + var2.readFromNBT(p_147273_1_.getNbtCompound()); } - else if (p_147273_1_.func_148853_f() == 4 && var2 instanceof TileEntitySkull) + else if (p_147273_1_.getMetadata() == 4 && var2 instanceof TileEntitySkull) { - var2.readFromNBT(p_147273_1_.func_148857_g()); + var2.readFromNBT(p_147273_1_.getNbtCompound()); } - else if (p_147273_1_.func_148853_f() == 5 && var2 instanceof TileEntityFlowerPot) + else if (p_147273_1_.getMetadata() == 5 && var2 instanceof TileEntityFlowerPot) { - var2.readFromNBT(p_147273_1_.func_148857_g()); + var2.readFromNBT(p_147273_1_.getNbtCompound()); } } } @@ -1366,7 +1372,7 @@ public void handleCloseWindow(S2EPacketCloseWindow p_147276_1_) */ public void handleBlockAction(S24PacketBlockAction p_147261_1_) { - this.gameController.theWorld.func_147452_c(p_147261_1_.func_148867_d(), p_147261_1_.func_148866_e(), p_147261_1_.func_148865_f(), p_147261_1_.func_148868_c(), p_147261_1_.func_148869_g(), p_147261_1_.func_148864_h()); + this.gameController.theWorld.addBlockEvent(p_147261_1_.func_148867_d(), p_147261_1_.func_148866_e(), p_147261_1_.func_148865_f(), p_147261_1_.func_148868_c(), p_147261_1_.func_148869_g(), p_147261_1_.func_148864_h()); } /** @@ -1436,15 +1442,15 @@ else if (var3 == 5) } else if (var4 == 101.0F) { - this.gameController.ingameGUI.getChatGUI().func_146227_a(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())})); + 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().func_146227_a(new ChatComponentTranslation("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindJump.getKeyCode())})); + 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().func_146227_a(new ChatComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindInventory.getKeyCode())})); + this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindInventory.getKeyCode())})); } } else if (var3 == 6) @@ -1493,7 +1499,7 @@ public void handleStatistics(S37PacketStatistics p_147293_1_) StatBase var5; int var6; - for (Iterator var3 = p_147293_1_.func_148974_c().entrySet().iterator(); var3.hasNext(); this.gameController.thePlayer.func_146107_m().func_150873_a(this.gameController.thePlayer, var5, var6)) + for (Iterator var3 = p_147293_1_.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(); @@ -1501,7 +1507,7 @@ public void handleStatistics(S37PacketStatistics p_147293_1_) if (var5.isAchievement() && var6 > 0) { - if (this.field_147308_k && this.gameController.thePlayer.func_146107_m().writeStat(var5) == 0) + if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().writeStat(var5) == 0) { this.gameController.guiAchievement.func_146256_a((Achievement)var5); @@ -1541,6 +1547,9 @@ public void handleEntityEffect(S1DPacketEntityEffect p_147260_1_) } } + /** + * Handle a remove entity effect packet. + */ public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect p_147262_1_) { Entity var2 = this.clientWorldController.getEntityByID(p_147262_1_.func_149076_c()); @@ -1657,11 +1666,11 @@ else if ("MC|RPack".equals(p_147240_1_.func_149169_c())) if (this.gameController.gameSettings.serverTextures) { - if (this.gameController.func_147104_D() != null && this.gameController.func_147104_D().func_147408_b()) + if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().acceptsAllResourcePackRequests()) { - this.gameController.getResourcePackRepository().func_148526_a(var8); + this.gameController.getResourcePackRepository().obtainResourcePack(var8); } - else if (this.gameController.func_147104_D() == null || this.gameController.func_147104_D().func_147410_c()) + else if (this.gameController.getCurrentServerData() == null || this.gameController.getCurrentServerData().func_147410_c()) { this.gameController.displayGuiScreen(new GuiYesNo(new GuiScreen() { @@ -1670,15 +1679,15 @@ public void confirmClicked(boolean par1, int par2) { this.mc = Minecraft.getMinecraft(); - if (this.mc.func_147104_D() != null) + if (this.mc.getCurrentServerData() != null) { - this.mc.func_147104_D().setAcceptsTextures(par1); - ServerList.func_147414_b(this.mc.func_147104_D()); + this.mc.getCurrentServerData().setAcceptsTextures(par1); + ServerList.func_147414_b(this.mc.getCurrentServerData()); } if (par1) { - this.mc.getResourcePackRepository().func_148526_a(var8); + this.mc.getResourcePackRepository().obtainResourcePack(var8); } this.mc.displayGuiScreen((GuiScreen)null); diff --git a/src/WDL.java b/src/WDL.java index 0cc96f6..bb51de2 100755 --- a/src/WDL.java +++ b/src/WDL.java @@ -196,11 +196,11 @@ public static void stop() if (downloading) { // Indicate that downloading has stopped - downloading = false; startOnChange = false; chatMsg("Download stopped"); startSaveThread(); + downloading = false; } } @@ -465,7 +465,7 @@ public static void onBlockEvent(int x, int y, int z, Block block, int event, int if (block == Blocks.noteblock) { TileEntityNote newTE = new TileEntityNote(); - newTE.field_145879_a = (byte)(param % 25); + newTE.note = (byte)(param % 25); wc.setTileEntity(x, y, z, newTE); newTileEntities.add(new ChunkPosition(x, y, z)); chatDebug("onBlockEvent: Note Block: " + x + " " + y + " " + z + " pitch: " + param + " - " + newTE); @@ -496,19 +496,19 @@ public static void importTileEntities(Chunk chunk) String entityType = null; if ((entityType = isImportableTileEntity(te)) != null) { - if (!newTileEntities.contains(new ChunkPosition(te.field_145851_c, te.field_145848_d, te.field_145849_e))) + if (!newTileEntities.contains(new ChunkPosition(te.xCoord, te.yCoord, te.zCoord))) { - wc.setTileEntity(te.field_145851_c, te.field_145848_d, te.field_145849_e, te); - chatDebug("Loaded TE: " + entityType + " at " + te.field_145851_c + " " + te.field_145848_d + " " + te.field_145849_e); + wc.setTileEntity(te.xCoord, te.yCoord, te.zCoord, te); + chatDebug("Loaded TE: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord); } else { - chatDebug("Dropping old TE: " + entityType + " at " + te.field_145851_c + " " + te.field_145848_d + " " + te.field_145849_e); + chatDebug("Dropping old TE: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord); } } else { - chatDebug("Old TE is not importable: " + entityType + " at " + te.field_145851_c + " " + te.field_145848_d + " " + te.field_145849_e); + chatDebug("Old TE is not importable: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord); } } } @@ -521,7 +521,7 @@ public static void importTileEntities(Chunk chunk) /** Checks if the TileEntity should be imported. Only "problematic" TEs will be imported. */ public static String isImportableTileEntity(TileEntity te) { - Block block = wc.getBlock(te.field_145851_c, te.field_145848_d, te.field_145849_e); + Block block = wc.getBlock(te.xCoord, te.yCoord, te.zCoord); if (block instanceof BlockChest && te instanceof TileEntityChest) { return "TileEntityChest"; @@ -666,7 +666,7 @@ public static void saveChunks() throws IllegalArgumentException, IllegalAccessEx { chatDebug("Saving chunks..."); // Get the ChunkProviderClient from WorldClient - ChunkProviderClient chunkProvider = (ChunkProviderClient)wc.getChunkProvider(); + ChunkProviderWDL chunkProvider = (ChunkProviderWDL)wc.getChunkProvider(); // Get the hashArray field and set it accessible Field hashArrayField = null; @@ -1074,9 +1074,9 @@ public static String getServerName() { try { - if (mc.func_147104_D() != null) // getServerData + if (mc.getCurrentServerData() != null) // getCurrentServerData { - return mc.func_147104_D().serverName; + return mc.getCurrentServerData().serverName; } else if (mcos != null) { @@ -1128,7 +1128,7 @@ public static void copyItemStacks(Container c, IInventory i, int startInContaine public static void chatMsg(String msg) { // System.out.println( "WorldDownloader: " + msg ); // Just for debugging! - mc.ingameGUI.getChatGUI().func_146227_a(new ChatComponentText("\u00A7c[WorldDL]\u00A76 " + msg)); + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("\u00A7c[WorldDL]\u00A76 " + msg)); } /** Adds a chat message with a World Downloader prefix */ @@ -1137,14 +1137,14 @@ public static void chatDebug(String msg) if (!WDL.DEBUG) return; // System.out.println( "WorldDownloader: " + msg ); // Just for debugging! - mc.ingameGUI.getChatGUI().func_146227_a(new ChatComponentText("\u00A72[WorldDL]\u00A76 " + msg)); + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("\u00A72[WorldDL]\u00A76 " + msg)); } /** Adds a chat message with a World Downloader prefix */ public static void chatError(String msg) { // System.out.println( "WorldDownloader: " + msg ); // Just for debugging! - mc.ingameGUI.getChatGUI().func_146227_a(new ChatComponentText("\u00A72[WorldDL]\u00A74 " + msg)); + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("\u00A72[WorldDL]\u00A74 " + msg)); } diff --git a/src/WorldClient.java b/src/WorldClient.java index 54108f7..ab8f3da 100755 --- a/src/WorldClient.java +++ b/src/WorldClient.java @@ -49,6 +49,7 @@ import net.minecraft.entity.projectile.EntityEgg; import net.minecraft.entity.projectile.EntityFishHook; import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.wdl.ChunkProviderWDL; import net.minecraft.wdl.WDL; import net.minecraft.world.IWorldAccess; /* <<< WDL */ @@ -60,7 +61,10 @@ public class WorldClient extends World private NetHandlerPlayClient sendQueue; /** The ChunkProviderClient instance */ - private ChunkProviderClient clientChunkProvider; + /* WDL >>> */ + //private ChunkProviderClient clientChunkProvider + private ChunkProviderWDL clientChunkProvider; + /* <<< WDL */ /** * The hash set of entities handled by this client. Uses the entity's ID as the hash set's key. @@ -153,7 +157,7 @@ public void invalidateBlockReceiveRegion(int par1, int par2, int par3, int par4, */ protected IChunkProvider createChunkProvider() { - this.clientChunkProvider = new ChunkProviderClient(this); + this.clientChunkProvider = new ChunkProviderWDL(this); return this.clientChunkProvider; } @@ -277,7 +281,7 @@ protected void onEntityRemoved(Entity par1Entity) } } - if (RenderManager.instance.getEntityRenderObject(par1Entity).func_147905_a() && !var2) + if (RenderManager.instance.getEntityRenderObject(par1Entity).isStaticEntity() && !var2) { this.mc.renderGlobal.onStaticEntitiesChanged(); } @@ -305,7 +309,7 @@ public void addEntityToWorld(int par1, Entity par2Entity) this.entityHashSet.addKey(par1, par2Entity); - if (RenderManager.instance.getEntityRenderObject(par2Entity).func_147905_a()) + if (RenderManager.instance.getEntityRenderObject(par2Entity).isStaticEntity()) { this.mc.renderGlobal.onStaticEntitiesChanged(); } @@ -592,9 +596,9 @@ public void removeWorldAccess(IWorldAccess par1iWorldAccess) } @Override - public void func_147452_c(int par1, int par2, int par3, Block par4, int par5, int par6) + public void addBlockEvent(int par1, int par2, int par3, Block par4, int par5, int par6) { - super.func_147452_c(par1, par2, par3, par4, par5, par6); + super.addBlockEvent(par1, par2, par3, par4, par5, par6); if( WDL.downloading ) WDL.onBlockEvent( par1, par2, par3, par4, par5, par6 ); }