Multi noise support for scarpet (#1176)

* fix: infinite params bug in AnnotationParser
feat: scarpet function query_noise()

* refactor: remove Method reflection

* fix: use BiomeCoords

* update: game version to 1.18-pre5

* feat: biome lookup from multinoise
fix: noise lookup wrongly scaled

* fix: jagged noise. Thanks, @Starmute

* fix: cave cheese and layer. Thanks, @Starmute

* fix: revert formatting
fix: caveLayer and caveCheese
feat: add terrain support

* more formatting reverts

* fix mapping issue

* use BlockPos

* docs: add documentation for query_noise

* docs: add documentation for biome(noise_map)
This commit is contained in:
Crec0 authored and GitHub committed 2021-11-30 02:47:28 +01:00
1 parent 6c7ac72c3e
commit aa57b586cb
8 files changed
+388 -9

No files matched your search

+27 -1
View File
@@ -346,12 +346,15 @@ poi(x,y,z,5) => [] // nothing around
poi(x,y,z,5) => [['nether_portal',0,[7,8,9]],['nether_portal',0,[7,9,9]]] // two portal blocks in the range
</pre>
### `biome()` `biome(name)` `biome(block)` `biome(block/name, feature)`
### `biome()` `biome(name)` `biome(block)` `biome(block/name, feature)`, `biome(noise_map)`
Without arguments, returns the list of biomes in the world.
With block, or name, returns the name of the biome in that position, or throws `'unknown_biome'` if provided biome or block are not valid.
if passed a map of `continentalness`, `depth`, `erosion`, `humidity`, `temperature`, `weirdness`, returns the biome that exists at those noise values.
Note: Have to pass all 6 of the mentioned noise types and only these noise types for it to evaluate a biome.
With an optional feature, it returns value for the specified attribute for that biome. Available and queryable features include:
* `'top_material'`: unlocalized block representing the top surface material
* `'under_material'`: unlocalized block representing what sits below topsoil
@@ -502,6 +505,29 @@ Returns the map colour of a block at position. One of:
`'brown_terracotta'`, `'green_terracotta'`, `'red_terracotta'`, `'black_terracotta'`,
`'crimson_nylium'`, `'crimson_stem'`, `'crimson_hyphae'`, `'warped_nylium'`, `'warped_stem'`, `'warped_hyphae'`, `'warped_wart'`
### `query_noise(pos, ...type?)`
Queries the multi noise value(s) on the given position.
If no type is passed, returns a map of `continentalness`, `depth`, `erosion`, `humidity`, `temperature`, `weirdness`.
Otherwise, returns the map of that specific noise.
<pre>
// without type
query_noise(pos) => {continentalness: 0.445300012827, erosion: 0.395399987698, temperature: 0.165399998426, ...}
// passing type as multiple arguments
query_noise(pos, 'pillarRareness', 'aquiferBarrier') => {aquiferBarrier: -0.205013844481, pillarRareness: 1.04772473438}
// passing types as a list with unpacking operator
query_noise(pos, ...['spaghetti3dFirst', 'spaghetti3dSecond']) => {spaghetti3dFirst: -0.186052125186, spaghetti3dSecond: 0.211626790923}
</pre>
Available types:
`aquiferBarrier`, `aquiferFluidLevelFloodedness`, `aquiferFluidLevelSpread`, `aquiferLava`, `caveCheese`,
`caveEntrance`, `caveLayer`, `continentalness`, `depth`, `erosion`, `humidity`, `island`, `jagged`, `oreGap`,
`pillar`, `pillarRareness`, `pillarThickness`, `shiftX`, `shiftY`, `shiftZ`, `spaghetti2d`, `spaghetti2dElevation`,
`spaghetti2dModulator`, `spaghetti2dThickness`, `spaghetti3d`, `spaghetti3dFirst`, `spaghetti3dRarity`,
`spaghetti3dSecond`, `spaghetti3dThickness`, `spaghettiRoughness`, `spaghettiRoughnessModulator`, `temperature`,
`terrain`, `terrainFactor`, `terrainOffset`, `terrainPeaks`, `weirdness`
### `loaded(pos)`