summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/BlockEntities/CMakeLists.txt1
-rw-r--r--src/BlockID.cpp5
-rw-r--r--src/Blocks/BlockLeaves.h1
-rw-r--r--src/Blocks/CMakeLists.txt1
-rw-r--r--src/ByteBuffer.cpp2
-rw-r--r--src/ByteBuffer.h2
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Chunk.cpp130
-rw-r--r--src/Chunk.h14
-rw-r--r--src/ChunkDef.h89
-rw-r--r--src/ChunkMap.cpp6
-rw-r--r--src/ClientHandle.cpp128
-rw-r--r--src/ClientHandle.h5
-rw-r--r--src/Enchantments.h2
-rw-r--r--src/Entities/CMakeLists.txt1
-rw-r--r--src/Entities/Entity.cpp98
-rw-r--r--src/Entities/Entity.h11
-rw-r--r--src/Entities/FallingBlock.cpp4
-rw-r--r--src/Entities/ProjectileEntity.cpp63
-rw-r--r--src/Entities/ProjectileEntity.h13
-rw-r--r--src/Generating/CMakeLists.txt1
-rw-r--r--src/Generating/Prefabs/CMakeLists.txt1
-rw-r--r--src/Generating/Prefabs/NetherFortPrefabs.cpp1093
-rw-r--r--src/HTTPServer/CMakeLists.txt1
-rw-r--r--src/Items/CMakeLists.txt7
-rw-r--r--src/Items/ItemArmor.h67
-rw-r--r--src/Items/ItemHandler.cpp26
-rw-r--r--src/Items/ItemHandler.h30
-rw-r--r--src/LineBlockTracer.cpp1
-rw-r--r--src/MCLogger.cpp14
-rw-r--r--src/MCLogger.h1
-rw-r--r--src/Mobs/AggressiveMonster.cpp17
-rw-r--r--src/Mobs/AggressiveMonster.h4
-rw-r--r--src/Mobs/CMakeLists.txt1
-rw-r--r--src/Mobs/CaveSpider.cpp (renamed from src/Mobs/Cavespider.cpp)11
-rw-r--r--src/Mobs/CaveSpider.h (renamed from src/Mobs/Cavespider.h)5
-rw-r--r--src/Mobs/IncludeAllMonsters.h6
-rw-r--r--src/Mobs/MagmaCube.cpp (renamed from src/Mobs/Magmacube.cpp)3
-rw-r--r--src/Mobs/MagmaCube.h (renamed from src/Mobs/Magmacube.h)1
-rw-r--r--src/Mobs/Monster.cpp24
-rw-r--r--src/Mobs/Monster.h3
-rw-r--r--src/Mobs/ZombiePigman.cpp (renamed from src/Mobs/Zombiepigman.cpp)3
-rw-r--r--src/Mobs/ZombiePigman.h (renamed from src/Mobs/Zombiepigman.h)1
-rw-r--r--src/MonsterConfig.cpp3
-rw-r--r--src/OSSupport/CMakeLists.txt1
-rw-r--r--src/OSSupport/File.cpp10
-rw-r--r--src/Protocol/CMakeLists.txt1
-rw-r--r--src/Simulator/CMakeLists.txt1
-rw-r--r--src/UI/CMakeLists.txt1
-rw-r--r--src/UI/SlotArea.cpp74
-rw-r--r--src/UI/SlotArea.h7
-rw-r--r--src/World.cpp80
-rw-r--r--src/World.h5
-rw-r--r--src/WorldStorage/CMakeLists.txt1
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp10
-rw-r--r--src/WorldStorage/WSSAnvil.cpp2
-rw-r--r--src/WorldStorage/WSSCompact.cpp1
57 files changed, 1515 insertions, 580 deletions
diff --git a/src/BlockEntities/CMakeLists.txt b/src/BlockEntities/CMakeLists.txt
index 920767f5c..3e3d17f86 100644
--- a/src/BlockEntities/CMakeLists.txt
+++ b/src/BlockEntities/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(BlockEntities ${SOURCE})
diff --git a/src/BlockID.cpp b/src/BlockID.cpp
index 79e122032..bf95d0798 100644
--- a/src/BlockID.cpp
+++ b/src/BlockID.cpp
@@ -324,7 +324,7 @@ eDimension StringToDimension(const AString & a_DimensionString)
{ dimOverworld, "Normal"},
{ dimOverworld, "World"},
{ dimNether, "Nether"},
- { dimNether, "Hell"}, // Alternate name for End
+ { dimNether, "Hell"}, // Alternate name for Nether
{ dimEnd, "End"},
{ dimEnd, "Sky"}, // Old name for End
} ;
@@ -337,7 +337,8 @@ eDimension StringToDimension(const AString & a_DimensionString)
} // for i - DimensionMap[]
// Not found
- return (eDimension)-1000;
+ LOGWARNING("Unknown dimension: \"%s\". Setting to Overworld", a_DimensionString.c_str());
+ return dimOverworld;
}
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 8af14686e..d21227b07 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -16,6 +16,7 @@
{ \
case E_BLOCK_LEAVES: a_Area.SetBlockType(x, y, z, (BLOCKTYPE)(E_BLOCK_SPONGE + i + 1)); break; \
case E_BLOCK_LOG: return true; \
+ case E_BLOCK_NEW_LEAVES: a_Area.SetBlockType(x, y, z, (BLOCKTYPE)(E_BLOCK_SPONGE + i + 1)); break; \
case E_BLOCK_NEW_LOG: return true; \
}
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index 082ff41ac..4b8c745ad 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Blocks ${SOURCE})
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index 1893d89a8..c634dc308 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -143,7 +143,7 @@ protected:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cByteBuffer:
-cByteBuffer::cByteBuffer(int a_BufferSize) :
+cByteBuffer::cByteBuffer(size_t a_BufferSize) :
m_Buffer(new char[a_BufferSize + 1]),
m_BufferSize(a_BufferSize + 1),
#ifdef _DEBUG
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index 1915467f3..44f43e17f 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -27,7 +27,7 @@ their own synchronization.
class cByteBuffer
{
public:
- cByteBuffer(int a_BufferSize);
+ cByteBuffer(size_t a_BufferSize);
~cByteBuffer();
/// Writes the bytes specified to the ringbuffer. Returns true if successful, false if not
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 30e9dbfd4..9cc5fcb1e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -123,6 +123,7 @@ if (NOT MSVC)
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/StackWalker.cpp" "${PROJECT_SOURCE_DIR}/LeakFinder.cpp")
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 8bd0985e9..cd3bceda2 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -240,11 +240,24 @@ void cChunk::GetAllData(cChunkDataCallback & a_Callback)
{
a_Callback.HeightMap (&m_HeightMap);
a_Callback.BiomeData (&m_BiomeMap);
- a_Callback.BlockTypes (m_BlockTypes);
- a_Callback.BlockMeta (m_BlockMeta);
+
+ COMPRESSED_BLOCKTYPE Blocks = m_BlockTypes;
+ Blocks.resize(NumBlocks);
+ a_Callback.BlockTypes (&Blocks[0]);
+
+ COMPRESSED_NIBBLETYPE Metas = m_BlockMeta;
+ Metas.resize(NumBlocks / 2);
+ a_Callback.BlockMeta (&Metas[0]);
+
a_Callback.LightIsValid (m_IsLightValid);
- a_Callback.BlockLight (m_BlockLight);
- a_Callback.BlockSkyLight(m_BlockSkyLight);
+
+ COMPRESSED_NIBBLETYPE BlockLights = m_BlockLight;
+ BlockLights.resize(NumBlocks / 2);
+ a_Callback.BlockLight (&BlockLights[0]);
+
+ COMPRESSED_NIBBLETYPE BlockSkyLights = m_BlockSkyLight;
+ BlockSkyLights.resize(NumBlocks / 2, 0xff);
+ a_Callback.BlockSkyLight(&BlockSkyLights[0]);
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
{
@@ -262,7 +275,7 @@ void cChunk::GetAllData(cChunkDataCallback & a_Callback)
void cChunk::SetAllData(
- const BLOCKTYPE * a_BlockTypes,
+ const BLOCKTYPE * a_BlockTypes,
const NIBBLETYPE * a_BlockMeta,
const NIBBLETYPE * a_BlockLight,
const NIBBLETYPE * a_BlockSkyLight,
@@ -272,29 +285,61 @@ void cChunk::SetAllData(
)
{
memcpy(m_BiomeMap, a_BiomeMap, sizeof(m_BiomeMap));
-
+
if (a_HeightMap != NULL)
{
memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap));
}
+
+ if (a_HeightMap == NULL)
+ {
+ CalculateHeightmap(a_BlockTypes);
+ }
+
+ int IdxWhereNonEmptyStarts = 0;
+ { // Blocktype compression
+ unsigned char Highest = 0;
+ int X = 0, Z = 0;
+ m_BlockTypes.clear();
+
+ for (int x = 0; x < Width; x++)
+ {
+ for (int z = 0; z < Width; z++)
+ {
+ unsigned char Height = m_HeightMap[x + z * Width];
+ if (Height > Highest)
+ {
+ Highest = Height;
+ X = x; Z = z;
+ }
+ }
+ }
+
+ IdxWhereNonEmptyStarts = MakeIndexNoCheck(X, Highest + 1, Z);
+
+ m_BlockTypes.insert(m_BlockTypes.end(), &a_BlockTypes[0], &a_BlockTypes[IdxWhereNonEmptyStarts]);
+ }
+
+ { // Blockmeta compression
+ m_BlockMeta.clear();
+ m_BlockMeta.insert(m_BlockMeta.end(), &a_BlockMeta[0], &a_BlockMeta[IdxWhereNonEmptyStarts / 2]);
+ }
- memcpy(m_BlockTypes, a_BlockTypes, sizeof(m_BlockTypes));
- memcpy(m_BlockMeta, a_BlockMeta, sizeof(m_BlockMeta));
if (a_BlockLight != NULL)
{
- memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight));
+ // Compress blocklight
+ m_BlockLight.clear();
+ m_BlockLight.insert(m_BlockLight.end(), &a_BlockLight[0], &a_BlockLight[IdxWhereNonEmptyStarts / 2]);
}
+
if (a_BlockSkyLight != NULL)
{
- memcpy(m_BlockSkyLight, a_BlockSkyLight, sizeof(m_BlockSkyLight));
+ // Compress skylight
+ m_BlockSkyLight.clear();
+ m_BlockSkyLight.insert(m_BlockSkyLight.end(), &a_BlockSkyLight[0], &a_BlockSkyLight[IdxWhereNonEmptyStarts / 2]);
}
m_IsLightValid = (a_BlockLight != NULL) && (a_BlockSkyLight != NULL);
-
- if (a_HeightMap == NULL)
- {
- CalculateHeightmap();
- }
// Clear the block entities present - either the loader / saver has better, or we'll create empty ones:
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
@@ -332,8 +377,17 @@ void cChunk::SetLight(
{
// TODO: We might get cases of wrong lighting when a chunk changes in the middle of a lighting calculation.
// Postponing until we see how bad it is :)
- memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight));
- memcpy(m_BlockSkyLight, a_SkyLight, sizeof(m_BlockSkyLight));
+
+ { // Compress blocklight
+ m_BlockLight.clear();
+ m_BlockLight.insert(m_BlockLight.end(), &a_BlockLight[0], &a_BlockLight[m_BlockTypes.size()]);
+ }
+
+ { // Compress skylight
+ m_BlockSkyLight.clear();
+ m_BlockSkyLight.insert(m_BlockSkyLight.end(), &a_SkyLight[0], &a_SkyLight[m_BlockTypes.size()]);
+ }
+
m_IsLightValid = true;
}
@@ -343,7 +397,8 @@ void cChunk::SetLight(
void cChunk::GetBlockTypes(BLOCKTYPE * a_BlockTypes)
{
- memcpy(a_BlockTypes, m_BlockTypes, NumBlocks);
+ std::copy(m_BlockTypes.begin(), m_BlockTypes.end(), a_BlockTypes);
+ std::fill_n(&a_BlockTypes[m_BlockTypes.size()], NumBlocks - m_BlockTypes.size(), E_BLOCK_AIR);
}
@@ -630,7 +685,7 @@ void cChunk::Tick(float a_Dt)
void cChunk::TickBlock(int a_RelX, int a_RelY, int a_RelZ)
{
unsigned Index = MakeIndex(a_RelX, a_RelY, a_RelZ);
- cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
+ cBlockHandler * Handler = BlockHandler(GetBlock(Index));
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
cChunkInterface ChunkInterface(this->GetWorld()->GetChunkMap());
cBlockInServerPluginInterface PluginInterface(*this->GetWorld());
@@ -751,7 +806,7 @@ void cChunk::BroadcastPendingBlockChanges(void)
void cChunk::CheckBlocks()
{
- if (m_ToTickBlocks.size() == 0)
+ if (m_ToTickBlocks.empty())
{
return;
}
@@ -811,7 +866,7 @@ void cChunk::TickBlocks(void)
}
unsigned int Index = MakeIndexNoCheck(m_BlockTickX, m_BlockTickY, m_BlockTickZ);
- cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
+ cBlockHandler * Handler = BlockHandler(GetBlock(Index));
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
Handler->OnUpdate(ChunkInterface, *this->GetWorld(), PluginInterface, *this, m_BlockTickX, m_BlockTickY, m_BlockTickZ);
} // for i - tickblocks
@@ -1296,7 +1351,7 @@ void cChunk::CreateBlockEntities(void)
{
for (int y = 0; y < Height; y++)
{
- BLOCKTYPE BlockType = cChunkDef::GetBlock(m_BlockTypes, x, y, z);
+ BLOCKTYPE BlockType = GetBlock(x, y, z);
switch (BlockType)
{
case E_BLOCK_BEACON:
@@ -1349,7 +1404,7 @@ void cChunk::WakeUpSimulators(void)
int BlockZ = z + BaseZ;
for (int y = GetHeight(x, z); y >= 0; y--)
{
- BLOCKTYPE Block = cChunkDef::GetBlock(m_BlockTypes, x, y, z);
+ BLOCKTYPE Block = GetBlock(x, y, z);
// The redstone sim takes multiple blocks, use the inbuilt checker
if (RedstoneSimulator->IsAllowedBlock(Block))
@@ -1384,7 +1439,7 @@ void cChunk::WakeUpSimulators(void)
-void cChunk::CalculateHeightmap()
+void cChunk::CalculateHeightmap(const BLOCKTYPE * a_BlockTypes)
{
for (int x = 0; x < Width; x++)
{
@@ -1393,7 +1448,7 @@ void cChunk::CalculateHeightmap()
for (int y = Height - 1; y > -1; y--)
{
int index = MakeIndex( x, y, z );
- if (m_BlockTypes[index] != E_BLOCK_AIR)
+ if (a_BlockTypes[index] != E_BLOCK_AIR)
{
m_HeightMap[x + z * Width] = (unsigned char)y;
break;
@@ -1517,7 +1572,7 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
ASSERT(IsValid());
const int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
- const BLOCKTYPE OldBlockType = cChunkDef::GetBlock(m_BlockTypes, index);
+ const BLOCKTYPE OldBlockType = GetBlock(index);
const BLOCKTYPE OldBlockMeta = GetNibble(m_BlockMeta, index);
if ((OldBlockType == a_BlockType) && (OldBlockMeta == a_BlockMeta))
{
@@ -1525,7 +1580,11 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
}
MarkDirty();
-
+
+ if ((size_t)index >= m_BlockTypes.size())
+ {
+ m_BlockTypes.resize(index + 1);
+ }
m_BlockTypes[index] = a_BlockType;
// The client doesn't need to distinguish between stationary and nonstationary fluids:
@@ -1565,7 +1624,7 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
{
for (int y = a_RelY - 1; y > 0; --y)
{
- if (m_BlockTypes[MakeIndexNoCheck(a_RelX, y, a_RelZ)] != E_BLOCK_AIR)
+ if (GetBlock(MakeIndexNoCheck(a_RelX, y, a_RelZ)) != E_BLOCK_AIR)
{
m_HeightMap[a_RelX + a_RelZ * Width] = (unsigned char)y;
break;
@@ -2452,7 +2511,7 @@ BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
return 0; // Clip
}
- return m_BlockTypes[MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ)];
+ return GetBlock(MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ));
}
@@ -2466,8 +2525,13 @@ BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const
ASSERT(!"GetBlock(idx) out of bounds!");
return 0;
}
-
- return m_BlockTypes[ a_BlockIdx ];
+
+ if ((size_t)a_BlockIdx >= m_BlockTypes.size())
+ {
+ return E_BLOCK_AIR;
+ }
+
+ return m_BlockTypes[a_BlockIdx];
}
@@ -2477,7 +2541,7 @@ BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const
void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
{
int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
- a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx);
+ a_BlockType = GetBlock(Idx);
a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, Idx);
}
@@ -2488,7 +2552,7 @@ void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_
void cChunk::GetBlockInfo(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight)
{
int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
- a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx);
+ a_BlockType = GetBlock(Idx);
a_Meta = cChunkDef::GetNibble(m_BlockMeta, Idx);
a_SkyLight = cChunkDef::GetNibble(m_BlockSkyLight, Idx);
a_BlockLight = cChunkDef::GetNibble(m_BlockLight, Idx);
diff --git a/src/Chunk.h b/src/Chunk.h
index f20134e66..a15d43e00 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -267,7 +267,7 @@ public:
void UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z); // [x, y, z] in world block coords
void CalculateLighting(); // Recalculate right now
- void CalculateHeightmap();
+ void CalculateHeightmap(const BLOCKTYPE * a_BlockTypes);
// Broadcast various packets to all clients of this chunk:
// (Please keep these alpha-sorted)
@@ -326,9 +326,9 @@ public:
inline void SetMeta(int a_BlockIdx, NIBBLETYPE a_Meta) { cChunkDef::SetNibble(m_BlockMeta, a_BlockIdx, a_Meta); }
inline NIBBLETYPE GetBlockLight(int a_RelX, int a_RelY, int a_RelZ) const {return cChunkDef::GetNibble(m_BlockLight, a_RelX, a_RelY, a_RelZ); }
- inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const {return cChunkDef::GetNibble(m_BlockSkyLight, a_RelX, a_RelY, a_RelZ); }
+ inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const {return cChunkDef::GetNibble(m_BlockSkyLight, a_RelX, a_RelY, a_RelZ, true); }
inline NIBBLETYPE GetBlockLight(int a_Idx) const {return cChunkDef::GetNibble(m_BlockLight, a_Idx); }
- inline NIBBLETYPE GetSkyLight (int a_Idx) const {return cChunkDef::GetNibble(m_BlockSkyLight, a_Idx); }
+ inline NIBBLETYPE GetSkyLight (int a_Idx) const {return cChunkDef::GetNibble(m_BlockSkyLight, a_Idx, true); }
/** Same as GetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */
bool UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const;
@@ -421,10 +421,10 @@ private:
cChunkMap * m_ChunkMap;
// TODO: Make these pointers and don't allocate what isn't needed
- BLOCKTYPE m_BlockTypes [cChunkDef::NumBlocks];
- NIBBLETYPE m_BlockMeta [cChunkDef::NumBlocks / 2];
- NIBBLETYPE m_BlockLight [cChunkDef::NumBlocks / 2];
- NIBBLETYPE m_BlockSkyLight[cChunkDef::NumBlocks / 2];
+ COMPRESSED_BLOCKTYPE m_BlockTypes;
+ COMPRESSED_NIBBLETYPE m_BlockMeta;
+ COMPRESSED_NIBBLETYPE m_BlockLight;
+ COMPRESSED_NIBBLETYPE m_BlockSkyLight;
cChunkDef::HeightMap m_HeightMap;
cChunkDef::BiomeMap m_BiomeMap;
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index 9c7753820..054168bdd 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -77,13 +77,19 @@ public:
idx = x + Width * z // Need to verify this with the protocol spec, currently unknown!
*/
typedef EMCSBiome BiomeMap[Width * Width];
-
+
/// The type used for block type operations and storage, AXIS_ORDER ordering
typedef BLOCKTYPE BlockTypes[NumBlocks];
-
+
/// The type used for block data in nibble format, AXIS_ORDER ordering
typedef NIBBLETYPE BlockNibbles[NumBlocks / 2];
+ /** The storage wrapper used for compressed blockdata residing in RAMz */
+ typedef std::vector<BLOCKTYPE> COMPRESSED_BLOCKTYPE;
+
+ /** The storage wrapper used for compressed nibbledata residing in RAMz */
+ typedef std::vector<NIBBLETYPE> COMPRESSED_NIBBLETYPE;
+
/// Converts absolute block coords into relative (chunk + block) coords:
inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ )
@@ -219,46 +225,67 @@ public:
ASSERT((a_Z >= 0) && (a_Z <= Width));
a_BiomeMap[a_X + Width * a_Z] = a_Biome;
}
-
-
- static NIBBLETYPE GetNibble(const NIBBLETYPE * a_Buffer, int a_BlockIdx)
+
+
+ static NIBBLETYPE GetNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, int a_BlockIdx, bool a_IsSkyLightNibble = false)
{
if ((a_BlockIdx > -1) && (a_BlockIdx < NumBlocks))
{
- return (a_Buffer[a_BlockIdx / 2] >> ((a_BlockIdx & 1) * 4)) & 0x0f;
+ if ((size_t)(a_BlockIdx / 2) >= a_Buffer.size())
+ {
+ return (a_IsSkyLightNibble ? 0xff : 0);
+ }
+ return (a_Buffer[(size_t)(a_BlockIdx / 2)] >> ((a_BlockIdx & 1) * 4)) & 0x0f;
}
ASSERT(!"cChunkDef::GetNibble(): index out of chunk range!");
return 0;
}
-
-
+
+
+ static NIBBLETYPE GetNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, int x, int y, int z, bool a_IsSkyLightNibble = false)
+ {
+ if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
+ {
+ int Index = MakeIndexNoCheck(x, y, z);
+ if ((size_t)(Index / 2) >= a_Buffer.size())
+ {
+ return (a_IsSkyLightNibble ? 0xff : 0);
+ }
+ return ExpandNibble(a_Buffer, Index);
+ }
+ ASSERT(!"cChunkDef::GetNibble(): coords out of chunk range!");
+ return 0;
+ }
+
+
static NIBBLETYPE GetNibble(const NIBBLETYPE * a_Buffer, int x, int y, int z)
{
if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
{
int Index = MakeIndexNoCheck(x, y, z);
- return (a_Buffer[Index / 2] >> ((Index & 1) * 4)) & 0x0f;
+ return (a_Buffer[(size_t)(Index / 2)] >> ((Index & 1) * 4)) & 0x0f;
}
ASSERT(!"cChunkDef::GetNibble(): coords out of chunk range!");
return 0;
}
- static void SetNibble(NIBBLETYPE * a_Buffer, int a_BlockIdx, NIBBLETYPE a_Nibble)
+ static void SetNibble(COMPRESSED_NIBBLETYPE & a_Buffer, int a_BlockIdx, NIBBLETYPE a_Nibble)
{
if ((a_BlockIdx < 0) || (a_BlockIdx >= NumBlocks))
{
ASSERT(!"cChunkDef::SetNibble(): index out of range!");
return;
}
- a_Buffer[a_BlockIdx / 2] = static_cast<NIBBLETYPE>(
- (a_Buffer[a_BlockIdx / 2] & (0xf0 >> ((a_BlockIdx & 1) * 4))) | // The untouched nibble
- ((a_Nibble & 0x0f) << ((a_BlockIdx & 1) * 4)) // The nibble being set
- );
+ if ((size_t)(a_BlockIdx / 2) >= a_Buffer.size())
+ {
+ a_Buffer.resize((size_t)((a_BlockIdx / 2) + 1));
+ }
+ a_Buffer[(size_t)(a_BlockIdx / 2)] = PackNibble(a_Buffer, a_BlockIdx, a_Nibble);
}
-
-
- static void SetNibble(NIBBLETYPE * a_Buffer, int x, int y, int z, NIBBLETYPE a_Nibble)
+
+
+ static void SetNibble(COMPRESSED_NIBBLETYPE & a_Buffer, int x, int y, int z, NIBBLETYPE a_Nibble)
{
if (
(x >= Width) || (x < 0) ||
@@ -271,24 +298,32 @@ public:
}
int Index = MakeIndexNoCheck(x, y, z);
- a_Buffer[Index / 2] = static_cast<NIBBLETYPE>(
- (a_Buffer[Index / 2] & (0xf0 >> ((Index & 1) * 4))) | // The untouched nibble
- ((a_Nibble & 0x0f) << ((Index & 1) * 4)) // The nibble being set
- );
+ if ((size_t)(Index / 2) >= a_Buffer.size())
+ {
+ a_Buffer.resize((size_t)((Index / 2) + 1));
+ }
+ a_Buffer[(size_t)(Index / 2)] = PackNibble(a_Buffer, Index, a_Nibble);
}
- inline static NIBBLETYPE GetNibble(const NIBBLETYPE * a_Buffer, const Vector3i & a_BlockPos )
+private:
+
+
+ inline static NIBBLETYPE PackNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, int a_Index, NIBBLETYPE a_Nibble)
{
- return GetNibble(a_Buffer, a_BlockPos.x, a_BlockPos.y, a_BlockPos.z );
+ return static_cast<NIBBLETYPE>(
+ (a_Buffer[a_Index / 2] & (0xf0 >> ((a_Index & 1) * 4))) | // The untouched nibble
+ ((a_Nibble & 0x0f) << ((a_Index & 1) * 4)) // The nibble being set
+ );
}
-
-
- inline static void SetNibble(NIBBLETYPE * a_Buffer, const Vector3i & a_BlockPos, NIBBLETYPE a_Value )
+
+
+ inline static NIBBLETYPE ExpandNibble(const COMPRESSED_NIBBLETYPE & a_Buffer, int a_Index)
{
- SetNibble( a_Buffer, a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Value );
+ return (a_Buffer[a_Index / 2] >> ((a_Index & 1) * 4)) & 0x0f;
}
+
} ;
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index ed9103174..0fb6988b5 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -346,9 +346,8 @@ void cChunkMap::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity *
void cChunkMap::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
{
cCSLock Lock(m_CSLayers);
- int x, y, z, ChunkX, ChunkZ;
+ int x, z, ChunkX, ChunkZ;
x = a_BlockX;
- y = a_BlockY;
z = a_BlockZ;
cChunkDef::BlockToChunk(x, z, ChunkX, ChunkZ);
cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ);
@@ -1146,9 +1145,8 @@ BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
// First check if it isn't queued in the m_FastSetBlockQueue:
{
int X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
- int ChunkX, ChunkY, ChunkZ;
+ int ChunkX, ChunkZ;
cChunkDef::AbsoluteToRelative(X, Y, Z, ChunkX, ChunkZ);
- ChunkY = 0;
cCSLock Lock(m_CSFastSetBlock);
for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr)
{
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0f26d41e7..fc3f98aaf 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -186,6 +186,46 @@ void cClientHandle::GenerateOfflineUUID(void)
+AString cClientHandle::FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2)
+{
+ if (ShouldAppendChatPrefixes)
+ return Printf("%s[%s] %s", m_Color1.c_str(), a_ChatPrefixS.c_str(), m_Color2.c_str());
+ else
+ return Printf("%s", m_Color1.c_str());
+}
+
+
+
+
+
+AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString &a_AdditionalData)
+{
+ switch (a_ChatPrefix)
+ {
+ case mtCustom: return AString();
+ case mtFailure: return FormatChatPrefix(ShouldAppendChatPrefixes, "INFO", cChatColor::Rose, cChatColor::White);
+ case mtInformation: return FormatChatPrefix(ShouldAppendChatPrefixes, "INFO", cChatColor::Yellow, cChatColor::White);
+ case mtSuccess: return FormatChatPrefix(ShouldAppendChatPrefixes, "INFO", cChatColor::Green, cChatColor::White);
+ case mtWarning: return FormatChatPrefix(ShouldAppendChatPrefixes, "WARN", cChatColor::Rose, cChatColor::White);
+ case mtFatal: return FormatChatPrefix(ShouldAppendChatPrefixes, "FATAL", cChatColor::Red, cChatColor::White);
+ case mtDeath: return FormatChatPrefix(ShouldAppendChatPrefixes, "DEATH", cChatColor::Gray, cChatColor::White);
+ case mtJoin: return FormatChatPrefix(ShouldAppendChatPrefixes, "JOIN", cChatColor::Yellow, cChatColor::White);
+ case mtLeave: return FormatChatPrefix(ShouldAppendChatPrefixes, "LEAVE", cChatColor::Yellow, cChatColor::White);
+ case mtPrivateMessage:
+ {
+ if (ShouldAppendChatPrefixes)
+ return Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue.c_str(), a_AdditionalData.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str());
+ else
+ return Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue.c_str());
+ }
+ }
+ ASSERT(!"Unhandled chat prefix type!");
+}
+
+
+
+
+
AString cClientHandle::GenerateOfflineUUID(const AString & a_Username)
{
// Proper format for a version 3 UUID is:
@@ -1037,7 +1077,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
{
HandlePlaceBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, *ItemHandler);
}
- else if (ItemHandler->IsFood())
+ else if (ItemHandler->IsFood() && !m_Player->IsGameModeCreative())
{
if (m_Player->IsSatiated())
{
@@ -1849,7 +1889,7 @@ void cClientHandle::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlock
void cClientHandle::SendChat(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData)
{
bool ShouldAppendChatPrefixes = true;
-
+
if (GetPlayer()->GetWorld() == NULL)
{
cWorld * World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName());
@@ -1868,89 +1908,9 @@ void cClientHandle::SendChat(const AString & a_Message, eMessageType a_ChatPrefi
ShouldAppendChatPrefixes = false;
}
- AString Message;
-
- switch (a_ChatPrefix)
- {
- case mtCustom: break;
- case mtFailure:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[INFO] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Rose.c_str());
- break;
- }
- case mtInformation:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[INFO] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Yellow.c_str());
- break;
- }
- case mtSuccess:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[INFO] %s", cChatColor::Green.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Green.c_str());
- break;
- }
- case mtWarning:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[WARN] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Rose.c_str());
- break;
- }
- case mtFatal:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[FATAL] %s", cChatColor::Red.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Red.c_str());
- break;
- }
- case mtDeath:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[DEATH] %s", cChatColor::Gray.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Gray.c_str());
- break;
- }
- case mtPrivateMessage:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue.c_str(), a_AdditionalData.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str());
- else
- Message = Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue.c_str());
- break;
- }
- case mtJoin:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[JOIN] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Yellow.c_str());
- break;
- }
- case mtLeave:
- {
- if (ShouldAppendChatPrefixes)
- Message = Printf("%s[LEAVE] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str());
- else
- Message = Printf("%s", cChatColor::Yellow.c_str());
- break;
- }
- default: ASSERT(!"Unhandled chat prefix type!"); return;
- }
-
- Message.append(a_Message);
+ AString Message = FormatMessageType(ShouldAppendChatPrefixes, a_ChatPrefix, a_AdditionalData);
- m_Protocol->SendChat(Message);
+ m_Protocol->SendChat(Message.append(a_Message));
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 3d01d8034..9f8d44129 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -77,6 +77,11 @@ public:
This is used for the offline (non-auth) mode, when there's no UUID source.
Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. */
static AString GenerateOfflineUUID(const AString & a_Username); // tolua_export
+
+ /** Formats the type of message with the proper color and prefix for sending to the client. **/
+ AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData);
+
+ AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2);
void Kick(const AString & a_Reason); // tolua_export
void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication
diff --git a/src/Enchantments.h b/src/Enchantments.h
index dc5502702..ec42257c8 100644
--- a/src/Enchantments.h
+++ b/src/Enchantments.h
@@ -99,7 +99,7 @@ public:
/** Returns true if there are no enchantments */
bool IsEmpty(void) const;
- /** Converts enchantment name to the numeric representation; returns -1 if enchantment name not found; case insensitive */
+ /** Converts enchantment name or ID (number in string) to the numeric representation; returns -1 if enchantment name not found; case insensitive */
static int StringToEnchantmentID(const AString & a_EnchantmentName);
/** Returns true if a_Other contains exactly the same enchantments and levels */
diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt
index 85cc45494..c9ca44d38 100644
--- a/src/Entities/CMakeLists.txt
+++ b/src/Entities/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Entities ${SOURCE})
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 56ef36ef8..7c8e18b51 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -45,6 +45,7 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
, m_IsInitialized(false)
, m_EntityType(a_EntityType)
, m_World(NULL)
+ , m_IsFireproof(false)
, m_TicksSinceLastBurnDamage(0)
, m_TicksSinceLastLavaDamage(0)
, m_TicksSinceLastFireDamage(0)
@@ -325,9 +326,38 @@ void cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
m_Health = 0;
}
- if (IsMob() || IsPlayer()) // Knockback for only players and mobs
+ if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
{
- AddSpeed(a_TDI.Knockback * 2);
+ int KnockbackLevel = 0;
+ if (a_TDI.Attacker->GetEquippedWeapon().m_ItemType == E_ITEM_BOW)
+ {
+ KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ }
+ else
+ {
+ KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback);
+ }
+
+ Vector3d additionalSpeed(0, 0, 0);
+ switch (KnockbackLevel)
+ {
+ case 1:
+ {
+ additionalSpeed.Set(5, .3, 5);
+ break;
+ }
+ case 2:
+ {
+ additionalSpeed.Set(8, .3, 8);
+ break;
+ }
+ default:
+ {
+ additionalSpeed.Set(2, .3, 2);
+ break;
+ }
+ }
+ AddSpeed(a_TDI.Knockback * additionalSpeed);
}
m_World->BroadcastEntityStatus(*this, esGenericHurt);
@@ -380,11 +410,8 @@ int cEntity::GetRawDamageAgainst(const cEntity & a_Receiver)
-int cEntity::GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_DamageType, int a_Damage)
+bool cEntity::ArmorCoversAgainst(eDamageType a_DamageType)
{
- // Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover
-
- // Filter out damage types that are not protected by armor:
// Ref.: http://www.minecraftwiki.net/wiki/Armor#Effects as of 2012_12_20
switch (a_DamageType)
{
@@ -399,9 +426,33 @@ int cEntity::GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_Dama
case dtLightning:
case dtPlugin:
{
- return 0;
+ return false;
+ }
+
+ case dtAttack:
+ case dtArrowAttack:
+ case dtCactusContact:
+ case dtLavaContact:
+ case dtFireContact:
+ case dtEnderPearl:
+ case dtExplosion:
+ {
+ return true;
}
}
+ ASSERT(!"Invalid damage type!");
+}
+
+
+
+
+
+int cEntity::GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_DamageType, int a_Damage)
+{
+ // Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover
+
+ // Filter out damage types that are not protected by armor:
+ if (!ArmorCoversAgainst(a_DamageType)) return 0;
// Add up all armor points:
// Ref.: http://www.minecraftwiki.net/wiki/Armor#Defense_points as of 2012_12_20
@@ -772,14 +823,12 @@ void cEntity::TickBurning(cChunk & a_Chunk)
// Remember the current burning state:
bool HasBeenBurning = (m_TicksLeftBurning > 0);
- if (GetWorld()->GetWeather() == eWeather_Rain)
+ if (m_World->IsWeatherWet())
{
- if (HasBeenBurning)
+ if (POSY_TOINT > m_World->GetHeight(POSX_TOINT, POSZ_TOINT))
{
m_TicksLeftBurning = 0;
- OnFinishedBurning();
- }
- return;
+ }
}
// Do the burning damage:
@@ -788,7 +837,10 @@ void cEntity::TickBurning(cChunk & a_Chunk)
m_TicksSinceLastBurnDamage++;
if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE)
{
- TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0);
+ if (!m_IsFireproof)
+ {
+ TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0);
+ }
m_TicksSinceLastBurnDamage = 0;
}
m_TicksLeftBurning--;
@@ -856,7 +908,10 @@ void cEntity::TickBurning(cChunk & a_Chunk)
m_TicksSinceLastLavaDamage++;
if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE)
{
- TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0);
+ if (!m_IsFireproof)
+ {
+ TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0);
+ }
m_TicksSinceLastLavaDamage = 0;
}
}
@@ -874,7 +929,10 @@ void cEntity::TickBurning(cChunk & a_Chunk)
m_TicksSinceLastFireDamage++;
if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE)
{
- TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0);
+ if (!m_IsFireproof)
+ {
+ TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0);
+ }
m_TicksSinceLastFireDamage = 0;
}
}
@@ -1033,6 +1091,16 @@ void cEntity::SetMaxHealth(int a_MaxHealth)
+/// Sets whether the entity is fireproof
+void cEntity::SetIsFireproof(bool a_IsFireproof)
+{
+ m_IsFireproof = a_IsFireproof;
+}
+
+
+
+
+
/// Puts the entity on fire for the specified amount of ticks
void cEntity::StartBurning(int a_TicksLeftBurning)
{
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 8f3899e2f..9b8011b55 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -270,6 +270,9 @@ public:
/// Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items
virtual int GetRawDamageAgainst(const cEntity & a_Receiver);
+ /** Returns whether armor will protect against the passed damage type **/
+ virtual bool ArmorCoversAgainst(eDamageType a_DamageType);
+
/// Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover
virtual int GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_DamageType, int a_RawDamage);
@@ -329,6 +332,11 @@ public:
int GetMaxHealth(void) const { return m_MaxHealth; }
+ /// Sets whether the entity is fireproof
+ void SetIsFireproof(bool a_IsFireproof);
+
+ bool IsFireproof(void) const { return m_IsFireproof; }
+
/// Puts the entity on fire for the specified amount of ticks
void StartBurning(int a_TicksLeftBurning);
@@ -435,6 +443,9 @@ protected:
cWorld * m_World;
+ /// Whether the entity is capable of taking fire or lava damage.
+ bool m_IsFireproof;
+
/// Time, in ticks, since the last damage dealt by being on fire. Valid only if on fire (IsOnFire())
int m_TicksSinceLastBurnDamage;
diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp
index a66c7e4ae..bcdac0291 100644
--- a/src/Entities/FallingBlock.cpp
+++ b/src/Entities/FallingBlock.cpp
@@ -87,7 +87,9 @@ void cFallingBlock::Tick(float a_Dt, cChunk & a_Chunk)
AddSpeedY(MilliDt * -9.8f);
AddPosition(GetSpeed() * MilliDt);
- if ((GetSpeedX() != 0) || (GetSpeedZ() != 0))
+ // If not static (One billionth precision) broadcast movement.
+ static const float epsilon = 0.000000001;
+ if ((fabs(GetSpeedX()) > epsilon) || (fabs(GetSpeedZ()) > epsilon))
{
BroadcastMovementUpdate();
}
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 96db17ffd..fd3e80e5f 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -440,6 +440,7 @@ cArrowEntity::cArrowEntity(cPlayer & a_Player, double a_Force) :
m_IsCritical((a_Force >= 1)),
m_Timer(0),
m_HitGroundTimer(0),
+ m_HasTeleported(false),
m_bIsCollected(false),
m_HitBlockPos(0, 0, 0)
{
@@ -562,12 +563,12 @@ void cArrowEntity::Tick(float a_Dt, cChunk & a_Chunk)
// We can afford to do this because xoft's algorithm for trajectory is near perfect, so things are pretty close anyway without sync
// Besides, this seems to be what the vanilla server does, note how arrows teleport half a second after they hit to the server position
- if (m_HitGroundTimer != -1) // Sent a teleport already, don't do again
+ if (!m_HasTeleported) // Sent a teleport already, don't do again
{
if (m_HitGroundTimer > 1000.f) // Send after a second, could be less, but just in case
{
m_World->BroadcastTeleportEntity(*this);
- m_HitGroundTimer = -1;
+ m_HasTeleported = true;
}
else
{
@@ -611,6 +612,32 @@ cThrownEggEntity::cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y,
void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
+ TrySpawnChicken(a_HitPos);
+
+ Destroy();
+}
+
+
+
+
+
+void cThrownEggEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
+{
+ int TotalDamage = 0;
+ // TODO: If entity is Ender Crystal, destroy it
+
+ TrySpawnChicken(a_HitPos);
+ a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
+
+ Destroy(true);
+}
+
+
+
+
+
+void cThrownEggEntity::TrySpawnChicken(const Vector3d & a_HitPos)
+{
if (m_World->GetTickRandomNumber(7) == 1)
{
m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken);
@@ -622,7 +649,6 @@ void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_H
m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken);
m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken);
}
- Destroy();
}
@@ -644,15 +670,39 @@ cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, double a_X
void cThrownEnderPearlEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
+ // TODO: Tweak a_HitPos based on block face.
+ TeleportCreator(a_HitPos);
+
+ Destroy();
+}
+
+
+
+
+
+void cThrownEnderPearlEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
+{
+ int TotalDamage = 0;
+ // TODO: If entity is Ender Crystal, destroy it
+
+ TeleportCreator(a_HitPos);
+ a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
+
+ Destroy(true);
+}
+
+
+
+
+
+void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
+{
// Teleport the creator here, make them take 5 damage:
if (m_Creator != NULL)
{
- // TODO: The coords might need some tweaking based on the block face
m_Creator->TeleportToCoords(a_HitPos.x + 0.5, a_HitPos.y + 1.7, a_HitPos.z + 0.5);
m_Creator->TakeDamage(dtEnderPearl, this, 5, 0);
}
-
- Destroy();
}
@@ -696,6 +746,7 @@ void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d &
TotalDamage = 1;
}
}
+ // TODO: If entity is Ender Crystal, destroy it
a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
Destroy(true);
diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h
index efb7ae783..731dd060e 100644
--- a/src/Entities/ProjectileEntity.h
+++ b/src/Entities/ProjectileEntity.h
@@ -166,6 +166,9 @@ protected:
/// Timer for client arrow position confirmation via TeleportEntity
float m_HitGroundTimer;
+
+ // Whether the arrow has already been teleported into the proper position in the ground.
+ bool m_HasTeleported;
/// If true, the arrow is in the process of being collected - don't go to anyone else
bool m_bIsCollected;
@@ -205,7 +208,11 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
-
+ virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
+
+ // Randomly decides whether to spawn a chicken where the egg lands.
+ void TrySpawnChicken(const Vector3d & a_HitPos);
+
// tolua_begin
} ;
@@ -233,6 +240,10 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
+ virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
+
+ // Teleports the creator where the ender pearl lands.
+ void TeleportCreator(const Vector3d & a_HitPos);
// tolua_begin
diff --git a/src/Generating/CMakeLists.txt b/src/Generating/CMakeLists.txt
index 1147744c0..3dacb5066 100644
--- a/src/Generating/CMakeLists.txt
+++ b/src/Generating/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Generating ${SOURCE})
diff --git a/src/Generating/Prefabs/CMakeLists.txt b/src/Generating/Prefabs/CMakeLists.txt
index 1e60447e7..a1f09112d 100644
--- a/src/Generating/Prefabs/CMakeLists.txt
+++ b/src/Generating/Prefabs/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Generating_Prefabs ${SOURCE})
diff --git a/src/Generating/Prefabs/NetherFortPrefabs.cpp b/src/Generating/Prefabs/NetherFortPrefabs.cpp
index 61b32378a..d2ef5663d 100644
--- a/src/Generating/Prefabs/NetherFortPrefabs.cpp
+++ b/src/Generating/Prefabs/NetherFortPrefabs.cpp
@@ -439,11 +439,11 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
// The data has been exported from the gallery Nether, area index 20, ID 162, created by STR_Warrior
{
// Size:
- 14, 9, 7, // SizeX = 14, SizeY = 9, SizeZ = 7
+ 14, 11, 7, // SizeX = 14, SizeY = 11, SizeZ = 7
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 13, 18, 6, // MaxX, MaxY, MaxZ
+ 13, 20, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
@@ -552,11 +552,33 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* * 01234567890123 */
/* 0 */ "mmmmmmmmhhhhhm"
/* 1 */ "mmmmmmhhh...hh"
- /* 2 */ ".............h"
- /* 3 */ ".............h"
- /* 4 */ ".............h"
+ /* 2 */ "mm...........h"
+ /* 3 */ "mm...........h"
+ /* 4 */ "mm...........h"
/* 5 */ "mmmmmmhhh...hh"
- /* 6 */ "mmmmmmmmhhhhhm",
+ /* 6 */ "mmmmmmmmhhhhhm"
+
+ // Level 9
+ /* z\x* 1111 */
+ /* * 01234567890123 */
+ /* 0 */ "mmmmmmmm.....m"
+ /* 1 */ "mmmmmm........"
+ /* 2 */ "mmmm.........."
+ /* 3 */ "mmmm.........."
+ /* 4 */ "mmmm.........."
+ /* 5 */ "mmmmmm........"
+ /* 6 */ "mmmmmmmm.....m"
+
+ // Level 10
+ /* z\x* 1111 */
+ /* * 01234567890123 */
+ /* 0 */ "mmmmmmmm.....m"
+ /* 1 */ "mmmmmm........"
+ /* 2 */ "mmmmmm........"
+ /* 3 */ "mmmmmm........"
+ /* 4 */ "mmmmmm........"
+ /* 5 */ "mmmmmm........"
+ /* 6 */ "mmmmmmmm.....m",
// Connectors:
"0: 0, 5, 3: 4\n" /* Type 0, direction X- */,
@@ -777,7 +799,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
"",
// AddWeightIfSame:
- 0,
+ -1000,
}, // BridgeCircleCrossing
@@ -1365,7 +1387,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 14, 11, 11, // MaxX, MaxY, MaxZ
+ 14, 21, 11, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
@@ -1598,308 +1620,311 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// BridgeLevelCrossing:
- // The data has been exported from the gallery Nether, area index 45, ID 304, created by Aloe_vera
+ // The data has been exported from the gallery Nether, area index 61, ID 321, created by Aloe_vera
{
// Size:
- 15, 14, 16, // SizeX = 15, SizeY = 14, SizeZ = 16
+ 16, 14, 16, // SizeX = 16, SizeY = 14, SizeZ = 16
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 14, 13, 15, // MaxX, MaxY, MaxZ
+ 15, 23, 15, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
"a:112: 0\n" /* netherbrick */
- "b:114: 6\n" /* netherbrickstairs */
+ "b:114: 5\n" /* netherbrickstairs */
"c:114: 4\n" /* netherbrickstairs */
- "d:114: 5\n" /* netherbrickstairs */
- "e: 44:14\n" /* step */
+ "d: 44:14\n" /* step */
+ "e:114: 6\n" /* netherbrickstairs */
"f:114: 7\n" /* netherbrickstairs */
"m: 19: 0\n" /* sponge */,
// Block data:
// Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "...........aaa."
- /* 1 */ "aa.........aaaa"
- /* 2 */ "aa...........aa"
- /* 3 */ "aa...........aa"
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "...........aaa."
- /* 15 */ "...........aaa."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmmmmmm"
+ /* 1 */ "aammmmmmmmmmmmaa"
+ /* 2 */ "aammmmmmmmmmmmaa"
+ /* 3 */ "aammmmmmmmmmmmaa"
+ /* 4 */ "mmmmmmmmmmmmmmmm"
+ /* 5 */ "mmmmmmmmmmmmmmmm"
+ /* 6 */ "mmmmmmmmmmmmmmmm"
+ /* 7 */ "mmmmmmmmmmmmmmmm"
+ /* 8 */ "mmmmmmmmmmmmmmmm"
+ /* 9 */ "mmmmmmmmmmmmmmmm"
+ /* 10 */ "mmmmmmmmmmmmmmmm"
+ /* 11 */ "mmmmmmmmmmmmmmmm"
+ /* 12 */ "maaammmmmmmmmmmm"
+ /* 13 */ "maaammmmmmmmmmmm"
+ /* 14 */ "maaammmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "...........aaa."
- /* 1 */ "aa.........aaaa"
- /* 2 */ "aa...........aa"
- /* 3 */ "aa...........aa"
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "...........aaa."
- /* 15 */ "...........aaa."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmmmmmm"
+ /* 1 */ "aabmmmmmmmmmmcaa"
+ /* 2 */ "aabmmmmmmmmmmcaa"
+ /* 3 */ "aabmmmmmmmmmmcaa"
+ /* 4 */ "mmmmmmmmmmmmmmmm"
+ /* 5 */ "mmmmmmmmmmmmmmmm"
+ /* 6 */ "mmmmmmmmmmmmmmmm"
+ /* 7 */ "mmmmmmmmmmmmmmmm"
+ /* 8 */ "mmmmmmmmmmmmmmmm"
+ /* 9 */ "mmmmmmmmmmmmmmmm"
+ /* 10 */ "mmmmmmmmmmmmmmmm"
+ /* 11 */ "mmmmmmmmmmmmmmmm"
+ /* 12 */ "maaammmmmmmmmmmm"
+ /* 13 */ "maaammmmmmmmmmmm"
+ /* 14 */ "maaammmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "...........aaa."
- /* 1 */ "aa.........aaaa"
- /* 2 */ "aa...........aa"
- /* 3 */ "aa...........aa"
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "...........bbb."
- /* 14 */ "...........aaa."
- /* 15 */ "...........aaa."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmmmmmm"
+ /* 1 */ "aaabdmmmmmmdcaaa"
+ /* 2 */ "aaabdmmmmmmdcaaa"
+ /* 3 */ "aaabdmmmmmmdcaaa"
+ /* 4 */ "mmmmmmmmmmmmmmmm"
+ /* 5 */ "mmmmmmmmmmmmmmmm"
+ /* 6 */ "mmmmmmmmmmmmmmmm"
+ /* 7 */ "mmmmmmmmmmmmmmmm"
+ /* 8 */ "mmmmmmmmmmmmmmmm"
+ /* 9 */ "mmmmmmmmmmmmmmmm"
+ /* 10 */ "mmmmmmmmmmmmmmmm"
+ /* 11 */ "mmmmmmmmmmmmmmmm"
+ /* 12 */ "maaammmmmmmmmmmm"
+ /* 13 */ "maaammmmmmmmmmmm"
+ /* 14 */ "maaammmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..........caaad"
- /* 1 */ "aa........caaaa"
- /* 2 */ "aa........caaaa"
- /* 3 */ "aa........caaaa"
- /* 4 */ "...........aaad"
- /* 5 */ "...........aaad"
- /* 6 */ "...........aaad"
- /* 7 */ "...........aaad"
- /* 8 */ "...........aaad"
- /* 9 */ "..........caaad"
- /* 10 */ "..........caaad"
- /* 11 */ "..........caaad"
- /* 12 */ "..........caaad"
- /* 13 */ "..........caaad"
- /* 14 */ "..........caaad"
- /* 15 */ "..........caaad"
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "eeeeeeeeeeeeeeee"
+ /* 1 */ "aaaaaaaaaaaaaaaa"
+ /* 2 */ "aaaaaaaaaaaaaaaa"
+ /* 3 */ "aaaaaaaaaaaaaaaa"
+ /* 4 */ "ffffffffffffffff"
+ /* 5 */ "mmmmmmmmmmmmmmmm"
+ /* 6 */ "mmmmmmmmmmmmmmmm"
+ /* 7 */ "mmmmmmmmmmmmmmmm"
+ /* 8 */ "mmmmmmmmmmmmmmmm"
+ /* 9 */ "mmmmmmmmmmmmmmmm"
+ /* 10 */ "mmmmmmmmmmmmmmmm"
+ /* 11 */ "mmmmmmmmmmmmmmmm"
+ /* 12 */ "maaammmmmmmmmmmm"
+ /* 13 */ "maaammmmmmmmmmmm"
+ /* 14 */ "maaammmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..........aaaaa"
- /* 1 */ "aa........aaaaa"
- /* 2 */ "aa........aaaaa"
- /* 3 */ "aa........aaaaa"
- /* 4 */ "..........aaaaa"
- /* 5 */ "..........aaaaa"
- /* 6 */ "..........aaaaa"
- /* 7 */ "..........aaaaa"
- /* 8 */ "..........aaaaa"
- /* 9 */ "..........aaaaa"
- /* 10 */ "..........aaaaa"
- /* 11 */ "..........aaaaa"
- /* 12 */ "..........aaaaa"
- /* 13 */ "..........aaaaa"
- /* 14 */ "..........aaaaa"
- /* 15 */ "..........aaaaa"
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "aaaaaaaaaaaaaaaa"
+ /* 1 */ "aaaaaaaaaaaaaaaa"
+ /* 2 */ "aaaaaaaaaaaaaaaa"
+ /* 3 */ "aaaaaaaaaaaaaaaa"
+ /* 4 */ "aaaaaaaaaaaaaaaa"
+ /* 5 */ "faaabmmmmmmmmmmm"
+ /* 6 */ "caaabmmmmmmmmmmm"
+ /* 7 */ "caaabmmmmmmmmmmm"
+ /* 8 */ "mmmmmmmmmmmmmmmm"
+ /* 9 */ "mmmmmmmmmmmmmmmm"
+ /* 10 */ "mmmmmmmmmmmmmmmm"
+ /* 11 */ "mmmmmmmmmmmmmmmm"
+ /* 12 */ "maaammmmmmmmmmmm"
+ /* 13 */ "maaammmmmmmmmmmm"
+ /* 14 */ "maaammmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..........a...a"
- /* 1 */ "aa........a...a"
- /* 2 */ "aa........a...a"
- /* 3 */ "aa........a...a"
- /* 4 */ "..........a...a"
- /* 5 */ "..........a...a"
- /* 6 */ "........aaa...a"
- /* 7 */ "........aa....a"
- /* 8 */ "........aa....a"
- /* 9 */ "........aa....a"
- /* 10 */ "........aaa...a"
- /* 11 */ "..........a...a"
- /* 12 */ "..........a...a"
- /* 13 */ "..........a...a"
- /* 14 */ "..........a...a"
- /* 15 */ "..........a...a"
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "aaaaaaaaaaaaaaaa"
+ /* 1 */ "................"
+ /* 2 */ "................"
+ /* 3 */ "................"
+ /* 4 */ "a...aaaaaaaaaaaa"
+ /* 5 */ "a...ammmmmmmmmmm"
+ /* 6 */ "aaaaammmmmmmmmmm"
+ /* 7 */ "aaaaammmmmmmmmmm"
+ /* 8 */ "caaabmmmmmmmmmmm"
+ /* 9 */ "caaabmmmmmmmmmmm"
+ /* 10 */ "mmmmmmmmmmmmmmmm"
+ /* 11 */ "mmmmmmmmmmmmmmmm"
+ /* 12 */ "maaammmmmmmmmmmm"
+ /* 13 */ "maaammmmmmmmmmmm"
+ /* 14 */ "maaammmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "aa........a...a"
- /* 2 */ "aa........a...a"
- /* 3 */ "aa........a...a"
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "........aaa...."
- /* 7 */ "....aaaaa......"
- /* 8 */ "....aaaaa......"
- /* 9 */ "....aaaaa......"
- /* 10 */ "....aaaaaaa...."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmmaaam"
+ /* 1 */ "................"
+ /* 2 */ "................"
+ /* 3 */ "................"
+ /* 4 */ "m...mmmmmmmmaaam"
+ /* 5 */ "a...ammmmmmmmmmm"
+ /* 6 */ "a...ammmmmmmmmmm"
+ /* 7 */ "a...ammmmmmmmmmm"
+ /* 8 */ "aaaaammmmmmmmmmm"
+ /* 9 */ "aaaaammmmmmmmmmm"
+ /* 10 */ "caaabmmmmmmmmmmm"
+ /* 11 */ "caaabmmmmmmmmmmm"
+ /* 12 */ "maaabmmmmmmmmmmm"
+ /* 13 */ "maaabmmmmmmmmmmm"
+ /* 14 */ "maaafmmmmmmmaaam"
+ /* 15 */ "mmmmmmmmmmmmaaam"
// Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "aad.......a...a"
- /* 2 */ "aad.......a...a"
- /* 3 */ "aad.......a...a"
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "....aaaaaa....."
- /* 7 */ "....aaaa......."
- /* 8 */ "....aaaa......."
- /* 9 */ "....aaaa......."
- /* 10 */ "....aaaaaa....."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmmaaam"
+ /* 1 */ "................"
+ /* 2 */ "................"
+ /* 3 */ "................"
+ /* 4 */ "m...mmmmmmmmaaam"
+ /* 5 */ "m...mmmmmmmmmmmm"
+ /* 6 */ "m...mmmmmmmmmmmm"
+ /* 7 */ "a...ammmmmmmmmmm"
+ /* 8 */ "a...ammmmmmmmmmm"
+ /* 9 */ "a...ammmmmmmmmmm"
+ /* 10 */ "aaaaammmmmmmmmmm"
+ /* 11 */ "aaaaaeemmmmmmmmm"
+ /* 12 */ "caaaaaammmmmmmmm"
+ /* 13 */ "caaaaaammmmmmmmm"
+ /* 14 */ "caaaaaammmmmaaam"
+ /* 15 */ "fffffffmmmmmaaam"
// Level 8
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "aaade.....a...a"
- /* 2 */ "aaade.....a...a"
- /* 3 */ "aaade.....a...a"
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "....aaaaa......"
- /* 7 */ "....a.........."
- /* 8 */ "....a.........."
- /* 9 */ "....a.........."
- /* 10 */ "....aaaa......."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmmaaam"
+ /* 1 */ "mmmmmmmmmmmmmmmm"
+ /* 2 */ "mmmmmmmmmmmmmmmm"
+ /* 3 */ "mmmmmmmmmmmmmmmm"
+ /* 4 */ "m...mmmmmmmmaaam"
+ /* 5 */ "m...mmmmmmmmmmmm"
+ /* 6 */ "m...mmmmmmmmmmmm"
+ /* 7 */ "m...mmmmmmmmmmmm"
+ /* 8 */ "m...mmmmmmmmmmmm"
+ /* 9 */ "a...ammmmmmmmmmm"
+ /* 10 */ "a...ammmmmmmmmmm"
+ /* 11 */ "a...aaaeemmmmmmm"
+ /* 12 */ "a.....aaammmmmmm"
+ /* 13 */ "a.....aaammmmmmm"
+ /* 14 */ "a.....aaammmaaam"
+ /* 15 */ "aaaaaaaffmmmaaam"
// Level 9
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "bbbbbbbbbbbbbbb"
- /* 1 */ "aaaaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaaaa"
- /* 4 */ "ffffffaaaffffff"
- /* 5 */ "....aaaaa......"
- /* 6 */ "....a...a......"
- /* 7 */ "....a.........."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmcaaab"
+ /* 1 */ "mmmmmmmmmmmcaaab"
+ /* 2 */ "mmmmmmmmmmmcaaab"
+ /* 3 */ "mmmmmmmmmmmcaaab"
+ /* 4 */ "mmmmmmmmmmmcaaab"
+ /* 5 */ "mmmmmmmmmmmcaaab"
+ /* 6 */ "m...mmmmmmmcaaab"
+ /* 7 */ "m...mmmmmmmcaaab"
+ /* 8 */ "m...mmmmmmmcaaab"
+ /* 9 */ "m...mmmmmmmcaaab"
+ /* 10 */ "m...mmmmmmmcaaab"
+ /* 11 */ "m...maaaaeecaaab"
+ /* 12 */ "m.......aaaaaaab"
+ /* 13 */ "m.......aaaaaaab"
+ /* 14 */ "m.......aaaaaaab"
+ /* 15 */ "mmmmmaaaafffaaab"
// Level 10
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "aaaaaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaaaaa"
- /* 5 */ "....a...a......"
- /* 6 */ "....a...a......"
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmaaaaa"
+ /* 1 */ "mmmmmmmmmmmaaaaa"
+ /* 2 */ "mmmmmmmmmmmaaaaa"
+ /* 3 */ "mmmmmmmmmmmaaaaa"
+ /* 4 */ "mmmmmmmmmmmaaaaa"
+ /* 5 */ "mmmmmmmmmmmaaaaa"
+ /* 6 */ "mmmmmmmmmmmaaaaa"
+ /* 7 */ "mmmmmmmmmmmaaaaa"
+ /* 8 */ "m...mmmmmmmaaaaa"
+ /* 9 */ "m...mmmmmmmaaaaa"
+ /* 10 */ "m...mmmmmmmaaaaa"
+ /* 11 */ "m...mmmaaaaaaaaa"
+ /* 12 */ "m.........aaaaaa"
+ /* 13 */ "m.........aaaaaa"
+ /* 14 */ "m.........aaaaaa"
+ /* 15 */ "mmmmmmmaaaaaaaaa"
// Level 11
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "aaaaaaaaaaaaaaa"
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "aaaaa...aaaaaaa"
- /* 5 */ "....a...a......"
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmma...a"
+ /* 1 */ "mmmmmmmmmmma...a"
+ /* 2 */ "mmmmmmmmmmma...a"
+ /* 3 */ "mmmmmmmmmmma...a"
+ /* 4 */ "mmmmmmmmmmma...a"
+ /* 5 */ "mmmmmmmmmmma...a"
+ /* 6 */ "mmmmmmmmmmma...a"
+ /* 7 */ "mmmmmmmmmmma...a"
+ /* 8 */ "mmmmmmmmmmma...a"
+ /* 9 */ "mmmmmmmmmmma...a"
+ /* 10 */ "mmmmmmmmmmma...a"
+ /* 11 */ "mmmmmmmmmaaa...a"
+ /* 12 */ "mmmm...........a"
+ /* 13 */ "mmmm...........a"
+ /* 14 */ "mmmm...........a"
+ /* 15 */ "mmmmmmmmmaaa...a"
// Level 12
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "..............."
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmm...m"
+ /* 1 */ "mmmmmmmmmmmm...m"
+ /* 2 */ "mmmmmmmmmmmm...m"
+ /* 3 */ "mmmmmmmmmmmm...m"
+ /* 4 */ "mmmmmmmmmmmm...m"
+ /* 5 */ "mmmmmmmmmmmm...m"
+ /* 6 */ "mmmmmmmmmmmm...m"
+ /* 7 */ "mmmmmmmmmmmm...m"
+ /* 8 */ "mmmmmmmmmmmm...m"
+ /* 9 */ "mmmmmmmmmmmm...m"
+ /* 10 */ "mmmmmmmmmmmm...m"
+ /* 11 */ "mmmmmmmmmmmm...m"
+ /* 12 */ "mmmmmm.........m"
+ /* 13 */ "mmmmmm.........m"
+ /* 14 */ "mmmmmm.........m"
+ /* 15 */ "mmmmmmmmmmmm...m"
// Level 13
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "..............."
- /* 15 */ "...............",
+ /* z\x* 111111 */
+ /* * 0123456789012345 */
+ /* 0 */ "mmmmmmmmmmmm...m"
+ /* 1 */ "mmmmmmmmmmmm...m"
+ /* 2 */ "mmmmmmmmmmmm...m"
+ /* 3 */ "mmmmmmmmmmmm...m"
+ /* 4 */ "mmmmmmmmmmmm...m"
+ /* 5 */ "mmmmmmmmmmmm...m"
+ /* 6 */ "mmmmmmmmmmmm...m"
+ /* 7 */ "mmmmmmmmmmmm...m"
+ /* 8 */ "mmmmmmmmmmmm...m"
+ /* 9 */ "mmmmmmmmmmmm...m"
+ /* 10 */ "mmmmmmmmmmmm...m"
+ /* 11 */ "mmmmmmmmmmmm...m"
+ /* 12 */ "mmmmmmmm.......m"
+ /* 13 */ "mmmmmmmm.......m"
+ /* 14 */ "mmmmmmmm.......m"
+ /* 15 */ "mmmmmmmmmmmm...m",
// Connectors:
- "",
+ "0: 0, 5, 2: 4\n" /* Type 0, direction X- */
+ "0: 15, 5, 2: 5\n" /* Type 0, direction X+ */
+ "0: 13, 11, 0: 2\n" /* Type 0, direction Z- */
+ "0: 13, 11, 15: 3\n" /* Type 0, direction Z+ */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -1911,7 +1936,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
false,
// DefaultWeight:
- 100,
+ 20,
// DepthWeight:
"",
@@ -2033,7 +2058,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
500,
// DepthWeight:
- "",
+ "4:-3000|8:-3000|12:-3000|16:-3000|20:-3000",
// AddWeightIfSame:
1000,
@@ -2289,7 +2314,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
false,
// DefaultWeight:
- 200,
+ 300,
// DepthWeight:
"",
@@ -2388,7 +2413,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
false,
// DefaultWeight:
- 200,
+ 300,
// DepthWeight:
"",
@@ -2400,6 +2425,99 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Corridor5:
+ // The data has been exported from the gallery Nether, area index 65, ID 330, created by xoft
+ {
+ // Size:
+ 5, 6, 5, // SizeX = 5, SizeY = 6, SizeZ = 5
+
+ // Hitbox (relative to bounding box):
+ 0, 0, 0, // MinX, MinY, MinZ
+ 4, 5, 4, // MaxX, MaxY, MaxZ
+
+ // Block definitions:
+ ".: 0: 0\n" /* air */
+ "a:112: 0\n" /* netherbrick */
+ "b:113: 0\n" /* netherbrickfence */
+ "c:114: 2\n" /* netherbrickstairs */
+ "d:114: 3\n" /* netherbrickstairs */
+ "m: 19: 0\n" /* sponge */,
+
+ // Block data:
+ // Level 0
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "aaaaa"
+ /* 2 */ "aaaaa"
+ /* 3 */ "aaaaa"
+ /* 4 */ "aaaaa"
+
+ // Level 1
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "aaaaa"
+
+ // Level 2
+ /* z\x* 01234 */
+ /* 0 */ "ababa"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "ababa"
+
+ // Level 3
+ /* z\x* 01234 */
+ /* 0 */ "ababa"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "ababa"
+
+ // Level 4
+ /* z\x* 01234 */
+ /* 0 */ "ababa"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "ababa"
+
+ // Level 5
+ /* z\x* 01234 */
+ /* 0 */ "ccccc"
+ /* 1 */ "aaaaa"
+ /* 2 */ "aaaaa"
+ /* 3 */ "aaaaa"
+ /* 4 */ "ddddd",
+
+ // Connectors:
+ "1: 4, 1, 2: 5\n" /* Type 1, direction X+ */
+ "1: 0, 1, 2: 4\n" /* Type 1, direction X- */,
+
+ // AllowedRotations:
+ 7, /* 1, 2, 3 CCW rotation allowed */
+
+ // Merge strategy:
+ cBlockArea::msSpongePrint,
+
+ // ShouldExtendFloor:
+ false,
+
+ // DefaultWeight:
+ 500,
+
+ // DepthWeight:
+ "6:0|12:0|18:0",
+
+ // AddWeightIfSame:
+ 500,
+ }, // Corridor5
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CorridorCorner5:
// The data has been exported from the gallery Nether, area index 10, ID 40, created by xoft
{
@@ -2675,6 +2793,127 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // CorridorCrossing:
+ // The data has been exported from the gallery Nether, area index 63, ID 328, created by xoft
+ {
+ // Size:
+ 9, 6, 9, // SizeX = 9, SizeY = 6, SizeZ = 9
+
+ // Hitbox (relative to bounding box):
+ 0, 0, 0, // MinX, MinY, MinZ
+ 8, 5, 8, // MaxX, MaxY, MaxZ
+
+ // Block definitions:
+ ".: 0: 0\n" /* air */
+ "a:112: 0\n" /* netherbrick */
+ "b:113: 0\n" /* netherbrickfence */
+ "c:114: 0\n" /* netherbrickstairs */
+ "d:114: 1\n" /* netherbrickstairs */
+ "e:114: 2\n" /* netherbrickstairs */
+ "f:114: 3\n" /* netherbrickstairs */
+ "m: 19: 0\n" /* sponge */,
+
+ // Block data:
+ // Level 0
+ /* z\x* 012345678 */
+ /* 0 */ "mmaaaaamm"
+ /* 1 */ "mmaaaaamm"
+ /* 2 */ "aaaaaaaaa"
+ /* 3 */ "aaaaaaaaa"
+ /* 4 */ "aaaaaaaaa"
+ /* 5 */ "aaaaaaaaa"
+ /* 6 */ "aaaaaaaaa"
+ /* 7 */ "mmaaaaamm"
+ /* 8 */ "mmaaaaamm"
+
+ // Level 1
+ /* z\x* 012345678 */
+ /* 0 */ "mma...amm"
+ /* 1 */ "mma...amm"
+ /* 2 */ "aaa...aaa"
+ /* 3 */ "........."
+ /* 4 */ "........."
+ /* 5 */ "........."
+ /* 6 */ "aaa...aaa"
+ /* 7 */ "mma...amm"
+ /* 8 */ "mma...amm"
+
+ // Level 2
+ /* z\x* 012345678 */
+ /* 0 */ "mma...amm"
+ /* 1 */ "mmb...bmm"
+ /* 2 */ "aba...aba"
+ /* 3 */ "........."
+ /* 4 */ "........."
+ /* 5 */ "........."
+ /* 6 */ "aba...aba"
+ /* 7 */ "mmb...bmm"
+ /* 8 */ "mma...amm"
+
+ // Level 3
+ /* z\x* 012345678 */
+ /* 0 */ "mma...amm"
+ /* 1 */ "mmb...bmm"
+ /* 2 */ "aba...aba"
+ /* 3 */ "........."
+ /* 4 */ "........."
+ /* 5 */ "........."
+ /* 6 */ "aba...aba"
+ /* 7 */ "mmb...bmm"
+ /* 8 */ "mma...amm"
+
+ // Level 4
+ /* z\x* 012345678 */
+ /* 0 */ "mma...amm"
+ /* 1 */ "mmb...bmm"
+ /* 2 */ "aba...aba"
+ /* 3 */ "........."
+ /* 4 */ "........."
+ /* 5 */ "........."
+ /* 6 */ "aba...aba"
+ /* 7 */ "mmb...bmm"
+ /* 8 */ "mma...amm"
+
+ // Level 5
+ /* z\x* 012345678 */
+ /* 0 */ "mmcaaadmm"
+ /* 1 */ "mmcaaadmm"
+ /* 2 */ "eeeaaaeee"
+ /* 3 */ "aaaaaaaaa"
+ /* 4 */ "aaaaaaaaa"
+ /* 5 */ "aaaaaaaaa"
+ /* 6 */ "ffcaaadff"
+ /* 7 */ "mmcaaadmm"
+ /* 8 */ "mmcaaadmm",
+
+ // Connectors:
+ "1: 8, 1, 4: 5\n" /* Type 1, direction X+ */
+ "1: 4, 1, 0: 2\n" /* Type 1, direction Z- */
+ "1: 4, 1, 8: 3\n" /* Type 1, direction Z+ */
+ "1: 0, 1, 4: 4\n" /* Type 1, direction X- */,
+
+ // AllowedRotations:
+ 7, /* 1, 2, 3 CCW rotation allowed */
+
+ // Merge strategy:
+ cBlockArea::msSpongePrint,
+
+ // ShouldExtendFloor:
+ false,
+
+ // DefaultWeight:
+ 100,
+
+ // DepthWeight:
+ "",
+
+ // AddWeightIfSame:
+ -50,
+ }, // CorridorCrossing
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CorridorStairs:
// The data has been exported from the gallery Nether, area index 12, ID 42, created by xoft
{
@@ -2813,10 +3052,10 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
false,
// DefaultWeight:
- 100,
+ 1000,
// DepthWeight:
- "",
+ "0:0|2:0|4:0|6:0|8:0|10:0|12:0|14:0|16:0|18:0",
// AddWeightIfSame:
0,
@@ -3501,7 +3740,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
"",
// AddWeightIfSame:
- 0,
+ -1000,
}, // LavaStaircaseBig
@@ -3965,7 +4204,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
"",
// AddWeightIfSame:
- 0,
+ -1000,
}, // MidStaircase
@@ -3979,7 +4218,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 6, 9, 6, // MaxX, MaxY, MaxZ
+ 6, 19, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
@@ -4122,7 +4361,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 6, 9, 6, // MaxX, MaxY, MaxZ
+ 6, 19, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
@@ -4497,15 +4736,299 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TinyCorridorCorner:
+ // The data has been exported from the gallery Nether, area index 66, ID 331, created by xoft
+ {
+ // Size:
+ 5, 6, 5, // SizeX = 5, SizeY = 6, SizeZ = 5
+
+ // Hitbox (relative to bounding box):
+ 0, 0, 0, // MinX, MinY, MinZ
+ 4, 5, 4, // MaxX, MaxY, MaxZ
+
+ // Block definitions:
+ ".: 0: 0\n" /* air */
+ "a:112: 0\n" /* netherbrick */
+ "b:113: 0\n" /* netherbrickfence */
+ "c:114: 2\n" /* netherbrickstairs */
+ "d:114: 1\n" /* netherbrickstairs */
+ "e:114: 0\n" /* netherbrickstairs */
+ "m: 19: 0\n" /* sponge */,
+
+ // Block data:
+ // Level 0
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "aaaaa"
+ /* 2 */ "aaaaa"
+ /* 3 */ "aaaaa"
+ /* 4 */ "aaaaa"
+
+ // Level 1
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "....a"
+ /* 2 */ "....a"
+ /* 3 */ "....a"
+ /* 4 */ "a...a"
+
+ // Level 2
+ /* z\x* 01234 */
+ /* 0 */ "ababa"
+ /* 1 */ "....b"
+ /* 2 */ "....a"
+ /* 3 */ "....b"
+ /* 4 */ "a...a"
+
+ // Level 3
+ /* z\x* 01234 */
+ /* 0 */ "ababa"
+ /* 1 */ "....b"
+ /* 2 */ "....a"
+ /* 3 */ "....b"
+ /* 4 */ "a...a"
+
+ // Level 4
+ /* z\x* 01234 */
+ /* 0 */ "ababa"
+ /* 1 */ "....b"
+ /* 2 */ "....a"
+ /* 3 */ "....b"
+ /* 4 */ "a...a"
+
+ // Level 5
+ /* z\x* 01234 */
+ /* 0 */ "ccccc"
+ /* 1 */ "aaaad"
+ /* 2 */ "aaaad"
+ /* 3 */ "aaaad"
+ /* 4 */ "eaaad",
+
+ // Connectors:
+ "1: 2, 1, 4: 3\n" /* Type 1, direction Z+ */
+ "1: 0, 1, 2: 4\n" /* Type 1, direction X- */,
+
+ // AllowedRotations:
+ 7, /* 1, 2, 3 CCW rotation allowed */
+
+ // Merge strategy:
+ cBlockArea::msSpongePrint,
+
+ // ShouldExtendFloor:
+ false,
+
+ // DefaultWeight:
+ 100,
+
+ // DepthWeight:
+ "",
+
+ // AddWeightIfSame:
+ -50,
+ }, // TinyCorridorCorner
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TinyCorridorCornerChest:
+ // The data has been exported from the gallery Nether, area index 67, ID 332, created by Aloe_vera
+ {
+ // Size:
+ 5, 6, 5, // SizeX = 5, SizeY = 6, SizeZ = 5
+
+ // Hitbox (relative to bounding box):
+ 0, 0, 0, // MinX, MinY, MinZ
+ 4, 5, 4, // MaxX, MaxY, MaxZ
+
+ // Block definitions:
+ ".: 0: 0\n" /* air */
+ "a:112: 0\n" /* netherbrick */
+ "b: 54: 4\n" /* chest */
+ "c:113: 0\n" /* netherbrickfence */
+ "d:114: 2\n" /* netherbrickstairs */
+ "e:114: 1\n" /* netherbrickstairs */
+ "f:114: 0\n" /* netherbrickstairs */
+ "m: 19: 0\n" /* sponge */,
+
+ // Block data:
+ // Level 0
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "aaaaa"
+ /* 2 */ "aaaaa"
+ /* 3 */ "aaaaa"
+ /* 4 */ "aaaaa"
+
+ // Level 1
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "....a"
+ /* 2 */ "...ba"
+ /* 3 */ "....a"
+ /* 4 */ "a...a"
+
+ // Level 2
+ /* z\x* 01234 */
+ /* 0 */ "acaca"
+ /* 1 */ "....c"
+ /* 2 */ "....a"
+ /* 3 */ "....c"
+ /* 4 */ "a...a"
+
+ // Level 3
+ /* z\x* 01234 */
+ /* 0 */ "acaca"
+ /* 1 */ "....c"
+ /* 2 */ "....a"
+ /* 3 */ "....c"
+ /* 4 */ "a...a"
+
+ // Level 4
+ /* z\x* 01234 */
+ /* 0 */ "acaca"
+ /* 1 */ "....c"
+ /* 2 */ "....a"
+ /* 3 */ "....c"
+ /* 4 */ "a...a"
+
+ // Level 5
+ /* z\x* 01234 */
+ /* 0 */ "ddddd"
+ /* 1 */ "aaaae"
+ /* 2 */ "aaaae"
+ /* 3 */ "aaaae"
+ /* 4 */ "faaae",
+
+ // Connectors:
+ "1: 2, 1, 4: 3\n" /* Type 1, direction Z+ */
+ "1: 0, 1, 2: 4\n" /* Type 1, direction X- */,
+
+ // AllowedRotations:
+ 7, /* 1, 2, 3 CCW rotation allowed */
+
+ // Merge strategy:
+ cBlockArea::msSpongePrint,
+
+ // ShouldExtendFloor:
+ false,
+
+ // DefaultWeight:
+ 100,
+
+ // DepthWeight:
+ "",
+
+ // AddWeightIfSame:
+ 0,
+ }, // TinyCorridorCornerChest
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TinyCorridorCrossing:
+ // The data has been exported from the gallery Nether, area index 64, ID 329, created by xoft
+ {
+ // Size:
+ 5, 6, 5, // SizeX = 5, SizeY = 6, SizeZ = 5
+
+ // Hitbox (relative to bounding box):
+ 0, 0, 0, // MinX, MinY, MinZ
+ 4, 5, 4, // MaxX, MaxY, MaxZ
+
+ // Block definitions:
+ ".: 0: 0\n" /* air */
+ "a:112: 0\n" /* netherbrick */
+ "b:114: 2\n" /* netherbrickstairs */
+ "c:114: 0\n" /* netherbrickstairs */
+ "d:114: 1\n" /* netherbrickstairs */
+ "m: 19: 0\n" /* sponge */,
+
+ // Block data:
+ // Level 0
+ /* z\x* 01234 */
+ /* 0 */ "aaaaa"
+ /* 1 */ "aaaaa"
+ /* 2 */ "aaaaa"
+ /* 3 */ "aaaaa"
+ /* 4 */ "aaaaa"
+
+ // Level 1
+ /* z\x* 01234 */
+ /* 0 */ "a...a"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "a...a"
+
+ // Level 2
+ /* z\x* 01234 */
+ /* 0 */ "a...a"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "a...a"
+
+ // Level 3
+ /* z\x* 01234 */
+ /* 0 */ "a...a"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "a...a"
+
+ // Level 4
+ /* z\x* 01234 */
+ /* 0 */ "a...a"
+ /* 1 */ "....."
+ /* 2 */ "....."
+ /* 3 */ "....."
+ /* 4 */ "a...a"
+
+ // Level 5
+ /* z\x* 01234 */
+ /* 0 */ "baaab"
+ /* 1 */ "aaaaa"
+ /* 2 */ "aaaaa"
+ /* 3 */ "aaaaa"
+ /* 4 */ "caaad",
+
+ // Connectors:
+ "1: 4, 1, 2: 5\n" /* Type 1, direction X+ */
+ "1: 2, 1, 4: 3\n" /* Type 1, direction Z+ */
+ "1: 0, 1, 2: 4\n" /* Type 1, direction X- */
+ "1: 2, 1, 0: 2\n" /* Type 1, direction Z- */,
+
+ // AllowedRotations:
+ 7, /* 1, 2, 3 CCW rotation allowed */
+
+ // Merge strategy:
+ cBlockArea::msSpongePrint,
+
+ // ShouldExtendFloor:
+ false,
+
+ // DefaultWeight:
+ 100,
+
+ // DepthWeight:
+ "1:200|2:400|3:0|4:500",
+
+ // AddWeightIfSame:
+ -50,
+ }, // TinyCorridorCrossing
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Turret:
// The data has been exported from the gallery Nether, area index 7, ID 34, created by xoft
{
// Size:
- 7, 6, 7, // SizeX = 7, SizeY = 6, SizeZ = 7
+ 7, 7, 7, // SizeX = 7, SizeY = 7, SizeZ = 7
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 6, 5, 6, // MaxX, MaxY, MaxZ
+ 6, 16, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
@@ -4572,7 +5095,17 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 3 */ "a.....a"
/* 4 */ "a.....a"
/* 5 */ "a.....a"
- /* 6 */ "aaaaaaa",
+ /* 6 */ "aaaaaaa"
+
+ // Level 6
+ /* z\x* 0123456 */
+ /* 0 */ "......."
+ /* 1 */ "......."
+ /* 2 */ "......."
+ /* 3 */ "......."
+ /* 4 */ "......."
+ /* 5 */ "......."
+ /* 6 */ ".......",
// Connectors:
"0: 0, 1, 3: 4\n" /* Type 0, direction X- */
diff --git a/src/HTTPServer/CMakeLists.txt b/src/HTTPServer/CMakeLists.txt
index 3badc669f..dc894368d 100644
--- a/src/HTTPServer/CMakeLists.txt
+++ b/src/HTTPServer/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(HTTPServer ${SOURCE})
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index 44a9f594f..a6fe6ea70 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -4,4 +4,9 @@ project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
-add_library(Items ItemHandler)
+file(GLOB SOURCE
+ "*.cpp"
+ "*.h"
+)
+
+add_library(Items ${SOURCE})
diff --git a/src/Items/ItemArmor.h b/src/Items/ItemArmor.h
new file mode 100644
index 000000000..08cddb1ad
--- /dev/null
+++ b/src/Items/ItemArmor.h
@@ -0,0 +1,67 @@
+
+#pragma once
+
+#include "ItemHandler.h"
+#include "../World.h"
+
+
+
+
+
+class cItemArmorHandler :
+ public cItemHandler
+{
+public:
+ cItemArmorHandler(int a_ItemType) :
+ cItemHandler(a_ItemType)
+ {
+ }
+
+ /** Move the armor to the armor slot of the player's inventory */
+ virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
+ {
+ int SlotNum;
+ if (ItemCategory::IsHelmet(a_Item.m_ItemType))
+ {
+ SlotNum = 0;
+ }
+ else if (ItemCategory::IsChestPlate(a_Item.m_ItemType))
+ {
+ SlotNum = 1;
+ }
+ else if (ItemCategory::IsLeggings(a_Item.m_ItemType))
+ {
+ SlotNum = 2;
+ }
+ else if (ItemCategory::IsBoots(a_Item.m_ItemType))
+ {
+ SlotNum = 3;
+ }
+ else
+ {
+ LOGWARNING("Used unknown armor: %i", a_Item.m_ItemType);
+ return false;
+ }
+
+ if (!a_Player->GetInventory().GetArmorSlot(SlotNum).IsEmpty())
+ {
+ return false;
+ }
+
+ a_Player->GetInventory().SetArmorSlot(SlotNum, a_Item.CopyOne());
+
+ cItem Item(a_Item);
+ Item.m_ItemCount--;
+ if (Item.m_ItemCount <= 0)
+ {
+ Item.Empty();
+ }
+ a_Player->GetInventory().SetHotbarSlot(a_Player->GetInventory().GetEquippedSlotNum(), Item);
+ return true;
+ }
+
+} ;
+
+
+
+
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 5151eac38..ce9593a70 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -8,6 +8,7 @@
#include "../BlockInServerPluginInterface.h"
// Handlers:
+#include "ItemArmor.h"
#include "ItemBed.h"
#include "ItemBoat.h"
#include "ItemBow.h"
@@ -222,6 +223,31 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
{
return new cItemFoodHandler(a_ItemType);
}
+
+ // Armor:
+ case E_ITEM_LEATHER_CAP:
+ case E_ITEM_GOLD_HELMET:
+ case E_ITEM_CHAIN_HELMET:
+ case E_ITEM_IRON_HELMET:
+ case E_ITEM_DIAMOND_HELMET:
+ case E_ITEM_LEATHER_TUNIC:
+ case E_ITEM_GOLD_CHESTPLATE:
+ case E_ITEM_CHAIN_CHESTPLATE:
+ case E_ITEM_IRON_CHESTPLATE:
+ case E_ITEM_DIAMOND_CHESTPLATE:
+ case E_ITEM_LEATHER_PANTS:
+ case E_ITEM_GOLD_LEGGINGS:
+ case E_ITEM_CHAIN_LEGGINGS:
+ case E_ITEM_IRON_LEGGINGS:
+ case E_ITEM_DIAMOND_LEGGINGS:
+ case E_ITEM_LEATHER_BOOTS:
+ case E_ITEM_GOLD_BOOTS:
+ case E_ITEM_CHAIN_BOOTS:
+ case E_ITEM_IRON_BOOTS:
+ case E_ITEM_DIAMOND_BOOTS:
+ {
+ return new cItemArmorHandler(a_ItemType);
+ }
}
}
diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h
index f3d78335e..4993eac85 100644
--- a/src/Items/ItemHandler.h
+++ b/src/Items/ItemHandler.h
@@ -21,13 +21,13 @@ class cItemHandler
public:
cItemHandler(int a_ItemType);
- // Force virtual destructor
+ /** Force virtual destructor */
virtual ~cItemHandler() {}
- /// Called when the player tries to use the item (right mouse button). Return false to make the item unusable. DEFAULT: False
+ /** Called when the player tries to use the item (right mouse button). Return false to make the item unusable. DEFAULT: False */
virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir);
- /// Called when the client sends the SHOOT status in the lclk packet
+ /** Called when the client sends the SHOOT status in the lclk packet */
virtual void OnItemShoot(cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
{
UNUSED(a_BlockX);
@@ -36,7 +36,7 @@ public:
UNUSED(a_BlockFace);
}
- /// Called every tick while the item is on the player's inventory (Used by maps) - For now, called only for equipped items
+ /** Called every tick while the item is on the player's inventory (Used by maps) - For now, called only for equipped items */
virtual void OnUpdate(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item)
{
UNUSED(a_World);
@@ -44,16 +44,16 @@ public:
UNUSED(a_Item);
}
- /// Called while the player diggs a block using this item
+ /** Called while the player diggs a block using this item */
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace);
- /// Called when the player destroys a block using this item. This also calls the drop function for the destroyed block
+ /** Called when the player destroys a block using this item. This also calls the drop function for the destroyed block */
virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_X, int a_Y, int a_Z);
- /// Called after the player has eaten this item.
+ /** Called after the player has eaten this item. */
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
- /// Returns the maximum stack size for a given item
+ /** Returns the maximum stack size for a given item */
virtual char GetMaxStackSize(void);
struct FoodInfo
@@ -70,22 +70,22 @@ public:
}
} ;
- /// Returns the FoodInfo for this item. (FoodRecovery, Saturation and PoisionChance)
+ /** Returns the FoodInfo for this item. (FoodRecovery, Saturation and PoisionChance) */
virtual FoodInfo GetFoodInfo();
- /// Lets the player eat a selected item. Returns true if the player ate the item
+ /** Lets the player eat a selected item. Returns true if the player ate the item */
virtual bool EatItem(cPlayer *a_Player, cItem *a_Item);
- /// Indicates if this item is a tool
+ /** Indicates if this item is a tool */
virtual bool IsTool(void);
- /// Indicates if this item is food
+ /** Indicates if this item is food */
virtual bool IsFood(void);
- /// Blocks simply get placed
+ /** Blocks simply get placed */
virtual bool IsPlaceable(void);
- /** Called before a block is placed into a world.
+ /** Called before a block is placed into a world.
The handler should return true to allow placement, false to refuse.
Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block.
*/
@@ -96,7 +96,7 @@ public:
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
);
- /// Returns whether this tool/item can harvest a specific block (e.g. wooden pickaxe can harvest stone, but wood can´t) DEFAULT: False
+ /** Returns whether this tool/item can harvest a specific block (e.g. wooden pickaxe can harvest stone, but wood can�t) DEFAULT: False */
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType);
static cItemHandler * GetItemHandler(int a_ItemType);
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index f4f29e833..b03652bab 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -171,7 +171,6 @@ bool cLineBlockTracer::MoveToNextBlock(void)
double CoeffZ = (DestZ - m_StartZ) / m_DiffZ;
if (CoeffZ < Coeff)
{
- Coeff = CoeffZ;
Direction = dirZ;
}
}
diff --git a/src/MCLogger.cpp b/src/MCLogger.cpp
index 80fa7b173..583438d65 100644
--- a/src/MCLogger.cpp
+++ b/src/MCLogger.cpp
@@ -9,7 +9,6 @@
cMCLogger * cMCLogger::s_MCLogger = NULL;
-bool g_ShouldColorOutput = false;
#ifdef _WIN32
#include <io.h> // Needed for _isatty(), not available on Linux
@@ -33,7 +32,8 @@ cMCLogger * cMCLogger::GetInstance(void)
-cMCLogger::cMCLogger(void)
+cMCLogger::cMCLogger(void):
+ m_ShouldColorOutput(false)
{
AString FileName;
Printf(FileName, "LOG_%d.txt", (int)time(NULL));
@@ -76,15 +76,15 @@ void cMCLogger::InitLog(const AString & a_FileName)
#ifdef _WIN32
// See whether we are writing to a console the default console attrib:
- g_ShouldColorOutput = (_isatty(_fileno(stdin)) != 0);
- if (g_ShouldColorOutput)
+ m_ShouldColorOutput = (_isatty(_fileno(stdin)) != 0);
+ if (m_ShouldColorOutput)
{
CONSOLE_SCREEN_BUFFER_INFO sbi;
GetConsoleScreenBufferInfo(g_Console, &sbi);
g_DefaultConsoleAttrib = sbi.wAttributes;
}
#elif defined (__linux) && !defined(ANDROID_NDK)
- g_ShouldColorOutput = isatty(fileno(stdout));
+ m_ShouldColorOutput = isatty(fileno(stdout));
// TODO: Check if the terminal supports colors, somehow?
#endif
}
@@ -178,7 +178,7 @@ void cMCLogger::Error(const char * a_Format, va_list a_ArgList)
void cMCLogger::SetColor(eColorScheme a_Scheme)
{
- if (!g_ShouldColorOutput)
+ if (!m_ShouldColorOutput)
{
return;
}
@@ -211,7 +211,7 @@ void cMCLogger::SetColor(eColorScheme a_Scheme)
void cMCLogger::ResetColor(void)
{
- if (!g_ShouldColorOutput)
+ if (!m_ShouldColorOutput)
{
return;
}
diff --git a/src/MCLogger.h b/src/MCLogger.h
index c0150c124..114210f63 100644
--- a/src/MCLogger.h
+++ b/src/MCLogger.h
@@ -52,6 +52,7 @@ private:
cCriticalSection m_CriticalSection;
cLog * m_Log;
static cMCLogger * s_MCLogger;
+ bool m_ShouldColorOutput;
/// Sets the specified color scheme in the terminal (TODO: if coloring available)
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 0901f85a9..3e5f72dbf 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -37,7 +37,7 @@ void cAggressiveMonster::InStateChasing(float a_Dt)
}
}
- if (((float)m_FinalDestination.x != (float)m_Target->GetPosX()) || ((float)m_FinalDestination.z != (float)m_Target->GetPosZ()))
+ if (!IsMovingToTargetPosition())
{
MoveToPosition(m_Target->GetPosition());
}
@@ -106,3 +106,18 @@ void cAggressiveMonster::Attack(float a_Dt)
+bool cAggressiveMonster::IsMovingToTargetPosition()
+{
+ float epsilon = 0.000000000001;
+ // Difference between destination x and target x is negligible (to 10^-12 precision)
+ if (fabsf((float)m_FinalDestination.x - (float)m_Target->GetPosX()) < epsilon)
+ {
+ return false;
+ }
+ // Difference between destination z and target z is negligible (to 10^-12 precision)
+ else if (fabsf(m_FinalDestination.z - (float)m_Target->GetPosZ()) > epsilon)
+ {
+ return false;
+ }
+ return true;
+}
diff --git a/src/Mobs/AggressiveMonster.h b/src/Mobs/AggressiveMonster.h
index 152260f95..d70ff04a3 100644
--- a/src/Mobs/AggressiveMonster.h
+++ b/src/Mobs/AggressiveMonster.h
@@ -22,6 +22,10 @@ public:
virtual void EventSeePlayer(cEntity *) override;
virtual void Attack(float a_Dt);
+protected:
+ /** Whether this mob's destination is the same as its target's position. */
+ bool IsMovingToTargetPosition();
+
} ;
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index 87fbfd2fc..53c265803 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Mobs ${SOURCE})
diff --git a/src/Mobs/Cavespider.cpp b/src/Mobs/CaveSpider.cpp
index 94e93283d..56ecd2d28 100644
--- a/src/Mobs/Cavespider.cpp
+++ b/src/Mobs/CaveSpider.cpp
@@ -1,15 +1,14 @@
-
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-#include "Cavespider.h"
+#include "CaveSpider.h"
#include "../World.h"
-cCavespider::cCavespider(void) :
- super("Cavespider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5)
+cCaveSpider::cCaveSpider(void) :
+ super("CaveSpider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5)
{
}
@@ -17,7 +16,7 @@ cCavespider::cCavespider(void) :
-void cCavespider::Tick(float a_Dt, cChunk & a_Chunk)
+void cCaveSpider::Tick(float a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
@@ -29,7 +28,7 @@ void cCavespider::Tick(float a_Dt, cChunk & a_Chunk)
-void cCavespider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
int LootingLevel = 0;
if (a_Killer != NULL)
diff --git a/src/Mobs/Cavespider.h b/src/Mobs/CaveSpider.h
index 10ea03f7b..be9f174f9 100644
--- a/src/Mobs/Cavespider.h
+++ b/src/Mobs/CaveSpider.h
@@ -1,4 +1,3 @@
-
#pragma once
#include "AggressiveMonster.h"
@@ -7,13 +6,13 @@
-class cCavespider :
+class cCaveSpider :
public cAggressiveMonster
{
typedef cAggressiveMonster super;
public:
- cCavespider(void);
+ cCaveSpider(void);
CLASS_PROTODEF(cCaveSpider);
diff --git a/src/Mobs/IncludeAllMonsters.h b/src/Mobs/IncludeAllMonsters.h
index 1b436a11f..3460db993 100644
--- a/src/Mobs/IncludeAllMonsters.h
+++ b/src/Mobs/IncludeAllMonsters.h
@@ -1,6 +1,6 @@
#include "Bat.h"
#include "Blaze.h"
-#include "Cavespider.h"
+#include "CaveSpider.h"
#include "Chicken.h"
#include "Cow.h"
#include "Creeper.h"
@@ -10,7 +10,7 @@
#include "Giant.h"
#include "Horse.h"
#include "IronGolem.h"
-#include "Magmacube.h"
+#include "MagmaCube.h"
#include "Mooshroom.h"
#include "Ocelot.h"
#include "Pig.h"
@@ -26,4 +26,4 @@
#include "Wither.h"
#include "Wolf.h"
#include "Zombie.h"
-#include "Zombiepigman.h"
+#include "ZombiePigman.h"
diff --git a/src/Mobs/Magmacube.cpp b/src/Mobs/MagmaCube.cpp
index 05405f082..3e9abc108 100644
--- a/src/Mobs/Magmacube.cpp
+++ b/src/Mobs/MagmaCube.cpp
@@ -1,7 +1,6 @@
-
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-#include "Magmacube.h"
+#include "MagmaCube.h"
diff --git a/src/Mobs/Magmacube.h b/src/Mobs/MagmaCube.h
index 130952970..43065cae5 100644
--- a/src/Mobs/Magmacube.h
+++ b/src/Mobs/MagmaCube.h
@@ -1,4 +1,3 @@
-
#pragma once
#include "AggressiveMonster.h"
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 248e88f5d..14d951393 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -761,8 +761,10 @@ cMonster::eFamily cMonster::FamilyFromType(eType a_Type)
case mtChicken: return mfPassive;
case mtCow: return mfPassive;
case mtCreeper: return mfHostile;
+ case mtEnderDragon: return mfNoSpawn;
case mtEnderman: return mfHostile;
case mtGhast: return mfHostile;
+ case mtGiant: return mfNoSpawn;
case mtHorse: return mfPassive;
case mtIronGolem: return mfPassive;
case mtMagmaCube: return mfHostile;
@@ -773,17 +775,20 @@ cMonster::eFamily cMonster::FamilyFromType(eType a_Type)
case mtSilverfish: return mfHostile;
case mtSkeleton: return mfHostile;
case mtSlime: return mfHostile;
+ case mtSnowGolem: return mfNoSpawn;
case mtSpider: return mfHostile;
case mtSquid: return mfWater;
case mtVillager: return mfPassive;
case mtWitch: return mfHostile;
- case mtWither: return mfHostile;
+ case mtWither: return mfNoSpawn;
case mtWolf: return mfHostile;
case mtZombie: return mfHostile;
case mtZombiePigman: return mfHostile;
- } ;
+
+ case mtInvalidType: break;
+ }
ASSERT(!"Unhandled mob type");
- return mfMaxplusone;
+ return mfUnhandled;
}
@@ -794,10 +799,12 @@ int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily)
{
switch (a_MobFamily)
{
- case mfHostile: return 40;
- case mfPassive: return 40;
- case mfAmbient: return 40;
- case mfWater: return 400;
+ case mfHostile: return 40;
+ case mfPassive: return 40;
+ case mfAmbient: return 40;
+ case mfWater: return 400;
+ case mfNoSpawn: return -1;
+ case mfUnhandled: break;
}
ASSERT(!"Unhandled mob family");
return -1;
@@ -859,13 +866,14 @@ cMonster * cMonster::NewMonsterFromType(cMonster::eType a_MobType)
case mtBat: toReturn = new cBat(); break;
case mtBlaze: toReturn = new cBlaze(); break;
- case mtCaveSpider: toReturn = new cCavespider(); break;
+ case mtCaveSpider: toReturn = new cCaveSpider(); break;
case mtChicken: toReturn = new cChicken(); break;
case mtCow: toReturn = new cCow(); break;
case mtCreeper: toReturn = new cCreeper(); break;
case mtEnderDragon: toReturn = new cEnderDragon(); break;
case mtEnderman: toReturn = new cEnderman(); break;
case mtGhast: toReturn = new cGhast(); break;
+ case mtGiant: toReturn = new cGiant(); break;
case mtIronGolem: toReturn = new cIronGolem(); break;
case mtMooshroom: toReturn = new cMooshroom(); break;
case mtOcelot: toReturn = new cOcelot(); break;
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 70b3783fc..6b9c4fab8 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -66,7 +66,8 @@ public:
mfAmbient = 2, // Bats
mfWater = 3, // Squid
- mfMaxplusone, // Nothing. Be sure this is the last and the others are in order
+ mfNoSpawn,
+ mfUnhandled, // Nothing. Be sure this is the last and the others are in order
} ;
// tolua_end
diff --git a/src/Mobs/Zombiepigman.cpp b/src/Mobs/ZombiePigman.cpp
index a0142b566..c9d94face 100644
--- a/src/Mobs/Zombiepigman.cpp
+++ b/src/Mobs/ZombiePigman.cpp
@@ -1,7 +1,6 @@
-
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-#include "Zombiepigman.h"
+#include "ZombiePigman.h"
#include "../World.h"
diff --git a/src/Mobs/Zombiepigman.h b/src/Mobs/ZombiePigman.h
index 67991d56a..ab3cebf6d 100644
--- a/src/Mobs/Zombiepigman.h
+++ b/src/Mobs/ZombiePigman.h
@@ -1,4 +1,3 @@
-
#pragma once
#include "PassiveAggressiveMonster.h"
diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp
index c06bd6b6f..72a3a3245 100644
--- a/src/MonsterConfig.cpp
+++ b/src/MonsterConfig.cpp
@@ -17,6 +17,7 @@ struct cMonsterConfig::sAttributesStruct
int m_AttackRange;
double m_AttackRate;
int m_MaxHealth;
+ bool m_IsFireproof;
};
@@ -72,6 +73,7 @@ void cMonsterConfig::Initialize()
Attributes.m_SightDistance = MonstersIniFile.GetValueI(Name, "SightDistance", 0);
Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0);
Attributes.m_MaxHealth = MonstersIniFile.GetValueI(Name, "MaxHealth", 1);
+ Attributes.m_IsFireproof = MonstersIniFile.GetValueB(Name, "IsFireproof", false);
m_pState->AttributesList.push_front(Attributes);
} // for i - SplitList[]
}
@@ -92,6 +94,7 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na
a_Monster->SetSightDistance(itr->m_SightDistance);
a_Monster->SetAttackRate ((float)itr->m_AttackRate);
a_Monster->SetMaxHealth (itr->m_MaxHealth);
+ a_Monster->SetIsFireproof (itr->m_IsFireproof);
return;
}
} // for itr - m_pState->AttributesList[]
diff --git a/src/OSSupport/CMakeLists.txt b/src/OSSupport/CMakeLists.txt
index 497cd0ba3..dee60b450 100644
--- a/src/OSSupport/CMakeLists.txt
+++ b/src/OSSupport/CMakeLists.txt
@@ -5,6 +5,7 @@ project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(OSSupport ${SOURCE})
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp
index 7f0f0ad2f..f1b3bcf9e 100644
--- a/src/OSSupport/File.cpp
+++ b/src/OSSupport/File.cpp
@@ -67,11 +67,11 @@ bool cFile::Open(const AString & iFileName, eMode iMode)
case fmRead: Mode = "rb"; break;
case fmWrite: Mode = "wb"; break;
case fmReadWrite: Mode = "rb+"; break;
- default:
- {
- ASSERT(!"Unhandled file mode");
- return false;
- }
+ }
+ if (Mode == NULL)
+ {
+ ASSERT(!"Unhandled file mode");
+ return false;
}
#ifdef _WIN32
diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt
index 107b79627..849ec27ca 100644
--- a/src/Protocol/CMakeLists.txt
+++ b/src/Protocol/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Protocol ${SOURCE})
diff --git a/src/Simulator/CMakeLists.txt b/src/Simulator/CMakeLists.txt
index 4f3f1ad0e..b2a29d45c 100644
--- a/src/Simulator/CMakeLists.txt
+++ b/src/Simulator/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(Simulator ${SOURCE})
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
index cef2a9f35..5b5b8cc18 100644
--- a/src/UI/CMakeLists.txt
+++ b/src/UI/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(UI ${SOURCE})
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 2d58388b1..87b4032e0 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1091,6 +1091,80 @@ void cSlotAreaArmor::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bo
+void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem)
+{
+ ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots()));
+
+ bool bAsync = false;
+ if (GetSlot(a_SlotNum, a_Player) == NULL)
+ {
+ LOGWARNING("GetSlot(%d) returned NULL! Ignoring click", a_SlotNum);
+ return;
+ }
+
+ if ((a_ClickAction == caShiftLeftClick) || (a_ClickAction == caShiftRightClick))
+ {
+ ShiftClicked(a_Player, a_SlotNum, a_ClickedItem);
+ return;
+ }
+
+ // Armors haven't a dbl click
+ if (a_ClickAction == caDblClick)
+ {
+ return;
+ }
+
+ cItem Slot(*GetSlot(a_SlotNum, a_Player));
+ if (!Slot.IsSameType(a_ClickedItem))
+ {
+ LOGWARNING("*** Window lost sync at item %d in SlotArea with %d items ***", a_SlotNum, m_NumSlots);
+ LOGWARNING("My item: %s", ItemToFullString(Slot).c_str());
+ LOGWARNING("Their item: %s", ItemToFullString(a_ClickedItem).c_str());
+ bAsync = true;
+ }
+ cItem & DraggingItem = a_Player.GetDraggingItem();
+ if ((a_ClickAction != caRightClick) && (a_ClickAction != caLeftClick))
+ {
+ LOGWARNING("SlotArea: Unhandled click action: %d (%s)", a_ClickAction, ClickActionToString(a_ClickAction));
+ m_ParentWindow.BroadcastWholeWindow();
+ return;
+ }
+
+ if (DraggingItem.IsEmpty() || CanPlaceInSlot(a_SlotNum, DraggingItem))
+ {
+ // Swap contents
+ cItem tmp(DraggingItem);
+ DraggingItem = Slot;
+ Slot = tmp;
+ }
+
+ SetSlot(a_SlotNum, a_Player, Slot);
+ if (bAsync)
+ {
+ m_ParentWindow.BroadcastWholeWindow();
+ }
+}
+
+
+
+
+
+bool cSlotAreaArmor::CanPlaceInSlot(int a_SlotNum, const cItem & a_Item)
+{
+ switch (a_SlotNum)
+ {
+ case 0: return ItemCategory::IsHelmet (a_Item.m_ItemType);
+ case 1: return ItemCategory::IsChestPlate(a_Item.m_ItemType);
+ case 2: return ItemCategory::IsLeggings (a_Item.m_ItemType);
+ case 3: return ItemCategory::IsBoots (a_Item.m_ItemType);
+ }
+ return false;
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaItemGrid:
diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h
index bab1098bb..254722822 100644
--- a/src/UI/SlotArea.h
+++ b/src/UI/SlotArea.h
@@ -145,8 +145,13 @@ public:
{
}
- // Distributing the stack is allowed only for compatible items (helmets into helmet slot etc.)
+ /** Distributing the stack is allowed only for compatible items (helmets into helmet slot etc.) */
virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override;
+
+ /** Called when a player clicks in the window. Parameters taken from the click packet. */
+ virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
+
+ bool CanPlaceInSlot(int a_SlotNum, const cItem & a_Item);
} ;
diff --git a/src/World.cpp b/src/World.cpp
index 25ac9b021..5ac8e0a6e 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -316,12 +316,9 @@ int cWorld::GetDefaultWeatherInterval(eWeather a_Weather)
{
return 2400 + (m_TickRand.randInt() % 4800); // 2 - 6 minutes
}
- default:
- {
- LOGWARNING("%s: Missing default weather interval for weather %d.", __FUNCTION__, a_Weather);
- return -1;
- }
- } // switch (Weather)
+ }
+ LOGWARNING("%s: Missing default weather interval for weather %d.", __FUNCTION__, a_Weather);
+ return -1;
}
@@ -521,21 +518,6 @@ void cWorld::Start(void)
}
AString Dimension = IniFile.GetValueSet("General", "Dimension", "Overworld");
m_Dimension = StringToDimension(Dimension);
- switch (m_Dimension)
- {
- case dimNether:
- case dimOverworld:
- case dimEnd:
- {
- break;
- }
- default:
- {
- LOGWARNING("Unknown dimension: \"%s\". Setting to Overworld", Dimension.c_str());
- m_Dimension = dimOverworld;
- break;
- }
- } // switch (m_Dimension)
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
int KeyNum = IniFile.FindKey("SpawnPosition");
@@ -592,12 +574,6 @@ void cWorld::Start(void)
case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break;
case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break;
case dimEnd: DefaultMonsters = "enderman"; break;
- default:
- {
- ASSERT(!"Unhandled world dimension");
- DefaultMonsters = "wither";
- break;
- }
}
m_bAnimals = IniFile.GetValueSetB("Monsters", "AnimalsOn", true);
AString AllMonsters = IniFile.GetValueSet("Monsters", "Types", DefaultMonsters);
@@ -687,6 +663,30 @@ void cWorld::GenerateRandomSpawn(void)
+eWeather cWorld::ChooseNewWeather()
+{
+ // Pick a new weather. Only reasonable transitions allowed:
+ switch (m_Weather)
+ {
+ case eWeather_Sunny:
+ case eWeather_ThunderStorm: return eWeather_Rain;
+
+ case eWeather_Rain:
+ {
+ // 1/8 chance of turning into a thunderstorm
+ return ((m_TickRand.randInt() % 256) < 32) ? eWeather_ThunderStorm : eWeather_Sunny;
+ }
+ }
+
+ LOGWARNING("Unknown current weather: %d. Setting sunny.", m_Weather);
+ ASSERT(!"Unknown weather");
+ return eWeather_Sunny;
+}
+
+
+
+
+
void cWorld::Stop(void)
{
// Delete the clients that have been in this world:
@@ -786,30 +786,8 @@ void cWorld::TickWeather(float a_Dt)
else
{
// Change weather:
-
- // Pick a new weather. Only reasonable transitions allowed:
- eWeather NewWeather = m_Weather;
- switch (m_Weather)
- {
- case eWeather_Sunny: NewWeather = eWeather_Rain; break;
- case eWeather_ThunderStorm: NewWeather = eWeather_Rain; break;
- case eWeather_Rain:
- {
- // 1/8 chance of turning into a thunderstorm
- NewWeather = ((m_TickRand.randInt() % 256) < 32) ? eWeather_ThunderStorm : eWeather_Sunny;
- break;
- }
-
- default:
- {
- LOGWARNING("Unknown current weather: %d. Setting sunny.", m_Weather);
- ASSERT(!"Unknown weather");
- NewWeather = eWeather_Sunny;
- }
- }
-
- SetWeather(NewWeather);
- } // else (m_WeatherInterval > 0)
+ SetWeather(ChooseNewWeather());
+ }
if (m_Weather == eWeather_ThunderStorm)
{
diff --git a/src/World.h b/src/World.h
index e2be4cd35..f789916df 100644
--- a/src/World.h
+++ b/src/World.h
@@ -938,7 +938,10 @@ private:
/** <summary>Generates a random spawnpoint on solid land by walking chunks and finding their biomes</summary> */
void GenerateRandomSpawn(void);
-
+
+ /** Chooses a reasonable transition from the current weather to a new weather **/
+ eWeather ChooseNewWeather(void);
+
/** Creates a new fluid simulator, loads its settings from the inifile (a_FluidName section) */
cFluidSimulator * InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock);
diff --git a/src/WorldStorage/CMakeLists.txt b/src/WorldStorage/CMakeLists.txt
index 2c83c4662..2844f7fe5 100644
--- a/src/WorldStorage/CMakeLists.txt
+++ b/src/WorldStorage/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
+ "*.h"
)
add_library(WorldStorage ${SOURCE})
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 415693ae2..773954f73 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -39,7 +39,7 @@
#include "../Mobs/Creeper.h"
#include "../Mobs/Enderman.h"
#include "../Mobs/Horse.h"
-#include "../Mobs/Magmacube.h"
+#include "../Mobs/MagmaCube.h"
#include "../Mobs/Sheep.h"
#include "../Mobs/Slime.h"
#include "../Mobs/Skeleton.h"
@@ -621,10 +621,10 @@ void cNBTChunkSerializer::AddHangingEntity(cHangingEntity * a_Hanging)
m_Writer.AddInt("TileZ", a_Hanging->GetTileZ());
switch (a_Hanging->GetDirection())
{
- case 0: m_Writer.AddByte("Dir", (unsigned char)2); break;
- case 1: m_Writer.AddByte("Dir", (unsigned char)1); break;
- case 2: m_Writer.AddByte("Dir", (unsigned char)0); break;
- case 3: m_Writer.AddByte("Dir", (unsigned char)3); break;
+ case BLOCK_FACE_YM: m_Writer.AddByte("Dir", (unsigned char)2); break;
+ case BLOCK_FACE_YP: m_Writer.AddByte("Dir", (unsigned char)1); break;
+ case BLOCK_FACE_ZM: m_Writer.AddByte("Dir", (unsigned char)0); break;
+ case BLOCK_FACE_ZP: m_Writer.AddByte("Dir", (unsigned char)3); break;
}
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 48934d074..66144dbd5 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1757,7 +1757,7 @@ void cWSSAnvil::LoadBlazeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadCaveSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::auto_ptr<cCavespider> Monster(new cCavespider());
+ std::auto_ptr<cCaveSpider> Monster(new cCaveSpider());
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp
index 59b8e4f6c..359bac4a8 100644
--- a/src/WorldStorage/WSSCompact.cpp
+++ b/src/WorldStorage/WSSCompact.cpp
@@ -805,7 +805,6 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
++index2;
}
InChunkOffset += index2 / 2;
- index2 = 0;
AString Converted(ConvertedData, ExpectedSize);