First commit
This commit is contained in:
commit
9b0fe9b1b7
126 changed files with 31043 additions and 0 deletions
196
cubiomes/_cubiomes.pxd
Normal file
196
cubiomes/_cubiomes.pxd
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
# C declarations for the cubiomes library.
|
||||
# Included by _wrapper.pyx via `cimport _cubiomes`.
|
||||
|
||||
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
|
||||
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
|
||||
from libc.stddef cimport size_t
|
||||
|
||||
|
||||
# ─── biomes.h ────────────────────────────────────────────────────────────────
|
||||
|
||||
cdef extern from "biomes.h":
|
||||
int biomeExists(int mc, int id) nogil
|
||||
int isOverworld(int mc, int id) nogil
|
||||
int getDimension(int id) nogil
|
||||
int getMutated(int mc, int id) nogil
|
||||
int getCategory(int mc, int id) nogil
|
||||
int areSimilar(int mc, int id1, int id2) nogil
|
||||
int isMesa(int id) nogil
|
||||
int isShallowOcean(int id) nogil
|
||||
int isDeepOcean(int id) nogil
|
||||
int isOceanic(int id) nogil
|
||||
int isSnowy(int id) nogil
|
||||
|
||||
|
||||
# ─── biomenoise.h → Range ─────────────────────────────────────────────────────
|
||||
|
||||
cdef extern from "biomenoise.h":
|
||||
ctypedef struct Range:
|
||||
int scale
|
||||
int x
|
||||
int z
|
||||
int sx
|
||||
int sz
|
||||
int y
|
||||
int sy
|
||||
|
||||
|
||||
# ─── generator.h ─────────────────────────────────────────────────────────────
|
||||
|
||||
cdef extern from "generator.h":
|
||||
# Only the leading public fields are declared; the rest (large union) are
|
||||
# opaque from Python's perspective but correctly sized by the C header.
|
||||
ctypedef struct Generator:
|
||||
int mc
|
||||
int dim
|
||||
uint32_t flags
|
||||
uint64_t seed
|
||||
uint64_t sha
|
||||
|
||||
void setupGenerator(Generator *g, int mc, uint32_t flags) nogil
|
||||
void applySeed(Generator *g, int dim, uint64_t seed) nogil
|
||||
size_t getMinCacheSize(const Generator *g, int scale,
|
||||
int sx, int sy, int sz) nogil
|
||||
int *allocCache(const Generator *g, Range r) nogil
|
||||
int genBiomes(const Generator *g, int *cache, Range r) nogil
|
||||
int getBiomeAt(const Generator *g, int scale, int x, int y, int z) nogil
|
||||
|
||||
|
||||
# ─── finders.h ───────────────────────────────────────────────────────────────
|
||||
|
||||
cdef extern from "finders.h":
|
||||
|
||||
ctypedef struct Pos:
|
||||
int x
|
||||
int z
|
||||
|
||||
ctypedef struct Pos3:
|
||||
int x
|
||||
int y
|
||||
int z
|
||||
|
||||
ctypedef struct StructureConfig:
|
||||
int32_t salt
|
||||
int8_t regionSize
|
||||
int8_t chunkRange
|
||||
uint8_t structType
|
||||
int8_t dim
|
||||
float rarity
|
||||
|
||||
ctypedef struct StrongholdIter:
|
||||
Pos pos
|
||||
Pos nextapprox
|
||||
int index
|
||||
int ringnum
|
||||
int ringmax
|
||||
int ringidx
|
||||
double angle
|
||||
double dist
|
||||
uint64_t rnds
|
||||
int mc
|
||||
|
||||
ctypedef struct StructureVariant:
|
||||
uint8_t abandoned
|
||||
uint8_t giant
|
||||
uint8_t underground
|
||||
uint8_t airpocket
|
||||
uint8_t basement
|
||||
uint8_t cracked
|
||||
uint8_t size
|
||||
uint8_t start
|
||||
short biome
|
||||
uint8_t rotation
|
||||
uint8_t mirror
|
||||
int16_t x
|
||||
int16_t y
|
||||
int16_t z
|
||||
int16_t sx
|
||||
int16_t sy
|
||||
int16_t sz
|
||||
|
||||
ctypedef struct BiomeFilter:
|
||||
uint64_t tempsToFind
|
||||
uint64_t otempToFind
|
||||
uint64_t majorToFind
|
||||
uint64_t edgesToFind
|
||||
uint64_t raresToFind
|
||||
uint64_t raresToFindM
|
||||
uint64_t shoreToFind
|
||||
uint64_t shoreToFindM
|
||||
uint64_t riverToFind
|
||||
uint64_t riverToFindM
|
||||
uint64_t oceanToFind
|
||||
int specialCnt
|
||||
uint32_t flags
|
||||
uint64_t tempsToExcl
|
||||
uint64_t majorToExcl
|
||||
uint64_t edgesToExcl
|
||||
uint64_t raresToExcl
|
||||
uint64_t raresToExclM
|
||||
uint64_t shoreToExcl
|
||||
uint64_t shoreToExclM
|
||||
uint64_t riverToExcl
|
||||
uint64_t riverToExclM
|
||||
uint64_t biomeToExcl
|
||||
uint64_t biomeToExclM
|
||||
uint64_t biomeToFind
|
||||
uint64_t biomeToFindM
|
||||
uint64_t biomeToPick
|
||||
uint64_t biomeToPickM
|
||||
|
||||
# Static-inline functions (callable because finders.h is included in the
|
||||
# generated C translation unit).
|
||||
uint64_t moveStructure(uint64_t baseSeed, int regX, int regZ) nogil
|
||||
uint64_t getShadow(uint64_t seed) nogil
|
||||
int isSlimeChunk(uint64_t seed, int chunkX, int chunkZ) nogil
|
||||
uint64_t chunkGenerateRnd(uint64_t worldSeed,
|
||||
int chunkX, int chunkZ) nogil
|
||||
Pos getFeaturePos(StructureConfig config, uint64_t seed,
|
||||
int regX, int regZ) nogil
|
||||
Pos getLargeStructurePos(StructureConfig config, uint64_t seed,
|
||||
int regX, int regZ) nogil
|
||||
|
||||
# Regular exported functions
|
||||
int getStructureConfig(int structureType, int mc,
|
||||
StructureConfig *sconf) nogil
|
||||
int getStructurePos(int structureType, int mc, uint64_t seed,
|
||||
int regX, int regZ, Pos *pos) nogil
|
||||
int isViableStructurePos(int structType, Generator *g,
|
||||
int blockX, int blockZ, uint32_t flags) nogil
|
||||
int isViableFeatureBiome(int mc, int structureType, int biomeID) nogil
|
||||
int getMineshafts(int mc, uint64_t seed,
|
||||
int chunkX, int chunkZ, int chunkW, int chunkH,
|
||||
Pos *out, int nout) nogil
|
||||
int getVariant(StructureVariant *sv, int structType, int mc,
|
||||
uint64_t seed, int blockX, int blockZ, int biomeID) nogil
|
||||
|
||||
Pos initFirstStronghold(StrongholdIter *sh, int mc, uint64_t s48) nogil
|
||||
int nextStronghold(StrongholdIter *sh, const Generator *g) nogil
|
||||
|
||||
Pos getSpawn(const Generator *g) nogil
|
||||
Pos estimateSpawn(const Generator *g, uint64_t *rng) nogil
|
||||
|
||||
void setupBiomeFilter(
|
||||
BiomeFilter *bf,
|
||||
int mc, uint32_t flags,
|
||||
const int *required, int requiredLen,
|
||||
const int *excluded, int excludedLen,
|
||||
const int *matchany, int matchanyLen) nogil
|
||||
int checkForBiomes(
|
||||
Generator *g, int *cache, Range r,
|
||||
int dim, uint64_t seed,
|
||||
const BiomeFilter *filter,
|
||||
volatile char *stop) nogil
|
||||
|
||||
Pos locateBiome(
|
||||
const Generator *g, int x, int y, int z, int radius,
|
||||
uint64_t validB, uint64_t validM,
|
||||
uint64_t *rng, int *passes) nogil
|
||||
|
||||
int getBiomeCenters(
|
||||
Pos *pos, int *siz, int nmax,
|
||||
Generator *g, Range r,
|
||||
int match, int minsiz, int tol,
|
||||
volatile char *stop) nogil
|
||||
|
||||
uint64_t getPopulationSeed(int mc, uint64_t ws, int x, int z) nogil
|
||||
Loading…
Add table
Add a link
Reference in a new issue