Fix #176 switching between choices

This commit is contained in:
Misode
2021-10-06 00:02:06 +02:00
parent d883459dba
commit 0ff7de3aea
7 changed files with 22 additions and 33 deletions

View File

@@ -1,8 +1,9 @@
import { DataModel } from '@mcschema/core'
import type { BiomeSource, Climate, NoiseOctaves } from 'deepslate'
import { FixedBiome, MultiNoise, NoiseGeneratorSettings, NoiseSampler, NormalNoise, Random } from 'deepslate'
import { fetchPreset } from '../DataFetcher'
import type { VersionId } from '../Schemas'
import { clamp, deepClone, deepEqual, square, stringToColor, unwrapLists } from '../Utils'
import { clamp, deepClone, deepEqual, square, stringToColor } from '../Utils'
type BiomeColors = Record<string, number[]>
type BiomeSourceOptions = {
@@ -90,7 +91,7 @@ async function getBiomeSource(state: any, options: BiomeSourceOptions): Promise<
state = options.version === '1.18' ? await OverworldPreset18() : state
break
}
state = unwrapLists(state)
state = DataModel.unwrapLists(state)
if (options.version === '1.18') {
return MultiNoise.fromJson(state)
} else {

View File

@@ -1,6 +1,7 @@
import { DataModel } from '@mcschema/core'
import { PerlinNoise, Random } from 'deepslate'
import type { VersionId } from '../Schemas'
import { clamp, stringToColor, unwrapLists } from '../Utils'
import { clamp, stringToColor } from '../Utils'
type BlockPos = [number, number, number]
type Placement = [BlockPos, number]
@@ -49,7 +50,7 @@ export function decorator(state: any, img: ImageData, options: DecoratorOptions)
for (let x = 0; x < options.size[0] / 16; x += 1) {
for (let z = 0; z < options.size[2] / 16; z += 1) {
getPlacements([x * 16, 0, z * 16], unwrapLists(state), ctx)
getPlacements([x * 16, 0, z * 16], DataModel.unwrapLists(state), ctx)
}
}

View File

@@ -1,8 +1,9 @@
import { DataModel } from '@mcschema/core'
import type { BlockPos, BlockState } from 'deepslate'
import { Chunk, ChunkPos, FixedBiome, NoiseChunkGenerator, NoiseGeneratorSettings } from 'deepslate'
import type { VersionId } from '../Schemas'
import { checkVersion } from '../Schemas'
import { deepClone, deepEqual, unwrapLists } from '../Utils'
import { deepClone, deepEqual } from '../Utils'
import { NoiseChunkGenerator as OldNoiseChunkGenerator } from './noise/NoiseChunkGenerator'
export type NoiseSettingsOptions = {
@@ -70,7 +71,7 @@ export function noiseSettings(state: any, img: ImageData, options: NoiseSettings
}
function getCached(state: unknown, options: NoiseSettingsOptions) {
const settings = NoiseGeneratorSettings.fromJson(unwrapLists(state))
const settings = NoiseGeneratorSettings.fromJson(DataModel.unwrapLists(state))
// Temporary fix for slides
settings.noise.bottomSlide.target *= 128
settings.noise.topSlide.target *= 128