chore: format Minecraft.World

This commit is contained in:
Tropical
2026-03-13 17:06:56 -05:00
parent bd6284025d
commit 33d0737d1d
1511 changed files with 108661 additions and 115521 deletions

View File

@@ -4,108 +4,85 @@
#include "StructurePiece.h"
#include "../../Util/BoundingBox.h"
StructureStart::StructureStart()
{
boundingBox = NULL; // 4J added initialiser
StructureStart::StructureStart() {
boundingBox = NULL; // 4J added initialiser
}
StructureStart::~StructureStart()
{
for(AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++ )
{
delete (*it);
}
delete boundingBox;
StructureStart::~StructureStart() {
for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) {
delete (*it);
}
delete boundingBox;
}
BoundingBox *StructureStart::getBoundingBox()
{
return boundingBox;
}
BoundingBox* StructureStart::getBoundingBox() { return boundingBox; }
std::list<StructurePiece *> *StructureStart::getPieces()
{
return &pieces;
}
std::list<StructurePiece*>* StructureStart::getPieces() { return &pieces; }
void StructureStart::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
{
AUTO_VAR(it, pieces.begin());
void StructureStart::postProcess(Level* level, Random* random,
BoundingBox* chunkBB) {
AUTO_VAR(it, pieces.begin());
while( it != pieces.end() )
{
if( (*it)->getBoundingBox()->intersects(chunkBB) && !(*it)->postProcess(level, random, chunkBB))
{
while (it != pieces.end()) {
if ((*it)->getBoundingBox()->intersects(chunkBB) &&
!(*it)->postProcess(level, random, chunkBB)) {
// this piece can't be placed, so remove it to avoid future
// attempts
it = pieces.erase(it);
}
else
{
it++;
}
}
it = pieces.erase(it);
} else {
it++;
}
}
}
void StructureStart::calculateBoundingBox()
{
void StructureStart::calculateBoundingBox() {
boundingBox = BoundingBox::getUnknownBox();
for( AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++ )
{
StructurePiece *piece = *it;
boundingBox->expand(piece->getBoundingBox());
}
for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) {
StructurePiece* piece = *it;
boundingBox->expand(piece->getBoundingBox());
}
}
void StructureStart::moveBelowSeaLevel(Level *level, Random *random, int offset)
{
const int MAX_Y = level->seaLevel - offset;
void StructureStart::moveBelowSeaLevel(Level* level, Random* random,
int offset) {
const int MAX_Y = level->seaLevel - offset;
// set lowest possible position (at bedrock)
int y1Pos = boundingBox->getYSpan() + 1;
// move up randomly within the available span
if (y1Pos < MAX_Y)
{
if (y1Pos < MAX_Y) {
y1Pos += random->nextInt(MAX_Y - y1Pos);
}
// move all bounding boxes
int dy = y1Pos - boundingBox->y1;
boundingBox->move(0, dy, 0);
for( AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++ )
{
StructurePiece *piece = *it;
for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) {
StructurePiece* piece = *it;
piece->getBoundingBox()->move(0, dy, 0);
}
}
void StructureStart::moveInsideHeights(Level *level, Random *random, int lowestAllowed, int highestAllowed)
{
int heightSpan = highestAllowed - lowestAllowed + 1 - boundingBox->getYSpan();
void StructureStart::moveInsideHeights(Level* level, Random* random,
int lowestAllowed, int highestAllowed) {
int heightSpan =
highestAllowed - lowestAllowed + 1 - boundingBox->getYSpan();
int y0Pos = 1;
if (heightSpan > 1)
{
if (heightSpan > 1) {
y0Pos = lowestAllowed + random->nextInt(heightSpan);
}
else
{
} else {
y0Pos = lowestAllowed;
}
// move all bounding boxes
int dy = y0Pos - boundingBox->y0;
boundingBox->move(0, dy, 0);
for( AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++ )
{
StructurePiece *piece = *it;
for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) {
StructurePiece* piece = *it;
piece->getBoundingBox()->move(0, dy, 0);
}
}
bool StructureStart::isValid()
{
return true;
}
bool StructureStart::isValid() { return true; }