summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Bindings/PluginManager.cpp2
-rw-r--r--src/Blocks/BlockPortal.h14
-rw-r--r--src/WorldStorage/MapSerializer.cpp8
-rw-r--r--src/WorldStorage/SchematicFileSerializer.cpp2
4 files changed, 24 insertions, 2 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 310ecc7e8..fc690d4de 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -144,7 +144,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
}
size_t NumLoadedPlugins = GetNumPlugins();
- if (NumLoadedPlugins)
+ if (NumLoadedPlugins == 0)
{
LOG("-- No Plugins Loaded --");
}
diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h
index 21bcbdeea..3b8030028 100644
--- a/src/Blocks/BlockPortal.h
+++ b/src/Blocks/BlockPortal.h
@@ -2,6 +2,7 @@
#pragma once
#include "BlockHandler.h"
+#include "../Mobs/Monster.h"
@@ -38,6 +39,19 @@ public:
return; // No pickups
}
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ {
+ cFastRandom Random;
+ if (Random.NextInt(2000) != 0)
+ {
+ return;
+ }
+
+ int PosX = a_Chunk.GetPosX() * 16 + a_RelX;
+ int PosZ = a_Chunk.GetPosZ() * 16 + a_RelZ;
+
+ a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::mtZombiePigman);
+ }
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index df72d1cc9..012fc52f3 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -152,6 +152,10 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
if (CurrLine >= 0)
{
unsigned int Width = a_NBT.GetShort(CurrLine);
+ if (Width != 128)
+ {
+ return false;
+ }
m_Map->m_Width = Width;
}
@@ -159,6 +163,10 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
if (CurrLine >= 0)
{
unsigned int Height = a_NBT.GetShort(CurrLine);
+ if (Height >= 256)
+ {
+ return false;
+ }
m_Map->m_Height = Height;
}
diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp
index d3a708f92..1cf99efd9 100644
--- a/src/WorldStorage/SchematicFileSerializer.cpp
+++ b/src/WorldStorage/SchematicFileSerializer.cpp
@@ -192,7 +192,7 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP
int SizeX = a_NBT.GetShort(TSizeX);
int SizeY = a_NBT.GetShort(TSizeY);
int SizeZ = a_NBT.GetShort(TSizeZ);
- if ((SizeX < 1) || (SizeY < 1) || (SizeZ < 1))
+ if ((SizeX < 1) || (SizeX > 65535) || (SizeY < 1) || (SizeY > 256) || (SizeZ < 1) || (SizeZ > 65535))
{
LOG("Dimensions are invalid in the schematic file: %d, %d, %d", SizeX, SizeY, SizeZ);
return false;