2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
// Zapper.h
|
|
|
|
|
|
|
|
// Declares the cZapper class representing the processor that actually zaps blocks and entities
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Regions.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fwd: ParsedNBT.h
|
|
|
|
class cParsedNBT;
|
|
|
|
class cFastNBTWriter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cZapper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cZapper(const AString & a_MCAFolder);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps all the specified regions */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegions(const cRegionVector & a_Regions);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
protected:
|
|
|
|
static const int BlocksPerChunkX = 16;
|
|
|
|
static const int BlocksPerChunkZ = 16;
|
|
|
|
static const int ChunksPerMCAX = 32;
|
|
|
|
static const int ChunksPerMCAZ = 32;
|
2017-12-23 07:49:08 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
AString m_MCAFolder;
|
|
|
|
|
2017-12-23 07:49:08 -05:00
|
|
|
/** Converts from block coords to MCA coords */
|
2013-07-29 07:13:03 -04:00
|
|
|
void BlockToMCA(int a_BlockX, int a_BlockZ, int & a_MCAX, int & a_MCAZ);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Converts from block coords to chunk coords */
|
2013-07-29 07:13:03 -04:00
|
|
|
void BlockToChunk(int a_BlockX, int a_BlockZ, int & a_ChunkX, int & a_ChunkZ);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps the specified region in the MCA file with the specified MCA coords */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionInMCAFile(const cRegion & a_Region, int a_MCAX, int a_MCAZ);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
/** Loads raw compressed chunk data from the specified file
|
|
|
|
* chunk is specified by ChunkHeaderValue, which is the int describing the chunk in file header.
|
|
|
|
*/
|
|
|
|
void LoadChunkData(cFile & a_InFile, int a_ChunkHeaderValue, AString & a_ChunkData, int a_ChunkX, int a_ChunkZ);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps the specified region in the raw (compressed) chunk data. */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionInRawChunkData(const cRegion & a_Region, AString & a_ChunkData, int a_ChunkX, int a_ChunkZ);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps the specified region in the specified NBT structure */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionInNBTChunk(const cRegion & a_Region, cParsedNBT & a_NBT, int a_ChunkX, int a_ChunkZ);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps the blocks in the specified region from the specified NBT */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionBlocksInNBT(const cRegion & a_Region, cParsedNBT & a_NBT, int a_SectionsTag);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps the blocks in the specified bytes (types) from one vertical section (16^3 blocks) of a chunk. */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionInNBTSectionBytes(const cRegion & a_Region, int a_SectionY, unsigned char * a_BlockBytes);
|
|
|
|
|
2017-12-23 07:49:08 -05:00
|
|
|
/** Zaps the blocks in the specified nibbles (meta, add) from one vertical section (16^3 blocks) of a chunk. */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionInNBTSectionNibbles(const cRegion & a_Region, int a_SectionY, unsigned char * a_BlockNibbles);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Zaps entities in the specified region from the specified NBT */
|
2013-07-29 07:13:03 -04:00
|
|
|
void ZapRegionEntitiesInNBT(const cRegion & a_Region, cParsedNBT & a_NBT, int a_EntitiesTag);
|
2017-12-23 07:49:08 -05:00
|
|
|
|
|
|
|
/** Serializes the NBT subtree into a writer */
|
2013-07-29 07:13:03 -04:00
|
|
|
void SerializeNBTTag(const cParsedNBT & a_NBT, int a_Tag, cFastNBTWriter & a_Writer);
|
|
|
|
} ;
|