Examples of NetServerHandler


Examples of net.minecraft.network.NetServerHandler

  public void processPacket(NetHandler netHandler) {
    if (!(netHandler instanceof NetServerHandler)) {
      Log.warning(netHandler + " sent a movement update before properly connecting. It will be ignored.");
      return;
    }
    NetServerHandler nsh = (NetServerHandler) netHandler;
    EntityPlayerMP entityPlayerMP = nsh.playerEntity;
    sendChunks(entityPlayerMP);
    nsh.handleFlying(this);
  }
View Full Code Here

Examples of net.minecraft.network.NetServerHandler

    sendChunks(entityPlayerMP);
    nsh.handleFlying(this);
  }

  private static void sendChunks(EntityPlayerMP entityPlayerMP) {
    NetServerHandler netServerHandler = entityPlayerMP.playerNetServerHandler;
    if (!entityPlayerMP.loadedChunks.isEmpty()) {
      ArrayList<ChunkCoordIntPair> unpopulatedChunks = new ArrayList<ChunkCoordIntPair>();
      ArrayList<Chunk> chunks = new ArrayList<Chunk>(5);
      ArrayList<TileEntity> tileEntities = new ArrayList<TileEntity>();
      synchronized (entityPlayerMP.loadedChunks) {
        ChunkCoordIntPair chunkCoordIntPair;

        while (chunks.size() < 5 && (chunkCoordIntPair = (ChunkCoordIntPair) entityPlayerMP.loadedChunks.remove(0)) != null) {
          int x = chunkCoordIntPair.chunkXPos;
          int z = chunkCoordIntPair.chunkZPos;

          Chunk chunk = entityPlayerMP.worldObj.getChunkIfExists(x, z);
          if (chunk == null) {
            continue;
          }
          synchronized (chunk) {
            if (!chunk.isTerrainPopulated) {
              unpopulatedChunks.add(chunkCoordIntPair);
              continue;
            }
          }
          chunks.add(chunk);
          tileEntities.addAll(chunk.chunkTileEntityMap.values());
        }
      }
      entityPlayerMP.loadedChunks.addAll(unpopulatedChunks);

      if (!chunks.isEmpty()) {
        netServerHandler.sendPacketToPlayer(new Packet56MapChunks(chunks));
        Iterator iterator = tileEntities.iterator();

        while (iterator.hasNext()) {
          Packet descriptionPacket;
          try {
            descriptionPacket = ((TileEntity) iterator.next()).getDescriptionPacket();
          } catch (Throwable t) {
            Log.warning("A TileEntity failed to provide a description packet", t);
            continue;
          }
          if (descriptionPacket != null) {
            netServerHandler.sendPacketToPlayer(descriptionPacket);
          }
        }

        iterator = chunks.iterator();
View Full Code Here

Examples of net.minecraft.src.NetServerHandler

   private static void updateServerHandler(EntityPlayerMP playerEntity) {
      if(hasXCommands()) {
         return;
      }

      NetServerHandler handler = playerEntity.playerNetServerHandler;

      if(playerEntity.noClip) {
         if(!(handler instanceof ONetServerHandler)) {
            playerEntity.playerNetServerHandler = new ONetServerHandler(MinecraftServer.getServer(),
                     handler.netManager, handler.playerEntity, handler);
         }
      } else {
         if(handler instanceof ONetServerHandler) {
            NetServerHandler oldInstance = ((ONetServerHandler)handler).getOldInstance();
            if(oldInstance != null) {
               handler.netManager.setNetHandler(oldInstance);
               playerEntity.playerNetServerHandler = oldInstance;
            }
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.