forked from PolyhedralDev/TerraOverworldConfig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sakura_mountains to use cherry features
- Loading branch information
1 parent
56b86fd
commit 96bcbe6
Showing
6 changed files
with
258 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
id: PINK_PETALS | ||
type: FEATURE | ||
|
||
distributor: | ||
type: AND | ||
distributors: | ||
- type: SAMPLER | ||
sampler: | ||
type: POSITIVE_WHITE_NOISE | ||
salt: 8172 | ||
threshold: 0.7 | ||
- type: SAMPLER | ||
sampler: | ||
type: PROBABILITY | ||
sampler: | ||
type: DOMAIN_WARP | ||
amplitude: 5 | ||
warp: | ||
type: GAUSSIAN | ||
sampler: | ||
type: OPEN_SIMPLEX_2 | ||
threshold: 0.5 | ||
|
||
locator: | ||
type: AND | ||
locators: | ||
- type: TOP | ||
range: &range | ||
min: 62 | ||
max: 319 | ||
- type: PATTERN | ||
range: *range | ||
pattern: | ||
type: MATCH_SET | ||
blocks: $features/vegetation/meta.yml:plantable-blocks | ||
offset: -1 | ||
- type: PATTERN | ||
range: *range | ||
pattern: | ||
type: MATCH_SET | ||
blocks: | ||
- minecraft:snow | ||
- minecraft:air | ||
offset: 0 | ||
|
||
structures: | ||
distribution: | ||
type: CONSTANT | ||
structures: pink_petals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
id: DENSE_SAKURA_TREES | ||
type: FEATURE | ||
|
||
distributor: | ||
type: PADDED_GRID | ||
width: 7 | ||
padding: 5 | ||
salt: 5972 | ||
|
||
locator: | ||
type: AND | ||
locators: | ||
- type: TOP | ||
range: &range | ||
min: 64 | ||
max: 255 | ||
- type: PATTERN | ||
range: *range | ||
pattern: | ||
type: MATCH_SET | ||
blocks: $features/vegetation/meta.yml:plantable-blocks | ||
offset: -1 | ||
- type: PATTERN | ||
range: *range | ||
pattern: | ||
type: MATCH_SET | ||
blocks: | ||
- minecraft:snow | ||
- minecraft:air | ||
offset: 0 | ||
|
||
structures: | ||
distribution: | ||
type: CONSTANT | ||
structures: | ||
- sakura_tree_procedural: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
num flowers = randomInt(1000)/1000; | ||
num dir = randomInt(10); | ||
str blockID = "minecraft:pink_petals"; | ||
|
||
if(dir == 0) blockID = blockID + "[facing=north"; | ||
else if(dir == 1) blockID = blockID + "[facing=east"; | ||
else if(dir == 2) blockID = blockID + "[facing=west"; | ||
else if(dir == 3) blockID = blockID + "[facing=south"; | ||
|
||
if(flowers <= 0.5) blockID = blockID + ",flower_amount=4]"; | ||
else if(flowers <= 0.6) blockID = blockID + ",flower_amount=3]"; | ||
else if(flowers <= 0.8) blockID = blockID + ",flower_amount=2]"; | ||
else if(flowers <= 0.9) blockID = blockID + ",flower_amount=1]"; | ||
|
||
// Place flowers | ||
block(0, 0, 0, blockID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
block(0, 0, 0, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
|
||
if (randomInt(4) == 0) { | ||
block(0, 0, 1, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
block(0, 1, 0, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
block(0, 1, 1, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
block(1, 0, 0, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
block(1, 0, 1, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
block(1, 1, 0, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
block(1, 1, 1, "minecraft:cherry_leaves[distance=1,persistent=false]", false); | ||
} |
142 changes: 142 additions & 0 deletions
142
structures/vegetation/trees/sakura_tree_procedural.tesf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
num randPrecision = 100; | ||
num goldenAngle = 2.39996; | ||
num pi = 3.14159; | ||
num twopi = 6.28318530718; | ||
|
||
num trunkHeight = 4+randomInt(4); | ||
str trunkBlock = "minecraft:cherry_log"; | ||
|
||
num sideBranchInterval = 3+randomInt(2); | ||
num sideBranchMinHeight = 2+randomInt(3); | ||
num sideBranchLengthMin = 3; | ||
num sideBranchLengthVariation = 2; | ||
num sideBranchVerticalVariation = 0; | ||
num sideBranchVerticalDirection = 1+randomInt(randPrecision)/randPrecision/2; | ||
num sideBranchLeafRadiusMin = 2; | ||
num sideBranchLeafTranslate = 0; | ||
num sideBranchLeafTopFlatness = 2; | ||
num sideBranchLeafBottomFlatness = 4; | ||
num sideBranchLeafDensity = 0.6; | ||
str sideBranchLeafStructure = "cherry_leaves_clump"; | ||
str sideBranchBlockX = "minecraft:cherry_log[axis=x]"; | ||
str sideBranchBlockY = "minecraft:cherry_log[axis=y]"; | ||
str sideBranchBlockZ = "minecraft:cherry_log[axis=z]"; | ||
|
||
num topBranches = 10+randomInt(3); | ||
num topBranchLengthUpwardsMin = 7+randomInt(3); | ||
num topBranchLengthOutwardsMin = 4+randomInt(3); | ||
num topBranchVerticalDirection = 0.4; | ||
num topBranchLeafRadiusMin = 2; | ||
num topBranchLeafTranslate = 0; | ||
num topBranchLeafTopFlatness = 1.5; | ||
num topBranchLeafBottomFlatness = 1; | ||
num topBranchLeafDensity = 0.6; | ||
str topBranchLeafStructure = "cherry_leaves_clump"; | ||
str topBranchBlockX = "minecraft:cherry_log[axis=x]"; | ||
str topBranchBlockY = "minecraft:cherry_log[axis=y]"; | ||
str topBranchBlockZ = "minecraft:cherry_log[axis=z]"; | ||
|
||
num branchAngle = randomInt(randPrecision)/randPrecision*2*pi; | ||
for (num i = 0; i < trunkHeight; i = i + 1) { | ||
if (i > sideBranchMinHeight) { | ||
if (i % sideBranchInterval == 0) { | ||
// Branch direction vector | ||
num dx = sin(branchAngle); | ||
num dy = sideBranchVerticalDirection + randomInt(randPrecision)/randPrecision*sideBranchVerticalVariation; | ||
num dz = cos(branchAngle); | ||
// Normalize vector | ||
num mag = sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2)); | ||
dx = dx/mag; | ||
dy = dy/mag; | ||
dz = dz/mag; | ||
// Branch origin | ||
num ox = 0; | ||
num oy = i; | ||
num oz = 0; | ||
// Set branch block based on largest unsigned vector component | ||
str branchBlock = sideBranchBlockY; | ||
if (abs(dx) > max(abs(dy),abs(dz))) branchBlock = sideBranchBlockX; | ||
else if (abs(dz) > max(abs(dy),abs(dx))) branchBlock = sideBranchBlockZ; | ||
num branchLength = sideBranchLengthMin + randomInt(randPrecision)/randPrecision*sideBranchLengthVariation; | ||
// Generate branch | ||
for (num l = 1; l <= branchLength; l = l + 1) { | ||
block(l*dx+ox, l*dy+oy, l*dz+oz, branchBlock); | ||
} | ||
// Rotate angle of next branch | ||
branchAngle = branchAngle + goldenAngle; | ||
// Generate leaf cluster at the end of the branch | ||
num radius = sideBranchLeafRadiusMin; | ||
num radiusSquared = pow(radius, 2); | ||
// Leaf cluster origin (end of branch) | ||
num lox = ox+branchLength*dx; | ||
num loy = oy+branchLength*dy + sideBranchLeafTranslate; | ||
num loz = oz+branchLength*dz; | ||
for (num cx = ceil(-radius); cx <= ceil(radius); cx = cx + 1) { | ||
for (num cy = ceil(-radius/sideBranchLeafBottomFlatness); cy <= ceil(radius/sideBranchLeafTopFlatness); cy = cy + 1) { | ||
for (num cz = ceil(-radius); cz <= ceil(radius); cz = cz + 1) { | ||
num squashFactor = sideBranchLeafBottomFlatness; | ||
if (cy > 0) squashFactor = sideBranchLeafTopFlatness; | ||
num distanceSquared = pow(cx,2)+pow(cy*squashFactor,2)+pow(cz,2); | ||
if (distanceSquared<radiusSquared && randomInt(randPrecision) / randPrecision < sideBranchLeafDensity) { | ||
structure(lox+cx, loy+cy, loz+cz, sideBranchLeafStructure, "NONE", "CW_90", "CCW_90", "CW_180"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
block(0, i, 0, trunkBlock); | ||
} | ||
|
||
for (num b = 1; b <= topBranches; b = b + 1) { | ||
num t = b/topBranches; | ||
num ti = 1-t; | ||
// Branch direction vector | ||
num dx = sin(branchAngle) * t; | ||
num dy = topBranchVerticalDirection; | ||
num dz = cos(branchAngle) * t; | ||
// Normalize vector | ||
num mag = sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2)); | ||
dx = dx/mag; | ||
dy = dy/mag; | ||
dz = dz/mag; | ||
// Branch origin | ||
num ox = 0; | ||
num oy = trunkHeight; | ||
num oz = 0; | ||
// Set branch block based on largest unsigned vector component | ||
str branchBlock = topBranchBlockY; | ||
if (abs(dx) > max(abs(dy),abs(dz))) branchBlock = topBranchBlockX; | ||
else if (abs(dz) > max(abs(dy),abs(dx))) branchBlock = topBranchBlockZ; | ||
num branchLength = topBranchLengthUpwardsMin*ti + topBranchLengthOutwardsMin*t; | ||
// Generate branch | ||
for (num l = 0; l <= branchLength; l = l + 1) { | ||
block(l*dx+ox, l*dy+oy, l*dz+oz, branchBlock); | ||
} | ||
// Rotate angle of next branch | ||
branchAngle = branchAngle + goldenAngle; | ||
// Generate leaf cluster at the end of the branch | ||
num radius = topBranchLeafRadiusMin; | ||
num radiusSquared = pow(radius, 2); | ||
// Leaf cluster origin (end of branch) | ||
num lox = ox+branchLength*dx; | ||
num loy = oy+branchLength*dy + topBranchLeafTranslate; | ||
num loz = oz+branchLength*dz; | ||
for (num cx = ceil(-radius); cx <= ceil(radius); cx = cx + 1) { | ||
for (num cy = ceil(-radius/topBranchLeafBottomFlatness); cy <= ceil(radius/topBranchLeafTopFlatness); cy = cy + 1) { | ||
for (num cz = ceil(-radius); cz <= ceil(radius); cz = cz + 1) { | ||
num squashFactor = topBranchLeafBottomFlatness; | ||
if (cy > 0) squashFactor = topBranchLeafTopFlatness; | ||
num distanceSquared = pow(cx,2)+pow(cy*squashFactor,2)+pow(cz,2); | ||
if (distanceSquared < radiusSquared && randomInt(randPrecision)/randPrecision < topBranchLeafDensity) { | ||
structure(lox+cx, loy+cy, loz+cz, topBranchLeafStructure, "NONE", "CW_90", "CCW_90", "CW_180"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
num beeNestRoll = randomInt(30); // 1 in 30 chance | ||
if (beeNestRoll == 0) { | ||
structure(0, sideBranchMinHeight-1, 0, "bee_nest", "NONE"); | ||
} |