diff --git a/assets/cubyz/biomes/autumn/dead_forest.zig.zon b/assets/cubyz/biomes/autumn/dead_forest.zig.zon index c1c3c340c3..5ace1c3d77 100644 --- a/assets/cubyz/biomes/autumn/dead_forest.zig.zon +++ b/assets/cubyz/biomes/autumn/dead_forest.zig.zon @@ -55,8 +55,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:air", - .log = "cubyz:birch_log", - .top = "cubyz:birch_top", + .log = "cubyz:log/birch", .chance = 0.03, .type = .round, .height = 10, @@ -78,16 +77,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.05, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.03, .height = 6, .height_variation = 3, @@ -95,8 +92,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:air", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.075, .type = .round, .height = 8, diff --git a/assets/cubyz/biomes/autumn/forest.zig.zon b/assets/cubyz/biomes/autumn/forest.zig.zon index 323b39528e..648e99d530 100644 --- a/assets/cubyz/biomes/autumn/forest.zig.zon +++ b/assets/cubyz/biomes/autumn/forest.zig.zon @@ -22,8 +22,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:air", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.015, .type = .round, .height = 8, @@ -34,8 +33,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:air", - .log = "cubyz:birch_log", - .top = "cubyz:birch_top", + .log = "cubyz:log/birch", .chance = 0.015, .type = .round, .height = 10, @@ -46,8 +44,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:yellow_leaves", - .log = "cubyz:birch_log", - .top = "cubyz:birch_top", + .log = "cubyz:log/birch", .chance = 0.15, .type = .round, .height = 10, @@ -60,8 +57,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:red_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.15, .type = .round, .height = 8, @@ -72,8 +68,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:birch_leaves", - .log = "cubyz:birch_log", - .top = "cubyz:birch_top", + .log = "cubyz:log/birch", .chance = 0.03, .type = .round, .height = 10, @@ -86,8 +81,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.015, .type = .round, .height = 8, @@ -97,16 +91,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.005, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.002, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/autumn/mixed_forest.zig.zon b/assets/cubyz/biomes/autumn/mixed_forest.zig.zon index 4be4d95450..5bdc81717a 100644 --- a/assets/cubyz/biomes/autumn/mixed_forest.zig.zon +++ b/assets/cubyz/biomes/autumn/mixed_forest.zig.zon @@ -46,8 +46,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:yellow_leaves", - .log = "cubyz:birch_log", - .top = "cubyz:birch_top", + .log = "cubyz:log/birch", .chance = 0.1, .type = .round, .height = 10, @@ -59,16 +58,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.005, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.002, .height = 6, .height_variation = 3, @@ -76,8 +73,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:red_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.1, .type = .round, .height = 8, diff --git a/assets/cubyz/biomes/bush_lands.zig.zon b/assets/cubyz/biomes/bush_lands.zig.zon index 5711c35720..33e569db4c 100644 --- a/assets/cubyz/biomes/bush_lands.zig.zon +++ b/assets/cubyz/biomes/bush_lands.zig.zon @@ -23,8 +23,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.16, .type = .round, .height = 1, diff --git a/assets/cubyz/biomes/bush_mountains.zig.zon b/assets/cubyz/biomes/bush_mountains.zig.zon index 2324bad2f3..eb68938eab 100644 --- a/assets/cubyz/biomes/bush_mountains.zig.zon +++ b/assets/cubyz/biomes/bush_mountains.zig.zon @@ -21,8 +21,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.16, .type = .round, .height = 4, diff --git a/assets/cubyz/biomes/cave/crystal_forest.zig.zon b/assets/cubyz/biomes/cave/crystal_forest.zig.zon index 639c91d8b2..4b4592e51f 100644 --- a/assets/cubyz/biomes/cave/crystal_forest.zig.zon +++ b/assets/cubyz/biomes/cave/crystal_forest.zig.zon @@ -18,8 +18,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.32, .type = .round, .height = 4, diff --git a/assets/cubyz/biomes/forest/birch.zig.zon b/assets/cubyz/biomes/forest/birch.zig.zon index 2714d502dc..b11c8427b8 100644 --- a/assets/cubyz/biomes/forest/birch.zig.zon +++ b/assets/cubyz/biomes/forest/birch.zig.zon @@ -40,8 +40,7 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.005, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/bluebell_woods.zig.zon b/assets/cubyz/biomes/forest/bluebell_woods.zig.zon index fe046210dd..22f5fbf94d 100644 --- a/assets/cubyz/biomes/forest/bluebell_woods.zig.zon +++ b/assets/cubyz/biomes/forest/bluebell_woods.zig.zon @@ -37,16 +37,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.01, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.003, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/chopped.zig.zon b/assets/cubyz/biomes/forest/chopped.zig.zon index 71d2a169d7..ea11715bd5 100644 --- a/assets/cubyz/biomes/forest/chopped.zig.zon +++ b/assets/cubyz/biomes/forest/chopped.zig.zon @@ -25,30 +25,28 @@ }, .{ .id = "cubyz:simple_vegetation", - .block = "cubyz:oak_log", + .block = "cubyz:log/oak", .chance = 0.2, .height = 1, .height_variation = 0, }, .{ .id = "cubyz:simple_vegetation", - .block = "cubyz:birch_log", + .block = "cubyz:log/oak", .chance = 0.1, .height = 1, .height_variation = 0, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.005, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.002, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/mixed/oak_birch.zig.zon b/assets/cubyz/biomes/forest/mixed/oak_birch.zig.zon index b2894d8938..3457ec110c 100644 --- a/assets/cubyz/biomes/forest/mixed/oak_birch.zig.zon +++ b/assets/cubyz/biomes/forest/mixed/oak_birch.zig.zon @@ -36,16 +36,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.005, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.002, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/mixed/oak_birch_clearing.zig.zon b/assets/cubyz/biomes/forest/mixed/oak_birch_clearing.zig.zon index 7ce3e18568..2ad3774a2a 100644 --- a/assets/cubyz/biomes/forest/mixed/oak_birch_clearing.zig.zon +++ b/assets/cubyz/biomes/forest/mixed/oak_birch_clearing.zig.zon @@ -22,16 +22,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.05, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:birch_log", - .top = "cubyz:birch_log", + .log = "cubyz:log/birch", .chance = 0.02, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/mixed/oak_pine.zig.zon b/assets/cubyz/biomes/forest/mixed/oak_pine.zig.zon index 8a7da6a10a..72ed9d621b 100644 --- a/assets/cubyz/biomes/forest/mixed/oak_pine.zig.zon +++ b/assets/cubyz/biomes/forest/mixed/oak_pine.zig.zon @@ -48,16 +48,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.005, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:pine_log", - .top = "cubyz:pine_log", + .log = "cubyz:log/pine", .chance = 0.002, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/mixed/oak_pine_clearing.zig.zon b/assets/cubyz/biomes/forest/mixed/oak_pine_clearing.zig.zon index 5dabd112cc..684d449e96 100644 --- a/assets/cubyz/biomes/forest/mixed/oak_pine_clearing.zig.zon +++ b/assets/cubyz/biomes/forest/mixed/oak_pine_clearing.zig.zon @@ -22,16 +22,14 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .chance = 0.03, .height = 6, .height_variation = 3, }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:pine_log", - .top = "cubyz:pine_log", + .log = "cubyz:log/pine", .chance = 0.03, .height = 6, .height_variation = 3, diff --git a/assets/cubyz/biomes/forest/thin_birch.zig.zon b/assets/cubyz/biomes/forest/thin_birch.zig.zon index d82acce6c6..ccd31d66b4 100644 --- a/assets/cubyz/biomes/forest/thin_birch.zig.zon +++ b/assets/cubyz/biomes/forest/thin_birch.zig.zon @@ -52,8 +52,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:birch_leaves", - .log = "cubyz:birch_log", - .top = "cubyz:birch_top", + .log = "cubyz:log/birch", .chance = 0.1, .type = .round, .height = 10, diff --git a/assets/cubyz/biomes/grassland.zig.zon b/assets/cubyz/biomes/grassland.zig.zon index 9a66774db6..9e88236986 100644 --- a/assets/cubyz/biomes/grassland.zig.zon +++ b/assets/cubyz/biomes/grassland.zig.zon @@ -26,8 +26,7 @@ }, .{ .id = "cubyz:fallen_tree", - .log = "cubyz:oak_log", - .top = "cubyz:oak_log", + .log = "cubyz:log/oak", .height = 6, .height_variation = 3, .chance = 0.0024, diff --git a/assets/cubyz/biomes/island.zig.zon b/assets/cubyz/biomes/island.zig.zon index 25ecab3678..3a1a6ebdd2 100644 --- a/assets/cubyz/biomes/island.zig.zon +++ b/assets/cubyz/biomes/island.zig.zon @@ -18,8 +18,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.016, .type = .round, .height = 12, diff --git a/assets/cubyz/biomes/jungle.zig.zon b/assets/cubyz/biomes/jungle.zig.zon index 3f1db17645..10787af57b 100644 --- a/assets/cubyz/biomes/jungle.zig.zon +++ b/assets/cubyz/biomes/jungle.zig.zon @@ -25,8 +25,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:mahogany_leaves", - .log = "cubyz:mahogany_log", - .top = "cubyz:mahogany_top", + .log = "cubyz:log/mahogany", .chance = 0.36, .type = .round, .height = 6, @@ -37,8 +36,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:mahogany_leaves", - .log = "cubyz:mahogany_log", - .top = "cubyz:mahogany_top", + .log = "cubyz:log/mahogany", .chance = 0.2, .type = .round, .height = 1, diff --git a/assets/cubyz/biomes/limestone_mountains/base.zig.zon b/assets/cubyz/biomes/limestone_mountains/base.zig.zon index 2a186a0182..c1d7ff6b12 100644 --- a/assets/cubyz/biomes/limestone_mountains/base.zig.zon +++ b/assets/cubyz/biomes/limestone_mountains/base.zig.zon @@ -35,8 +35,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.075, .type = .round, .height = 3, diff --git a/assets/cubyz/biomes/mountains.zig.zon b/assets/cubyz/biomes/mountains.zig.zon index c0ce9b7286..bfbff4364f 100644 --- a/assets/cubyz/biomes/mountains.zig.zon +++ b/assets/cubyz/biomes/mountains.zig.zon @@ -21,8 +21,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.8, .type = .round, .height = 3, diff --git a/assets/cubyz/biomes/prairie/base.zig.zon b/assets/cubyz/biomes/prairie/base.zig.zon index 46cd433f01..c2ad53c140 100644 --- a/assets/cubyz/biomes/prairie/base.zig.zon +++ b/assets/cubyz/biomes/prairie/base.zig.zon @@ -37,8 +37,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.025, .type = .round, .height = 2, diff --git a/assets/cubyz/biomes/rainbow_forest.zig.zon b/assets/cubyz/biomes/rainbow_forest.zig.zon index 91dd9b7af5..148524814e 100644 --- a/assets/cubyz/biomes/rainbow_forest.zig.zon +++ b/assets/cubyz/biomes/rainbow_forest.zig.zon @@ -25,8 +25,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.48, .type = .round, .height = 8, diff --git a/assets/cubyz/biomes/rocky_grassland.zig.zon b/assets/cubyz/biomes/rocky_grassland.zig.zon index 85f9d1bfdc..702191d67c 100644 --- a/assets/cubyz/biomes/rocky_grassland.zig.zon +++ b/assets/cubyz/biomes/rocky_grassland.zig.zon @@ -20,8 +20,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.016, .type = .round, .height = 6, diff --git a/assets/cubyz/biomes/savannah/baobab_shrublands.zig.zon b/assets/cubyz/biomes/savannah/baobab_shrublands.zig.zon index a4cce2fbee..49a57f6724 100644 --- a/assets/cubyz/biomes/savannah/baobab_shrublands.zig.zon +++ b/assets/cubyz/biomes/savannah/baobab_shrublands.zig.zon @@ -39,8 +39,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.08, .type = .round, .height = 1, diff --git a/assets/cubyz/biomes/spawn.zig.zon b/assets/cubyz/biomes/spawn.zig.zon index 2f9ef06a95..f0cbd7079f 100644 --- a/assets/cubyz/biomes/spawn.zig.zon +++ b/assets/cubyz/biomes/spawn.zig.zon @@ -35,8 +35,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.004, .type = .round, .height = 6, @@ -48,7 +47,7 @@ }, .{ .id = "cubyz:simple_vegetation", - .block = "cubyz:oak_log", + .block = "cubyz:log/oak", .chance = 0.01, .height = 1, .height_variation = 2, diff --git a/assets/cubyz/biomes/swamp/base.zig.zon b/assets/cubyz/biomes/swamp/base.zig.zon index 3c91d14c4b..42370a8da8 100644 --- a/assets/cubyz/biomes/swamp/base.zig.zon +++ b/assets/cubyz/biomes/swamp/base.zig.zon @@ -74,8 +74,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:willow_leaves", - .log = "cubyz:willow_log", - .top = "cubyz:willow_leaves", + .log = "cubyz:log/willow", .chance = 0.8, .type = .round, .height = 4, diff --git a/assets/cubyz/biomes/thicket.zig.zon b/assets/cubyz/biomes/thicket.zig.zon index d71d58c323..7b1f3bc4ac 100644 --- a/assets/cubyz/biomes/thicket.zig.zon +++ b/assets/cubyz/biomes/thicket.zig.zon @@ -22,8 +22,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", - .log = "cubyz:oak_log", - .top = "cubyz:oak_top", + .log = "cubyz:log/oak", .chance = 0.8, .type = .round, .height = 6, diff --git a/assets/cubyz/biomes/wetlands/base.zig.zon b/assets/cubyz/biomes/wetlands/base.zig.zon index 8f2467836e..b312198988 100644 --- a/assets/cubyz/biomes/wetlands/base.zig.zon +++ b/assets/cubyz/biomes/wetlands/base.zig.zon @@ -30,8 +30,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:willow_leaves", - .log = "cubyz:willow_log", - .top = "cubyz:willow_top", + .log = "cubyz:log/willow", .chance = 0.02, .type = .round, .height = 12, @@ -45,8 +44,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:willow_leaves", - .log = "cubyz:willow_log", - .top = "cubyz:willow_top", + .log = "cubyz:log/willow", .chance = 0.02, .type = .round, .height = 10, diff --git a/assets/cubyz/biomes/wetlands/willows.zig.zon b/assets/cubyz/biomes/wetlands/willows.zig.zon index 2c4b233c57..5461d0a799 100644 --- a/assets/cubyz/biomes/wetlands/willows.zig.zon +++ b/assets/cubyz/biomes/wetlands/willows.zig.zon @@ -27,8 +27,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:willow_leaves", - .log = "cubyz:willow_log", - .top = "cubyz:willow_top", + .log = "cubyz:log/willow", .chance = 0.3, .type = .round, .height = 13, @@ -42,8 +41,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:willow_leaves", - .log = "cubyz:willow_log", - .top = "cubyz:willow_top", + .log = "cubyz:log/willow", .chance = 0.3, .type = .round, .height = 11, diff --git a/src/server/terrain/simple_structures/FallenTree.zig b/src/server/terrain/simple_structures/FallenTree.zig index 680539d98b..6cb80f3b9a 100644 --- a/src/server/terrain/simple_structures/FallenTree.zig +++ b/src/server/terrain/simple_structures/FallenTree.zig @@ -20,15 +20,13 @@ pub const generationMode = .floor; const FallenTree = @This(); woodBlock: u16, -topWoodBlock: u16, height0: u32, deltaHeight: u31, pub fn loadModel(parameters: ZonElement) ?*FallenTree { const self = main.worldArena.create(FallenTree); self.* = .{ - .woodBlock = main.blocks.getTypeById(parameters.get([]const u8, "log", "cubyz:oak_log")), - .topWoodBlock = main.blocks.getTypeById(parameters.get([]const u8, "top", "cubyz:oak_top")), + .woodBlock = main.blocks.getTypeById(parameters.get([]const u8, "log", "cubyz:log/oak")), .height0 = parameters.get(u32, "height", 6), .deltaHeight = parameters.get(u31, "height_variation", 3), }; @@ -37,7 +35,7 @@ pub fn loadModel(parameters: ZonElement) ?*FallenTree { pub fn generateStump(self: *FallenTree, x: i32, y: i32, z: i32, chunk: *main.chunk.ServerChunk) void { if(chunk.liesInChunk(x, y, z)) - chunk.updateBlockIfDegradable(x, y, z, .{.typ = self.woodBlock, .data = 0}); + chunk.updateBlockIfDegradable(x, y, z, .{.typ = self.woodBlock, .data = 0b000011}); } pub fn generateFallen(self: *FallenTree, x: i32, y: i32, z: i32, length: u32, chunk: *main.chunk.ServerChunk, caveMap: CaveMapView, seed: *u64) void { @@ -82,21 +80,26 @@ pub fn generateFallen(self: *FallenTree, x: i32, y: i32, z: i32, length: u32, ch var dx: i32 = 0; var dy: i32 = 0; + var enabledConnections: u6 = 0b000000; + if(d.? == 0) { dx = 1; + enabledConnections = 0b001100; } else if(d.? == 1) { dx = -1; + enabledConnections = 0b001100; } else if(d.? == 2) { dy = 1; + enabledConnections = 0b110000; } else if(d.? == 3) { dy = -1; + enabledConnections = 0b110000; } for(0..length) |val| { const v: i32 = @intCast(val); if(chunk.liesInChunk(x + dx*(v + 2), y + dy*(v + 2), z)) { - const typ = if(v == (length - 1)) self.topWoodBlock else self.woodBlock; - chunk.updateBlockIfDegradable(x + dx*(v + 2), y + dy*(v + 2), z, .{.typ = typ, .data = @intCast(d.? + 2)}); + chunk.updateBlockIfDegradable(x + dx*(v + 2), y + dy*(v + 2), z, .{.typ = self.woodBlock, .data = enabledConnections}); } } } diff --git a/src/server/terrain/simple_structures/SimpleTreeModel.zig b/src/server/terrain/simple_structures/SimpleTreeModel.zig index 270cebee04..bb7262d770 100644 --- a/src/server/terrain/simple_structures/SimpleTreeModel.zig +++ b/src/server/terrain/simple_structures/SimpleTreeModel.zig @@ -27,7 +27,6 @@ const Type = enum { typ: Type, leavesBlock: main.blocks.Block, woodBlock: main.blocks.Block, -topWoodBlock: main.blocks.Block, height0: i32, deltaHeight: u31, leafRadius: f32, @@ -44,8 +43,7 @@ pub fn loadModel(parameters: ZonElement) ?*SimpleTreeModel { break :blk .round; }, .leavesBlock = main.blocks.parseBlock(parameters.get([]const u8, "leaves", "cubyz:oak_leaves")), - .woodBlock = main.blocks.parseBlock(parameters.get([]const u8, "log", "cubyz:oak_log")), - .topWoodBlock = main.blocks.parseBlock(parameters.get([]const u8, "top", "cubyz:oak_top")), + .woodBlock = main.blocks.parseBlock(parameters.get([]const u8, "log", "cubyz:log/oak")), .height0 = parameters.get(i32, "height", 6), .deltaHeight = parameters.get(u31, "height_variation", 3), .leafRadius = parameters.get(f32, "leafRadius", (1 + parameters.get(f32, "height", 6))/2), @@ -62,15 +60,18 @@ pub fn generateStem(self: *SimpleTreeModel, x: i32, y: i32, z: i32, height: i32, var pz: i32 = chunk.startIndex(z); while(pz < z + height) : (pz += chunk.super.pos.voxelSize) { if(chunk.liesInChunk(x, y, pz)) { - chunk.updateBlockIfDegradable(x, y, pz, if(pz == z + height - 1) self.topWoodBlock else self.woodBlock); + var enabledConnections: u6 = if(pz == z + height - 1) 0b000010 else 0b000011; if(self.branched) { const chance = @sqrt(@as(f32, @floatFromInt(pz - z))/@as(f32, @floatFromInt(height*2))); if(main.random.nextFloat(seed) < chance) { const d = main.random.nextIntBounded(u32, seed, 4); generateBranch(self, x, y, pz, d, chunk, seed); + enabledConnections += @as(u6, 2) << @truncate(d + 1); } } + + chunk.updateBlockIfDegradable(x, y, pz, .{.typ = self.woodBlock.typ, .data = enabledConnections}); } } } @@ -80,13 +81,13 @@ pub fn generateBranch(self: *SimpleTreeModel, x: i32, y: i32, z: i32, d: u32, ch _ = seed; if(d == 0 and chunk.liesInChunk(x + 1, y, z)) { - chunk.updateBlockIfDegradable(x + 1, y, z, .{.typ = self.topWoodBlock.typ, .data = 2}); + chunk.updateBlockIfDegradable(x + 1, y, z, .{.typ = self.woodBlock.typ, .data = 0b001000}); } else if(d == 1 and chunk.liesInChunk(x - 1, y, z)) { - chunk.updateBlockIfDegradable(x - 1, y, z, .{.typ = self.topWoodBlock.typ, .data = 3}); + chunk.updateBlockIfDegradable(x - 1, y, z, .{.typ = self.woodBlock.typ, .data = 0b000100}); } else if(d == 2 and chunk.liesInChunk(x, y + 1, z)) { - chunk.updateBlockIfDegradable(x, y + 1, z, .{.typ = self.topWoodBlock.typ, .data = 4}); + chunk.updateBlockIfDegradable(x, y + 1, z, .{.typ = self.woodBlock.typ, .data = 0b100000}); } else if(d == 3 and chunk.liesInChunk(x, y - 1, z)) { - chunk.updateBlockIfDegradable(x, y - 1, z, .{.typ = self.topWoodBlock.typ, .data = 5}); + chunk.updateBlockIfDegradable(x, y - 1, z, .{.typ = self.woodBlock.typ, .data = 0b010000}); } }