Improve a buuuunch of textures and some reworks
This commit is contained in:
@@ -15,14 +15,32 @@ const REACH = Math.ceil(MIN_DISTANCE / CELL);
|
||||
// the widest a canopy layer gets
|
||||
const MAX_CANOPY = 3;
|
||||
|
||||
export type TreeKind = "oak" | "big_oak" | "spruce" | "jungle" | "acacia";
|
||||
export type TreeKind = "oak" | "big_oak" | "birch" | "spruce" | "jungle" | "acacia" | "cherry";
|
||||
export const WOODS = ["oak", "spruce", "birch", "jungle", "acacia", "dark_oak", "cherry"] as const;
|
||||
export type Wood = typeof WOODS[number];
|
||||
|
||||
// the logs and leaves a tree grows, big oaks are dark oak in the dark forest like minecraft's
|
||||
export function tree_wood(kind: TreeKind, biome: string): Wood {
|
||||
switch (kind) {
|
||||
case "big_oak":
|
||||
return biome === "bworld:dark_forest" ? "dark_oak" : "oak";
|
||||
case "birch":
|
||||
case "spruce":
|
||||
case "jungle":
|
||||
case "acacia":
|
||||
case "cherry":
|
||||
return kind;
|
||||
default:
|
||||
return "oak";
|
||||
}
|
||||
}
|
||||
|
||||
// how likely each biome's cells are to have a tree, and which kinds grow there
|
||||
export const BIOME_TREES: Record<string, { chance: number; kinds: TreeKind[] }> = {
|
||||
"bworld:forest": { chance: 0.85, kinds: ["oak", "oak", "big_oak"] },
|
||||
"bworld:forest": { chance: 0.85, kinds: ["oak", "oak", "big_oak", "birch"] },
|
||||
"bworld:dark_forest": { chance: 1, kinds: ["big_oak", "big_oak", "oak"] },
|
||||
"bworld:plains": { chance: 0.05, kinds: ["oak"] },
|
||||
"bworld:meadow": { chance: 0.04, kinds: ["oak"] },
|
||||
"bworld:meadow": { chance: 0.06, kinds: ["oak", "birch", "cherry", "cherry"] },
|
||||
"bworld:swamp": { chance: 0.4, kinds: ["big_oak"] },
|
||||
"bworld:river": { chance: 0.05, kinds: ["oak"] },
|
||||
"bworld:taiga": { chance: 0.75, kinds: ["spruce"] },
|
||||
@@ -126,6 +144,30 @@ export function grow_tree(kind: TreeKind, x: number, y: number, z: number, rng:
|
||||
layer(y + height + 1, 1, false);
|
||||
break;
|
||||
}
|
||||
case "birch": {
|
||||
// oak's canopy on a taller, straight trunk
|
||||
const height = random(5, 7);
|
||||
top = y + height + 1;
|
||||
if (top >= CHUNK_HEIGHT - 1) return false;
|
||||
trunk(height);
|
||||
layer(y + height - 2, 2, true);
|
||||
layer(y + height - 1, 2, true);
|
||||
layer(y + height, 1, true);
|
||||
layer(y + height + 1, 1, false);
|
||||
break;
|
||||
}
|
||||
case "cherry": {
|
||||
// a short trunk under a wide, rounded canopy
|
||||
const height = random(4, 6);
|
||||
top = y + height + 1;
|
||||
if (top >= CHUNK_HEIGHT - 1) return false;
|
||||
trunk(height);
|
||||
layer(y + height - 2, 2, false);
|
||||
layer(y + height - 1, MAX_CANOPY, false);
|
||||
layer(y + height, MAX_CANOPY, false);
|
||||
layer(y + height + 1, 2, false);
|
||||
break;
|
||||
}
|
||||
case "big_oak": {
|
||||
const height = random(6, 8);
|
||||
top = y + height + 1;
|
||||
|
||||
Reference in New Issue
Block a user