mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-03 12:56:32 +00:00
TU19: merge Minecraft.World/WorldGen
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include "../../Headers/net.minecraft.world.level.h"
|
||||
#include "../../Headers/net.minecraft.world.level.levelgen.structure.h"
|
||||
#include "StructureStart.h"
|
||||
#include "StructurePiece.h"
|
||||
#include "../../Util/BoundingBox.h"
|
||||
|
||||
StructureStart::StructureStart() {
|
||||
chunkX = chunkZ = 0;
|
||||
boundingBox = NULL; // 4J added initialiser
|
||||
}
|
||||
|
||||
StructureStart::StructureStart(int x, int z) {
|
||||
this->chunkX = x;
|
||||
this->chunkZ = z;
|
||||
boundingBox = NULL;
|
||||
}
|
||||
|
||||
StructureStart::~StructureStart() {
|
||||
for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) {
|
||||
delete (*it);
|
||||
@@ -44,6 +52,47 @@ void StructureStart::calculateBoundingBox() {
|
||||
}
|
||||
}
|
||||
|
||||
CompoundTag* StructureStart::createTag(int chunkX, int chunkZ) {
|
||||
CompoundTag* tag = new CompoundTag();
|
||||
|
||||
tag->putString(L"id", StructureFeatureIO::getEncodeId(this));
|
||||
tag->putInt(L"ChunkX", chunkX);
|
||||
tag->putInt(L"ChunkZ", chunkZ);
|
||||
tag->put(L"BB", boundingBox->createTag(L"BB"));
|
||||
|
||||
ListTag<CompoundTag>* childrenTags = new ListTag<CompoundTag>(L"Children");
|
||||
for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); ++it) {
|
||||
StructurePiece* piece = *it;
|
||||
childrenTags->add(piece->createTag());
|
||||
}
|
||||
tag->put(L"Children", childrenTags);
|
||||
|
||||
addAdditonalSaveData(tag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
void StructureStart::addAdditonalSaveData(CompoundTag* tag) {}
|
||||
|
||||
void StructureStart::load(Level* level, CompoundTag* tag) {
|
||||
chunkX = tag->getInt(L"ChunkX");
|
||||
chunkZ = tag->getInt(L"ChunkZ");
|
||||
if (tag->contains(L"BB")) {
|
||||
boundingBox = new BoundingBox(tag->getIntArray(L"BB"));
|
||||
}
|
||||
|
||||
ListTag<CompoundTag>* children =
|
||||
(ListTag<CompoundTag>*)tag->getList(L"Children");
|
||||
for (int i = 0; i < children->size(); i++) {
|
||||
pieces.push_back(
|
||||
StructureFeatureIO::loadStaticPiece(children->get(i), level));
|
||||
}
|
||||
|
||||
readAdditonalSaveData(tag);
|
||||
}
|
||||
|
||||
void StructureStart::readAdditonalSaveData(CompoundTag* tag) {}
|
||||
|
||||
void StructureStart::moveBelowSeaLevel(Level* level, Random* random,
|
||||
int offset) {
|
||||
const int MAX_Y = level->seaLevel - offset;
|
||||
@@ -85,4 +134,8 @@ void StructureStart::moveInsideHeights(Level* level, Random* random,
|
||||
}
|
||||
}
|
||||
|
||||
bool StructureStart::isValid() { return true; }
|
||||
bool StructureStart::isValid() { return true; }
|
||||
|
||||
int StructureStart::getChunkX() { return chunkX; }
|
||||
|
||||
int StructureStart::getChunkZ() { return chunkZ; }
|
||||
Reference in New Issue
Block a user