Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int id;
- net.minecraft.server.Chunk mcChunk;
- int j1;
- ChunkSection[] sections = null;
- ChunkSection chunksection;
- List<Player> playerList = world.getPlayers();
- for(Chunk c: world.getLoadedChunks())
- {
- mcChunk = ((CraftChunk)c).getHandle();
- try
- {
- sections = (ChunkSection[])f.get(mcChunk);
- }
- catch(Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- chunksection = sections[at.waterHeight >> 4];
- if(chunksection == null)
- chunksection = sections[at.waterHeight >> 4] = new ChunkSection(at.waterHeight >> 4 << 4);
- for(int x = 0; x < 16; x++)
- {
- for(int z = 0; z < 16; z++)
- {
- j1 = z << 4 | x;
- if(at.waterHeight > mcChunk.b[j1] - 1)
- mcChunk.b[j1] = -999;
- id = chunksection.a(x, at.waterHeight & 15, z);
- if(up)
- {
- if(id == air || id == leaves)
- {
- chunksection.a(x, at.waterHeight & 15, z, water);
- if(id == leaves)
- Block.byId[leaves].remove(mcChunk.world, mcChunk.x * 16 + x, at.waterHeight, mcChunk.z * 16 + z);
- }
- else if(id == grass)
- {
- chunksection.a(x, at.waterHeight & 15, z, dirt);
- Block.byId[id].remove(mcChunk.world, mcChunk.x * 16 + x, at.waterHeight, mcChunk.z * 16 + z);
- }
- }
- else if(id == water)
- {
- chunksection.a(x, at.waterHeight & 15, z, air);
- Block.byId[id].remove(mcChunk.world, mcChunk.x * 16 + x, at.waterHeight, mcChunk.z * 16 + z);
- }
- mcChunk.l = true;
- }
- }
- Packet51MapChunk packet = new Packet51MapChunk(mcChunk, true, 0);
- for(Player p: playerList)
- ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(packet);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement