Represents a chunk in the world
- add_texture
- apply
- apply_all
- apply_heightmap
- apply_textures
- apply_vertex_color
- clear_colors
- clear_textures
- get_area_id
- get_deep_flag
- get_deep_flag_high
- get_effect
- get_fishable_flag
- get_fishable_flag_high
- get_tex
- get_texture
- get_texture_count
- get_vert
- has_render_flags
- remove_texture
- set_area_id
- set_deep_flag
- set_effect
- set_fishable_flag
- set_hole
- set_impassable
- to_selection
+ new chunk(): chunk
Returns: chunk
▸ add_texture(texture
: string, effect
: number): number
Adds a new texture at the current topmost layer.
note
A chunk can hold at most 4 texture layers.
Name | Type | Description |
---|---|---|
texture |
string | |
effect |
number | effect id to add - -2 (default): does not change effect - -1: clears current effect index - 0+: change to this effect index |
Returns: number
texture index added to
▸ apply(): void
Same as apply_all
Returns: void
▸ apply_all(): void
Applies all changes in this chunk
Returns: void
▸ apply_heightmap(): void
Applies all changes to the heightmap in this chunk
Returns: void
▸ apply_textures(): void
Applies all changes to texture alphamaps in this chunk
Returns: void
▸ apply_vertex_color(): void
Applies all changes to vertex colors in this chunk
Returns: void
▸ clear_colors(): void
Removes all vertex colors in this chunk
Returns: void
▸ clear_textures(): void
Removes all texture layers in this chunk
Returns: void
▸ get_area_id(): number
Returns the area id of a chunk
Returns: number
▸ get_deep_flag(): number
Returns the lower bits of the deep flag for the water in this chunk.
If chunk has no render data, 0 is returned
note
Only contains the lower 32 bits.
For the higher bits, use get_fishable_flag_high
Returns: number
▸ get_deep_flag_high(): number
Returns the higher bits of the fishable flag for the water in this chunk.
If chunk has no render data, 0 is returned
Returns: number
▸ get_effect(layer
: number): number
Returns the effect id at a texture layer
Name | Type |
---|---|
layer |
number |
Returns: number
▸ get_fishable_flag(): number
Returns the lower bits of the fishable flag for the water in this chunk.
If chunk has no render data, 0xffffffff is returned
note
Only contains the lower 32 bits.
For the higher bits, use get_fishable_flag_high
Returns: number
▸ get_fishable_flag_high(): number
Returns the higher bits of the fishable flag for the water in this chunk.
If chunk has no render data, 0xffffffff is returned
Returns: number
▸ get_tex(index
: number): tex
Returns a texel by index in this chunk
Name | Type | Description |
---|---|---|
index |
number | valid in range [0-4095] |
Returns: tex
▸ get_texture(index
: number): string
Returns the name of the texture at the specified layer.
Name | Type |
---|---|
index |
number |
Returns: string
▸ get_texture_count(): number
Returns the amount of textures on this chunk
Returns: number
▸ get_vert(index
: number): vert
Returns a vertex by index in this chunk
Name | Type | Description |
---|---|---|
index |
number | valid in range [0-144] |
Returns: vert
▸ has_render_flags(): any
Returns true if the water in this chunk has deep/fishable flag data.
Returns: any
▸ remove_texture(index
: number): void
Removes a texture layer from this chunk and decreases the texture ids of all higher layers by 1
Name | Type |
---|---|
index |
number |
Returns: void
▸ set_area_id(value
: number): void
Changes the area id of a chunk
Name | Type |
---|---|
value |
number |
Returns: void
▸ set_deep_flag(low
: number, high?
: number): void
Sets the deep flags for the water in this chunk. If the first bit is set (it is for value=1), emulators typically interpret this to mean fatigue should be applied here.
-high is 0 by default.
Name | Type |
---|---|
low |
number |
high? |
number |
Returns: void
▸ set_effect(layer
: number, effect
: number): any
Changes the effect id at a texture layer
Name | Type | Description |
---|---|---|
layer |
number | |
effect |
number | effect id to set (-1 to remove effects) |
Returns: any
▸ set_fishable_flag(low
: number, high?
: number): void
Sets the fishable flag for the water in this chunk. If render flag data is not present, it is automatically created.
- high is 0 by default
Name | Type |
---|---|
low |
number |
high? |
number |
Returns: void
▸ set_hole(hole
: boolean): void
Creates or removes a hole in this chunk
Name | Type |
---|---|
hole |
boolean |
Returns: void
▸ set_impassable(impassable
: boolean): void
Sets whether this chunk should be impassable for players or not
Name | Type |
---|---|
impassable |
boolean |
Returns: void
▸ to_selection(): selection
Returns a selection spanning this chunk
note
- iterating will include border vert/texels
Returns: selection