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);
}
}
}
java类net.minecraft.world.ChunkCoordIntPair的实例源码
CraftWorld.java 文件源码
项目:Uranium
阅读 21
收藏 0
点赞 0
评论 0
AnvilChunkLoader.java 文件源码
项目:DecompiledMinecraft
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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);
}
MapGenStructure.java 文件源码
项目:DecompiledMinecraft
阅读 25
收藏 0
点赞 0
评论 0
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;
}
MapGenStronghold.java 文件源码
项目:BaseClient
阅读 22
收藏 0
点赞 0
评论 0
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);
}
}
}
AnvilChunkLoader.java 文件源码
项目:BaseClient
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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);
}
AnvilChunkLoader.java 文件源码
项目:DecompiledMinecraft
阅读 20
收藏 0
点赞 0
评论 0
/**
* 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);
}
MapGenStructure.java 文件源码
项目:DecompiledMinecraft
阅读 36
收藏 0
点赞 0
评论 0
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;
}
AnvilChunkLoader.java 文件源码
项目:BaseClient
阅读 17
收藏 0
点赞 0
评论 0
/**
* 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);
}
MapGenStructure.java 文件源码
项目:BaseClient
阅读 28
收藏 0
点赞 0
评论 0
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;
}
ChunkProviderServer.java 文件源码
项目:BaseClient
阅读 19
收藏 0
点赞 0
评论 0
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_)));
}
}
MapGenStronghold.java 文件源码
项目:DecompiledMinecraft
阅读 22
收藏 0
点赞 0
评论 0
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);
}
}
}
MapGenStronghold.java 文件源码
项目:DecompiledMinecraft
阅读 24
收藏 0
点赞 0
评论 0
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;
}
WorldClient.java 文件源码
项目:BaseClient
阅读 19
收藏 0
点赞 0
评论 0
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;
}
}
}
}
MapGenStructure.java 文件源码
项目:DecompiledMinecraft
阅读 24
收藏 0
点赞 0
评论 0
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);
}
}
}
}
}
}
}
StructureOceanMonument.java 文件源码
项目:DecompiledMinecraft
阅读 23
收藏 0
点赞 0
评论 0
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);
}
ChunkProviderServer.java 文件源码
项目:DecompiledMinecraft
阅读 22
收藏 0
点赞 0
评论 0
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_)));
}
}
ChunkProviderGenerate.java 文件源码
项目:DecompiledMinecraft
阅读 25
收藏 0
点赞 0
评论 0
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;
}
S22PacketMultiBlockChange.java 文件源码
项目:DecompiledMinecraft
阅读 19
收藏 0
点赞 0
评论 0
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);
}
}
S22PacketMultiBlockChange.java 文件源码
项目:DecompiledMinecraft
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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()));
}
}
MapGenStronghold.java 文件源码
项目:DecompiledMinecraft
阅读 27
收藏 0
点赞 0
评论 0
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);
}
}
}
MapGenStronghold.java 文件源码
项目:DecompiledMinecraft
阅读 23
收藏 0
点赞 0
评论 0
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;
}
AnvilChunkLoader.java 文件源码
项目:BaseClient
阅读 20
收藏 0
点赞 0
评论 0
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);
}
MapGenStructure.java 文件源码
项目:DecompiledMinecraft
阅读 23
收藏 0
点赞 0
评论 0
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);
}
}
}
}
}
}
}
ChunkProviderGenerate.java 文件源码
项目:BaseClient
阅读 25
收藏 0
点赞 0
评论 0
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;
}
StructureOceanMonument.java 文件源码
项目:DecompiledMinecraft
阅读 28
收藏 0
点赞 0
评论 0
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);
}
StructureOceanMonument.java 文件源码
项目:DecompiledMinecraft
阅读 31
收藏 0
点赞 0
评论 0
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")));
}
}
}
ChunkProviderServer.java 文件源码
项目:DecompiledMinecraft
阅读 20
收藏 0
点赞 0
评论 0
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_)));
}
}
ChunkProviderGenerate.java 文件源码
项目:DecompiledMinecraft
阅读 23
收藏 0
点赞 0
评论 0
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;
}
S22PacketMultiBlockChange.java 文件源码
项目:DecompiledMinecraft
阅读 17
收藏 0
点赞 0
评论 0
/**
* 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()));
}
}
ChunkProviderClient.java 文件源码
项目:DecompiledMinecraft
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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);
}