@Override public void set(BaseVector2i pos, T value) { set(pos.getX(), pos.getY(), value); }
private Optional<Vector3f> findSpawnPos(Vector3f targetPos, float entityHeight) { int targetBlockX = TeraMath.floorToInt(targetPos.x); int targetBlockY = TeraMath.floorToInt(targetPos.y); int targetBlockZ = TeraMath.floorToInt(targetPos.z); Vector2i center = new Vector2i(targetBlockX, targetBlockZ); for (BaseVector2i pos : SpiralIterable.clockwise(center).maxRadius(32).scale(2).build()) { Vector3i testPos = new Vector3i(pos.getX(), targetBlockY, pos.getY()); Vector3i spawnPos = findOpenVerticalPosition(testPos, entityHeight); if (spawnPos != null) { return Optional.of(new Vector3f(spawnPos.getX(), spawnPos.getY() + entityHeight, spawnPos.getZ())); } } return Optional.empty(); }
switch (configuration.wrapMode) { case CLAMP: mapX0 = TeraMath.clamp(pos.getX(), 0, mapWidth * xzScale - 1) / xzScale; mapZ0 = TeraMath.clamp(pos.getY(), 0, mapHeight * xzScale - 1) / xzScale; mapX1 = TeraMath.clamp(mapX0 + 1, 0, mapWidth - 1); break; case REPEAT: mapX0 = IntMath.mod(pos.getX(), mapWidth * xzScale) / xzScale; mapZ0 = IntMath.mod(pos.getY(), mapHeight * xzScale) / xzScale; mapX1 = IntMath.mod(mapX0 + 1, mapWidth); double p01 = heightmap[mapX0][mapZ1]; float relX = IntMath.mod(pos.getX(), xzScale) / (float) xzScale; float relZ = IntMath.mod(pos.getY(), xzScale) / (float) xzScale;
SpiralIterable spiral = SpiralIterable.clockwise(pos).maxRadius(spiralRad).scale(2).build(); for (BaseVector2i test : spiral) { float val = surfaceHeightFacet.getWorld(test.getX(), test.getY()); int height = TeraMath.floorToInt(val); if (height >= seaLevel) { return new Vector3f(test.getX(), height, test.getY());
Chunk chunk = new ChunkImpl(chunkPos.getX(), 0, chunkPos.getY(), blockManager, biomeManager, extraDataManager) { @Override public Block setBlock(int x, int y, int z, Block block) {