minerender 2.1.0-alpha.114 → 2.1.0-alpha.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +199 -13
- package/dist/browser/index.d.ts +199 -13
- package/dist/browser/index.js +939 -231
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +885 -177
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/section.worker.js +6 -3
- package/dist/browser/section.worker.js.map +1 -1
- package/dist/browser/section.worker.mjs +6 -3
- package/dist/browser/section.worker.mjs.map +1 -1
- package/dist/bundle.js +903 -139
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +199 -13
- package/dist/node/index.d.ts +199 -13
- package/dist/node/index.js +944 -231
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +887 -177
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, ShaderMaterial, Texture, Camera, MOUSE, TOUCH, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
2
|
+
import { Vector3, PixelFormat, BoxGeometry, Material, ColorRepresentation, MeshBasicMaterial, Mesh, Euler, Vector2, BufferAttribute, Float32BufferAttribute, BufferGeometry, Object3D, Box3, InstancedMesh, PerspectiveCamera, OrthographicCamera, Matrix4, Box2, Scene, Object3DEventMap, ShaderMaterial, Texture, Camera, MOUSE, TOUCH, Controls, WebGLRenderer, EventDispatcher, Raycaster, Intersection, Group, DataTexture, CanvasTexture, InterleavedBufferAttribute, TrianglesDrawModes, Line, Points } from 'three';
|
|
3
3
|
import * as nodeCanvas from 'canvas';
|
|
4
4
|
import { ImageData as ImageData$1, CanvasRenderingContext2D } from 'canvas';
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
@@ -1067,6 +1067,24 @@ declare class Assets {
|
|
|
1067
1067
|
static getBlockState(key: AssetKey): Promise<Maybe<BlockState>>;
|
|
1068
1068
|
}
|
|
1069
1069
|
|
|
1070
|
+
type BiomeColorKind = "grass" | "foliage" | "dry_foliage" | "water";
|
|
1071
|
+
/** Climate and color fields from a biome registry entry. Other registry fields are ignored. */
|
|
1072
|
+
interface Biome extends MinecraftAsset {
|
|
1073
|
+
temperature: number;
|
|
1074
|
+
downfall: number;
|
|
1075
|
+
effects: Partial<Record<`${BiomeColorKind}_color`, number | string>> & {
|
|
1076
|
+
grass_color_modifier?: "none" | "dark_forest" | "swamp";
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
/** Resolves biome colors through the selected version's registry and resource-pack colormaps. */
|
|
1080
|
+
declare class Biomes {
|
|
1081
|
+
/** Loads a biome registry entry, or returns `undefined` when no source provides it. */
|
|
1082
|
+
static get(id: string, origin?: AssetKey): Promise<Biome | undefined>;
|
|
1083
|
+
/** Returns packed sRGB, or `undefined` when the biome or requested water color is missing. */
|
|
1084
|
+
static getColor(id: string, kind: BiomeColorKind, origin?: AssetKey, x?: number, z?: number): Promise<number | undefined>;
|
|
1085
|
+
private static parseColor;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1070
1088
|
type BlockStatePropertyValue = string | boolean | number;
|
|
1071
1089
|
/** A vanilla block property's default and allowed values, loaded through {@link BlockStates.getDefaultState}. */
|
|
1072
1090
|
interface BlockStateProperty {
|
|
@@ -1290,6 +1308,7 @@ interface MineRenderDatasets {
|
|
|
1290
1308
|
source: "grass" | "stem" | "redstone";
|
|
1291
1309
|
}) & {
|
|
1292
1310
|
untinted?: number[];
|
|
1311
|
+
biome?: BiomeColorKind;
|
|
1293
1312
|
}>;
|
|
1294
1313
|
fluids: Record<string, {
|
|
1295
1314
|
kind: "water" | "lava";
|
|
@@ -1635,6 +1654,8 @@ declare class BlockObject extends SceneObject {
|
|
|
1635
1654
|
private _fluidKey?;
|
|
1636
1655
|
private _fluidRules;
|
|
1637
1656
|
private _fluidSampler?;
|
|
1657
|
+
private readonly biomePosition?;
|
|
1658
|
+
private waterTint?;
|
|
1638
1659
|
private _fluidModel?;
|
|
1639
1660
|
private _entities;
|
|
1640
1661
|
private _entityPlacement;
|
|
@@ -1701,6 +1722,10 @@ interface BlockObjectOptions extends ModelObjectOptions {
|
|
|
1701
1722
|
initialState?: BlockStateProperties;
|
|
1702
1723
|
/** Absolute block coordinates for repeatable variants, copied at construction. Omit for random previews. */
|
|
1703
1724
|
variantPosition?: TripleArray;
|
|
1725
|
+
/** Saved biome ID used for automatic grass, foliage, and water colors. */
|
|
1726
|
+
biome?: string;
|
|
1727
|
+
/** World block coordinates used by biome grass modifiers. Copied at construction; defaults to the origin. */
|
|
1728
|
+
biomePosition?: TripleArray;
|
|
1704
1729
|
}
|
|
1705
1730
|
declare function isBlockObject(obj: any): obj is BlockObject;
|
|
1706
1731
|
|
|
@@ -2188,10 +2213,14 @@ declare class BlockStateResolver {
|
|
|
2188
2213
|
static rotation(variant: BlockStateVariant): Euler;
|
|
2189
2214
|
}
|
|
2190
2215
|
|
|
2191
|
-
/** Supplies block
|
|
2216
|
+
/** Supplies block tint colors from versioned rendering rules and the active resource pack. */
|
|
2192
2217
|
declare class BlockTints {
|
|
2193
|
-
/**
|
|
2194
|
-
static
|
|
2218
|
+
/** Returns a block's versioned biome color source, leaving fixed-color blocks unchanged. */
|
|
2219
|
+
static biomeSource(key?: AssetKey): Promise<BiomeColorKind | undefined>;
|
|
2220
|
+
/** Resolves one block's biome tint at world block coordinates, without biome blending. */
|
|
2221
|
+
static getBiomeColor(key?: AssetKey, biome?: string, position?: Readonly<TripleArray>): Promise<number | undefined>;
|
|
2222
|
+
/** Resolves used tint indices from biome or preview colors; explicit tints take precedence. */
|
|
2223
|
+
static get(key: AssetKey | undefined, state: BlockStateProperties, model: Model, tints?: Record<number, number>, biomeColor?: number | (() => Promise<number | undefined>)): Promise<Record<number, number> | undefined>;
|
|
2195
2224
|
}
|
|
2196
2225
|
|
|
2197
2226
|
/** Saved fluid levels and solid neighbors determine the geometry shared by an instance pool. */
|
|
@@ -2601,6 +2630,7 @@ declare class Caching {
|
|
|
2601
2630
|
static readonly bannerPatternCache: AsyncLoadingCache<CacheKey, BannerPattern>;
|
|
2602
2631
|
static readonly mineRenderDataCache: AsyncLoadingCache<CacheKey, unknown>;
|
|
2603
2632
|
static readonly usernameUuidCache: AsyncLoadingCache<CacheKey, string>;
|
|
2633
|
+
static readonly biomeCache: AsyncLoadingCache<CacheKey, Biome>;
|
|
2604
2634
|
private static createAssetCache;
|
|
2605
2635
|
/** Every cache above, so clear()/end() can never fall out of sync with the field list again. */
|
|
2606
2636
|
private static get all();
|
|
@@ -2879,6 +2909,112 @@ declare class MapControls extends OrbitControls {
|
|
|
2879
2909
|
constructor(object: Camera, domElement?: HTMLElement);
|
|
2880
2910
|
}
|
|
2881
2911
|
|
|
2912
|
+
/** Events dispatched by {@link FlyControls}. */
|
|
2913
|
+
interface FlyControlsEventMap {
|
|
2914
|
+
/** The camera moved or turned. */
|
|
2915
|
+
change: {};
|
|
2916
|
+
/** Mouse look captured the pointer. */
|
|
2917
|
+
lock: {};
|
|
2918
|
+
/** Mouse look released the pointer. */
|
|
2919
|
+
unlock: {};
|
|
2920
|
+
}
|
|
2921
|
+
/** Movement actions that {@link FlyControls.keys} binds to `KeyboardEvent.code` values. */
|
|
2922
|
+
type FlyAction = "forward" | "back" | "left" | "right" | "up" | "down" | "sprint";
|
|
2923
|
+
/**
|
|
2924
|
+
* Creative-flight camera controls: WASD moves horizontally along the view direction, space and shift
|
|
2925
|
+
* move up and down, control sprints, and the mouse turns the camera (pointer lock, or drag).
|
|
2926
|
+
*
|
|
2927
|
+
* Call {@link FlyControls.update} with the elapsed seconds once per frame; the `change` event marks the
|
|
2928
|
+
* renderer dirty while keys are held. Speeds use scene units (16 per block). The element becomes focusable
|
|
2929
|
+
* and keys apply while it has focus or the pointer is locked. The wheel changes the speed, as in vanilla
|
|
2930
|
+
* spectator mode. Touch input uses the left half of the element as a joystick and the right half for looking.
|
|
2931
|
+
*/
|
|
2932
|
+
declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
|
|
2933
|
+
readonly isFlyControls: true;
|
|
2934
|
+
/** Horizontal and vertical speed in scene units per second; vanilla creative flight by default. */
|
|
2935
|
+
movementSpeed: number;
|
|
2936
|
+
/** Speed multiplier while the sprint key is held. */
|
|
2937
|
+
sprintMultiplier: number;
|
|
2938
|
+
/** Radians per pixel of pointer movement. */
|
|
2939
|
+
lookSpeed: number;
|
|
2940
|
+
/** Smooth acceleration and deceleration, approximating vanilla flight momentum. */
|
|
2941
|
+
enableDamping: boolean;
|
|
2942
|
+
/** Portion of the remaining velocity change applied per 60 Hz frame (0–1) when damping is enabled. */
|
|
2943
|
+
dampingFactor: number;
|
|
2944
|
+
/** Capture the pointer on click so the mouse turns the camera without dragging; dragging works regardless. */
|
|
2945
|
+
pointerLock: boolean;
|
|
2946
|
+
/** Scroll the wheel to change `movementSpeed` within `speedRange`. */
|
|
2947
|
+
enableWheelSpeed: boolean;
|
|
2948
|
+
/** Minimum and maximum `movementSpeed` reachable with the wheel. */
|
|
2949
|
+
speedRange: [number, number];
|
|
2950
|
+
/** Touch joystick travel in CSS pixels for full speed. */
|
|
2951
|
+
joystickRadius: number;
|
|
2952
|
+
/** Key bindings by `KeyboardEvent.code`. */
|
|
2953
|
+
keys: Record<FlyAction, string[]>;
|
|
2954
|
+
private readonly _pressed;
|
|
2955
|
+
private readonly _velocity;
|
|
2956
|
+
private readonly _lastPosition;
|
|
2957
|
+
private readonly _lastQuaternion;
|
|
2958
|
+
private _position0;
|
|
2959
|
+
private _quaternion0;
|
|
2960
|
+
private _dragPointer?;
|
|
2961
|
+
private _dragMoved;
|
|
2962
|
+
private _joystick?;
|
|
2963
|
+
private _locked;
|
|
2964
|
+
private _lastTime?;
|
|
2965
|
+
private readonly _onKeyDown;
|
|
2966
|
+
private readonly _onKeyUp;
|
|
2967
|
+
private readonly _onPointerDown;
|
|
2968
|
+
private readonly _onPointerMove;
|
|
2969
|
+
private readonly _onPointerUp;
|
|
2970
|
+
private readonly _onPointerLockChange;
|
|
2971
|
+
private readonly _onContextMenu;
|
|
2972
|
+
private readonly _onWheel;
|
|
2973
|
+
private readonly _onBlur;
|
|
2974
|
+
constructor(camera: Camera, domElement?: HTMLElement | null);
|
|
2975
|
+
connect(element: HTMLElement): void;
|
|
2976
|
+
disconnect(): void;
|
|
2977
|
+
dispose(): void;
|
|
2978
|
+
/** Whether mouse look currently owns the pointer. */
|
|
2979
|
+
get locked(): boolean;
|
|
2980
|
+
/** Requests pointer capture; browsers only allow this from a user gesture. */
|
|
2981
|
+
lock(): void;
|
|
2982
|
+
/** Releases a captured pointer. */
|
|
2983
|
+
unlock(): void;
|
|
2984
|
+
/** Stores the camera pose that {@link reset} restores. */
|
|
2985
|
+
saveState(): void;
|
|
2986
|
+
/** Restores the saved camera pose and stops movement. */
|
|
2987
|
+
reset(): void;
|
|
2988
|
+
/** Horizontal yaw in radians, where zero looks toward -Z. */
|
|
2989
|
+
get yaw(): number;
|
|
2990
|
+
/** Vertical pitch in radians, positive looking up. */
|
|
2991
|
+
get pitch(): number;
|
|
2992
|
+
/** Turns the camera; pitch is clamped to straight up and down. */
|
|
2993
|
+
setRotation(yaw: number, pitch: number): void;
|
|
2994
|
+
/** Points the camera at a position without rolling it. */
|
|
2995
|
+
lookAt(target: Vector3): void;
|
|
2996
|
+
/** Whether an action's key is held. */
|
|
2997
|
+
isPressed(action: FlyAction): boolean;
|
|
2998
|
+
/**
|
|
2999
|
+
* Advances movement by `delta` seconds (measured since the previous call when omitted)
|
|
3000
|
+
* and dispatches `change` when the camera moved.
|
|
3001
|
+
*/
|
|
3002
|
+
update(delta?: number): void;
|
|
3003
|
+
private move;
|
|
3004
|
+
private notifyChange;
|
|
3005
|
+
private releaseKeys;
|
|
3006
|
+
private handleKey;
|
|
3007
|
+
private actionFor;
|
|
3008
|
+
private handlePointerDown;
|
|
3009
|
+
private onJoystickSide;
|
|
3010
|
+
private handlePointerMove;
|
|
3011
|
+
private handlePointerUp;
|
|
3012
|
+
private handleWheel;
|
|
3013
|
+
private handlePointerLockChange;
|
|
3014
|
+
private turn;
|
|
3015
|
+
}
|
|
3016
|
+
declare function isFlyControls(obj: any): obj is FlyControls;
|
|
3017
|
+
|
|
2882
3018
|
/**
|
|
2883
3019
|
* Renders a Minecraft scene with a camera and an optional effects composer.
|
|
2884
3020
|
* Uses a browser canvas by default, or a caller-supplied {@link RendererSurface}.
|
|
@@ -2895,7 +3031,9 @@ declare class Renderer implements Disposable {
|
|
|
2895
3031
|
protected _camera: Camera;
|
|
2896
3032
|
protected _renderer: WebGLRenderer;
|
|
2897
3033
|
protected _composer?: EffectComposer;
|
|
2898
|
-
protected _controls?:
|
|
3034
|
+
protected _controls?: RendererControls;
|
|
3035
|
+
private _controlsTime?;
|
|
3036
|
+
private _orbitDistance?;
|
|
2899
3037
|
protected _stats?: Stats;
|
|
2900
3038
|
protected _dirty: boolean;
|
|
2901
3039
|
protected _animationLoop: any;
|
|
@@ -2915,7 +3053,18 @@ declare class Renderer implements Disposable {
|
|
|
2915
3053
|
protected createCamera(): Camera;
|
|
2916
3054
|
protected createRenderer(): WebGLRenderer;
|
|
2917
3055
|
protected createComposer(): Maybe<EffectComposer>;
|
|
2918
|
-
protected createControls(): Maybe<
|
|
3056
|
+
protected createControls(): Maybe<RendererControls>;
|
|
3057
|
+
private initialTarget;
|
|
3058
|
+
private createControlsFor;
|
|
3059
|
+
/**
|
|
3060
|
+
* Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
|
|
3061
|
+
* Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
|
|
3062
|
+
* Returns the new controls, or undefined when controls were disabled at construction or after disposal.
|
|
3063
|
+
*/
|
|
3064
|
+
setControlsMode(mode: ControlsMode): Maybe<RendererControls>;
|
|
3065
|
+
private disposeControls;
|
|
3066
|
+
/** Advances owned controls; without a frame time, flight movement does not progress. */
|
|
3067
|
+
private updateControls;
|
|
2919
3068
|
init(): void;
|
|
2920
3069
|
get element(): Maybe<HTMLElement>;
|
|
2921
3070
|
/** Attaches the canvas to an element and sizes it to that element's dimensions. */
|
|
@@ -2925,6 +3074,7 @@ declare class Renderer implements Disposable {
|
|
|
2925
3074
|
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
2926
3075
|
*/
|
|
2927
3076
|
registerEventDispatcher(dispatcher: EventDispatcher<any>, changeEvent?: string): void;
|
|
3077
|
+
private unregisterEventDispatcher;
|
|
2928
3078
|
/** Updates the camera and canvas size. Width and height are in CSS pixels. */
|
|
2929
3079
|
resize(width: number, height: number): void;
|
|
2930
3080
|
private validateSurfaceSize;
|
|
@@ -2978,7 +3128,13 @@ declare class Renderer implements Disposable {
|
|
|
2978
3128
|
get renderer(): WebGLRenderer;
|
|
2979
3129
|
get composer(): Maybe<EffectComposer>;
|
|
2980
3130
|
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
2981
|
-
get controls(): Maybe<
|
|
3131
|
+
get controls(): Maybe<RendererControls>;
|
|
3132
|
+
/** Renderer-owned OrbitControls, or undefined in fly mode or without controls. */
|
|
3133
|
+
get orbitControls(): Maybe<OrbitControls>;
|
|
3134
|
+
/** Renderer-owned {@link FlyControls}, or undefined in orbit mode or without controls. */
|
|
3135
|
+
get flyControls(): Maybe<FlyControls>;
|
|
3136
|
+
/** The active renderer-owned controls mode, or undefined without controls. */
|
|
3137
|
+
get controlsMode(): Maybe<ControlsMode>;
|
|
2982
3138
|
}
|
|
2983
3139
|
/** Caller-owned canvas and WebGL 2 context for rendering without a browser DOM. */
|
|
2984
3140
|
interface RendererSurface {
|
|
@@ -3044,9 +3200,15 @@ interface RenderOptions {
|
|
|
3044
3200
|
interface ComposerOptions {
|
|
3045
3201
|
enabled: boolean;
|
|
3046
3202
|
}
|
|
3047
|
-
/**
|
|
3203
|
+
/** Renderer-owned camera controls: orbiting around a target, or creative-style flight. */
|
|
3204
|
+
type ControlsMode = "orbit" | "fly";
|
|
3205
|
+
/** Controls created through `controls.enabled`; narrow with `isFlyControls` or {@link Renderer.controlsMode}. */
|
|
3206
|
+
type RendererControls = OrbitControls | FlyControls;
|
|
3207
|
+
/** Set `controls: { enabled: true }` in the Renderer constructor to create owned controls. */
|
|
3048
3208
|
interface ControlsOptions {
|
|
3049
3209
|
enabled: boolean;
|
|
3210
|
+
/** `orbit` (default) creates OrbitControls; `fly` creates {@link FlyControls}. */
|
|
3211
|
+
mode?: ControlsMode;
|
|
3050
3212
|
}
|
|
3051
3213
|
/** Scene helpers enabled through `debug` in the Renderer constructor options. */
|
|
3052
3214
|
interface DebugOptions {
|
|
@@ -3327,6 +3489,8 @@ declare class Skins {
|
|
|
3327
3489
|
declare class Colormaps {
|
|
3328
3490
|
/** Samples the selected resource pack's grass colormap using Minecraft's climate coordinates. */
|
|
3329
3491
|
static grassColor(origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
|
|
3492
|
+
/** Samples a resource-pack colormap at the supplied climate coordinates. */
|
|
3493
|
+
static getColor(kind: "grass" | "foliage" | "dry_foliage", origin?: AssetKey, temperature?: number, downfall?: number): Promise<number>;
|
|
3330
3494
|
}
|
|
3331
3495
|
|
|
3332
3496
|
/** Creates sRGB textures immediately and fills their pixels after asynchronous image loading. */
|
|
@@ -3549,6 +3713,8 @@ interface SectionMeshEntry {
|
|
|
3549
3713
|
/** Fluid cells for one section and the shared atlases of the kinds present. */
|
|
3550
3714
|
interface SectionFluids {
|
|
3551
3715
|
cells: Uint8Array;
|
|
3716
|
+
/** Linear RGB per section cell, indexed by (x + 16z + 256y) * 3. */
|
|
3717
|
+
waterTints?: Float32Array;
|
|
3552
3718
|
water?: TextureAtlas;
|
|
3553
3719
|
lava?: TextureAtlas;
|
|
3554
3720
|
}
|
|
@@ -3572,14 +3738,16 @@ declare class SectionModels {
|
|
|
3572
3738
|
private readonly fluidAtlases;
|
|
3573
3739
|
constructor(maxAtlasSize?: number);
|
|
3574
3740
|
/** Returns templates for the matched parts, or `undefined` when the block needs an individual render object. */
|
|
3575
|
-
get(blockState: BlockState, properties?: BlockStateProperties, position?: Readonly<TripleArray
|
|
3576
|
-
/** Resolves section templates
|
|
3577
|
-
prepareState(blockState: BlockState, properties?: BlockStateProperties): Promise<{
|
|
3741
|
+
get(blockState: BlockState, properties?: BlockStateProperties, position?: Readonly<TripleArray>, biome?: string): Promise<SectionMeshTemplate[] | undefined>;
|
|
3742
|
+
/** Resolves section templates for one tint palette, with a synchronous weighted choice for each cell. */
|
|
3743
|
+
prepareState(blockState: BlockState, properties?: BlockStateProperties, biomeColor?: number | (() => Promise<number | undefined>)): Promise<{
|
|
3578
3744
|
pick(position?: Readonly<TripleArray>): SectionMeshTemplate[];
|
|
3579
3745
|
} | undefined>;
|
|
3746
|
+
private state;
|
|
3580
3747
|
/** Returns the shared still/flow atlas used by per-block fluid objects. */
|
|
3581
3748
|
fluidAtlas(kind: FluidKind, root?: string): Promise<TextureAtlas>;
|
|
3582
3749
|
private prepare;
|
|
3750
|
+
private template;
|
|
3583
3751
|
/** Disposes prepared geometry and clears this world's template caches. */
|
|
3584
3752
|
clear(): void;
|
|
3585
3753
|
}
|
|
@@ -3593,6 +3761,8 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3593
3761
|
private readonly onBlocksChanged?;
|
|
3594
3762
|
private readonly sectionModels?;
|
|
3595
3763
|
private readonly neighborCell?;
|
|
3764
|
+
private readonly biomeAt?;
|
|
3765
|
+
private readonly onBiomesChanged?;
|
|
3596
3766
|
readonly scene: MineRenderScene;
|
|
3597
3767
|
readonly x: number;
|
|
3598
3768
|
readonly y: number;
|
|
@@ -3603,13 +3773,23 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3603
3773
|
private readonly hiddenBlocks;
|
|
3604
3774
|
private readonly fluidCells;
|
|
3605
3775
|
private readonly blockPosition;
|
|
3776
|
+
private waterTints?;
|
|
3777
|
+
private biomes?;
|
|
3606
3778
|
private sectionMesh?;
|
|
3607
3779
|
private meshDirty;
|
|
3608
3780
|
private meshGeneration;
|
|
3609
|
-
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined, neighborCell?: ((x: number, y: number, z: number) => number) | undefined);
|
|
3781
|
+
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined, neighborCell?: ((x: number, y: number, z: number) => number) | undefined, biomeAt?: ((x: number, y: number, z: number) => Maybe<string>) | undefined, onBiomesChanged?: ((biomes?: readonly string[]) => Promise<void>) | undefined);
|
|
3610
3782
|
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
3611
3783
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
3612
3784
|
getBlockAt(pos: TripleArray): Maybe<BlockInfo<SectionMeshing>>;
|
|
3785
|
+
/** Returns the saved 4-block biome sample at integer world block coordinates, or `undefined` if absent. */
|
|
3786
|
+
getBiomeAt(x: number, y: number, z: number): Maybe<string>;
|
|
3787
|
+
getBiomeAt(pos: Vector3): Maybe<string>;
|
|
3788
|
+
getBiomeAt(pos: TripleArray): Maybe<string>;
|
|
3789
|
+
/** Copies 64 biome IDs in x + z * 4 + y * 16 order and refreshes placed blocks. Omit the array to clear biome data. */
|
|
3790
|
+
setBiomes(biomes?: readonly string[]): Promise<void>;
|
|
3791
|
+
/** Rebuilds biome-tinted blocks while preserving hidden blocks and unrelated render objects. */
|
|
3792
|
+
refreshBiomes(): Promise<void>;
|
|
3613
3793
|
/**
|
|
3614
3794
|
* Places a block at integer world block coordinates. Pass `undefined` to remove it.
|
|
3615
3795
|
*/
|
|
@@ -3627,6 +3807,10 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3627
3807
|
}[]): Promise<Vector3[]>;
|
|
3628
3808
|
/** Replaces every cell from parsed section data. The caller refreshes neighbor culling. */
|
|
3629
3809
|
placeSection(data: ChunkData): Promise<void>;
|
|
3810
|
+
private positionAt;
|
|
3811
|
+
private biomePosition;
|
|
3812
|
+
private resolveState;
|
|
3813
|
+
private setWaterTint;
|
|
3630
3814
|
/** Changes visibility at world block coordinates while preserving the block's data. */
|
|
3631
3815
|
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
3632
3816
|
isBlockVisibleAt(pos: Vector3): boolean;
|
|
@@ -3765,6 +3949,8 @@ interface SectionFluidKind {
|
|
|
3765
3949
|
interface SectionFluidInput {
|
|
3766
3950
|
/** Bit 128 marks a surface rendered elsewhere; the cell still supplies neighbor fluid samples. */
|
|
3767
3951
|
cells: Uint8Array;
|
|
3952
|
+
/** Linear RGB per section cell, indexed by (x + 16z + 256y) * 3. Omission uses the water kind's tint. */
|
|
3953
|
+
waterTints?: Float32Array;
|
|
3768
3954
|
water?: SectionFluidKind;
|
|
3769
3955
|
lava?: SectionFluidKind;
|
|
3770
3956
|
}
|
|
@@ -3923,4 +4109,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
3923
4109
|
*/
|
|
3924
4110
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
3925
4111
|
|
|
3926
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
4112
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, probeImageSize, registerBrowserEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|