| 1513 | |
| 1514 | |
| 1515 | void cWSSAnvil::LoadHangingFromNBT(cHangingEntity & a_Hanging, const cParsedNBT & a_NBT, int a_TagIdx) |
| 1516 | { |
| 1517 | int Direction = a_NBT.FindChildByName(a_TagIdx, "Direction"); |
| 1518 | if (Direction > 0) |
| 1519 | { |
| 1520 | Direction = (int)a_NBT.GetByte(Direction); |
| 1521 | if ((Direction < 0) || (Direction > 5)) |
| 1522 | { |
| 1523 | a_Hanging.SetDirection(BLOCK_FACE_NORTH); |
| 1524 | } |
| 1525 | else |
| 1526 | { |
| 1527 | a_Hanging.SetDirection(static_cast<eBlockFace>(Direction)); |
| 1528 | } |
| 1529 | } |
| 1530 | else |
| 1531 | { |
| 1532 | Direction = a_NBT.FindChildByName(a_TagIdx, "Dir"); |
| 1533 | if (Direction > 0) |
| 1534 | { |
| 1535 | switch ((int)a_NBT.GetByte(Direction)) |
| 1536 | { |
| 1537 | case 0: a_Hanging.SetDirection(BLOCK_FACE_NORTH); break; |
| 1538 | case 1: a_Hanging.SetDirection(BLOCK_FACE_TOP); break; |
| 1539 | case 2: a_Hanging.SetDirection(BLOCK_FACE_BOTTOM); break; |
| 1540 | case 3: a_Hanging.SetDirection(BLOCK_FACE_SOUTH); break; |
| 1541 | } |
| 1542 | } |
| 1543 | } |
| 1544 | |
| 1545 | int TileX = a_NBT.FindChildByName(a_TagIdx, "TileX"); |
| 1546 | int TileY = a_NBT.FindChildByName(a_TagIdx, "TileY"); |
| 1547 | int TileZ = a_NBT.FindChildByName(a_TagIdx, "TileZ"); |
| 1548 | if ((TileX > 0) && (TileY > 0) && (TileZ > 0)) |
| 1549 | { |
| 1550 | a_Hanging.SetPosition( |
| 1551 | (double)a_NBT.GetInt(TileX), |
| 1552 | (double)a_NBT.GetInt(TileY), |
| 1553 | (double)a_NBT.GetInt(TileZ) |
| 1554 | ); |
| 1555 | } |
| 1556 | } |
| 1557 | |
| 1558 | |
| 1559 |
nothing calls this directly
no test coverage detected