Esempio n. 1
0
  int serverInitiateHandshake() {
    // Send mod salutation to the client
    // This will be ignored by vanilla clients
    this.state = ConnectionState.AWAITING_HANDSHAKE;
    // Need to start the handler here, so we can send custompayload packets
    serverHandler =
        new NetHandlerPlayServer(scm.getServerInstance(), manager, player) {
          /** Updates the JList with a new model. */
          @Override
          public void update() {
            if (NetworkDispatcher.this.state == ConnectionState.FINALIZING) {
              completeServerSideConnection(ConnectionType.MODDED);
            }
            super.update();
          }
        };
    this.netHandler = serverHandler;
    // NULL the play server here - we restore it further on. If not, there are packets sent before
    // the login
    player.playerNetServerHandler = null;
    // manually for the manager into the PLAY state, so we can send packets later
    this.manager.setConnectionState(EnumConnectionState.PLAY);

    // Return the dimension the player is in, so it can be pre-sent to the client in the ServerHello
    // v2 packet
    // Requires some hackery to the serverconfigmanager and stuff for this to work
    NBTTagCompound playerNBT = scm.getPlayerNBT(player);
    if (playerNBT != null) {
      return playerNBT.getInteger("Dimension");
    } else {
      return 0;
    }
  }