Skip to content

Commit

Permalink
Merge pull request #149 from PolyhedralDev/ver/1.3.2
Browse files Browse the repository at this point in the history
Patch version 1.3.2
  • Loading branch information
Astrashh committed Jul 10, 2023
2 parents b53f7d0 + 72189f0 commit bd16c03
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Expand Up @@ -41,10 +41,12 @@ generate in an area where it previously did not (resulting in a chunk border).

## [Unreleased]
### Added

- Cherry tree features.
- Pink petal features.

### Changed

- Sakura Mountains now use Cherry tree features instead of Dark Oak.
- Sakura Mountains generate pink petal patches.

### Removed

Expand Down
Expand Up @@ -6,12 +6,15 @@ color: $biomes/colors.yml:SAKURA_MOUNTAINS

colors:
foliage: 0xffb7c5
grass: 0xB6DB61
water: 0x5DB7EF

features:
flora:
- GRASS
- PINK_PETALS
trees:
- DENSE_DARK_FOREST_TREES
- DENSE_SAKURA_TREES
landforms:
- MOSSY_BOULDERS
- SMALL_MOSSY_BOULDER_PATCHES
49 changes: 49 additions & 0 deletions features/vegetation/flowers/pink_petals.yml
@@ -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
36 changes: 36 additions & 0 deletions features/vegetation/trees/dense_sakura_trees.yml
@@ -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
2 changes: 1 addition & 1 deletion pack.yml
@@ -1,5 +1,5 @@
id: OVERWORLD
version: 1.3.1
version: 1.3.2
author: "Astrash, Sancires, Aureus"

generator: NOISE_3D
Expand Down
16 changes: 16 additions & 0 deletions structures/vegetation/flowers/pink_petals.tesf
@@ -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);
11 changes: 11 additions & 0 deletions structures/vegetation/trees/cherry_leaves_clump.tesf
@@ -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 structures/vegetation/trees/sakura_tree_procedural.tesf
@@ -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");
}

0 comments on commit bd16c03

Please sign in to comment.