summaryrefslogtreecommitdiffstats
path: root/src
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
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 'src')
-rw-r--r--src/Generating/Prefab.cpp11
-rw-r--r--src/Generating/Prefab.h4
2 files changed, 9 insertions, 6 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);
}
diff --git a/src/Generating/Prefab.h b/src/Generating/Prefab.h
index 3733166ab..ec95c909b 100644
--- a/src/Generating/Prefab.h
+++ b/src/Generating/Prefab.h
@@ -40,8 +40,8 @@ public:
cPrefab(const sDef & a_Def);
- /** Draws the prefab into the specified block area, according to the placement stored in the PlacedPiece. */
- void Draw(cBlockArea & a_Dest, const cPlacedPiece * a_Placement);
+ /** Draws the prefab into the specified chunk, according to the placement stored in the PlacedPiece. */
+ void Draw(cChunkDesc & a_Dest, const cPlacedPiece * a_Placement) const;
/** Returns true if the prefab has any connector of the specified type. */
bool HasConnectorType(int a_ConnectorType) const;