summaryrefslogtreecommitdiffstats
path: root/src/Generating/Prefab.cpp
diff options
context:
space:
mode:
authorDamián Imrich <damian@haze.sk>2021-04-08 12:24:59 +0200
committerGitHub <noreply@github.com>2021-04-08 12:24:59 +0200
commitbefe132861b1995dfe776d4e134a90fc243d1a17 (patch)
treeee11f50ccb917718a4da7282a8e5243193571847 /src/Generating/Prefab.cpp
parentObsidian pillars, end fountain, not Ender dragon spawning (#4993) (diff)
downloadcuberite-befe132861b1995dfe776d4e134a90fc243d1a17.tar
cuberite-befe132861b1995dfe776d4e134a90fc243d1a17.tar.gz
cuberite-befe132861b1995dfe776d4e134a90fc243d1a17.tar.bz2
cuberite-befe132861b1995dfe776d4e134a90fc243d1a17.tar.lz
cuberite-befe132861b1995dfe776d4e134a90fc243d1a17.tar.xz
cuberite-befe132861b1995dfe776d4e134a90fc243d1a17.tar.zst
cuberite-befe132861b1995dfe776d4e134a90fc243d1a17.zip
Diffstat (limited to 'src/Generating/Prefab.cpp')
-rw-r--r--src/Generating/Prefab.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index 7c8c3c0bc..0a7b2a89b 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -157,8 +157,24 @@ void cPrefab::Draw(cChunkDesc & a_Dest, const Vector3i & a_Placement, int a_NumR
return;
}
- // Write the image:
- a_Dest.WriteBlockArea(Image, Placement.x, Placement.y, Placement.z, m_MergeStrategy);
+ if (m_Modifiers.size() == 0)
+ {
+ // Write the image:
+ a_Dest.WriteBlockArea(Image, Placement.x, Placement.y, Placement.z, m_MergeStrategy);
+ }
+ else
+ {
+ cBlockArea RandomizedImage;
+ Image.CopyTo(RandomizedImage);
+
+ for (size_t i = 0; i < m_Modifiers.size(); i++)
+ {
+ m_Modifiers[i]->Modify(RandomizedImage, a_Placement, a_NumRotations);
+ }
+
+ // Write the modified image:
+ a_Dest.WriteBlockArea(RandomizedImage, Placement.x, Placement.y, Placement.z, m_MergeStrategy);
+ }
// If requested, draw the floor (from the bottom of the prefab down to the nearest non-air)
switch (m_ExtendFloorStrategy)