MCPcopy Create free account
hub / github.com/cuberite/cuberite / RotateMoveConnector

Method RotateMoveConnector

src/Generating/PieceGenerator.cpp:181–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179
180
181cPiece::cConnector cPiece::RotateMoveConnector(const cConnector & a_Connector, int a_NumCCWRotations, int a_MoveX, int a_MoveY, int a_MoveZ) const
182{
183 cPiece::cConnector res(a_Connector);
184
185 // Rotate the res connector:
186 switch (a_NumCCWRotations)
187 {
188 case 0:
189 {
190 // No rotation needed
191 break;
192 }
193 case 1:
194 {
195 // 1 CCW rotation:
196 res.m_Direction = RotateBlockFaceCCW(res.m_Direction);
197 break;
198 }
199 case 2:
200 {
201 // 2 rotations ( = axis flip):
202 res.m_Direction = MirrorBlockFaceY(res.m_Direction);
203 break;
204 }
205 case 3:
206 {
207 // 1 CW rotation:
208 res.m_Direction = RotateBlockFaceCW(res.m_Direction);
209 break;
210 }
211 }
212 res.m_Pos = RotatePos(a_Connector.m_Pos, a_NumCCWRotations);
213
214 // Move the res connector:
215 res.m_Pos.x += a_MoveX;
216 res.m_Pos.y += a_MoveY;
217 res.m_Pos.z += a_MoveZ;
218
219 return res;
220}
221
222
223

Callers 2

PlaceStartingPieceMethod · 0.80

Calls 3

RotateBlockFaceCCWFunction · 0.85
MirrorBlockFaceYFunction · 0.85
RotateBlockFaceCWFunction · 0.85

Tested by

no test coverage detected