summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua52
-rw-r--r--src/BlockType.h15
-rw-r--r--src/Generating/StructGen.cpp4
-rw-r--r--src/Generating/Trees.cpp145
-rw-r--r--src/Generating/Trees.h6
5 files changed, 217 insertions, 5 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 430e43df6..c84260903 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -16999,6 +16999,58 @@ end
{
Notes = "A flag in the metadata of sponges that indicates that the sponge is wet.",
},
+ E_META_MUSHROOM_ALL_SIDES =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on all sides.",
+ },
+ E_META_MUSHROOM_NORTH_WEST =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the pore texture on north and west side.",
+ },
+ E_META_MUSHROOM_NORTH =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on north side.",
+ },
+ E_META_MUSHROOM_NORTH_EAST =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on north and east side.",
+ },
+ E_META_MUSHROOM_WEST =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on west side.",
+ },
+ E_META_MUSHROOM_CENTER =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on top.",
+ },
+ E_META_MUSHROOM_EAST =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on east side.",
+ },
+ E_META_MUSHROOM_SOUTH_WEST =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on south and west side.",
+ },
+ E_META_MUSHROOM_SOUTH =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on south side.",
+ },
+ E_META_MUSHROOM_SOUTH_EAST =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on south and east side.",
+ },
+ E_META_MUSHROOM_STEM =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the stem texture on all sides but not on top and bottom.",
+ },
+ E_META_MUSHROOM_CAP =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the outside texture on all sides.",
+ },
+ E_META_MUSHROOM_FULL_STEM =
+ {
+ Notes = "A flag in the metadata of mushroom blocks to display the stem texture on all sides.",
+ },
esBed =
{
Notes = "A bed explosion. The SourceData param is the {{Vector3i|position}} of the bed.",
diff --git a/src/BlockType.h b/src/BlockType.h
index 4db75b252..f98d9db82 100644
--- a/src/BlockType.h
+++ b/src/BlockType.h
@@ -712,6 +712,21 @@ enum ENUM_BLOCK_META : NIBBLETYPE
E_META_LEAVES_BIRCH_CHECK_DECAY = 10,
E_META_LEAVES_JUNGLE_CHECK_DECAY = 11,
+ // E_BLOCK_MUSHROOM metas:
+ E_META_MUSHROOM_ALL_SIDES = 0,
+ E_META_MUSHROOM_NORTH_WEST = 1,
+ E_META_MUSHROOM_NORTH = 2,
+ E_META_MUSHROOM_NORTH_EAST = 3,
+ E_META_MUSHROOM_WEST = 4,
+ E_META_MUSHROOM_CENTER = 5,
+ E_META_MUSHROOM_EAST = 6,
+ E_META_MUSHROOM_SOUTH_WEST = 7,
+ E_META_MUSHROOM_SOUTH = 8,
+ E_META_MUSHROOM_SOUTH_EAST = 9,
+ E_META_MUSHROOM_STEM = 10,
+ E_META_MUSHROOM_CAP = 14,
+ E_META_MUSHROOM_FULL_STEM = 15,
+
// E_BLOCK_LEAVES meta cont. (Block ID 161):
E_META_NEWLEAVES_ACACIA = 0,
E_META_NEWLEAVES_DARK_OAK = 1,
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index 9fa413e2d..fd78ceb3e 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -108,7 +108,7 @@ void cStructGenTrees::GenerateSingleTree(
// Check the block underneath the tree:
BLOCKTYPE TopBlock = a_ChunkDesc.GetBlockType(a_Pos.x, a_Pos.y, a_Pos.z);
- if ((TopBlock != E_BLOCK_DIRT) && (TopBlock != E_BLOCK_GRASS) && (TopBlock != E_BLOCK_FARMLAND))
+ if ((TopBlock != E_BLOCK_DIRT) && (TopBlock != E_BLOCK_GRASS) && (TopBlock != E_BLOCK_FARMLAND) && (TopBlock != E_BLOCK_MYCELIUM))
{
return;
}
@@ -175,6 +175,8 @@ void cStructGenTrees::ApplyTreeImage(
{
case E_BLOCK_NEW_LEAVES:
case E_BLOCK_LEAVES:
+ case E_BLOCK_HUGE_BROWN_MUSHROOM:
+ case E_BLOCK_HUGE_RED_MUSHROOM:
{
if ((itr->m_BlockType != E_BLOCK_LOG) && (itr->m_BlockType != E_BLOCK_NEW_LOG))
{
diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp
index 0d6a40291..cb9726d08 100644
--- a/src/Generating/Trees.cpp
+++ b/src/Generating/Trees.cpp
@@ -313,8 +313,6 @@ void GetTreeImageByBiome(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, EMCSB
{
case biPlains:
case biForest:
- case biMushroomIsland:
- case biMushroomShore:
case biForestHills:
case biSunflowerPlains:
case biFlowerForest:
@@ -434,7 +432,39 @@ void GetTreeImageByBiome(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, EMCSB
case biRoofedForest:
case biRoofedForestM:
{
- GetDarkoakTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ // 53 % DarkOak
+ // 23 % SmallAppleTree
+ // 16 % RedMushroom
+ // 4 % BrownMushroom
+ // 4 % Birch
+ const int DarkOakProb = 53;
+ const int SmallAppleTreeProb = DarkOakProb + 23;
+ const int RedMushroomProb = SmallAppleTreeProb + 16;
+ const int BrownMushroomProb = RedMushroomProb + 4;
+
+ static_assert(BrownMushroomProb + 4 == 100);
+
+ auto RandomValue = a_Noise.IntNoise3DInt(a_BlockPos.addedY(16 * a_Seq).addedZ(16 * a_Seq)) % 100;
+ if (RandomValue < DarkOakProb)
+ {
+ GetDarkoakTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
+ else if ((RandomValue >= DarkOakProb) && (RandomValue < SmallAppleTreeProb))
+ {
+ GetSmallAppleTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
+ else if ((RandomValue >= SmallAppleTreeProb) && (RandomValue < RedMushroomProb))
+ {
+ GetRedMushroomTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
+ else if ((RandomValue >= RedMushroomProb) && (RandomValue < BrownMushroomProb))
+ {
+ GetBrownMushroomTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
+ else
+ {
+ GetBirchTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
return;
}
@@ -447,7 +477,18 @@ void GetTreeImageByBiome(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, EMCSB
{
GetSmallAppleTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
}
-
+ case biMushroomIsland:
+ case biMushroomShore:
+ {
+ if (a_Noise.IntNoise3DInt(a_BlockPos.addedY(16 * a_Seq).addedZ(16 * a_Seq)) < 0x6fffffff)
+ {
+ GetBrownMushroomTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
+ else
+ {
+ GetRedMushroomTreeImage(a_BlockPos, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ }
+ }
case biDesert:
case biDesertHills:
case biDesertM:
@@ -1394,3 +1435,99 @@ void GetSmallJungleTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, s
PushCoordBlocks(a_BlockPos.x, hei, a_BlockPos.z, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE);
a_OtherBlocks.push_back(sSetBlock(a_BlockPos.x, hei, a_BlockPos.z, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE));
}
+
+
+
+
+
+void GetRedMushroomTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
+{
+ static constexpr int Height = 4;
+
+ for (int i = 0; i < Height; i++)
+ {
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_STEM));
+
+ if (i != 0)
+ {
+ // NORTH SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(-1, -2), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(0, -2), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(1, -2), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH_EAST));
+ // WEST SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(-2, -1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(-2, 0), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(-2, 1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH_WEST));
+ // SOUTH SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(-1, 2), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(0, 2), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(1, 2), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH_EAST));
+ // EAST SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(2, -1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH_EAST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(2, 0), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_EAST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i).addedXZ(2, 1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH_EAST));
+ }
+ }
+
+ // Top Layer
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-1, -1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedX(-1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-1, 1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH_WEST));
+
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedZ(-1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_CENTER));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedZ(1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH));
+
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(1, -1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_NORTH_EAST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedX(1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_EAST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(1, 1), E_BLOCK_HUGE_RED_MUSHROOM, E_META_MUSHROOM_SOUTH_EAST));
+}
+
+
+
+
+
+void GetBrownMushroomTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
+{
+ static constexpr int Height = 4;
+ static constexpr int Radius = 2;
+ static constexpr int Border = 3;
+
+ for (int i = 0; i < Height; i++)
+ {
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(i), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_STEM));
+ }
+
+ for (int x = -Radius; x <= Radius; x++)
+ {
+ for (int z = -Radius; z <= Radius; z++)
+ {
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(x, z), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_CENTER));
+ }
+ }
+
+ for (int i = 0; i < Border; i++)
+ {
+ // NORTH SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-1, -3).addedX(i), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_NORTH));
+ // WEST SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-3, -1).addedZ(i), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_WEST));
+ // SOUTH SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-1, 3).addedX(i), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_SOUTH));
+ // EAST SIDE
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(3, -1).addedZ(i), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_EAST));
+ }
+
+ // Corners
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(3, 2), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_SOUTH_EAST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(2, 3), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_SOUTH_EAST));
+
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-2, 3), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_SOUTH_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-3, 2), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_SOUTH_WEST));
+
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-2, -3), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_NORTH_WEST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(-3, -2), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_NORTH_WEST));
+
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(2, -3), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_NORTH_EAST));
+ a_LogBlocks.push_back(sSetBlock(a_BlockPos.addedY(Height).addedXZ(3, -2), E_BLOCK_HUGE_BROWN_MUSHROOM, E_META_MUSHROOM_NORTH_EAST));
+}
diff --git a/src/Generating/Trees.h b/src/Generating/Trees.h
index 99a5c24f9..0ffeed30c 100644
--- a/src/Generating/Trees.h
+++ b/src/Generating/Trees.h
@@ -117,3 +117,9 @@ void GetLargeJungleTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, s
/** Fills a_LogBlocks and a_OtherBlocks (dirt & leaves) with the blocks required to form a small jungle tree (1x1 trunk) */
void GetSmallJungleTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
+
+/** Fills a_LogBlocks and a_OtherBlocks with the blocks required to form the red mushroom */
+void GetRedMushroomTreeImage(Vector3i vector3, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
+
+/** Fills a_LogBlocks and a_OtherBlocks with the blocks required to form the brown mushroom */
+void GetBrownMushroomTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);