summaryrefslogtreecommitdiffstats
path: root/src/Generating/Prefab.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-27 23:03:57 +0100
committermadmaxoft <github@xoft.cz>2014-03-27 23:03:57 +0100
commit7b585290fccd3dc074b1f9feef0af754ab3dd632 (patch)
tree9597a064057c6852bb90d30709f11d15619f9284 /src/Generating/Prefab.cpp
parentFixed chunk neighbor-getting for long distances. (diff)
downloadcuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.tar
cuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.tar.gz
cuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.tar.bz2
cuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.tar.lz
cuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.tar.xz
cuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.tar.zst
cuberite-7b585290fccd3dc074b1f9feef0af754ab3dd632.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/Prefab.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index ded4f6c41..145c875a1 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -9,6 +9,7 @@ uses a prefabricate in a cBlockArea for drawing itself.
#include "Globals.h"
#include "Prefab.h"
#include "../WorldStorage/SchematicFileSerializer.h"
+#include "ChunkDesc.h"
@@ -16,7 +17,7 @@ uses a prefabricate in a cBlockArea for drawing itself.
cPrefab::cPrefab(const cPrefab::sDef & a_Def) :
m_Size(a_Def.m_SizeX, a_Def.m_SizeY, a_Def.m_SizeZ),
- m_HitBox(0, 0, 0, a_Def.m_SizeX, a_Def.m_SizeY, a_Def.m_SizeZ),
+ m_HitBox(0, 0, 0, a_Def.m_SizeX - 1, a_Def.m_SizeY - 1, a_Def.m_SizeZ - 1),
m_AllowedRotations(a_Def.m_AllowedRotations),
m_MergeStrategy(a_Def.m_MergeStrategy)
{
@@ -31,11 +32,13 @@ cPrefab::cPrefab(const cPrefab::sDef & a_Def) :
-void cPrefab::Draw(cBlockArea & a_Dest, const cPlacedPiece * a_Placement)
+void cPrefab::Draw(cChunkDesc & a_Dest, const cPlacedPiece * a_Placement) const
{
Vector3i Placement = a_Placement->GetCoords();
- Placement.Move(a_Dest.GetOrigin() * (-1));
- a_Dest.Merge(m_BlockArea, Placement, m_MergeStrategy);
+ int ChunkStartX = a_Dest.GetChunkX() * cChunkDef::Width;
+ int ChunkStartZ = a_Dest.GetChunkZ() * cChunkDef::Width;
+ Placement.Move(-ChunkStartX, 0, -ChunkStartZ);
+ a_Dest.WriteBlockArea(m_BlockArea, Placement.x, Placement.y, Placement.z, m_MergeStrategy);
}