@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); }
@Override public void init(SpoutApplication args) { boolean inJar = false; try { CodeSource cs = SpoutClient.class.getProtectionDomain().getCodeSource(); inJar = cs.getLocation().toURI().getPath().endsWith(".jar"); } catch (URISyntaxException e) { e.printStackTrace(); } if (inJar) { unpackLwjgl(); } ExecutorService executorBoss = Executors.newCachedThreadPool(new NamedThreadFactory("SpoutServer - Boss", true)); ExecutorService executorWorker = Executors.newCachedThreadPool(new NamedThreadFactory("SpoutServer - Worker", true)); ChannelFactory factory = new NioClientSocketChannelFactory(executorBoss, executorWorker); bootstrap.setFactory(factory); ChannelPipelineFactory pipelineFactory = new CommonPipelineFactory(this, true); bootstrap.setPipelineFactory(pipelineFactory); super.init(args); getScheduler().startRenderThread(); }
public void stopEngine() { if (rendering) { throw new IllegalStateException("Client is still rendering!"); } super.stop(stopMessage); }