mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-10 05:33:52 +00:00
TU19: merge Minecraft.World/Level
This commit is contained in:
@@ -260,7 +260,8 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level,
|
||||
dos->writeShort(SAVE_FILE_VERSION_NUMBER);
|
||||
dos->writeInt(lc->x);
|
||||
dos->writeInt(lc->z);
|
||||
dos->writeLong(level->getTime());
|
||||
dos->writeLong(level->getGameTime());
|
||||
dos->writeLong(lc->inhabitedTime);
|
||||
|
||||
PIXBeginNamedEvent(0, "Getting block data");
|
||||
lc->writeCompressedBlockData(dos);
|
||||
@@ -333,7 +334,8 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||
level->checkSession();
|
||||
tag->putInt(L"xPos", lc->x);
|
||||
tag->putInt(L"zPos", lc->z);
|
||||
tag->putLong(L"LastUpdate", level->getTime());
|
||||
tag->putLong(L"LastUpdate", level->getGameTime());
|
||||
tag->putLong(L"InhabitedTime", lc->inhabitedTime);
|
||||
// 4J - changes here for new storage. Now have static storage for getting
|
||||
// lighting data for block, data, and sky & block lighting. This wasn't
|
||||
// required in the original version as we could just reference the
|
||||
@@ -414,6 +416,7 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) {
|
||||
teTag->putInt(L"y", td.y);
|
||||
teTag->putInt(L"z", td.z);
|
||||
teTag->putInt(L"t", (int)(td.m_delay - levelTime));
|
||||
teTag->putInt(L"p", td.priorityTilt);
|
||||
|
||||
tickTags->add(teTag);
|
||||
}
|
||||
@@ -453,6 +456,7 @@ void OldChunkStorage::loadEntities(LevelChunk* lc, Level* level,
|
||||
}
|
||||
|
||||
LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||
PIXBeginNamedEvent(0, "Loading chunk");
|
||||
short version = dis->readShort();
|
||||
int x = dis->readInt();
|
||||
int z = dis->readInt();
|
||||
@@ -460,6 +464,10 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||
|
||||
LevelChunk* levelChunk = new LevelChunk(level, x, z);
|
||||
|
||||
if (version >= SAVE_FILE_VERSION_CHUNK_INHABITED_TIME) {
|
||||
levelChunk->inhabitedTime = dis->readLong();
|
||||
}
|
||||
|
||||
levelChunk->readCompressedBlockData(dis);
|
||||
levelChunk->readCompressedDataData(dis);
|
||||
levelChunk->readCompressedSkyLightData(dis);
|
||||
@@ -479,13 +487,26 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||
levelChunk->terrainPopulated |= LevelChunk::sTerrainPostPostProcessed;
|
||||
}
|
||||
|
||||
dis->readFully(levelChunk->biomes);
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
// Read the biome data from the stream, but don't use it
|
||||
byteArray dummyBiomes(levelChunk->biomes.length);
|
||||
dis->readFully(dummyBiomes);
|
||||
delete[] dummyBiomes.data;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
dis->readFully(levelChunk->biomes);
|
||||
}
|
||||
|
||||
CompoundTag* tag = NbtIo::read(dis);
|
||||
|
||||
loadEntities(levelChunk, level, tag);
|
||||
|
||||
if (tag->contains(L"TileTicks")) {
|
||||
PIXBeginNamedEvent(0, "Loading TileTicks");
|
||||
ListTag<CompoundTag>* tileTicks =
|
||||
(ListTag<CompoundTag>*)tag->getList(L"TileTicks");
|
||||
|
||||
@@ -496,13 +517,16 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) {
|
||||
level->forceAddTileTick(
|
||||
teTag->getInt(L"x"), teTag->getInt(L"y"),
|
||||
teTag->getInt(L"z"), teTag->getInt(L"i"),
|
||||
teTag->getInt(L"t"));
|
||||
teTag->getInt(L"t"), teTag->getInt(L"p"));
|
||||
}
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
|
||||
delete tag;
|
||||
|
||||
PIXEndNamedEvent();
|
||||
|
||||
return levelChunk;
|
||||
}
|
||||
|
||||
@@ -536,8 +560,8 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) {
|
||||
delete[] tag->getByteArray(L"BlockLight").data;
|
||||
|
||||
// levelChunk->skyLight = new DataLayer(tag->getByteArray(L"SkyLight"),
|
||||
//level->depthBits); levelChunk->blockLight = new
|
||||
//DataLayer(tag->getByteArray(L"BlockLight"), level->depthBits);
|
||||
// level->depthBits); levelChunk->blockLight = new
|
||||
// DataLayer(tag->getByteArray(L"BlockLight"), level->depthBits);
|
||||
|
||||
delete[] levelChunk->heightmap.data;
|
||||
levelChunk->heightmap = tag->getByteArray(L"HeightMap");
|
||||
@@ -597,8 +621,17 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tag->contains(L"Biomes")) {
|
||||
levelChunk->setBiomes(tag->getByteArray(L"Biomes"));
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if (app.DebugSettingsOn() &&
|
||||
app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) &
|
||||
(1L << eDebugSetting_EnableBiomeOverride)) {
|
||||
// Do nothing
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (tag->contains(L"Biomes")) {
|
||||
levelChunk->setBiomes(tag->getByteArray(L"Biomes"));
|
||||
}
|
||||
}
|
||||
|
||||
loadEntities(levelChunk, level, tag);
|
||||
@@ -614,7 +647,7 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) {
|
||||
level->forceAddTileTick(
|
||||
teTag->getInt(L"x"), teTag->getInt(L"y"),
|
||||
teTag->getInt(L"z"), teTag->getInt(L"i"),
|
||||
teTag->getInt(L"t"));
|
||||
teTag->getInt(L"t"), teTag->getInt(L"p"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user