Advertisement
Guest User

Untitled

a guest
May 4th, 2012
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1.     int id;
  2.     net.minecraft.server.Chunk mcChunk;
  3.     int j1;
  4.     ChunkSection[] sections = null;
  5.     ChunkSection chunksection;
  6.     List<Player> playerList = world.getPlayers();
  7.     for(Chunk c: world.getLoadedChunks())
  8.     {
  9.       mcChunk = ((CraftChunk)c).getHandle();
  10.       try
  11.       {
  12.         sections = (ChunkSection[])f.get(mcChunk);
  13.       }
  14.       catch(Exception e)
  15.       {
  16.         // TODO Auto-generated catch block
  17.         e.printStackTrace();
  18.       }
  19.       chunksection = sections[at.waterHeight >> 4];
  20.       if(chunksection == null)
  21.         chunksection = sections[at.waterHeight >> 4] = new ChunkSection(at.waterHeight >> 4 << 4);
  22.      
  23.       for(int x = 0; x < 16; x++)
  24.       {
  25.         for(int z = 0; z < 16; z++)
  26.         {
  27.           j1 = z << 4 | x;
  28.          
  29.           if(at.waterHeight > mcChunk.b[j1] - 1)
  30.             mcChunk.b[j1] = -999;
  31.           id = chunksection.a(x, at.waterHeight & 15, z);
  32.           if(up)
  33.           {
  34.             if(id == air || id == leaves)
  35.             {
  36.               chunksection.a(x, at.waterHeight & 15, z, water);
  37.               if(id == leaves)
  38.                 Block.byId[leaves].remove(mcChunk.world, mcChunk.x * 16 + x, at.waterHeight, mcChunk.z * 16 + z);
  39.             }
  40.             else if(id == grass)
  41.             {
  42.               chunksection.a(x, at.waterHeight & 15, z, dirt);
  43.               Block.byId[id].remove(mcChunk.world, mcChunk.x * 16 + x, at.waterHeight, mcChunk.z * 16 + z);
  44.             }
  45.           }
  46.           else if(id == water)
  47.           {
  48.             chunksection.a(x, at.waterHeight & 15, z, air);
  49.             Block.byId[id].remove(mcChunk.world, mcChunk.x * 16 + x, at.waterHeight, mcChunk.z * 16 + z);
  50.           }
  51.           mcChunk.l = true;
  52.         }
  53.       }
  54.       Packet51MapChunk packet = new Packet51MapChunk(mcChunk, true, 0);
  55.       for(Player p: playerList)
  56.         ((CraftPlayer)p).getHandle().netServerHandler.sendPacket(packet);
  57.     }
  58.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement