private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) { if (chunk != null) { world.theChunkProviderServer.loadedChunkHashMap.add(ChunkCoordIntPair.chunkXZ2Int(x, z),chunk); world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility chunk.onChunkLoad(); if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) { world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z); } if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) { world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z); } if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) { world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1); } if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) { world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1); } } }
/** * Loads the specified(XZ) chunk into the specified world. */ public Chunk loadChunk(World worldIn, int x, int z) throws IOException { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); if (nbttagcompound == null) { DataInputStream datainputstream = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, x, z); if (datainputstream == null) { return null; } nbttagcompound = CompressedStreamTools.read(datainputstream); } return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); }
public boolean generateStructure(World worldIn, Random randomIn, ChunkCoordIntPair chunkCoord) { this.func_143027_a(worldIn); int i = (chunkCoord.chunkXPos << 4) + 8; int j = (chunkCoord.chunkZPos << 4) + 8; boolean flag = false; for (StructureStart structurestart : this.structureMap.values()) { if (structurestart.isSizeableStructure() && structurestart.func_175788_a(chunkCoord) && structurestart.getBoundingBox().intersectsWith(i, j, i + 15, j + 15)) { structurestart.generateStructure(worldIn, randomIn, new StructureBoundingBox(i, j, i + 15, j + 15)); structurestart.func_175787_b(chunkCoord); flag = true; this.func_143026_a(structurestart.getChunkPosX(), structurestart.getChunkPosZ(), structurestart); } } return flag; }
public MapGenStronghold(Map<String, String> p_i2068_1_) { this(); for (Entry<String, String> entry : p_i2068_1_.entrySet()) { if (((String)entry.getKey()).equals("distance")) { this.field_82671_h = MathHelper.parseDoubleWithDefaultAndMax((String)entry.getValue(), this.field_82671_h, 1.0D); } else if (((String)entry.getKey()).equals("count")) { this.structureCoords = new ChunkCoordIntPair[MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.structureCoords.length, 1)]; } else if (((String)entry.getKey()).equals("spread")) { this.field_82672_i = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.field_82672_i, 1); } } }
public boolean generateStructure(World worldIn, Random randomIn, ChunkCoordIntPair chunkCoord) { this.func_143027_a(worldIn); int i = (chunkCoord.chunkXPos << 4) + 8; int j = (chunkCoord.chunkZPos << 4) + 8; boolean flag = false; for (Object structurestart0 : this.structureMap.values()) { StructureStart structurestart = (StructureStart)structurestart0; if (structurestart.isSizeableStructure() && structurestart.func_175788_a(chunkCoord) && structurestart.getBoundingBox().intersectsWith(i, j, i + 15, j + 15)) { structurestart.generateStructure(worldIn, randomIn, new StructureBoundingBox(i, j, i + 15, j + 15)); structurestart.func_175787_b(chunkCoord); flag = true; this.func_143026_a(structurestart.getChunkPosX(), structurestart.getChunkPosZ(), structurestart); } } return flag; }
public void dropChunk(int p_73241_1_, int p_73241_2_) { if (this.worldObj.provider.canRespawnHere()) { if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) { this.droppedChunksSet.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(p_73241_1_, p_73241_2_))); } } else { this.droppedChunksSet.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(p_73241_1_, p_73241_2_))); } }
public MapGenStronghold() { this.structureCoords = new ChunkCoordIntPair[3]; this.field_82671_h = 32.0D; this.field_82672_i = 3; this.field_151546_e = Lists.<BiomeGenBase>newArrayList(); for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) { if (biomegenbase != null && biomegenbase.minHeight > 0.0F) { this.field_151546_e.add(biomegenbase); } } }
protected List<BlockPos> getCoordList() { List<BlockPos> list = Lists.<BlockPos>newArrayList(); for (ChunkCoordIntPair chunkcoordintpair : this.structureCoords) { if (chunkcoordintpair != null) { list.add(chunkcoordintpair.getCenterBlock(64)); } } return list; }
protected void updateBlocks() { super.updateBlocks(); this.previousActiveChunkSet.retainAll(this.activeChunkSet); if (this.previousActiveChunkSet.size() == this.activeChunkSet.size()) { this.previousActiveChunkSet.clear(); } int i = 0; for (ChunkCoordIntPair chunkcoordintpair : this.activeChunkSet) { if (!this.previousActiveChunkSet.contains(chunkcoordintpair)) { int j = chunkcoordintpair.chunkXPos * 16; int k = chunkcoordintpair.chunkZPos * 16; this.theProfiler.startSection("getChunk"); Chunk chunk = this.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos); this.playMoodSoundAndCheckLight(j, k, chunk); this.theProfiler.endSection(); this.previousActiveChunkSet.add(chunkcoordintpair); ++i; if (i >= 10) { return; } } } }
private void func_143027_a(World worldIn) { if (this.structureData == null) { this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); if (this.structureData == null) { this.structureData = new MapGenStructureData(this.getStructureName()); worldIn.setItemData(this.getStructureName(), this.structureData); } else { NBTTagCompound nbttagcompound = this.structureData.getTagCompound(); for (String s : nbttagcompound.getKeySet()) { NBTBase nbtbase = nbttagcompound.getTag(s); if (nbtbase.getId() == 10) { NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase; if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ")) { int i = nbttagcompound1.getInteger("ChunkX"); int j = nbttagcompound1.getInteger("ChunkZ"); StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn); if (structurestart != null) { this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart); } } } } } } }
public void writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); NBTTagList nbttaglist = new NBTTagList(); for (ChunkCoordIntPair chunkcoordintpair : this.field_175791_c) { NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setInteger("X", chunkcoordintpair.chunkXPos); nbttagcompound.setInteger("Z", chunkcoordintpair.chunkZPos); nbttaglist.appendTag(nbttagcompound); } tagCompound.setTag("Processed", nbttaglist); }
public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { boolean flag = false; if (this.settings.useMonuments && this.mapFeaturesEnabled && p_177460_2_.getInhabitedTime() < 3600L) { flag |= this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(p_177460_3_, p_177460_4_)); } return flag; }
public S22PacketMultiBlockChange(int p_i45181_1_, short[] crammedPositionsIn, Chunk chunkIn) { this.chunkPosCoord = new ChunkCoordIntPair(chunkIn.xPosition, chunkIn.zPosition); this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[p_i45181_1_]; for (int i = 0; i < this.changedBlocks.length; ++i) { this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(crammedPositionsIn[i], chunkIn); } }
/** * Reads the raw packet data from the data stream. */ public void readPacketData(PacketBuffer buf) throws IOException { this.chunkPosCoord = new ChunkCoordIntPair(buf.readInt(), buf.readInt()); this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[buf.readVarIntFromBuffer()]; for (int i = 0; i < this.changedBlocks.length; ++i) { this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(buf.readShort(), (IBlockState)Block.BLOCK_STATE_IDS.getByValue(buf.readVarIntFromBuffer())); } }
protected void addChunkToPending(ChunkCoordIntPair p_75824_1_, NBTTagCompound p_75824_2_) { if (!this.pendingAnvilChunksCoordinates.contains(p_75824_1_)) { this.chunksToRemove.put(p_75824_1_, p_75824_2_); } ThreadedFileIOBase.getThreadedIOInstance().queueIO(this); }
public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); if (tagCompound.hasKey("Processed", 9)) { NBTTagList nbttaglist = tagCompound.getTagList("Processed", 10); for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); this.field_175791_c.add(new ChunkCoordIntPair(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Z"))); } } }
/** * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set * to false */ public void unloadChunk(int p_73234_1_, int p_73234_2_) { Chunk chunk = this.provideChunk(p_73234_1_, p_73234_2_); if (!chunk.isEmpty()) { chunk.onChunkUnload(); } this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(p_73234_1_, p_73234_2_)); this.chunkListing.remove(chunk); }
/** * loads or generates the chunk at the chunk location specified */ public Chunk loadChunk(int p_73158_1_, int p_73158_2_) { Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); this.chunkListing.add(chunk); chunk.setChunkLoaded(true); return chunk; }