Exemple #1
0
  @Override
  public void start(boolean checkWorlds) {
    super.start(checkWorlds);
    getEventManager().registerEvents(new SpoutClientListener(this), this);
    CommandRegistrationsFactory<Class<?>> commandRegFactory =
        new AnnotatedCommandRegistrationFactory(new SimpleInjector(this));

    // Register commands
    getRootCommand().addSubCommands(this, InputManagementCommands.class, commandRegFactory);

    while (super.getDefaultWorld() == null) {
      try {
        Thread.sleep(10);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      // TODO : Wait until the world is fully loaded
    }

    Transform loc =
        new Transform(
            new Point(super.getDefaultWorld(), 0f, 0f, 0f),
            new Quaternion(0f, 0f, 0f, 0f),
            Vector3.ONE);
    activePlayer =
        new SpoutClientPlayer(
            "Spouty", loc, SpoutConfiguration.VIEW_DISTANCE.getInt() * Chunk.BLOCKS.SIZE);
    activeCamera = activePlayer.add(CameraComponent.class);

    System.out.println("activeWorld: " + super.getDefaultWorld().getName());
    super.getDefaultWorld().spawnEntity(activePlayer);
  }