Skip to content

Commit abf1554

Browse files
committed
Replace plump trees with mauventitious trees
1 parent fc81092 commit abf1554

File tree

7 files changed

+249
-552
lines changed

7 files changed

+249
-552
lines changed

biomes/end/mauve_forest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ palette:
1313

1414
features:
1515
trees:
16-
- PLUMP_TREES
16+
- MAUVENTITIOUS_TREES
1717
flora:
1818
- CRIMSON_STEM_BUSHES
1919
- GRASS
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
id: MAUVENTITIOUS_TREES
2+
type: FEATURE
3+
4+
distributor:
5+
type: PADDED_GRID
6+
width: 19
7+
padding: 14
8+
salt: 9105
9+
10+
locator:
11+
type: AND
12+
locators:
13+
- type: TOP
14+
range: &range
15+
min: 0
16+
max: 319
17+
- type: PATTERN
18+
range: *range
19+
pattern:
20+
type: MATCH_AIR
21+
offset: 0
22+
- type: PATTERN
23+
range: *range
24+
pattern:
25+
type: MATCH_AIR
26+
offset: 3
27+
- type: PATTERN
28+
range: *range
29+
pattern:
30+
type: MATCH_SET
31+
blocks:
32+
- minecraft:magenta_concrete_powder
33+
- minecraft:purple_concrete_powder
34+
- minecraft:end_stone
35+
offset: -1
36+
37+
structures:
38+
distribution:
39+
type: CONSTANT
40+
structures: mauventitious_tree_procedural

features/end/vegetation/trees/plump_trees.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
num randPrecision = 100;
2+
num goldenAngle = 2.39996;
3+
num pi = 3.14159;
4+
num twopi = 6.28318530718;
5+
6+
num trunkHeight = 10+randomInt(18);
7+
num trunkBase = 1;
8+
str trunkBlock = "minecraft:stripped_crimson_hyphae";
9+
str rootBlock = "minecraft:stripped_crimson_hyphae";
10+
str undergroundRootBlock = "minecraft:stripped_crimson_hyphae";
11+
str underwaterRootBlock = "minecraft:stripped_crimson_hyphae";
12+
13+
num sideBranchInterval = 1+randomInt(2);
14+
num sideBranchMinHeight = 2+randomInt(3);
15+
num sideBranchLengthMin = 3;
16+
num sideBranchLengthVariation = 6;
17+
num sideBranchVerticalVariation = 0;
18+
num sideBranchVerticalDirection = 1+randomInt(randPrecision)/randPrecision/2;
19+
num sideBranchLeafRadiusMin = 4;
20+
num sideBranchLeafTranslate = 0;
21+
num sideBranchLeafTopFlatness = 2;
22+
num sideBranchLeafBottomFlatness = 4;
23+
num sideBranchLeafDensity = 0.6;
24+
str sideBranchLeafStructure = "oak_leaves_clump";
25+
str sideBranchBlockX = "minecraft:stripped_crimson_hyphae";
26+
str sideBranchBlockY = "minecraft:stripped_crimson_hyphae";
27+
str sideBranchBlockZ = "minecraft:stripped_crimson_hyphae";
28+
29+
num topBranches = 10+randomInt(3);
30+
num topBranchLengthUpwardsMin = 9+randomInt(3);
31+
num topBranchLengthOutwardsMin = 11+randomInt(3);
32+
num topBranchVerticalDirection = 0.4;
33+
num topBranchLeafRadiusMin = 4;
34+
num topBranchLeafTranslate = 0;
35+
num topBranchLeafTopFlatness = 2;
36+
num topBranchLeafBottomFlatness = 4;
37+
num topBranchLeafDensity = 0.6;
38+
str topBranchLeafStructure = "oak_leaves_clump";
39+
str topBranchBlockX = "minecraft:stripped_crimson_hyphae";
40+
str topBranchBlockY = "minecraft:stripped_crimson_hyphae";
41+
str topBranchBlockZ = "minecraft:stripped_crimson_hyphae";
42+
43+
if (getBlock(0,trunkHeight,0) != "minecraft:air") fail;
44+
45+
// Generate roots at base of trunk
46+
num roots = 6+randomInt(3);
47+
num rootMaxLength = 15;
48+
num rootDroop = -0.04;
49+
num rootVerticalDirection = -0.4-randomInt(randPrecision)/randPrecision*0.3;
50+
num rootAngle = randomInt(randPrecision)/randPrecision*2*pi;
51+
for (num r = 0; r < roots; r = r + 1) {
52+
// Branch direction vector
53+
num dx = sin(rootAngle);
54+
num dy = rootVerticalDirection;
55+
num dz = cos(rootAngle);
56+
// Normalize vector
57+
num mag = sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2));
58+
dx = dx/mag;
59+
dy = dy/mag;
60+
dz = dz/mag;
61+
62+
for (num i = 0; i <= rootMaxLength; i = i + 0.5) {
63+
num cx = i*dx;
64+
num cy = trunkBase+i*dy;
65+
num cz = i*dz;
66+
67+
// Place root block
68+
block(cx, cy, cz, rootBlock);
69+
70+
if (i == rootMaxLength) {
71+
num radius = sideBranchLeafRadiusMin;
72+
num radiusSquared = pow(radius, 2);
73+
for (num lox = ceil(-radius); lox <= ceil(radius); lox = lox + 1) {
74+
for (num loy = ceil(-radius/sideBranchLeafBottomFlatness); loy <= ceil(radius/sideBranchLeafTopFlatness); loy = loy + 1) {
75+
for (num loz = ceil(-radius); loz <= ceil(radius); loz = loz + 1) {
76+
num squashFactor = sideBranchLeafBottomFlatness;
77+
if (loy > 0) squashFactor = sideBranchLeafTopFlatness;
78+
num distanceSquared = pow(lox,2)+pow(loy*squashFactor,2)+pow(loz,2);
79+
if (distanceSquared<radiusSquared && randomInt(randPrecision) / randPrecision < sideBranchLeafDensity) {
80+
structure(lox+cx, loy+cy, loz+cz, sideBranchLeafStructure, "NONE", "CW_90", "CCW_90", "CW_180");
81+
}
82+
}
83+
}
84+
}
85+
}
86+
87+
// Point vector down more
88+
dy = dy - rootDroop;
89+
// Normalize vector
90+
mag = sqrt(pow2(dx)+pow2(dy)+pow2(dz));
91+
dx = dx/mag;
92+
dy = dy/mag;
93+
dz = dz/mag;
94+
}
95+
96+
rootAngle = rootAngle + goldenAngle;
97+
}
98+
99+
num branchAngle = randomInt(randPrecision)/randPrecision*2*pi;
100+
for (num i = 0; i < trunkHeight; i = i + 1) {
101+
if (i > sideBranchMinHeight) {
102+
if (i % sideBranchInterval == 0) {
103+
// Branch direction vector
104+
num dx = sin(branchAngle);
105+
num dy = sideBranchVerticalDirection + randomInt(randPrecision)/randPrecision*sideBranchVerticalVariation;
106+
num dz = cos(branchAngle);
107+
// Normalize vector
108+
num mag = sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2));
109+
dx = dx/mag;
110+
dy = dy/mag;
111+
dz = dz/mag;
112+
// Branch origin
113+
num ox = 0;
114+
num oy = i+trunkBase;
115+
num oz = 0;
116+
// Set branch block based on largest unsigned vector component
117+
str branchBlock = sideBranchBlockY;
118+
if (abs(dx) > max(abs(dy),abs(dz))) branchBlock = sideBranchBlockX;
119+
else if (abs(dz) > max(abs(dy),abs(dx))) branchBlock = sideBranchBlockZ;
120+
num branchLength = sideBranchLengthMin + randomInt(randPrecision)/randPrecision*sideBranchLengthVariation;
121+
// Generate branch
122+
for (num l = 1; l <= branchLength; l = l + 1) {
123+
block(l*dx+ox, l*dy+oy, l*dz+oz, branchBlock);
124+
}
125+
// Rotate angle of next branch
126+
branchAngle = branchAngle + goldenAngle;
127+
// Generate leaf cluster at the end of the branch
128+
num radius = sideBranchLeafRadiusMin;
129+
num radiusSquared = pow(radius, 2);
130+
// Leaf cluster origin (end of branch)
131+
num lox = ox+branchLength*dx;
132+
num loy = oy+branchLength*dy + sideBranchLeafTranslate;
133+
num loz = oz+branchLength*dz;
134+
for (num cx = ceil(-radius); cx <= ceil(radius); cx = cx + 1) {
135+
for (num cy = ceil(-radius/sideBranchLeafBottomFlatness); cy <= ceil(radius/sideBranchLeafTopFlatness); cy = cy + 1) {
136+
for (num cz = ceil(-radius); cz <= ceil(radius); cz = cz + 1) {
137+
num squashFactor = sideBranchLeafBottomFlatness;
138+
if (cy > 0) squashFactor = sideBranchLeafTopFlatness;
139+
num distanceSquared = pow(cx,2)+pow(cy*squashFactor,2)+pow(cz,2);
140+
if (distanceSquared<radiusSquared && randomInt(randPrecision) / randPrecision < sideBranchLeafDensity) {
141+
structure(lox+cx, loy+cy, loz+cz, sideBranchLeafStructure, "NONE", "CW_90", "CCW_90", "CW_180");
142+
}
143+
}
144+
}
145+
}
146+
}
147+
}
148+
block(0, i+trunkBase, 0, trunkBlock);
149+
block(1, i+trunkBase, 0, trunkBlock);
150+
block(0, i+trunkBase, 1, trunkBlock);
151+
block(1, i+trunkBase, 1, trunkBlock);
152+
}
153+
154+
for (num b = 1; b <= topBranches; b = b + 1) {
155+
num t = b/topBranches;
156+
num ti = 1-t;
157+
// Branch direction vector
158+
num dx = sin(branchAngle) * t;
159+
num dy = topBranchVerticalDirection;
160+
num dz = cos(branchAngle) * t;
161+
// Normalize vector
162+
num mag = sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2));
163+
dx = dx/mag;
164+
dy = dy/mag;
165+
dz = dz/mag;
166+
// Branch origin
167+
num ox = 0;
168+
num oy = trunkBase + trunkHeight;
169+
num oz = 0;
170+
// Set branch block based on largest unsigned vector component
171+
str branchBlock = topBranchBlockY;
172+
if (abs(dx) > max(abs(dy),abs(dz))) branchBlock = topBranchBlockX;
173+
else if (abs(dz) > max(abs(dy),abs(dx))) branchBlock = topBranchBlockZ;
174+
num branchLength = topBranchLengthUpwardsMin*ti + topBranchLengthOutwardsMin*t;
175+
// Generate branch
176+
for (num l = 0; l <= branchLength; l = l + 1) {
177+
block(l*dx+ox, l*dy+oy, l*dz+oz, branchBlock);
178+
}
179+
// Rotate angle of next branch
180+
branchAngle = branchAngle + goldenAngle;
181+
// Generate leaf cluster at the end of the branch
182+
num radius = topBranchLeafRadiusMin;
183+
num radiusSquared = pow(radius, 2);
184+
// Leaf cluster origin (end of branch)
185+
num lox = ox+branchLength*dx;
186+
num loy = oy+branchLength*dy + topBranchLeafTranslate;
187+
num loz = oz+branchLength*dz;
188+
for (num cx = ceil(-radius); cx <= ceil(radius); cx = cx + 1) {
189+
for (num cy = ceil(-radius/topBranchLeafBottomFlatness); cy <= ceil(radius/topBranchLeafTopFlatness); cy = cy + 1) {
190+
for (num cz = ceil(-radius); cz <= ceil(radius); cz = cz + 1) {
191+
num squashFactor = topBranchLeafBottomFlatness;
192+
if (cy > 0) squashFactor = topBranchLeafTopFlatness;
193+
num distanceSquared = pow(cx,2)+pow(cy*squashFactor,2)+pow(cz,2);
194+
if (distanceSquared < radiusSquared && randomInt(randPrecision)/randPrecision < topBranchLeafDensity) {
195+
structure(lox+cx, loy+cy, loz+cz, topBranchLeafStructure, "NONE", "CW_90", "CCW_90", "CW_180");
196+
}
197+
}
198+
}
199+
}
200+
}
201+
202+
for (num x = -10; x < 10; x = x + 1) {
203+
for (num y = 15; y < 40; y = y + 1) {
204+
for (num z = -10; z < 10; z = z + 1) {
205+
structure(x,y,z,"warped_buds", "NONE");
206+
}
207+
}
208+
}

0 commit comments

Comments
 (0)