AnvilStats: Overall statistics and mobspawner statistics.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@899 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
b903b29057
commit
cead22a206
@ -13,6 +13,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// fwd:
|
||||||
|
class cParsedNBT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The base class for all chunk-processor callbacks, declares the interface.
|
/** The base class for all chunk-processor callbacks, declares the interface.
|
||||||
The processor calls each virtual function in the order they are declared here with the specified args.
|
The processor calls each virtual function in the order they are declared here with the specified args.
|
||||||
If the function returns true, the processor moves on to next chunk and starts calling the callbacks again from start with
|
If the function returns true, the processor moves on to next chunk and starts calling the callbacks again from start with
|
||||||
@ -68,7 +75,42 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool OnEmptySection(unsigned char a_Y) { return false; }
|
virtual bool OnEmptySection(unsigned char a_Y) { return false; }
|
||||||
|
|
||||||
// TODO: entities, tile-entities, tile-ticks
|
/** Called for each entity in the chunk.
|
||||||
|
Common parameters are parsed from the NBT.
|
||||||
|
The callback may parse any other param from the a_NBT and a_NBTTag parameters.
|
||||||
|
The a_NBTTag parameter points to the entity compound tag inside the Entities tag.
|
||||||
|
*/
|
||||||
|
virtual bool OnEntity(
|
||||||
|
const AString & a_EntityType,
|
||||||
|
double a_PosX, double a_PosY, double a_PosZ,
|
||||||
|
double a_SpeedX, double a_SpeedY, double a_SpeedZ,
|
||||||
|
float a_Yaw, float a_Pitch,
|
||||||
|
float a_FallDistance,
|
||||||
|
short a_FireTicksLeft,
|
||||||
|
short a_AirTicks,
|
||||||
|
char a_IsOnGround,
|
||||||
|
cParsedNBT & a_NBT,
|
||||||
|
int a_NBTTag
|
||||||
|
) { return true; }
|
||||||
|
|
||||||
|
/** Called for each tile entity in the chunk.
|
||||||
|
Common parameters are parsed from the NBT.
|
||||||
|
The callback may parse any other param from the a_NBT and a_NBTTag parameters.
|
||||||
|
The a_NBTTag parameter points to the tile entity compound tag inside the TileEntities tag.
|
||||||
|
*/
|
||||||
|
virtual bool OnTileEntity(
|
||||||
|
const AString & a_EntityType,
|
||||||
|
int a_PosX, int a_PosY, int a_PosZ,
|
||||||
|
cParsedNBT & a_NBT,
|
||||||
|
int a_NBTTag
|
||||||
|
) { return true; }
|
||||||
|
|
||||||
|
/// Called for each tile tick in the chunk
|
||||||
|
virtual bool OnTileTick(
|
||||||
|
int a_BlockType,
|
||||||
|
int a_TicksLeft,
|
||||||
|
int a_PosX, int a_PosY, int a_PosZ
|
||||||
|
) { return true; }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
typedef std::vector<cCallback *> cCallbacks;
|
typedef std::vector<cCallback *> cCallbacks;
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
// Disable some warnings that we don't care about:
|
// Disable some warnings that we don't care about:
|
||||||
#pragma warning(disable:4100)
|
#pragma warning(disable:4100)
|
||||||
|
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
#define OBSOLETE __declspec(deprecated)
|
#define OBSOLETE __declspec(deprecated)
|
||||||
|
|
||||||
@ -149,6 +151,7 @@ typedef short Int16;
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,7 +256,21 @@ void cProcessor::cThread::ProcessParsedChunkData(int a_ChunkX, int a_ChunkZ, cPa
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: entities, tile-entities etc.
|
|
||||||
|
if (ProcessChunkEntities(a_ChunkX, a_ChunkZ, a_NBT, LevelTag))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProcessChunkTileEntities(a_ChunkX, a_ChunkZ, a_NBT, LevelTag))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProcessChunkTileTicks(a_ChunkX, a_ChunkZ, a_NBT, LevelTag))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -323,6 +337,134 @@ bool cProcessor::cThread::ProcessChunkSections(int a_ChunkX, int a_ChunkZ, cPars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cProcessor::cThread::ProcessChunkEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag)
|
||||||
|
{
|
||||||
|
int EntitiesTag = a_NBT.FindChildByName(a_LevelTag, "Entities");
|
||||||
|
if (EntitiesTag < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int EntityTag = a_NBT.GetFirstChild(EntitiesTag); EntityTag > 0; EntityTag = a_NBT.GetNextSibling(EntityTag))
|
||||||
|
{
|
||||||
|
int PosTag = a_NBT.FindChildByName(EntityTag, "Pos");
|
||||||
|
if (PosTag < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int SpeedTag = a_NBT.FindChildByName(EntityTag, "Motion");
|
||||||
|
if (SpeedTag < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int RotTag = a_NBT.FindChildByName(EntityTag, "Rotation");
|
||||||
|
if (RotTag < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
double Pos[3];
|
||||||
|
for (int i = 0, tag = a_NBT.GetFirstChild(PosTag); (i < 3) && (tag > 0); i++)
|
||||||
|
{
|
||||||
|
Pos[i] = a_NBT.GetDouble(tag);
|
||||||
|
}
|
||||||
|
double Speed[3];
|
||||||
|
for (int i = 0, tag = a_NBT.GetFirstChild(SpeedTag); (i < 3) && (tag > 0); i++)
|
||||||
|
{
|
||||||
|
Speed[i] = a_NBT.GetDouble(tag);
|
||||||
|
}
|
||||||
|
float Rot[2];
|
||||||
|
for (int i = 0, tag = a_NBT.GetFirstChild(RotTag); (i < 2) && (tag > 0); i++)
|
||||||
|
{
|
||||||
|
Rot[i] = a_NBT.GetFloat(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Callback.OnEntity(
|
||||||
|
a_NBT.GetString(a_NBT.FindChildByName(EntityTag, "id")),
|
||||||
|
Pos[0], Pos[1], Pos[2],
|
||||||
|
Speed[0], Speed[1], Speed[2],
|
||||||
|
Rot[0], Rot[1],
|
||||||
|
a_NBT.GetFloat(a_NBT.FindChildByName(EntityTag, "FallDistance")),
|
||||||
|
a_NBT.GetShort(a_NBT.FindChildByName(EntityTag, "Fire")),
|
||||||
|
a_NBT.GetShort(a_NBT.FindChildByName(EntityTag, "Air")),
|
||||||
|
a_NBT.GetByte(a_NBT.FindChildByName(EntityTag, "OnGround")),
|
||||||
|
a_NBT, EntityTag
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // for EntityTag - Entities[]
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cProcessor::cThread::ProcessChunkTileEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag)
|
||||||
|
{
|
||||||
|
int TileEntitiesTag = a_NBT.FindChildByName(a_LevelTag, "TileEntities");
|
||||||
|
if (TileEntitiesTag < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int TileEntityTag = a_NBT.GetFirstChild(TileEntitiesTag); TileEntityTag > 0; TileEntityTag = a_NBT.GetNextSibling(TileEntityTag))
|
||||||
|
{
|
||||||
|
if (m_Callback.OnTileEntity(
|
||||||
|
a_NBT.GetString(a_NBT.FindChildByName(TileEntityTag, "id")),
|
||||||
|
a_NBT.GetInt(a_NBT.FindChildByName(TileEntityTag, "x")),
|
||||||
|
a_NBT.GetInt(a_NBT.FindChildByName(TileEntityTag, "y")),
|
||||||
|
a_NBT.GetInt(a_NBT.FindChildByName(TileEntityTag, "z")),
|
||||||
|
a_NBT, TileEntityTag
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // for EntityTag - Entities[]
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cProcessor::cThread::ProcessChunkTileTicks(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag)
|
||||||
|
{
|
||||||
|
int TileTicksTag = a_NBT.FindChildByName(a_LevelTag, "TileTicks");
|
||||||
|
if (TileTicksTag < 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int TileTickTag = a_NBT.GetFirstChild(TileTicksTag); TileTickTag > 0; TileTickTag = a_NBT.GetNextSibling(TileTickTag))
|
||||||
|
{
|
||||||
|
int iTag = a_NBT.FindChildByName(TileTicksTag, "i");
|
||||||
|
int tTag = a_NBT.FindChildByName(TileTicksTag, "t");
|
||||||
|
int xTag = a_NBT.FindChildByName(TileTicksTag, "x");
|
||||||
|
int yTag = a_NBT.FindChildByName(TileTicksTag, "y");
|
||||||
|
int zTag = a_NBT.FindChildByName(TileTicksTag, "z");
|
||||||
|
if ((iTag < 0) || (tTag < 0) || (xTag < 0) || (yTag < 0) || (zTag < 0))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (m_Callback.OnTileTick(
|
||||||
|
a_NBT.GetInt(iTag),
|
||||||
|
a_NBT.GetInt(iTag),
|
||||||
|
a_NBT.GetInt(iTag),
|
||||||
|
a_NBT.GetInt(iTag),
|
||||||
|
a_NBT.GetInt(iTag)
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // for EntityTag - Entities[]
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cProcessor:
|
// cProcessor:
|
||||||
|
|
||||||
|
@ -39,7 +39,12 @@ class cProcessor
|
|||||||
void ProcessChunk(const char * a_FileData, int a_ChunkX, int a_ChunkZ, unsigned a_SectorStart, unsigned a_SectorSize, unsigned a_TimeStamp);
|
void ProcessChunk(const char * a_FileData, int a_ChunkX, int a_ChunkZ, unsigned a_SectorStart, unsigned a_SectorSize, unsigned a_TimeStamp);
|
||||||
void ProcessCompressedChunkData(int a_ChunkX, int a_ChunkZ, const char * a_CompressedData, int a_CompressedSize);
|
void ProcessCompressedChunkData(int a_ChunkX, int a_ChunkZ, const char * a_CompressedData, int a_CompressedSize);
|
||||||
void ProcessParsedChunkData(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT);
|
void ProcessParsedChunkData(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT);
|
||||||
|
|
||||||
|
// The following processing parts return true if they were interrupted by the callback, causing the processing of current chunk to abort
|
||||||
bool ProcessChunkSections(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
|
bool ProcessChunkSections(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
|
||||||
|
bool ProcessChunkEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
|
||||||
|
bool ProcessChunkTileEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
|
||||||
|
bool ProcessChunkTileTicks(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor);
|
cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor);
|
||||||
|
@ -5,7 +5,56 @@
|
|||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
#include "Utils.h"
|
#include "../source/WorldStorage/FastNBT.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// cStatistics::cStats:
|
||||||
|
|
||||||
|
cStatistics::cStats::cStats(void) :
|
||||||
|
m_TotalChunks(0),
|
||||||
|
m_BiomeNumChunks(0),
|
||||||
|
m_BlockNumChunks(0),
|
||||||
|
m_NumEntities(0),
|
||||||
|
m_NumTileEntities(0),
|
||||||
|
m_NumTileTicks(0)
|
||||||
|
{
|
||||||
|
memset(m_BiomeCounts, 0, sizeof(m_BiomeCounts));
|
||||||
|
memset(m_BlockCounts, 0, sizeof(m_BlockCounts));
|
||||||
|
memset(m_SpawnerEntity, 0, sizeof(m_SpawnerEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cStatistics::cStats::Add(const cStatistics::cStats & a_Stats)
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 255; i++)
|
||||||
|
{
|
||||||
|
m_BiomeCounts[i] += a_Stats.m_BiomeCounts[i];
|
||||||
|
}
|
||||||
|
for (int i = 0; i <= 255; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j <= 255; j++)
|
||||||
|
{
|
||||||
|
m_BlockCounts[i][j] += a_Stats.m_BlockCounts[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < ARRAYCOUNT(m_SpawnerEntity); i++)
|
||||||
|
{
|
||||||
|
m_SpawnerEntity[i] += a_Stats.m_SpawnerEntity[i];
|
||||||
|
}
|
||||||
|
m_BiomeNumChunks += a_Stats.m_BiomeNumChunks;
|
||||||
|
m_BlockNumChunks += a_Stats.m_BlockNumChunks;
|
||||||
|
m_TotalChunks += a_Stats.m_TotalChunks;
|
||||||
|
m_NumEntities += a_Stats.m_NumEntities;
|
||||||
|
m_NumTileEntities += a_Stats.m_NumTileEntities;
|
||||||
|
m_NumTileTicks += a_Stats.m_NumTileTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -14,13 +63,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStatistics:
|
// cStatistics:
|
||||||
|
|
||||||
cStatistics::cStatistics(void) :
|
cStatistics::cStatistics(void)
|
||||||
m_TotalChunks(0),
|
|
||||||
m_BiomeNumChunks(0),
|
|
||||||
m_BlockNumChunks(0)
|
|
||||||
{
|
{
|
||||||
memset(m_BiomeCounts, 0, sizeof(m_BiomeCounts));
|
|
||||||
memset(m_BlockCounts, 0, sizeof(m_BlockCounts));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +73,7 @@ cStatistics::cStatistics(void) :
|
|||||||
|
|
||||||
bool cStatistics::OnNewChunk(int a_ChunkX, int a_ChunkZ)
|
bool cStatistics::OnNewChunk(int a_ChunkX, int a_ChunkZ)
|
||||||
{
|
{
|
||||||
m_TotalChunks++;
|
m_Stats.m_TotalChunks++;
|
||||||
m_IsBiomesValid = false;
|
m_IsBiomesValid = false;
|
||||||
m_IsFirstSectionInChunk = true;
|
m_IsFirstSectionInChunk = true;
|
||||||
return false;
|
return false;
|
||||||
@ -43,9 +87,9 @@ bool cStatistics::OnBiomes(const unsigned char * a_BiomeData)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 16 * 16; i++)
|
for (int i = 0; i < 16 * 16; i++)
|
||||||
{
|
{
|
||||||
m_BiomeCounts[a_BiomeData[i]] += 1;
|
m_Stats.m_BiomeCounts[a_BiomeData[i]] += 1;
|
||||||
}
|
}
|
||||||
m_BiomeNumChunks += 1;
|
m_Stats.m_BiomeNumChunks += 1;
|
||||||
memcpy(m_BiomeData, a_BiomeData, sizeof(m_BiomeData));
|
memcpy(m_BiomeData, a_BiomeData, sizeof(m_BiomeData));
|
||||||
m_IsBiomesValid = true;
|
m_IsBiomesValid = true;
|
||||||
return false;
|
return false;
|
||||||
@ -80,12 +124,12 @@ bool cStatistics::OnSection
|
|||||||
{
|
{
|
||||||
unsigned char Biome = m_BiomeData[x + 16 * z]; // Cannot use cChunkDef, different datatype
|
unsigned char Biome = m_BiomeData[x + 16 * z]; // Cannot use cChunkDef, different datatype
|
||||||
unsigned char BlockType = cChunkDef::GetBlock(a_BlockTypes, x, y, z);
|
unsigned char BlockType = cChunkDef::GetBlock(a_BlockTypes, x, y, z);
|
||||||
m_BlockCounts[Biome][BlockType] += 1;
|
m_Stats.m_BlockCounts[Biome][BlockType] += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_BlockNumChunks += m_IsFirstSectionInChunk ? 1 : 0;
|
m_Stats.m_BlockNumChunks += m_IsFirstSectionInChunk ? 1 : 0;
|
||||||
m_IsFirstSectionInChunk = false;
|
m_IsFirstSectionInChunk = false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -109,10 +153,58 @@ bool cStatistics::OnEmptySection(unsigned char a_Y)
|
|||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
{
|
{
|
||||||
unsigned char Biome = m_BiomeData[x + 16 * z]; // Cannot use cChunkDef, different datatype
|
unsigned char Biome = m_BiomeData[x + 16 * z]; // Cannot use cChunkDef, different datatype
|
||||||
m_BlockCounts[Biome][0] += 16; // 16 blocks in a column, all air
|
m_Stats.m_BlockCounts[Biome][0] += 16; // 16 blocks in a column, all air
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_Stats.m_BlockNumChunks += m_IsFirstSectionInChunk ? 1 : 0;
|
||||||
|
m_IsFirstSectionInChunk = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cStatistics::OnEntity(
|
||||||
|
const AString & a_EntityType,
|
||||||
|
double a_PosX, double a_PosY, double a_PosZ,
|
||||||
|
double a_SpeedX, double a_SpeedY, double a_SpeedZ,
|
||||||
|
float a_Yaw, float a_Pitch,
|
||||||
|
float a_FallDistance,
|
||||||
|
short a_FireTicksLeft,
|
||||||
|
short a_AirTicks,
|
||||||
|
char a_IsOnGround,
|
||||||
|
cParsedNBT & a_NBT,
|
||||||
|
int a_NBTTag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_Stats.m_NumEntities += 1;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cStatistics::OnTileEntity(
|
||||||
|
const AString & a_EntityType,
|
||||||
|
int a_PosX, int a_PosY, int a_PosZ,
|
||||||
|
cParsedNBT & a_NBT,
|
||||||
|
int a_NBTTag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_Stats.m_NumTileEntities += 1;
|
||||||
|
|
||||||
|
if (a_EntityType == "MobSpawner")
|
||||||
|
{
|
||||||
|
OnSpawner(a_NBT, a_NBTTag);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,17 +212,58 @@ bool cStatistics::OnEmptySection(unsigned char a_Y)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool cStatistics::OnTileTick(
|
||||||
|
int a_BlockType,
|
||||||
|
int a_TicksLeft,
|
||||||
|
int a_PosX, int a_PosY, int a_PosZ
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_Stats.m_NumTileTicks += 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cStatistics::OnSpawner(cParsedNBT & a_NBT, int a_TileEntityTag)
|
||||||
|
{
|
||||||
|
int EntityIDTag = a_NBT.FindChildByName(a_TileEntityTag, "EntityId");
|
||||||
|
if ((EntityIDTag < 0) || (a_NBT.GetType(EntityIDTag) != TAG_String))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
eEntityType Ent = GetEntityType(a_NBT.GetString(EntityIDTag));
|
||||||
|
if (Ent < ARRAYCOUNT(m_Stats.m_SpawnerEntity))
|
||||||
|
{
|
||||||
|
m_Stats.m_SpawnerEntity[Ent] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStatisticsFactory:
|
// cStatisticsFactory:
|
||||||
|
|
||||||
|
cStatisticsFactory::cStatisticsFactory(void) :
|
||||||
|
m_BeginTick(clock())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cStatisticsFactory::~cStatisticsFactory()
|
cStatisticsFactory::~cStatisticsFactory()
|
||||||
{
|
{
|
||||||
// Join the results together:
|
// Join the results together:
|
||||||
LOG("cStatistics:");
|
LOG("cStatistics:");
|
||||||
LOG(" Joining results...");
|
LOG(" Joining results...");
|
||||||
JoinResults();
|
JoinResults();
|
||||||
LOG(" Total %d chunks went through", m_TotalChunks);
|
LOG(" Total %d chunks went through", m_CombinedStats.m_TotalChunks);
|
||||||
LOG(" Biomes processed for %d chunks", m_BiomeNumChunks);
|
LOG(" Biomes processed for %d chunks", m_CombinedStats.m_BiomeNumChunks);
|
||||||
|
|
||||||
// Check the number of blocks processed
|
// Check the number of blocks processed
|
||||||
Int64 TotalBlocks = 0;
|
Int64 TotalBlocks = 0;
|
||||||
@ -138,20 +271,24 @@ cStatisticsFactory::~cStatisticsFactory()
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < 255; j++)
|
for (int j = 0; j < 255; j++)
|
||||||
{
|
{
|
||||||
TotalBlocks += m_BlockCounts[i][j];
|
TotalBlocks += m_CombinedStats.m_BlockCounts[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Int64 ExpTotalBlocks = (Int64)m_BlockNumChunks * 16LL * 16LL * 256LL;
|
Int64 ExpTotalBlocks = (Int64)(m_CombinedStats.m_BlockNumChunks) * 16LL * 16LL * 256LL;
|
||||||
LOG(" BlockIDs processed for %d chunks, %lld blocks (exp %lld; %s)", m_BlockNumChunks, TotalBlocks, ExpTotalBlocks, (TotalBlocks == ExpTotalBlocks) ? "match" : "failed");
|
LOG(" BlockIDs processed for %d chunks, %lld blocks (exp %lld; %s)", m_CombinedStats.m_BlockNumChunks, TotalBlocks, ExpTotalBlocks, (TotalBlocks == ExpTotalBlocks) ? "match" : "failed");
|
||||||
|
|
||||||
// Save statistics:
|
// Save statistics:
|
||||||
LOG(" Saving statistics into files:");
|
LOG(" Saving statistics into files:");
|
||||||
LOG(" Biomes.txt");
|
LOG(" Statistics.txt");
|
||||||
|
SaveStatistics();
|
||||||
|
LOG(" Biomes.xls");
|
||||||
SaveBiomes();
|
SaveBiomes();
|
||||||
LOG(" BlockTypes.txt");
|
LOG(" BlockTypes.xls");
|
||||||
SaveBlockTypes();
|
SaveBlockTypes();
|
||||||
LOG(" BiomeBlockTypes.txt");
|
LOG(" BiomeBlockTypes.xls");
|
||||||
SaveBiomeBlockTypes();
|
SaveBiomeBlockTypes();
|
||||||
|
LOG(" Spawners.xls");
|
||||||
|
SaveSpawners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -160,28 +297,9 @@ cStatisticsFactory::~cStatisticsFactory()
|
|||||||
|
|
||||||
void cStatisticsFactory::JoinResults(void)
|
void cStatisticsFactory::JoinResults(void)
|
||||||
{
|
{
|
||||||
m_BiomeNumChunks = 0;
|
|
||||||
m_BlockNumChunks = 0;
|
|
||||||
m_TotalChunks = 0;
|
|
||||||
memset(m_BiomeCounts, 0, sizeof(m_BiomeCounts));
|
|
||||||
memset(m_BlockCounts, 0, sizeof(m_BlockCounts));
|
|
||||||
for (cCallbacks::iterator itr = m_Callbacks.begin(), end = m_Callbacks.end(); itr != end; ++itr)
|
for (cCallbacks::iterator itr = m_Callbacks.begin(), end = m_Callbacks.end(); itr != end; ++itr)
|
||||||
{
|
{
|
||||||
cStatistics * stats = (cStatistics *)(*itr);
|
m_CombinedStats.Add(((cStatistics *)(*itr))->GetStats());
|
||||||
for (int i = 0; i <= 255; i++)
|
|
||||||
{
|
|
||||||
m_BiomeCounts[i] += stats->m_BiomeCounts[i];
|
|
||||||
}
|
|
||||||
for (int i = 0; i <= 255; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j <= 255; j++)
|
|
||||||
{
|
|
||||||
m_BlockCounts[i][j] += stats->m_BlockCounts[i][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_BiomeNumChunks += stats->m_BiomeNumChunks;
|
|
||||||
m_BlockNumChunks += stats->m_BlockNumChunks;
|
|
||||||
m_TotalChunks += stats->m_TotalChunks;
|
|
||||||
} // for itr - m_Callbacks[]
|
} // for itr - m_Callbacks[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +315,7 @@ void cStatisticsFactory::SaveBiomes(void)
|
|||||||
LOG("Cannot write to file Biomes.xls. Statistics not written.");
|
LOG("Cannot write to file Biomes.xls. Statistics not written.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double TotalColumns = (double)m_BiomeNumChunks * 16 * 16; // Total number of columns processed
|
double TotalColumns = (double)(m_CombinedStats.m_BiomeNumChunks) * 16 * 16 / 100; // Total number of columns processed; convert into percent
|
||||||
if (TotalColumns < 1)
|
if (TotalColumns < 1)
|
||||||
{
|
{
|
||||||
// Avoid division by zero
|
// Avoid division by zero
|
||||||
@ -206,7 +324,7 @@ void cStatisticsFactory::SaveBiomes(void)
|
|||||||
for (int i = 0; i <= 255; i++)
|
for (int i = 0; i <= 255; i++)
|
||||||
{
|
{
|
||||||
AString Line;
|
AString Line;
|
||||||
Printf(Line, "%s\t%d\t%d\t%.05f\n", GetBiomeString(i), i, m_BiomeCounts[i], ((double)m_BiomeCounts[i]) / TotalColumns);
|
Printf(Line, "%s\t%d\t%d\t%.05f\n", GetBiomeString(i), i, m_CombinedStats.m_BiomeCounts[i], ((double)(m_CombinedStats.m_BiomeCounts[i])) / TotalColumns);
|
||||||
f.Write(Line.c_str(), Line.length());
|
f.Write(Line.c_str(), Line.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +341,7 @@ void cStatisticsFactory::SaveBlockTypes(void)
|
|||||||
LOG("Cannot write to file Biomes.xls. Statistics not written.");
|
LOG("Cannot write to file Biomes.xls. Statistics not written.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double TotalBlocks = ((double)m_BlockNumChunks) * 16 * 16 * 256 / 100; // Total number of blocks processed
|
double TotalBlocks = ((double)(m_CombinedStats.m_BlockNumChunks)) * 16 * 16 * 256 / 100; // Total number of blocks processed; convert into percent
|
||||||
if (TotalBlocks < 1)
|
if (TotalBlocks < 1)
|
||||||
{
|
{
|
||||||
// Avoid division by zero
|
// Avoid division by zero
|
||||||
@ -234,13 +352,12 @@ void cStatisticsFactory::SaveBlockTypes(void)
|
|||||||
int Count = 0;
|
int Count = 0;
|
||||||
for (int Biome = 0; Biome <= 255; ++Biome)
|
for (int Biome = 0; Biome <= 255; ++Biome)
|
||||||
{
|
{
|
||||||
Count += m_BlockCounts[Biome][i];
|
Count += m_CombinedStats.m_BlockCounts[Biome][i];
|
||||||
}
|
}
|
||||||
AString Line;
|
AString Line;
|
||||||
Printf(Line, "%s\t%d\t%d\t%.08f\n", GetBlockTypeString(i), i, Count, ((double)Count) / TotalBlocks);
|
Printf(Line, "%s\t%d\t%d\t%.08f\n", GetBlockTypeString(i), i, Count, ((double)Count) / TotalBlocks);
|
||||||
f.Write(Line.c_str(), Line.length());
|
f.Write(Line.c_str(), Line.length());
|
||||||
}
|
}
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -282,7 +399,7 @@ void cStatisticsFactory::SaveBiomeBlockTypes(void)
|
|||||||
Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType);
|
Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType);
|
||||||
for (int Biome = 0; Biome <= 127; Biome++)
|
for (int Biome = 0; Biome <= 127; Biome++)
|
||||||
{
|
{
|
||||||
AppendPrintf(Line, "\t%d", m_BlockCounts[Biome][BlockType]);
|
AppendPrintf(Line, "\t%d", m_CombinedStats.m_BlockCounts[Biome][BlockType]);
|
||||||
}
|
}
|
||||||
Line.append("\n");
|
Line.append("\n");
|
||||||
f.Write(Line.c_str(), Line.length());
|
f.Write(Line.c_str(), Line.length());
|
||||||
@ -310,7 +427,7 @@ void cStatisticsFactory::SaveBiomeBlockTypes(void)
|
|||||||
Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType);
|
Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType);
|
||||||
for (int Biome = 128; Biome <= 255; Biome++)
|
for (int Biome = 128; Biome <= 255; Biome++)
|
||||||
{
|
{
|
||||||
AppendPrintf(Line, "\t%d", m_BlockCounts[Biome][BlockType]);
|
AppendPrintf(Line, "\t%d", m_CombinedStats.m_BlockCounts[Biome][BlockType]);
|
||||||
}
|
}
|
||||||
Line.append("\n");
|
Line.append("\n");
|
||||||
f.Write(Line.c_str(), Line.length());
|
f.Write(Line.c_str(), Line.length());
|
||||||
@ -321,3 +438,45 @@ void cStatisticsFactory::SaveBiomeBlockTypes(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cStatisticsFactory::SaveStatistics(void)
|
||||||
|
{
|
||||||
|
cFile f;
|
||||||
|
if (!f.Open("Statistics.txt", cFile::fmWrite))
|
||||||
|
{
|
||||||
|
LOG("Cannot write to file Statistics.txt. Statistics not written.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Elapsed = (clock() - m_BeginTick) / CLOCKS_PER_SEC;
|
||||||
|
f.Printf("Time elapsed: %d seconds (%d hours, %d minutes and %d seconds)\n", Elapsed, Elapsed / 3600, (Elapsed / 60) % 60, Elapsed % 60);
|
||||||
|
f.Printf("Total chunks processed: %d\n", m_CombinedStats.m_TotalChunks);
|
||||||
|
f.Printf("Chunk processing speed: %.02f chunks per second\n", (double)(m_CombinedStats.m_TotalChunks) / Elapsed);
|
||||||
|
f.Printf("Biomes counted for %d chunks.\n", m_CombinedStats.m_BiomeNumChunks);
|
||||||
|
f.Printf("Blocktypes counted for %d chunks.\n", m_CombinedStats.m_BlockNumChunks);
|
||||||
|
f.Printf("Total blocks counted: %lld\n", (Int64)(m_CombinedStats.m_BlockNumChunks) * 16 * 16 * 256);
|
||||||
|
f.Printf("Total biomes counted: %lld\n", (Int64)(m_CombinedStats.m_BiomeNumChunks) * 16 * 16);
|
||||||
|
f.Printf("Total entities counted: %d\n", m_CombinedStats.m_NumEntities);
|
||||||
|
f.Printf("Total tile entities counted: %d\n", m_CombinedStats.m_NumTileEntities);
|
||||||
|
f.Printf("Total tile ticks counted: %d\n", m_CombinedStats.m_NumTileTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cStatisticsFactory::SaveSpawners(void)
|
||||||
|
{
|
||||||
|
cFile f;
|
||||||
|
if (!f.Open("Spawners.xls", cFile::fmWrite))
|
||||||
|
{
|
||||||
|
LOG("Cannot write to file Spawners.xls. Statistics not written.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Printf("Entity type\tTotal count\tCount per chunk\n");
|
||||||
|
for (int i = 0; i < entMax; i++)
|
||||||
|
{
|
||||||
|
f.Printf("%s\t%d\t%0.4f\n", GetEntityTypeString((eEntityType)i), m_CombinedStats.m_SpawnerEntity[i], (double)(m_CombinedStats.m_SpawnerEntity[i]) / m_CombinedStats.m_BlockNumChunks);
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Callback.h"
|
#include "Callback.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -18,20 +19,35 @@
|
|||||||
class cStatistics :
|
class cStatistics :
|
||||||
public cCallback
|
public cCallback
|
||||||
{
|
{
|
||||||
friend class cStatisticsFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
class cStats
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int m_TotalChunks; // Total number of chunks that go through this callback (OnNewChunk())
|
||||||
|
int m_BiomeCounts[256];
|
||||||
|
int m_BlockCounts[256][256]; // First dimension is the biome, second dimension is BlockType
|
||||||
|
int m_BiomeNumChunks; // Num chunks that have been processed for biome stats
|
||||||
|
int m_BlockNumChunks; // Num chunks that have been processed for block stats
|
||||||
|
int m_NumEntities;
|
||||||
|
int m_NumTileEntities;
|
||||||
|
int m_NumTileTicks;
|
||||||
|
|
||||||
|
int m_SpawnerEntity[entMax + 1];
|
||||||
|
|
||||||
|
cStats(void);
|
||||||
|
void Add(const cStats & a_Stats);
|
||||||
|
} ;
|
||||||
|
|
||||||
cStatistics(void);
|
cStatistics(void);
|
||||||
|
|
||||||
|
const cStats & GetStats(void) const { return m_Stats; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_TotalChunks; // Total number of chunks that go through this callback (OnNewChunk())
|
cStats m_Stats;
|
||||||
int m_BiomeCounts[256];
|
|
||||||
int m_BlockCounts[256][256]; // First dimension is the biome, second dimension is BlockType
|
bool m_IsBiomesValid; // Set to true in OnBiomes(), reset to false in OnNewChunk(); if true, the m_BiomeData is valid for the current chunk
|
||||||
int m_BiomeNumChunks; // Num chunks that have been processed for biome stats
|
unsigned char m_BiomeData[16 * 16];
|
||||||
int m_BlockNumChunks; // Num chunks that have been processed for block stats
|
bool m_IsFirstSectionInChunk; // True if there was no section in the chunk yet. Set by OnNewChunk(), reset by OnSection()
|
||||||
bool m_IsBiomesValid; // Set to true in OnBiomes(), reset to false in OnNewChunk(); if true, the m_BiomeData is valid for the current chunk
|
|
||||||
unsigned char m_BiomeData[16 * 16];
|
|
||||||
bool m_IsFirstSectionInChunk; // True if there was no section in the chunk yet. Set by OnNewChunk(), reset by OnSection()
|
|
||||||
|
|
||||||
// cCallback overrides:
|
// cCallback overrides:
|
||||||
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
|
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
|
||||||
@ -51,7 +67,36 @@ protected:
|
|||||||
const NIBBLETYPE * a_BlockLight,
|
const NIBBLETYPE * a_BlockLight,
|
||||||
const NIBBLETYPE * a_BlockSkyLight
|
const NIBBLETYPE * a_BlockSkyLight
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
virtual bool OnEmptySection(unsigned char a_Y) override;
|
virtual bool OnEmptySection(unsigned char a_Y) override;
|
||||||
|
|
||||||
|
virtual bool OnEntity(
|
||||||
|
const AString & a_EntityType,
|
||||||
|
double a_PosX, double a_PosY, double a_PosZ,
|
||||||
|
double a_SpeedX, double a_SpeedY, double a_SpeedZ,
|
||||||
|
float a_Yaw, float a_Pitch,
|
||||||
|
float a_FallDistance,
|
||||||
|
short a_FireTicksLeft,
|
||||||
|
short a_AirTicks,
|
||||||
|
char a_IsOnGround,
|
||||||
|
cParsedNBT & a_NBT,
|
||||||
|
int a_NBTTag
|
||||||
|
) override;
|
||||||
|
|
||||||
|
virtual bool OnTileEntity(
|
||||||
|
const AString & a_EntityType,
|
||||||
|
int a_PosX, int a_PosY, int a_PosZ,
|
||||||
|
cParsedNBT & a_NBT,
|
||||||
|
int a_NBTTag
|
||||||
|
) override;
|
||||||
|
|
||||||
|
virtual bool OnTileTick(
|
||||||
|
int a_BlockType,
|
||||||
|
int a_TicksLeft,
|
||||||
|
int a_PosX, int a_PosY, int a_PosZ
|
||||||
|
) override;
|
||||||
|
|
||||||
|
void OnSpawner(cParsedNBT & a_NBT, int a_TileEntityTag);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@ -62,6 +107,7 @@ class cStatisticsFactory :
|
|||||||
public cCallbackFactory
|
public cCallbackFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
cStatisticsFactory(void);
|
||||||
virtual ~cStatisticsFactory();
|
virtual ~cStatisticsFactory();
|
||||||
|
|
||||||
virtual cCallback * CreateNewCallback(void)
|
virtual cCallback * CreateNewCallback(void)
|
||||||
@ -71,17 +117,16 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// The results, combined, are stored here:
|
// The results, combined, are stored here:
|
||||||
int m_TotalChunks;
|
cStatistics::cStats m_CombinedStats;
|
||||||
int m_BiomeCounts[256];
|
|
||||||
int m_BlockCounts[256][256]; // First dimension is the biome, second dimension is BlockType
|
clock_t m_BeginTick;
|
||||||
int m_BiomeNumChunks; // Num chunks that have been processed for biome stats
|
|
||||||
int m_BlockNumChunks; // Num chunks that have been processed for block stats
|
|
||||||
|
|
||||||
void JoinResults(void);
|
void JoinResults(void);
|
||||||
void SaveBiomes(void);
|
void SaveBiomes(void);
|
||||||
void SaveBlockTypes(void);
|
void SaveBlockTypes(void);
|
||||||
void SaveBiomeBlockTypes(void);
|
void SaveBiomeBlockTypes(void);
|
||||||
|
void SaveStatistics(void);
|
||||||
|
void SaveSpawners(void);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,47 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
eEntityType Type;
|
||||||
|
const char * String;
|
||||||
|
} g_EntityTypes[] =
|
||||||
|
{
|
||||||
|
{entBat, "Bat"},
|
||||||
|
{entBlaze, "Blaze"},
|
||||||
|
{entCaveSpider, "CaveSpider"},
|
||||||
|
{entChicken, "Chicken"},
|
||||||
|
{entCow, "Cow"},
|
||||||
|
{entCreeper, "Creeper"},
|
||||||
|
{entEnderDragon, "EnderDragon"},
|
||||||
|
{entEnderman, "Enderman"},
|
||||||
|
{entGhast, "Ghast"},
|
||||||
|
{entGiant, "Giant"},
|
||||||
|
{entLavaSlime, "LavaSlime"},
|
||||||
|
{entMushroomCow, "MushroomCow"},
|
||||||
|
{entOzelot, "Ozelot"},
|
||||||
|
{entPig, "Pig"},
|
||||||
|
{entPigZombie, "PigZombie"},
|
||||||
|
{entSheep, "Sheep"},
|
||||||
|
{entSilverfish, "Slverfish"},
|
||||||
|
{entSkeleton, "Skeleton"},
|
||||||
|
{entSlime, "Slime"},
|
||||||
|
{entSnowMan, "SnowMan"},
|
||||||
|
{entSpider, "Spider"},
|
||||||
|
{entSquid, "Squid"},
|
||||||
|
{entVillager, "Villager"},
|
||||||
|
{entVillagerGolem, "VillagerGolem"},
|
||||||
|
{entWitch, "Witch"},
|
||||||
|
{entWitherBoss, "WitherBoss"},
|
||||||
|
{entWolf, "Wolf"},
|
||||||
|
{entZombie, "Zombie"},
|
||||||
|
{entUnknown, "Unknown"},
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char * GetBiomeString(unsigned char a_Biome)
|
const char * GetBiomeString(unsigned char a_Biome)
|
||||||
{
|
{
|
||||||
static const char * BiomeNames[] = // Biome names, as equivalent to their index
|
static const char * BiomeNames[] = // Biome names, as equivalent to their index
|
||||||
@ -203,6 +244,31 @@ const char * GetBlockTypeString(unsigned char a_BlockType)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
eEntityType GetEntityType(const AString & a_EntityTypeString)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ARRAYCOUNT(g_EntityTypes); i++)
|
||||||
|
{
|
||||||
|
if (a_EntityTypeString == g_EntityTypes[i].String)
|
||||||
|
{
|
||||||
|
return g_EntityTypes[i].Type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return entUnknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern const char * GetEntityTypeString(eEntityType a_EntityType)
|
||||||
|
{
|
||||||
|
return g_EntityTypes[a_EntityType].String;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int GetNumCores(void)
|
int GetNumCores(void)
|
||||||
{
|
{
|
||||||
// Get number of cores by querying the system process affinity mask (Windows-specific)
|
// Get number of cores by querying the system process affinity mask (Windows-specific)
|
||||||
|
@ -7,8 +7,54 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum eEntityType
|
||||||
|
{
|
||||||
|
entBat,
|
||||||
|
entBlaze,
|
||||||
|
entCaveSpider,
|
||||||
|
entChicken,
|
||||||
|
entCow,
|
||||||
|
entCreeper,
|
||||||
|
entEnderDragon,
|
||||||
|
entEnderman,
|
||||||
|
entGhast,
|
||||||
|
entGiant,
|
||||||
|
entLavaSlime,
|
||||||
|
entMushroomCow,
|
||||||
|
entOzelot,
|
||||||
|
entPig,
|
||||||
|
entPigZombie,
|
||||||
|
entSheep,
|
||||||
|
entSilverfish,
|
||||||
|
entSkeleton,
|
||||||
|
entSlime,
|
||||||
|
entSnowMan,
|
||||||
|
entSpider,
|
||||||
|
entSquid,
|
||||||
|
entVillager,
|
||||||
|
entVillagerGolem,
|
||||||
|
entWitch,
|
||||||
|
entWitherBoss,
|
||||||
|
entWolf,
|
||||||
|
entZombie,
|
||||||
|
entUnknown,
|
||||||
|
entMax = entUnknown,
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern const char * GetBiomeString(unsigned char a_Biome);
|
extern const char * GetBiomeString(unsigned char a_Biome);
|
||||||
extern const char * GetBlockTypeString(unsigned char a_BlockType);
|
extern const char * GetBlockTypeString(unsigned char a_BlockType);
|
||||||
|
extern eEntityType GetEntityType(const AString & a_EntityTypeString);
|
||||||
|
extern const char * GetEntityTypeString(eEntityType a_EntityType);
|
||||||
extern int GetNumCores(void);
|
extern int GetNumCores(void);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user