public void addWorld(WorldInfo worldInfo) { this.worlds.put(worldInfo.getTitle(), worldInfo); }
@Command(shortDescription = "Make new entity in a given pool", runOnServer = true) public String makeEntity(@CommandParam("The world in which the entity is formed") String worldName) { for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { if (entry.getKey().getTitle().equalsIgnoreCase(worldName)) { EntityRef entityRef = entry.getValue().create(); return "Entity created in " + entry.getKey().getTitle() + " world with id " + entityRef.getId(); } } return worldName + " does not exist"; }
@Command(shortDescription = "Get information about different worlds and " + "entities present in each pool", runOnServer = true) public String getUniverseInfo() { int worldCount = entityManager.getWorldPools().size(); StringBuilder message = new StringBuilder(); message.append("Number of worlds is " + worldCount + "\n"); Map<EngineEntityPool, Long> poolCounts = entityManager.getPoolCounts(); for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { message.append("Pool for " + entry.getKey().getTitle() + " has " + entry.getValue().getActiveEntityCount() + " entities \n"); } return message.toString(); }
@Command(shortDescription = "Moves the last created entity to another pool ", runOnServer = true) public String moveEntity(@CommandParam("The world in which the entity is formed") String worldName, @CommandParam("Id of the entity to be moved") int id) { for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { if (entry.getKey().getTitle().equalsIgnoreCase(worldName)) { if (entityManager.moveToPool(id, entry.getValue())) { return "Entity " + id + " moved to " + entry.getKey().getTitle() + "world"; } else { return "Entity" + id + "could not be moved"; } } } return worldName + " does not exist"; }
@Command(shortDescription = "Check which pool an entity is in", runOnServer = true) public String whereIs(@CommandParam("entity id") long id) { Map<Long, EngineEntityPool> worldPoolMap = entityManager.getPoolMap(); if (worldPoolMap.containsKey(id)) { EngineEntityPool pool = worldPoolMap.get(id); for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { if (entry.getValue() == pool) { return "Entity" + id + " is present in " + entry.getKey().getTitle(); } } } return "Entity" + id + " not found"; }
private String getWorldText(Future<ServerInfoMessage> info) { try { List<String> codedWorldInfo = new ArrayList<>(); ServerInfoMessage serverInfoMessage = info.get(); if (serverInfoMessage == null) { return FontColor.getColored(translationSystem.translate("${engine:menu#connection-failed}"), Color.RED); } for (WorldInfo wi : serverInfoMessage.getWorldInfoList()) { float timeInDays = wi.getTime() / (float) WorldTime.DAY_LENGTH; codedWorldInfo.add(String.format("%s (%.2f days)", wi.getTitle(), timeInDays)); } return Joiner.on('\n').join(codedWorldInfo); } catch (ExecutionException | InterruptedException e) { return FontColor.getColored(translationSystem.translate("${engine:menu#connection-failed}"), Color.RED); } }
public WorldProviderCoreImpl(WorldInfo info, GeneratingChunkProvider chunkProvider, Block unloadedBlock, Context context) { this(info.getTitle(), info.getCustomTitle(), info.getSeed(), info.getTime(), info.getWorldGenerator(), chunkProvider, unloadedBlock, context); }
WorldInfo worldInfo = gameManifest.getWorldInfo(TerasologyConstants.MAIN_WORLD); config.getUniverseConfig().addWorldManager(worldInfo); config.getUniverseConfig().setSpawnWorldTitle(worldInfo.getTitle()); config.getUniverseConfig().setUniverseSeed(gameManifest.getSeed());
config.getUniverseConfig().setSpawnWorldTitle(worldInfo.getTitle()); config.getUniverseConfig().setUniverseSeed(universeWrapper.getSeed()); return gameManifest;