Package net.lightstone.msg

Examples of net.lightstone.msg.LoadChunkMessage


    for (int x = (centralX - Chunk.VISIBLE_RADIUS); x <= (centralX + Chunk.VISIBLE_RADIUS); x++) {
      for (int z = (centralZ - Chunk.VISIBLE_RADIUS); z <= (centralZ + Chunk.VISIBLE_RADIUS); z++) {
        Chunk.Key key = new Chunk.Key(x, z);
        if (!knownChunks.contains(key)) {
          knownChunks.add(key);
          session.send(new LoadChunkMessage(x, z, true));
          session.send(world.getChunks().getChunk(x, z).toMessage());
        }
        previousChunks.remove(key);
      }
    }

    for (Chunk.Key key : previousChunks) {
      session.send(new LoadChunkMessage(key.getX(), key.getZ(), false));
      knownChunks.remove(key);
    }

    previousChunks.clear();
  }
View Full Code Here


  @Override
  public LoadChunkMessage decode(ChannelBuffer buffer) {
    int x = buffer.readInt();
    int z = buffer.readInt();
    boolean loaded = buffer.readByte() == 1;
    return new LoadChunkMessage(x, z, loaded);
  }
View Full Code Here

TOP

Related Classes of net.lightstone.msg.LoadChunkMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.