From 95f35dc7620a3a678a939b3b0f496c1513ac4d07 Mon Sep 17 00:00:00 2001 From: OneAvargeCoder193 Date: Sun, 1 Jun 2025 12:33:48 -0400 Subject: [PATCH 1/2] fix --- .../cubyz/biomes/autumn/dead_forest.zig.zon | 16 +++----- assets/cubyz/biomes/autumn/forest.zig.zon | 24 ++++------- .../cubyz/biomes/autumn/mixed_forest.zig.zon | 15 +++---- assets/cubyz/biomes/bush_lands.zig.zon | 3 +- assets/cubyz/biomes/bush_mountains.zig.zon | 3 +- .../cubyz/biomes/cave/crystal_forest.zig.zon | 3 +- assets/cubyz/biomes/cave/stone_forest.zig.zon | 2 - assets/cubyz/biomes/desert/base.zig.zon | 1 - assets/cubyz/biomes/forest/base.zig.zon | 6 +-- assets/cubyz/biomes/forest/birch.zig.zon | 3 +- assets/cubyz/biomes/forest/chopped.zig.zon | 10 ++--- assets/cubyz/biomes/forest/clearing.zig.zon | 6 +-- assets/cubyz/biomes/forest/thin_birch.zig.zon | 6 +-- assets/cubyz/biomes/glass_forest.zig.zon | 20 ---------- assets/cubyz/biomes/grassland.zig.zon | 3 +- assets/cubyz/biomes/island.zig.zon | 3 +- assets/cubyz/biomes/jungle.zig.zon | 6 +-- .../biomes/limestone_mountains/base.zig.zon | 6 +-- assets/cubyz/biomes/modern_art.zig.zon | 20 ---------- assets/cubyz/biomes/mountains.zig.zon | 3 +- assets/cubyz/biomes/prairie/base.zig.zon | 3 +- assets/cubyz/biomes/rainbow_forest.zig.zon | 9 +---- assets/cubyz/biomes/rocky_grassland.zig.zon | 3 +- assets/cubyz/biomes/savannah/base.zig.zon | 3 +- assets/cubyz/biomes/savannah/elevated.zig.zon | 3 +- assets/cubyz/biomes/spawn.zig.zon | 6 +-- assets/cubyz/biomes/swamp/base.zig.zon | 3 +- assets/cubyz/biomes/taiga/base.zig.zon | 3 +- assets/cubyz/biomes/taiga/cold.zig.zon | 3 +- assets/cubyz/biomes/thicket.zig.zon | 3 +- assets/cubyz/biomes/wetlands/base.zig.zon | 6 +-- assets/cubyz/biomes/wetlands/willows.zig.zon | 6 +-- mods/rotation.zig | 12 ++++++ .../terrain/simple_structures/FallenTree.zig | 18 ++++++--- .../simple_structures/SimpleTreeModel.zig | 40 ++++++++++++++----- 35 files changed, 109 insertions(+), 171 deletions(-) create mode 100644 mods/rotation.zig diff --git a/assets/cubyz/biomes/autumn/dead_forest.zig.zon b/assets/cubyz/biomes/autumn/dead_forest.zig.zon index f3a81f42f3..ff93fe4be6 100644 --- a/assets/cubyz/biomes/autumn/dead_forest.zig.zon +++ b/assets/cubyz/biomes/autumn/dead_forest.zig.zon @@ -28,8 +28,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:pine_needles", - .log = "cubyz:pine_log", - .top = "cubyz:pine_top", + .log = "cubyz:log/pine", .chance = 0.19, .type = .pyramid, .height = 7, @@ -39,8 +38,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, @@ -51,7 +49,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:dead_leaves", .log = "cubyz:dead_leaves", - .top = "cubyz:dead_leaves", .chance = 0.8, .type = .round, .height = 0, @@ -62,16 +59,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, @@ -79,8 +74,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 fcc2e18955..5338f62306 100644 --- a/assets/cubyz/biomes/autumn/forest.zig.zon +++ b/assets/cubyz/biomes/autumn/forest.zig.zon @@ -19,8 +19,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, @@ -31,8 +30,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, @@ -43,8 +41,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, @@ -57,8 +54,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, @@ -69,8 +65,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, @@ -83,8 +78,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, @@ -94,16 +88,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 d4dbcc5d7d..df6bab9027 100644 --- a/assets/cubyz/biomes/autumn/mixed_forest.zig.zon +++ b/assets/cubyz/biomes/autumn/mixed_forest.zig.zon @@ -19,8 +19,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:pine_needles", - .log = "cubyz:pine_log", - .top = "cubyz:pine_top", + .log = "cubyz:log/pine", .chance = 0.2, .type = .pyramid, .height = 7, @@ -30,8 +29,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, @@ -43,16 +41,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, @@ -60,8 +56,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 86ad3bf718..ca8305b7e2 100644 --- a/assets/cubyz/biomes/bush_lands.zig.zon +++ b/assets/cubyz/biomes/bush_lands.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.16, .type = .round, .height = 1, diff --git a/assets/cubyz/biomes/bush_mountains.zig.zon b/assets/cubyz/biomes/bush_mountains.zig.zon index 4db4da6f23..6a0ca5fa90 100644 --- a/assets/cubyz/biomes/bush_mountains.zig.zon +++ b/assets/cubyz/biomes/bush_mountains.zig.zon @@ -19,8 +19,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 2df3c5197a..3e4a086860 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/cave/stone_forest.zig.zon b/assets/cubyz/biomes/cave/stone_forest.zig.zon index 31f23a4b23..85ac0ea7e5 100644 --- a/assets/cubyz/biomes/cave/stone_forest.zig.zon +++ b/assets/cubyz/biomes/cave/stone_forest.zig.zon @@ -38,7 +38,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cobblestone", .log = "cubyz:stone", - .top = "cubyz:stone", .chance = 0.16, .type = .round, .height = 3, @@ -48,7 +47,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:stone", .log = "cubyz:stone", - .top = "cubyz:stone", .chance = 0.48, .type = .round, .height = 3, diff --git a/assets/cubyz/biomes/desert/base.zig.zon b/assets/cubyz/biomes/desert/base.zig.zon index 1c4038d0f3..82b90f91a9 100644 --- a/assets/cubyz/biomes/desert/base.zig.zon +++ b/assets/cubyz/biomes/desert/base.zig.zon @@ -27,7 +27,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:air", .log = "cubyz:cactus", - .top = "cubyz:cactus_flower", .chance = 0.005, .type = .round, .height = 2, diff --git a/assets/cubyz/biomes/forest/base.zig.zon b/assets/cubyz/biomes/forest/base.zig.zon index f666264227..e4ba4d0320 100644 --- a/assets/cubyz/biomes/forest/base.zig.zon +++ b/assets/cubyz/biomes/forest/base.zig.zon @@ -27,16 +27,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/birch.zig.zon b/assets/cubyz/biomes/forest/birch.zig.zon index f1c4febf9e..56f3990832 100644 --- a/assets/cubyz/biomes/forest/birch.zig.zon +++ b/assets/cubyz/biomes/forest/birch.zig.zon @@ -31,8 +31,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/chopped.zig.zon b/assets/cubyz/biomes/forest/chopped.zig.zon index c50be97dfc..60f2f82000 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/birch", .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/clearing.zig.zon b/assets/cubyz/biomes/forest/clearing.zig.zon index a07be52292..4a6c5575f2 100644 --- a/assets/cubyz/biomes/forest/clearing.zig.zon +++ b/assets/cubyz/biomes/forest/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/thin_birch.zig.zon b/assets/cubyz/biomes/forest/thin_birch.zig.zon index 7026dd5819..daa6fbfa7f 100644 --- a/assets/cubyz/biomes/forest/thin_birch.zig.zon +++ b/assets/cubyz/biomes/forest/thin_birch.zig.zon @@ -35,8 +35,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:birch_leaves", - .log = "cubyz:birch_branch:0b11", - .top = "cubyz:birch_branch:0b11", + .log = "cubyz:birch_branch", .chance = 0.7, .type = .round, .height = 14, @@ -50,8 +49,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/glass_forest.zig.zon b/assets/cubyz/biomes/glass_forest.zig.zon index 177481228d..ac40cbbb26 100644 --- a/assets/cubyz/biomes/glass_forest.zig.zon +++ b/assets/cubyz/biomes/glass_forest.zig.zon @@ -17,7 +17,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/aqua", .log = "cubyz:chalk/aqua", - .top = "cubyz:chalk/aqua", .chance = 0.008, .type = .round, .height = 10, @@ -29,7 +28,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/black", .log = "cubyz:chalk/black", - .top = "cubyz:chalk/black", .chance = 0.008, .type = .round, .height = 10, @@ -41,7 +39,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/blue", .log = "cubyz:chalk/blue", - .top = "cubyz:chalk/blue", .chance = 0.008, .type = .round, .height = 10, @@ -53,7 +50,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/brown", .log = "cubyz:chalk/brown", - .top = "cubyz:chalk/brown", .chance = 0.008, .type = .round, .height = 10, @@ -65,7 +61,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/crimson", .log = "cubyz:chalk/crimson", - .top = "cubyz:chalk/crimson", .chance = 0.008, .type = .round, .height = 10, @@ -77,7 +72,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/cyan", .log = "cubyz:chalk/cyan", - .top = "cubyz:chalk/cyan", .chance = 0.008, .type = .round, .height = 10, @@ -89,7 +83,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/dark_grey", .log = "cubyz:chalk/dark_grey", - .top = "cubyz:chalk/dark_grey", .chance = 0.008, .type = .round, .height = 10, @@ -101,7 +94,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/green", .log = "cubyz:chalk/green", - .top = "cubyz:chalk/green", .chance = 0.008, .type = .round, .height = 10, @@ -113,7 +105,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/grey", .log = "cubyz:chalk/grey", - .top = "cubyz:chalk/grey", .chance = 0.008, .type = .round, .height = 10, @@ -125,7 +116,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/indigo", .log = "cubyz:chalk/indigo", - .top = "cubyz:chalk/indigo", .chance = 0.008, .type = .round, .height = 10, @@ -137,7 +127,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/lime", .log = "cubyz:chalk/lime", - .top = "cubyz:chalk/lime", .chance = 0.008, .type = .round, .height = 10, @@ -149,7 +138,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/magenta", .log = "cubyz:chalk/magenta", - .top = "cubyz:chalk/magenta", .chance = 0.008, .type = .round, .height = 10, @@ -161,7 +149,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/orange", .log = "cubyz:chalk/orange", - .top = "cubyz:chalk/orange", .chance = 0.008, .type = .round, .height = 10, @@ -173,7 +160,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/pink", .log = "cubyz:chalk/pink", - .top = "cubyz:chalk/pink", .chance = 0.008, .type = .round, .height = 10, @@ -185,7 +171,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/purple", .log = "cubyz:chalk/purple", - .top = "cubyz:chalk/purple", .chance = 0.008, .type = .round, .height = 10, @@ -197,7 +182,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/red", .log = "cubyz:chalk/red", - .top = "cubyz:chalk/red", .chance = 0.008, .type = .round, .height = 10, @@ -209,7 +193,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/violet", .log = "cubyz:chalk/violet", - .top = "cubyz:chalk/violet", .chance = 0.008, .type = .round, .height = 10, @@ -221,7 +204,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/viridian", .log = "cubyz:chalk/viridian", - .top = "cubyz:chalk/viridian", .chance = 0.008, .type = .round, .height = 10, @@ -233,7 +215,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/white", .log = "cubyz:chalk/white", - .top = "cubyz:chalk/white", .chance = 0.008, .type = .round, .height = 10, @@ -245,7 +226,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:glass/yellow", .log = "cubyz:chalk/yellow", - .top = "cubyz:chalk/yellow", .chance = 0.008, .type = .round, .height = 10, diff --git a/assets/cubyz/biomes/grassland.zig.zon b/assets/cubyz/biomes/grassland.zig.zon index ecfda76bee..e0849ae94c 100644 --- a/assets/cubyz/biomes/grassland.zig.zon +++ b/assets/cubyz/biomes/grassland.zig.zon @@ -22,8 +22,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 87e4a23651..cad88aa746 100644 --- a/assets/cubyz/biomes/jungle.zig.zon +++ b/assets/cubyz/biomes/jungle.zig.zon @@ -22,8 +22,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, @@ -34,8 +33,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 e6240ecde8..aa44fa0c1a 100644 --- a/assets/cubyz/biomes/limestone_mountains/base.zig.zon +++ b/assets/cubyz/biomes/limestone_mountains/base.zig.zon @@ -26,8 +26,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:baobab_leaves", - .log = "cubyz:baobab_log", - .top = "cubyz:baobab_top", + .log = "cubyz:log/baobab", .chance = 0.075, .type = .round, .height = 2, @@ -40,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.075, .type = .round, .height = 3, diff --git a/assets/cubyz/biomes/modern_art.zig.zon b/assets/cubyz/biomes/modern_art.zig.zon index 8f97805bcb..c67b892493 100644 --- a/assets/cubyz/biomes/modern_art.zig.zon +++ b/assets/cubyz/biomes/modern_art.zig.zon @@ -199,7 +199,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/aqua:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -213,7 +212,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/black:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -227,7 +225,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/blue:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -241,7 +238,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/brown:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -255,7 +251,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/crimson:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -269,7 +264,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/cyan:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -283,7 +277,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/dark_grey:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -297,7 +290,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/green:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -311,7 +303,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/grey:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -325,7 +316,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/indigo:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -339,7 +329,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/lime:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -353,7 +342,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/magenta:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -367,7 +355,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/orange:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -381,7 +368,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/pink:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -395,7 +381,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/purple:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -409,7 +394,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/red:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -423,7 +407,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/violet:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -437,7 +420,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/viridian:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -451,7 +433,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/white:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, @@ -465,7 +446,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:cloth/yellow:0b111111", .log = "cubyz:air", - .top = "cubyz:air", .chance = 0.02, .type = .round, .height = 5, diff --git a/assets/cubyz/biomes/mountains.zig.zon b/assets/cubyz/biomes/mountains.zig.zon index 9b7d78379e..0a7e609f5d 100644 --- a/assets/cubyz/biomes/mountains.zig.zon +++ b/assets/cubyz/biomes/mountains.zig.zon @@ -19,8 +19,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 85eabd6b47..2781437afa 100644 --- a/assets/cubyz/biomes/prairie/base.zig.zon +++ b/assets/cubyz/biomes/prairie/base.zig.zon @@ -34,8 +34,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 9632425ca6..b6b5cc751b 100644 --- a/assets/cubyz/biomes/rainbow_forest.zig.zon +++ b/assets/cubyz/biomes/rainbow_forest.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.48, .type = .round, .height = 8, @@ -33,7 +32,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:fog/red", .log = "cubyz:fog/red", - .top = "cubyz:fog/red", .chance = 0.16, .type = .round, .height = 0, @@ -46,7 +44,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:fog/green", .log = "cubyz:fog/green", - .top = "cubyz:fog/green", .chance = 0.16, .type = .round, .height = 0, @@ -59,7 +56,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:fog/blue", .log = "cubyz:fog/blue", - .top = "cubyz:fog/blue", .chance = 0.16, .type = .round, .height = 0, @@ -72,7 +68,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:fog/yellow", .log = "cubyz:fog/yellow", - .top = "cubyz:fog/yellow", .chance = 0.16, .type = .round, .height = 0, @@ -85,7 +80,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:fog/cyan", .log = "cubyz:fog/cyan", - .top = "cubyz:fog/cyan", .chance = 0.16, .type = .round, .height = 0, @@ -98,7 +92,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:fog/magenta", .log = "cubyz:fog/magenta", - .top = "cubyz:fog/magenta", .chance = 0.16, .type = .round, .height = 0, diff --git a/assets/cubyz/biomes/rocky_grassland.zig.zon b/assets/cubyz/biomes/rocky_grassland.zig.zon index d4832b799b..a23a9d8077 100644 --- a/assets/cubyz/biomes/rocky_grassland.zig.zon +++ b/assets/cubyz/biomes/rocky_grassland.zig.zon @@ -17,8 +17,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/base.zig.zon b/assets/cubyz/biomes/savannah/base.zig.zon index f03f4e1a7c..8919dd850b 100644 --- a/assets/cubyz/biomes/savannah/base.zig.zon +++ b/assets/cubyz/biomes/savannah/base.zig.zon @@ -35,8 +35,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:baobab_leaves", - .log = "cubyz:baobab_log", - .top = "cubyz:baobab_top", + .log = "cubyz:log/baobab", .chance = 0.075, .type = .round, .height = 1, diff --git a/assets/cubyz/biomes/savannah/elevated.zig.zon b/assets/cubyz/biomes/savannah/elevated.zig.zon index 8a72581cd0..fc34f45090 100644 --- a/assets/cubyz/biomes/savannah/elevated.zig.zon +++ b/assets/cubyz/biomes/savannah/elevated.zig.zon @@ -53,8 +53,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:baobab_leaves", - .log = "cubyz:baobab_log", - .top = "cubyz:baobab_leaves", + .log = "cubyz:log/baobab", .chance = 0.05, .type = .round, .height = 3, diff --git a/assets/cubyz/biomes/spawn.zig.zon b/assets/cubyz/biomes/spawn.zig.zon index 8a109ad831..5a2506e98a 100644 --- a/assets/cubyz/biomes/spawn.zig.zon +++ b/assets/cubyz/biomes/spawn.zig.zon @@ -18,7 +18,6 @@ .id = "cubyz:simple_tree", .leaves = "cubyz:oak_leaves", .log = "cubyz:air", - .top = "cubyz:oak_top", .chance = 0.3, .type = .round, .height = 6, @@ -32,8 +31,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, @@ -45,7 +43,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 5ef384abe2..8ed9dbdca0 100644 --- a/assets/cubyz/biomes/swamp/base.zig.zon +++ b/assets/cubyz/biomes/swamp/base.zig.zon @@ -71,8 +71,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/taiga/base.zig.zon b/assets/cubyz/biomes/taiga/base.zig.zon index 5ab389a242..768185dc71 100644 --- a/assets/cubyz/biomes/taiga/base.zig.zon +++ b/assets/cubyz/biomes/taiga/base.zig.zon @@ -17,8 +17,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:pine_needles", - .log = "cubyz:pine_log", - .top = "cubyz:pine_top", + .log = "cubyz:log/pine", .chance = 0.4, .type = .pyramid, .height = 8, diff --git a/assets/cubyz/biomes/taiga/cold.zig.zon b/assets/cubyz/biomes/taiga/cold.zig.zon index 09c2668c1f..c944413d75 100644 --- a/assets/cubyz/biomes/taiga/cold.zig.zon +++ b/assets/cubyz/biomes/taiga/cold.zig.zon @@ -19,8 +19,7 @@ .{ .id = "cubyz:simple_tree", .leaves = "cubyz:pine_needles", - .log = "cubyz:pine_log", - .top = "cubyz:pine_top", + .log = "cubyz:log/pine", .chance = 0.25, .type = .pyramid, .height = 6, 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 2f1d38286f..add30d027e 100644 --- a/assets/cubyz/biomes/wetlands/base.zig.zon +++ b/assets/cubyz/biomes/wetlands/base.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.02, .type = .round, .height = 12, @@ -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.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/mods/rotation.zig b/mods/rotation.zig new file mode 100644 index 0000000000..e5c3fb21b7 --- /dev/null +++ b/mods/rotation.zig @@ -0,0 +1,12 @@ +pub const @"cubyz:branch" = @import("cubyz/rotation/branch.zig"); +pub const @"cubyz:carpet" = @import("cubyz/rotation/carpet.zig"); +pub const @"cubyz:direction" = @import("cubyz/rotation/direction.zig"); +pub const @"cubyz:fence" = @import("cubyz/rotation/fence.zig"); +pub const @"cubyz:log" = @import("cubyz/rotation/log.zig"); +pub const @"cubyz:no_rotation" = @import("cubyz/rotation/no_rotation.zig"); +pub const @"cubyz:ore" = @import("cubyz/rotation/ore.zig"); +pub const @"cubyz:planar" = @import("cubyz/rotation/planar.zig"); +pub const @"cubyz:sign" = @import("cubyz/rotation/sign.zig"); +pub const @"cubyz:stairs" = @import("cubyz/rotation/stairs.zig"); +pub const @"cubyz:texture_pile" = @import("cubyz/rotation/texture_pile.zig"); +pub const @"cubyz:torch" = @import("cubyz/rotation/torch.zig"); diff --git a/src/server/terrain/simple_structures/FallenTree.zig b/src/server/terrain/simple_structures/FallenTree.zig index 14c2a993a3..310d67f3f6 100644 --- a/src/server/terrain/simple_structures/FallenTree.zig +++ b/src/server/terrain/simple_structures/FallenTree.zig @@ -12,6 +12,7 @@ const Vec3d = vec.Vec3d; const Vec3f = vec.Vec3f; const Vec3i = vec.Vec3i; const NeverFailingAllocator = main.heap.NeverFailingAllocator; +const Neighbor = main.chunk.Neighbor; pub const id = "cubyz:fallen_tree"; @@ -20,7 +21,6 @@ pub const generationMode = .floor; const FallenTree = @This(); woodBlock: u16, -topWoodBlock: u16, height0: u32, deltaHeight: u31, @@ -28,7 +28,6 @@ pub fn loadModel(arenaAllocator: NeverFailingAllocator, parameters: ZonElement) const self = arenaAllocator.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")), .height0 = parameters.get(u32, "height", 6), .deltaHeight = parameters.get(u31, "height_variation", 3), }; @@ -37,7 +36,7 @@ pub fn loadModel(arenaAllocator: NeverFailingAllocator, parameters: ZonElement) 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 = @as(u16, 1) << @intFromEnum(Neighbor.dirDown) | @as(u16, 1) << @intFromEnum(Neighbor.dirUp)}); } pub fn generateFallen(self: *FallenTree, x: i32, y: i32, z: i32, length: u32, chunk: *main.chunk.ServerChunk, caveMap: CaveMapView, seed: *u64) void { @@ -81,22 +80,31 @@ pub fn generateFallen(self: *FallenTree, x: i32, y: i32, z: i32, length: u32, ch var dx: i32 = 0; var dy: i32 = 0; + var dataLog: u16 = 0; + var dataTop: u16 = 0; if(d.? == 0) { dx = 1; + dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosX) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegX); + dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirNegX); } else if(d.? == 1) { dx = -1; + dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosX) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegX); + dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirPosX); } else if(d.? == 2) { dy = 1; + dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosY) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegY); + dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirNegY); } else if(d.? == 3) { dy = -1; + dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosY) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegY); + dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirPosY); } 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 = if(v == (length - 1)) dataTop else dataLog}); } } } diff --git a/src/server/terrain/simple_structures/SimpleTreeModel.zig b/src/server/terrain/simple_structures/SimpleTreeModel.zig index 651d4a86df..4cbfe5dc71 100644 --- a/src/server/terrain/simple_structures/SimpleTreeModel.zig +++ b/src/server/terrain/simple_structures/SimpleTreeModel.zig @@ -12,6 +12,7 @@ const Vec3d = vec.Vec3d; const Vec3f = vec.Vec3f; const Vec3i = vec.Vec3i; const NeverFailingAllocator = main.heap.NeverFailingAllocator; +const Neighbor = main.chunk.Neighbor; pub const id = "cubyz:simple_tree"; @@ -27,7 +28,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 +44,7 @@ pub fn loadModel(arenaAllocator: NeverFailingAllocator, parameters: ZonElement) 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), @@ -57,37 +56,58 @@ pub fn loadModel(arenaAllocator: NeverFailingAllocator, parameters: ZonElement) return self; } +fn getWoodBlock(self: *SimpleTreeModel, data: u16) main.blocks.Block { + if(self.woodBlock.mode() == main.rotation.getByID("log")) { + return .{.typ = self.woodBlock.typ, .data = data}; + } + return self.woodBlock; +} + pub fn generateStem(self: *SimpleTreeModel, x: i32, y: i32, z: i32, height: i32, chunk: *main.chunk.ServerChunk, seed: *u64) void { if(chunk.super.pos.voxelSize <= 2) { 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 data: u16 = 0; + if(pz != z + height - 1) { + data |= @as(u16, 1) << @intFromEnum(Neighbor.dirUp); + } + data |= @as(u16, 1) << @intFromEnum(Neighbor.dirDown); 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); + if(generateBranch(self, x, y, pz, d, chunk, seed)) |side| { + data |= @as(u16, 1) << @intFromEnum(side); + } } } + + chunk.updateBlockIfDegradable(x, y, pz, self.getWoodBlock(data)); } } } } -pub fn generateBranch(self: *SimpleTreeModel, x: i32, y: i32, z: i32, d: u32, chunk: *main.chunk.ServerChunk, seed: *u64) void { +pub fn generateBranch(self: *SimpleTreeModel, x: i32, y: i32, z: i32, d: u32, chunk: *main.chunk.ServerChunk, seed: *u64) ?Neighbor { _ = 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, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirNegX))); + return .dirPosX; } 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, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirPosX))); + return .dirNegX; } 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, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirNegY))); + return .dirPosY; } 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, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirPosY))); + return .dirNegY; } + + return null; } pub fn generate(self: *SimpleTreeModel, _: GenerationMode, x: i32, y: i32, z: i32, chunk: *main.chunk.ServerChunk, caveMap: CaveMapView, _: CaveBiomeMapView, seed: *u64, _: bool) void { From 0921bf64c6272788437a8740e45b6c445df75ea1 Mon Sep 17 00:00:00 2001 From: OneAvargeCoder193 Date: Mon, 2 Jun 2025 16:11:45 -0400 Subject: [PATCH 2/2] fixes --- mods/rotation.zig | 12 ------- .../terrain/simple_structures/FallenTree.zig | 31 ++++++++++++------- .../simple_structures/SimpleTreeModel.zig | 16 +++++----- 3 files changed, 27 insertions(+), 32 deletions(-) delete mode 100644 mods/rotation.zig diff --git a/mods/rotation.zig b/mods/rotation.zig deleted file mode 100644 index e5c3fb21b7..0000000000 --- a/mods/rotation.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub const @"cubyz:branch" = @import("cubyz/rotation/branch.zig"); -pub const @"cubyz:carpet" = @import("cubyz/rotation/carpet.zig"); -pub const @"cubyz:direction" = @import("cubyz/rotation/direction.zig"); -pub const @"cubyz:fence" = @import("cubyz/rotation/fence.zig"); -pub const @"cubyz:log" = @import("cubyz/rotation/log.zig"); -pub const @"cubyz:no_rotation" = @import("cubyz/rotation/no_rotation.zig"); -pub const @"cubyz:ore" = @import("cubyz/rotation/ore.zig"); -pub const @"cubyz:planar" = @import("cubyz/rotation/planar.zig"); -pub const @"cubyz:sign" = @import("cubyz/rotation/sign.zig"); -pub const @"cubyz:stairs" = @import("cubyz/rotation/stairs.zig"); -pub const @"cubyz:texture_pile" = @import("cubyz/rotation/texture_pile.zig"); -pub const @"cubyz:torch" = @import("cubyz/rotation/torch.zig"); diff --git a/src/server/terrain/simple_structures/FallenTree.zig b/src/server/terrain/simple_structures/FallenTree.zig index 310d67f3f6..94720e3b9b 100644 --- a/src/server/terrain/simple_structures/FallenTree.zig +++ b/src/server/terrain/simple_structures/FallenTree.zig @@ -20,23 +20,30 @@ pub const generationMode = .floor; const FallenTree = @This(); -woodBlock: u16, +woodBlock: main.blocks.Block, height0: u32, deltaHeight: u31, pub fn loadModel(arenaAllocator: NeverFailingAllocator, parameters: ZonElement) *FallenTree { const self = arenaAllocator.create(FallenTree); self.* = .{ - .woodBlock = main.blocks.getTypeById(parameters.get([]const u8, "log", "cubyz:oak_log")), + .woodBlock = main.blocks.parseBlock(parameters.get([]const u8, "log", "cubyz:oak_log")), .height0 = parameters.get(u32, "height", 6), .deltaHeight = parameters.get(u31, "height_variation", 3), }; return self; } +fn getWoodBlock(self: *FallenTree, data: u16) main.blocks.Block { + if(self.woodBlock.mode() == main.rotation.getByID("log") or self.woodBlock.mode() == main.rotation.getByID("branch")) { + return .{.typ = self.woodBlock.typ, .data = data}; + } + return self.woodBlock; +} + 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 = @as(u16, 1) << @intFromEnum(Neighbor.dirDown) | @as(u16, 1) << @intFromEnum(Neighbor.dirUp)}); + chunk.updateBlockIfDegradable(x, y, z, self.getWoodBlock(Neighbor.dirUp.bitMask() | Neighbor.dirDown.bitMask())); } pub fn generateFallen(self: *FallenTree, x: i32, y: i32, z: i32, length: u32, chunk: *main.chunk.ServerChunk, caveMap: CaveMapView, seed: *u64) void { @@ -85,26 +92,26 @@ pub fn generateFallen(self: *FallenTree, x: i32, y: i32, z: i32, length: u32, ch if(d.? == 0) { dx = 1; - dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosX) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegX); - dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirNegX); + dataLog = Neighbor.dirPosX.bitMask() | Neighbor.dirNegX.bitMask(); + dataTop = Neighbor.dirNegX.bitMask(); } else if(d.? == 1) { dx = -1; - dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosX) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegX); - dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirPosX); + dataLog = Neighbor.dirPosX.bitMask() | Neighbor.dirNegX.bitMask(); + dataTop = Neighbor.dirPosX.bitMask(); } else if(d.? == 2) { dy = 1; - dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosY) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegY); - dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirNegY); + dataLog = Neighbor.dirPosY.bitMask() | Neighbor.dirNegY.bitMask(); + dataTop = Neighbor.dirNegY.bitMask(); } else if(d.? == 3) { dy = -1; - dataLog = @as(u16, 1) << @intFromEnum(Neighbor.dirPosY) | @as(u16, 1) << @intFromEnum(Neighbor.dirNegY); - dataTop = @as(u16, 1) << @intFromEnum(Neighbor.dirPosY); + dataLog = Neighbor.dirPosY.bitMask() | Neighbor.dirNegY.bitMask(); + dataTop = Neighbor.dirPosY.bitMask(); } for(0..length) |val| { const v: i32 = @intCast(val); if(chunk.liesInChunk(x + dx*(v + 2), y + dy*(v + 2), z)) { - chunk.updateBlockIfDegradable(x + dx*(v + 2), y + dy*(v + 2), z, .{.typ = self.woodBlock, .data = if(v == (length - 1)) dataTop else dataLog}); + chunk.updateBlockIfDegradable(x + dx*(v + 2), y + dy*(v + 2), z, self.getWoodBlock(if(v == length - 1) dataTop else dataLog)); } } } diff --git a/src/server/terrain/simple_structures/SimpleTreeModel.zig b/src/server/terrain/simple_structures/SimpleTreeModel.zig index 4cbfe5dc71..f2d3bfa752 100644 --- a/src/server/terrain/simple_structures/SimpleTreeModel.zig +++ b/src/server/terrain/simple_structures/SimpleTreeModel.zig @@ -57,7 +57,7 @@ pub fn loadModel(arenaAllocator: NeverFailingAllocator, parameters: ZonElement) } fn getWoodBlock(self: *SimpleTreeModel, data: u16) main.blocks.Block { - if(self.woodBlock.mode() == main.rotation.getByID("log")) { + if(self.woodBlock.mode() == main.rotation.getByID("log") or self.woodBlock.mode() == main.rotation.getByID("branch")) { return .{.typ = self.woodBlock.typ, .data = data}; } return self.woodBlock; @@ -70,16 +70,16 @@ pub fn generateStem(self: *SimpleTreeModel, x: i32, y: i32, z: i32, height: i32, if(chunk.liesInChunk(x, y, pz)) { var data: u16 = 0; if(pz != z + height - 1) { - data |= @as(u16, 1) << @intFromEnum(Neighbor.dirUp); + data |= Neighbor.dirUp.bitMask(); } - data |= @as(u16, 1) << @intFromEnum(Neighbor.dirDown); + data |= Neighbor.dirDown.bitMask(); 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); if(generateBranch(self, x, y, pz, d, chunk, seed)) |side| { - data |= @as(u16, 1) << @intFromEnum(side); + data |= side.bitMask(); } } } @@ -94,16 +94,16 @@ 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, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirNegX))); + chunk.updateBlockIfDegradable(x + 1, y, z, self.getWoodBlock(Neighbor.dirNegX.bitMask())); return .dirPosX; } else if(d == 1 and chunk.liesInChunk(x - 1, y, z)) { - chunk.updateBlockIfDegradable(x - 1, y, z, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirPosX))); + chunk.updateBlockIfDegradable(x - 1, y, z, self.getWoodBlock(Neighbor.dirPosX.bitMask())); return .dirNegX; } else if(d == 2 and chunk.liesInChunk(x, y + 1, z)) { - chunk.updateBlockIfDegradable(x, y + 1, z, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirNegY))); + chunk.updateBlockIfDegradable(x, y + 1, z, self.getWoodBlock(Neighbor.dirNegY.bitMask())); return .dirPosY; } else if(d == 3 and chunk.liesInChunk(x, y - 1, z)) { - chunk.updateBlockIfDegradable(x, y - 1, z, self.getWoodBlock(@as(u16, 1) << @intFromEnum(Neighbor.dirPosY))); + chunk.updateBlockIfDegradable(x, y - 1, z, self.getWoodBlock(Neighbor.dirPosY.bitMask())); return .dirNegY; }