#pragma GCC optimize("wrapv") #include struct JavaRandom { int64_t seed; JavaRandom(int64_t seed) : seed((seed ^ 0x5DEECE66DLL) & ((1LL << 48) - 1)) {} int32_t next(int bits) { seed = (seed * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1); return (int32_t)((uint64_t)seed >> (48 - bits)); } int32_t nextInt(int32_t n) { if ((n & -n) == n) // n is a power of 2 return (int32_t)((n * (int64_t)next(31)) >> 31); int32_t bits, val; do { bits = next(31); val = bits % n; } while (bits - val + (n - 1) < 0); return val; } }; bool isSlimeChunk(int64_t worldSeed, int32_t chunkX, int32_t chunkZ) { int64_t seed = worldSeed + (int64_t)(chunkX * chunkX * 4987142) + (int64_t)(chunkX * 5947611) + (int64_t)(chunkZ * chunkZ) * 4392871LL + (int64_t)(chunkZ * 389711) ^ 987234911LL; JavaRandom rand(seed); return rand.nextInt(10) == 0; } #include #include int main(int argc, char *argv[]) { if (argc != 4) { return 1; } int64_t worldSeed = atoll(argv[1]); int32_t chunkX = atoi(argv[2]); int32_t chunkZ = atoi(argv[3]); bool isSlime = isSlimeChunk(worldSeed, chunkX, chunkZ); printf("Is Slime Chunk: %s\n", isSlime ? "true" : "false"); return 0; }