mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-15 18:58:12 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -2,41 +2,39 @@
|
||||
#include "../../IO/Streams/Compression.h"
|
||||
#include "../../IO/Streams/InputOutputStream.h"
|
||||
|
||||
|
||||
class FileEntry;
|
||||
class ConsoleSaveFile;
|
||||
|
||||
class RegionFile
|
||||
{
|
||||
// 4J Stu TEMP FOR TESTING
|
||||
class RegionFile {
|
||||
// 4J Stu TEMP FOR TESTING
|
||||
private:
|
||||
FileEntry *fileEntry;
|
||||
FileEntry* fileEntry;
|
||||
|
||||
private:
|
||||
static const int VERSION_GZIP = 1;
|
||||
static const int VERSION_GZIP = 1;
|
||||
static const int VERSION_DEFLATE = 2;
|
||||
static const int VERSION_XBOX = 3;
|
||||
|
||||
static const int VERSION_XBOX = 3;
|
||||
|
||||
static const int SECTOR_BYTES = 4096;
|
||||
static const int SECTOR_INTS = SECTOR_BYTES / 4;
|
||||
|
||||
static const int CHUNK_HEADER_SIZE = 8;
|
||||
static byteArray emptySector;
|
||||
static byteArray emptySector;
|
||||
|
||||
File *fileName;
|
||||
//HANDLE file;
|
||||
ConsoleSaveFile *m_saveFile;
|
||||
File* fileName;
|
||||
// HANDLE file;
|
||||
ConsoleSaveFile* m_saveFile;
|
||||
|
||||
int *offsets;
|
||||
int *chunkTimestamps;
|
||||
std::vector<bool> *sectorFree;
|
||||
int sizeDelta;
|
||||
__int64 _lastModified;
|
||||
bool m_bIsEmpty; // 4J added
|
||||
int* offsets;
|
||||
int* chunkTimestamps;
|
||||
std::vector<bool>* sectorFree;
|
||||
int sizeDelta;
|
||||
__int64 _lastModified;
|
||||
bool m_bIsEmpty; // 4J added
|
||||
|
||||
public:
|
||||
RegionFile(ConsoleSaveFile *saveFile, File *path);
|
||||
~RegionFile();
|
||||
RegionFile(ConsoleSaveFile* saveFile, File* path);
|
||||
~RegionFile();
|
||||
|
||||
/* the modification date of the region file when it was first opened */
|
||||
__int64 lastModified();
|
||||
@@ -48,35 +46,33 @@ public:
|
||||
* gets an (uncompressed) stream representing the chunk data returns null if
|
||||
* the chunk is not found or an error occurs
|
||||
*/
|
||||
DataInputStream *getChunkDataInputStream(int x, int z);
|
||||
DataOutputStream *getChunkDataOutputStream(int x, int z);
|
||||
DataInputStream* getChunkDataInputStream(int x, int z);
|
||||
DataOutputStream* getChunkDataOutputStream(int x, int z);
|
||||
|
||||
class ChunkBuffer : public ByteArrayOutputStream
|
||||
{
|
||||
private:
|
||||
RegionFile *rf;
|
||||
int x, z;
|
||||
public:
|
||||
ChunkBuffer( RegionFile *rf, int x, int z ) : ByteArrayOutputStream(8096)
|
||||
{
|
||||
this->rf = rf;
|
||||
this->x = x;
|
||||
this->z = z;
|
||||
}
|
||||
void close()
|
||||
{
|
||||
rf->write(x,z,buf.data,count);
|
||||
}
|
||||
};
|
||||
class ChunkBuffer : public ByteArrayOutputStream {
|
||||
private:
|
||||
RegionFile* rf;
|
||||
int x, z;
|
||||
|
||||
public:
|
||||
ChunkBuffer(RegionFile* rf, int x, int z)
|
||||
: ByteArrayOutputStream(8096) {
|
||||
this->rf = rf;
|
||||
this->x = x;
|
||||
this->z = z;
|
||||
}
|
||||
void close() { rf->write(x, z, buf.data, count); }
|
||||
};
|
||||
|
||||
/* write a chunk at (x,z) with length bytes of data to disk */
|
||||
protected:
|
||||
void write(int x, int z, uint8_t *data, int length);
|
||||
void write(int x, int z, uint8_t* data, int length);
|
||||
|
||||
/* write a chunk data to the region file at specified sector number */
|
||||
private:
|
||||
void write(int sectorNumber, uint8_t *data, int length, unsigned int compLength);
|
||||
void zero(int sectorNumber, int length); // 4J added
|
||||
void write(int sectorNumber, uint8_t* data, int length,
|
||||
unsigned int compLength);
|
||||
void zero(int sectorNumber, int length); // 4J added
|
||||
|
||||
/* is this an invalid chunk coordinate? */
|
||||
bool outOfBounds(int x, int z);
|
||||
@@ -87,11 +83,11 @@ public:
|
||||
bool hasChunk(int x, int z);
|
||||
|
||||
private:
|
||||
void insertInitialSectors(); // 4J added
|
||||
void insertInitialSectors(); // 4J added
|
||||
void setOffset(int x, int z, int offset);
|
||||
void setTimestamp(int x, int z, int value);
|
||||
|
||||
public:
|
||||
void writeAllOffsets();
|
||||
void writeAllOffsets();
|
||||
void close();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user