/** * Determines a spawn position suitable for this world, such as that used to spawn the initial player. * The default implementation simply picks a position in the very center of the world. * * @param entity the entity related to spawning, if needed (or not). Can be ignored. * @return the chosen position */ default Vector3f getSpawnPosition(EntityRef entity) { return new FixedSpawner(0, 0).getSpawnPosition(getWorld(), entity); } }
public FacetLayerPreview(ModuleEnvironment environment, WorldGenerator worldGenerator) { this.worldGenerator = worldGenerator; World world = worldGenerator.getWorld(); Set<Class<? extends WorldFacet>> facets = world.getAllFacets(); facetLayers = FacetLayers.createLayersFor(facets, environment); }
@Override public boolean step() { WorldGenerator worldGenerator = context.get(WorldGenerator.class); worldGenerator.initialize(); WorldRenderer worldRenderer = context.get(WorldRenderer.class); worldRenderer.getActiveCamera().setReflectionHeight(worldGenerator.getWorld().getSeaLevel() + 0.5f); return true; }
private Region createRegion(ImmutableVector2i chunkPos) { int vertChunks = 4; // 4 chunks high (relevant for trees, etc) int minX = chunkPos.getX() * TILE_SIZE_X; int minZ = chunkPos.getY() * TILE_SIZE_Y; int height = vertChunks * ChunkConstants.SIZE_Y; Region3i area3d = Region3i.createFromMinAndSize(new Vector3i(minX, 0, minZ), new Vector3i(TILE_SIZE_X, height, TILE_SIZE_Y)); World world = worldGenerator.getWorld(); Region region = world.getWorldData(area3d); return region; }
final int offY = -height * scale / 2; worldGenerator.getWorld(); // trigger building the World now
serverInfoMessageBuilder.setReflectionHeight(worldGen.getWorld().getSeaLevel() + 0.5f);