slightly fancier trees

This commit is contained in:
darkrose 2017-06-26 18:03:14 +10:00
parent eb6d734ce4
commit 91ca0b97c6
6 changed files with 167 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -5585,6 +5585,12 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
content_t n2;
bool mud_under = false;
float bottom_scale = 1.0;
float top_scale = 1.0;
int height = 0;
int dir = 0;
int cap = 0;
content_t thiscontent = n.getContent();
if (data->mesh_detail == 1) {
@ -5641,33 +5647,67 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
}else if (!meshgen_hardface(data,p,n,v3s16(0,0,-1))) {
z_minus_any = true;
}
if (content_features(thiscontent).param_type == CPT_BLOCKDATA) {
height = n.param1&0x0F;
cap = n.param1&0x10;
dir = (n.param1&0xE0)>>5;
}
if (height || dir) {
int top_height = height+1;
int bottom_height = height;
if (top_height > 16)
top_height = 16;
if (bottom_height > 16)
bottom_height = 16;
if (cap)
top_height = 16;
if (dir == 1 || dir == 4) {
bottom_scale = (0.0625*(16.0-((float)top_height)));
top_scale = (0.0625*(16.0-((float)bottom_height)));
}else{
bottom_scale = (0.0625*(16.0-((float)bottom_height)));
top_scale = (0.0625*(16.0-((float)top_height)));
}
if (dir) {
if (dir == 1 || dir == 2) {
x_plus = true;
x_minus = true;
}else if (dir == 3 || dir == 4) {
z_plus = true;
z_minus = true;
}
}
}
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),selected);
TileSpec endtile = getNodeTile(n,p,v3s16(0,1,0),selected);
video::S3DVertex vertices[10] = {
video::S3DVertex(0 ,-data->m_BS*0.5,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.),
video::S3DVertex(data->m_BS*0.125,-data->m_BS*0.5,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.25, 0.),
video::S3DVertex(data->m_BS*0.375,-data->m_BS*0.5,data->m_BS*0.375, 0,0,0, video::SColor(255,255,255,255), 0.5, 0.),
video::S3DVertex(data->m_BS*0.499,-data->m_BS*0.5,data->m_BS*0.125, 0,0,0, video::SColor(255,255,255,255), 0.75, 0.),
video::S3DVertex(data->m_BS*0.499,-data->m_BS*0.5,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 0.),
video::S3DVertex(0 ,-data->m_BS*0.5,data->m_BS*0.499*(bottom_scale), 0,0,0, video::SColor(255,255,255,255), 0.125, 0.),
video::S3DVertex(data->m_BS*0.125*(bottom_scale),-data->m_BS*0.5,data->m_BS*0.499*(bottom_scale), 0,0,0, video::SColor(255,255,255,255), 0.25, 0.),
video::S3DVertex(data->m_BS*0.375*(bottom_scale),-data->m_BS*0.5,data->m_BS*0.375*(bottom_scale), 0,0,0, video::SColor(255,255,255,255), 0.5, 0.),
video::S3DVertex(data->m_BS*0.499*(bottom_scale),-data->m_BS*0.5,data->m_BS*0.125*(bottom_scale), 0,0,0, video::SColor(255,255,255,255), 0.75, 0.),
video::S3DVertex(data->m_BS*0.499*(bottom_scale),-data->m_BS*0.5,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 0.),
video::S3DVertex(0 , data->m_BS*0.5,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.125, 1.0),
video::S3DVertex(data->m_BS*0.125, data->m_BS*0.5,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.25, 1.0),
video::S3DVertex(data->m_BS*0.375, data->m_BS*0.5,data->m_BS*0.375, 0,0,0, video::SColor(255,255,255,255), 0.5, 1.0),
video::S3DVertex(data->m_BS*0.499, data->m_BS*0.5,data->m_BS*0.125, 0,0,0, video::SColor(255,255,255,255), 0.75, 1.0),
video::S3DVertex(data->m_BS*0.499, data->m_BS*0.5,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 1.0)
video::S3DVertex(0 , data->m_BS*0.5,data->m_BS*0.499*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.125, 1.0),
video::S3DVertex(data->m_BS*0.125*top_scale, data->m_BS*0.5,data->m_BS*0.499*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.25, 1.0),
video::S3DVertex(data->m_BS*0.375*top_scale, data->m_BS*0.5,data->m_BS*0.375*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.5, 1.0),
video::S3DVertex(data->m_BS*0.499*top_scale, data->m_BS*0.5,data->m_BS*0.125*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.75, 1.0),
video::S3DVertex(data->m_BS*0.499*top_scale, data->m_BS*0.5,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 1.0)
};
video::S3DVertex branch_vertices[10] = {
video::S3DVertex(0 ,data->m_BS*0.125,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.625),
video::S3DVertex(data->m_BS*0.125,data->m_BS*0.125,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.25, 0.625),
video::S3DVertex(data->m_BS*0.375,data->m_BS*0.125,data->m_BS*0.375, 0,0,0, video::SColor(255,255,255,255), 0.5, 0.625),
video::S3DVertex(data->m_BS*0.499,data->m_BS*0.125,data->m_BS*0.125, 0,0,0, video::SColor(255,255,255,255), 0.75, 0.625),
video::S3DVertex(data->m_BS*0.499,data->m_BS*0.125,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 0.625),
video::S3DVertex(0 ,data->m_BS*0.125,data->m_BS*0.499*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.625),
video::S3DVertex(data->m_BS*0.125*top_scale,data->m_BS*0.125,data->m_BS*0.499*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.25, 0.625),
video::S3DVertex(data->m_BS*0.375*top_scale,data->m_BS*0.125,data->m_BS*0.375*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.5, 0.625),
video::S3DVertex(data->m_BS*0.499*top_scale,data->m_BS*0.125,data->m_BS*0.125*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.75, 0.625),
video::S3DVertex(data->m_BS*0.499*top_scale,data->m_BS*0.125,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 0.625),
video::S3DVertex(0 ,data->m_BS*0.5 ,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.125, 1.0),
video::S3DVertex(data->m_BS*0.125,data->m_BS*0.5 ,data->m_BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.25, 1.0),
video::S3DVertex(data->m_BS*0.375,data->m_BS*0.5 ,data->m_BS*0.375, 0,0,0, video::SColor(255,255,255,255), 0.5, 1.0),
video::S3DVertex(data->m_BS*0.499,data->m_BS*0.5 ,data->m_BS*0.125, 0,0,0, video::SColor(255,255,255,255), 0.75, 1.0),
video::S3DVertex(data->m_BS*0.499,data->m_BS*0.5 ,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 1.0)
video::S3DVertex(0 ,data->m_BS*0.5 ,data->m_BS*0.499*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.125, 1.0),
video::S3DVertex(data->m_BS*0.125*top_scale,data->m_BS*0.5 ,data->m_BS*0.499*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.25, 1.0),
video::S3DVertex(data->m_BS*0.375*top_scale,data->m_BS*0.5 ,data->m_BS*0.375*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.5, 1.0),
video::S3DVertex(data->m_BS*0.499*top_scale,data->m_BS*0.5 ,data->m_BS*0.125*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.75, 1.0),
video::S3DVertex(data->m_BS*0.499*top_scale,data->m_BS*0.5 ,0 , 0,0,0, video::SColor(255,255,255,255), 0.625, 1.0)
};
u16 indices[24] = {0,1,6,0,6,5,1,2,7,1,7,6,2,3,8,2,8,7,3,4,9,3,9,8};
video::S3DVertex end_vertices[6] = {
@ -5683,9 +5723,9 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex(data->m_BS*0.498,-data->m_BS*0.5 ,data->m_BS*0.498, 0,0,0, video::SColor(255,255,255,255), 0., 0.),
video::S3DVertex(data->m_BS*0.498,-data->m_BS*0.5 ,data->m_BS*0.125, 0,0,0, video::SColor(255,255,255,255), 0.375, 0.),
video::S3DVertex(data->m_BS*0.125,-data->m_BS*0.5 ,data->m_BS*0.498, 0,0,0, video::SColor(255,255,255,255), 0.375, 0.),
video::S3DVertex(data->m_BS*0.498, data->m_BS*0.25,data->m_BS*0.125, 0,0,0, video::SColor(255,255,255,255), 0.375, 0.75),
video::S3DVertex(data->m_BS*0.375, data->m_BS*0.25,data->m_BS*0.375, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.75),
video::S3DVertex(data->m_BS*0.125, data->m_BS*0.25,data->m_BS*0.498, 0,0,0, video::SColor(255,255,255,255), 0.375, 0.75),
video::S3DVertex(data->m_BS*0.498*top_scale, data->m_BS*0.25,data->m_BS*0.125*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.375, 0.75),
video::S3DVertex(data->m_BS*0.375*top_scale, data->m_BS*0.25,data->m_BS*0.375*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.75),
video::S3DVertex(data->m_BS*0.125*top_scale, data->m_BS*0.25,data->m_BS*0.498*top_scale, 0,0,0, video::SColor(255,255,255,255), 0.375, 0.75),
};
u16 base_indices[12] = {0,1,3,0,5,2,0,3,4,0,4,5};
u16 rots[4] = {0,90,180,270};
@ -5734,6 +5774,8 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex v[6];
for (u16 i=0; i<6; i++) {
v[i] = end_vertices[i];
v[i].Pos.X *= top_scale;
v[i].Pos.Z *= top_scale;
v[i].Pos.rotateXZBy(rots[j]);
v[i].TCoords *= endtile.texture.size;
v[i].TCoords += endtile.texture.pos;
@ -5757,6 +5799,8 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex v[6];
for (u16 i=0; i<6; i++) {
v[i] = end_vertices[i];
v[i].Pos.X *= bottom_scale;
v[i].Pos.Z *= bottom_scale;
v[i].Pos.rotateXYBy(180);
v[i].Pos.rotateXZBy(rots[j]);
v[i].TCoords *= endtile.texture.size;
@ -5980,6 +6024,10 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex v[6];
for (u16 i=0; i<6; i++) {
v[i] = end_vertices[i];
if (dir) {
v[i].Pos.X *= bottom_scale;
v[i].Pos.Z *= bottom_scale;
}
v[i].Pos.rotateXYBy(-90);
v[i].Pos.rotateYZBy(rots[j]);
v[i].TCoords *= endtile.texture.size;
@ -6004,6 +6052,10 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex v[6];
for (u16 i=0; i<6; i++) {
v[i] = end_vertices[i];
if (dir) {
v[i].Pos.X *= top_scale;
v[i].Pos.Z *= top_scale;
}
v[i].Pos.rotateXYBy(90);
v[i].Pos.rotateYZBy(rots[j]);
v[i].TCoords *= endtile.texture.size;
@ -6133,6 +6185,10 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex v[6];
for (u16 i=0; i<6; i++) {
v[i] = end_vertices[i];
if (dir) {
v[i].Pos.X *= top_scale;
v[i].Pos.Z *= top_scale;
}
v[i].Pos.rotateYZBy(90);
v[i].Pos.rotateXYBy(rots[j]);
v[i].TCoords *= endtile.texture.size;
@ -6157,6 +6213,10 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
video::S3DVertex v[6];
for (u16 i=0; i<6; i++) {
v[i] = end_vertices[i];
if (dir) {
v[i].Pos.X *= bottom_scale;
v[i].Pos.Z *= bottom_scale;
}
v[i].Pos.rotateYZBy(-90);
v[i].Pos.rotateXYBy(rots[j]);
v[i].TCoords *= endtile.texture.size;

View File

@ -41,6 +41,7 @@ void content_mapnode_plants(bool repeat)
f->setAllTextures("tree.png");
f->setTexture(0, "tree_top.png");
f->setTexture(1, "tree_top.png");
f->param_type = CPT_BLOCKDATA;
f->setInventoryTextureCube("tree_top.png", "tree.png", "tree.png");
f->draw_type = CDT_TRUNKLIKE;
f->is_ground_content = true;
@ -62,6 +63,7 @@ void content_mapnode_plants(bool repeat)
f->setAllTextures("apple_tree.png");
f->setTexture(0, "apple_tree_top.png");
f->setTexture(1, "apple_tree_top.png");
f->param_type = CPT_BLOCKDATA;
f->setInventoryTextureCube("apple_tree_top.png", "apple_tree.png", "apple_tree.png");
f->draw_type = CDT_TRUNKLIKE;
f->is_ground_content = true;
@ -83,6 +85,7 @@ void content_mapnode_plants(bool repeat)
f->setAllTextures("jungletree.png");
f->setTexture(0, "jungletree_top.png");
f->setTexture(1, "jungletree_top.png");
f->param_type = CPT_BLOCKDATA;
f->setInventoryTextureCube("jungletree_top.png", "jungletree.png", "jungletree.png");
f->draw_type = CDT_TRUNKLIKE;
//f->is_ground_content = true;
@ -103,6 +106,7 @@ void content_mapnode_plants(bool repeat)
f->setAllTextures("conifer_tree.png");
f->setTexture(0, "conifer_tree_top.png");
f->setTexture(1, "conifer_tree_top.png");
f->param_type = CPT_BLOCKDATA;
f->setInventoryTextureCube("conifer_tree_top.png", "conifer_tree.png", "conifer_tree.png");
f->draw_type = CDT_TRUNKLIKE;
f->is_ground_content = true;

View File

@ -43,12 +43,17 @@ static void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
{
MapNode treenode(CONTENT_TREE);
MapNode leavesnode(CONTENT_LEAVES);
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(5,6);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
if (vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
b = 0;
p1.Y++;
}
@ -117,13 +122,17 @@ static void make_appletree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
MapNode treenode(CONTENT_APPLE_TREE);
MapNode leavesnode(CONTENT_APPLE_LEAVES);
MapNode applenode(CONTENT_APPLE);
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(4, 5);
v3s16 p1 = p0;
for(s16 ii=0; ii<trunk_h; ii++)
{
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
if(vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
b = 0;
p1.Y++;
}
@ -196,12 +205,17 @@ static void make_conifertree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
{
MapNode treenode(CONTENT_CONIFER_TREE);
MapNode leavesnode(CONTENT_CONIFER_LEAVES);
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(8, 11);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
if(vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
b = 0;
p1.Y++;
}
@ -233,13 +247,17 @@ static void make_largetree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
{
MapNode treenode(CONTENT_TREE);
MapNode leavesnode(CONTENT_LEAVES);
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(10, 12);
v3s16 p1 = p0;
for(s16 ii=0; ii<trunk_h; ii++)
{
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
if(vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
b = 0;
p1.Y++;
}
@ -254,33 +272,50 @@ static void make_largetree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
for (s16 k=0; k<5; k++) {
if (k == 1) {
p1.Y -= 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.X++;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
}
p1.X--;
}else if (k == 2) {
p1.X -= 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.X--;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
}
p1.X++;
}else if (k == 3) {
p1.X += 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.Z++;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
}
p1.Z--;
}else if (k == 4) {
p1.Z -= 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.Z--;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
}
p1.Z++;
}else{
treenode.param1 = 0x10|trunk_h;
vmanip.m_data[vmanip.m_area.index(p1)] = treenode;
}
// Force leaves at near the end of the trunk

View File

@ -220,7 +220,7 @@ std::vector<NodeBox> SwitchNodeMetadata::getNodeBoxes(MapNode &n)
));
}
return transformNodeBox(n,boxes);
return boxes;
}

View File

@ -31,11 +31,16 @@ void plantgrowth_tree(ServerEnvironment *env, v3s16 p0)
MapNode treenode(CONTENT_TREE);
MapNode leavesnode(CONTENT_LEAVES);
Map *map = &env->getMap();
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(5,6);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
b = 0;
p1.Y++;
}
@ -101,11 +106,16 @@ void plantgrowth_appletree(ServerEnvironment *env, v3s16 p0)
MapNode leavesnode(CONTENT_APPLE_LEAVES);
MapNode applenode(CONTENT_APPLE);
Map *map = &env->getMap();
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(4, 5);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
b = 0;
p1.Y++;
}
@ -174,11 +184,16 @@ void plantgrowth_conifertree(ServerEnvironment *env, v3s16 p0)
MapNode treenode(CONTENT_CONIFER_TREE);
MapNode leavesnode(CONTENT_CONIFER_LEAVES);
Map *map = &env->getMap();
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(8, 11);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
b = 0;
p1.Y++;
}
@ -218,11 +233,16 @@ void plantgrowth_largetree(ServerEnvironment *env, v3s16 p0)
MapNode treenode(CONTENT_TREE);
MapNode leavesnode(CONTENT_LEAVES);
Map *map = &env->getMap();
uint8_t b = 0xE0;
s16 trunk_h = myrand_range(10, 12);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
if (ii == trunk_h-1)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
b = 0;
p1.Y++;
}
@ -238,33 +258,50 @@ void plantgrowth_largetree(ServerEnvironment *env, v3s16 p0)
for (s16 k=0; k<5; k++) {
if (k == 1) {
p1.Y -= 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.X++;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
}
p1.X--;
}else if (k == 2) {
p1.X -= 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.X--;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
}
p1.X++;
}else if (k == 3) {
p1.X += 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.Z++;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
}
p1.Z--;
}else if (k == 4) {
p1.Z -= 3;
b = k<<5;
for (s16 ki=0; ki<4; ki++) {
p1.Z--;
treenode.param1 = b|((trunk_h-3)+ki);
if (ki == 3)
treenode.param1 |= 0x10;
map->addNodeWithEvent(p1,treenode);
}
p1.Z++;
}else{
treenode.param1 = 0x10|trunk_h;
map->addNodeWithEvent(p1,treenode);
}
// Force leaves at near the end of the trunk
@ -319,6 +356,7 @@ void plantgrowth_jungletree(ServerEnvironment *env, v3s16 p0)
MapNode treenode(CONTENT_JUNGLETREE);
MapNode leavesnode(CONTENT_JUNGLELEAVES);
Map *map = &env->getMap();
uint8_t b = 0xE0;
for (s16 x=-1; x<=1; x++) {
for (s16 z=-1; z<=1; z++) {
@ -339,7 +377,9 @@ void plantgrowth_jungletree(ServerEnvironment *env, v3s16 p0)
s16 trunk_h = myrand_range(8, 12);
v3s16 p1 = p0;
for (s16 ii=0; ii<trunk_h; ii++) {
treenode.param1 = b|ii;
map->addNodeWithEvent(p1,treenode);
b = 0;
p1.Y++;
}