|
| 1 | +num randPrecision = 100; |
| 2 | + |
| 3 | +num radius = 4.5 + randomInt(randPrecision) / randPrecision; |
| 4 | +num warp = 3; |
| 5 | +num warpFreq = 4; |
| 6 | +num squish = 1 + randomInt(randPrecision) / randPrecision; |
| 7 | +num radiusSquared = pow(radius, 2); |
| 8 | +num yTranslate = 0; |
| 9 | + |
| 10 | +num length = 10 + randomInt(12); |
| 11 | + |
| 12 | +// Direction vector |
| 13 | +num dx = (randomInt(randPrecision) / randPrecision - 0.5) * 1.5; |
| 14 | +num dz = (randomInt(randPrecision) / randPrecision - 0.5) * 1.5; |
| 15 | + |
| 16 | +num mag = sqrt(pow2(dx) + pow2(dz)); |
| 17 | +dx = dx / mag; |
| 18 | +dz = dz / mag; |
| 19 | + |
| 20 | +if (!structure(radius, -radius / squish, 0, "is_rock", "NONE") || |
| 21 | + !structure(-radius, -radius / squish, 0, "is_rock", "NONE") || |
| 22 | + !structure(0, -radius / squish, radius, "is_rock", "NONE") || |
| 23 | + !structure(0, -radius / squish, -radius, "is_rock", "NONE") || |
| 24 | + !structure(dx * (length / 2) + radius, -radius / squish, dz * (length / 2), "is_rock", "NONE") || |
| 25 | + !structure(dx * (length / 2) - radius, -radius / squish, dz * (length / 2), "is_rock", "NONE") || |
| 26 | + !structure(dx * (length / 2), -radius / squish, dz * (length / 2) + radius, "is_rock", "NONE") || |
| 27 | + !structure(dx * (length / 2), -radius / squish, dz * (length / 2) - radius, "is_rock", "NONE") || |
| 28 | + !structure(dx * (-length / 2) + radius, -radius / squish, (dz * (-length / 2)), "is_rock", "NONE") || |
| 29 | + !structure(dx * (-length / 2) - radius, -radius / squish, (dz * (-length / 2)), "is_rock", "NONE") || |
| 30 | + !structure(dx * (-length / 2), -radius / squish, (dz * (-length / 2) + radius), "is_rock", "NONE") || |
| 31 | + !structure(dx * (-length / 2), -radius / squish, (dz * (-length / 2) - radius), "is_rock", "NONE") |
| 32 | +) fail; |
| 33 | + |
| 34 | +for(num l = -length/2; l < length/2; l = l + 1) { |
| 35 | + num xOffset = dx * l; |
| 36 | + num zOffset = dz * l; |
| 37 | + |
| 38 | + for (num x = -radius - warp; x < radius + warp; x = x + 1) { |
| 39 | + for (num y = (-radius - warp) / squish; y < (radius + warp) / squish; y = y + 1) { |
| 40 | + for (num z = -radius - warp; z < radius + warp; z = z + 1) { |
| 41 | + num warpX = warp * sampler("simplex3", |
| 42 | + warpFreq * (x + originX()), |
| 43 | + warpFreq * (y + originY() + 1000), |
| 44 | + warpFreq * (z + originZ())); |
| 45 | + num warpY = warp * sampler("simplex3", |
| 46 | + warpFreq * (x + originX()), |
| 47 | + warpFreq * (y + originY() + 2000), |
| 48 | + warpFreq * (z + originZ())); |
| 49 | + num warpZ = warp * sampler("simplex3", |
| 50 | + warpFreq * (x + originX()), |
| 51 | + warpFreq * (y + originY() + 3000), |
| 52 | + warpFreq * (z + originZ())); |
| 53 | + if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < radiusSquared && y < 0) { |
| 54 | + str setBlock = "minecraft:stone"; |
| 55 | + if (originY() < 10) setBlock = "minecraft:deepslate"; |
| 56 | + if (getBlock(x + xOffset, y + yTranslate, z + zOffset) != "minecraft:air" && |
| 57 | + getBlock(x + xOffset, y + yTranslate, z + zOffset) != "minecraft:water") block(x + xOffset, y + yTranslate, z + zOffset, setBlock, true); |
| 58 | + } |
| 59 | + |
| 60 | + if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < (radiusSquared - 15) && y < 0) { |
| 61 | + block(x + xOffset, y + yTranslate, z + zOffset, "minecraft:water", true, true); |
| 62 | + } |
| 63 | + |
| 64 | + if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < (radiusSquared - 15) && y >= 0) { |
| 65 | + block(x + xOffset, y + yTranslate, z + zOffset, "minecraft:air", true); |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | +} |
| 71 | + |
0 commit comments