Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Chunk oldChunk = world.getChunkFromBlockCoords(position);
- if (world instanceof WorldServer)
- {
- WorldServer worldServer = (WorldServer) world;
- ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer;
- IChunkProvider chunkProviderGenerate = chunkProviderServer.serverChunkGenerator;
- Chunk newChunk = chunkProviderGenerate.provideChunk(oldChunk.xPosition, oldChunk.zPosition);
- BlockPos chunkPos = new BlockPos(oldChunk.xPosition * 16, 0, oldChunk.zPosition * 16);
- for (int x = 0; x < 16; x++)
- {
- for (int z = 0; z < 16; z++)
- {
- for (int y = 0; y < world.getHeight(); y++)
- {
- BlockPos posInChunk = new BlockPos(x, y, z);
- BlockPos pos = chunkPos.add(posInChunk);
- IBlockState state = newChunk.getBlockState(posInChunk);
- worldServer.setBlockState(pos, state, 2);
- TileEntity tileEntity = newChunk.getTileEntity(posInChunk, Chunk.EnumCreateEntityType.IMMEDIATE);
- if (tileEntity != null)
- {
- worldServer.setTileEntity(pos, tileEntity);
- }
- }
- }
- }
- ObfuscationReflectionHelper.setPrivateValue(Chunk.class, oldChunk, false, "field_76646_k", "isTerrainPopulated");
- chunkProviderGenerate.populate(chunkProviderGenerate, oldChunk.xPosition, oldChunk.zPosition);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement