summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-14 10:48:57 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-14 10:48:57 +0200
commit307e7aaff5c454b703db4d536c40d5715d96032b (patch)
treee217d6a073e6b87aaeb6618a933676d3251b9355
parentUpdated compile.sh script (#4009) (diff)
downloadcuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.gz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.bz2
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.lz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.xz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.zst
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/CMakeLists.txt1
-rw-r--r--src/BlockEntities/BlockEntity.cpp18
-rw-r--r--src/BlockEntities/CMakeLists.txt4
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/Entities/CMakeLists.txt4
-rw-r--r--src/Generating/CMakeLists.txt9
-rw-r--r--src/Generating/FinishGen.cpp6
-rw-r--r--src/Generating/StructGen.cpp135
-rw-r--r--src/HTTP/CMakeLists.txt5
-rw-r--r--src/Items/CMakeLists.txt4
-rw-r--r--src/Items/ItemHandler.cpp4
-rw-r--r--src/Mobs/CMakeLists.txt4
-rw-r--r--src/Mobs/Monster.cpp16
-rw-r--r--src/Protocol/CMakeLists.txt8
-rw-r--r--src/Protocol/Protocol_1_10.cpp68
-rw-r--r--src/Protocol/Protocol_1_11.cpp68
-rw-r--r--src/Protocol/Protocol_1_12.cpp98
-rw-r--r--src/Protocol/Protocol_1_8.cpp34
-rw-r--r--src/Protocol/Protocol_1_9.cpp69
-rw-r--r--src/UI/CMakeLists.txt5
-rw-r--r--src/UI/SlotArea.cpp7
-rw-r--r--src/WorldStorage/CMakeLists.txt7
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp64
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp35
24 files changed, 357 insertions, 322 deletions
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
index 0ab21467b..0cfb7add9 100644
--- a/src/Bindings/CMakeLists.txt
+++ b/src/Bindings/CMakeLists.txt
@@ -169,7 +169,6 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPER
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_source_files_properties(Bindings.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} "-Wno-old-style-cast -Wno-missing-prototypes")
- set_source_files_properties(LuaWindow.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
endif()
if(NOT MSVC)
diff --git a/src/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp
index f2380734a..b83c5319f 100644
--- a/src/BlockEntities/BlockEntity.cpp
+++ b/src/BlockEntities/BlockEntity.cpp
@@ -64,8 +64,11 @@ bool cBlockEntity::IsBlockEntityBlockType(BLOCKTYPE a_BlockType)
{
return true;
}
+ default:
+ {
+ return false;
+ }
}
- return false;
}
@@ -95,12 +98,15 @@ cBlockEntity * cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE
case E_BLOCK_SIGN_POST: return new cSignEntity (a_BlockType, a_BlockMeta, a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_TRAPPED_CHEST: return new cChestEntity (a_BlockType, a_BlockMeta, a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_WALLSIGN: return new cSignEntity (a_BlockType, a_BlockMeta, a_BlockX, a_BlockY, a_BlockZ, a_World);
+ default:
+ {
+ LOGD("%s: Requesting creation of an unknown block entity - block type %d (%s)",
+ __FUNCTION__, a_BlockType, ItemTypeToString(a_BlockType).c_str()
+ );
+ ASSERT(!"Requesting creation of an unknown block entity");
+ return nullptr;
+ }
}
- LOGD("%s: Requesting creation of an unknown block entity - block type %d (%s)",
- __FUNCTION__, a_BlockType, ItemTypeToString(a_BlockType).c_str()
- );
- ASSERT(!"Requesting creation of an unknown block entity");
- return nullptr;
}
diff --git a/src/BlockEntities/CMakeLists.txt b/src/BlockEntities/CMakeLists.txt
index 93033931c..d512a776c 100644
--- a/src/BlockEntities/CMakeLists.txt
+++ b/src/BlockEntities/CMakeLists.txt
@@ -46,10 +46,6 @@ SET (HDRS
SignEntity.h
)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(BeaconEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
-endif()
-
if(NOT MSVC)
add_library(BlockEntities ${SRCS} ${HDRS})
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8a6a5ec7b..c023889bc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-project (Cuberite)
+project (Cuberite)
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/")
@@ -165,13 +165,9 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/TCLAP/include")
configure_file("BuildInfo.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.h")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(BiomeDef.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
set_source_files_properties(BlockID.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
- set_source_files_properties(BoundingBox.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
set_source_files_properties(ByteBuffer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
set_source_files_properties(ClientHandle.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors ")
- set_source_files_properties(CompositeChat.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
- set_source_files_properties(MobSpawner.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
set_source_files_properties(Statistics.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
endif()
diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt
index aaab6ebe4..780243d8c 100644
--- a/src/Entities/CMakeLists.txt
+++ b/src/Entities/CMakeLists.txt
@@ -60,10 +60,6 @@ SET (HDRS
ThrownSnowballEntity.h
WitherSkullEntity.h)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
-endif()
-
if(NOT MSVC)
add_library(Entities ${SRCS} ${HDRS})
target_link_libraries(Entities WorldStorage)
diff --git a/src/Generating/CMakeLists.txt b/src/Generating/CMakeLists.txt
index 67e0e8b22..02f94729f 100644
--- a/src/Generating/CMakeLists.txt
+++ b/src/Generating/CMakeLists.txt
@@ -71,14 +71,7 @@ SET (HDRS
)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
- set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors ")
- set_source_files_properties(ComposableGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
- set_source_files_properties(FinishGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch")
- set_source_files_properties(PieceGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
- set_source_files_properties(Prefab.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
- set_source_files_properties(StructGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch")
- set_source_files_properties(VillageGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=switch-enum")
+ set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
endif()
if(NOT MSVC)
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index fe5ce82be..aa7dd86c1 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -586,9 +586,11 @@ bool cFinishGenVines::IsJungleVariant(EMCSBiome a_Biome)
{
return true;
}
+ default:
+ {
+ return false;
+ }
}
-
- return false;
}
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index a36ebc608..d0e8da26a 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -198,65 +198,88 @@ int cStructGenTrees::GetNumTrees(
const cChunkDef::BiomeMap & a_Biomes
)
{
- int NumTrees = 0;
- for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++)
+ auto BiomeTrees = [](EMCSBiome a_Biome)
{
- int Add = 0;
- switch (cChunkDef::GetBiome(a_Biomes, x, z))
+ switch (a_Biome)
{
- case biOcean: Add = 2; break;
- case biDesert: Add = 0; break;
- case biPlains: Add = 1; break;
- case biExtremeHills: Add = 3; break;
- case biForest: Add = 30; break;
- case biTaiga: Add = 30; break;
- case biSwampland: Add = 8; break;
- case biIcePlains: Add = 1; break;
- case biIceMountains: Add = 1; break;
- case biMushroomIsland: Add = 3; break;
- case biMushroomShore: Add = 3; break;
- case biForestHills: Add = 20; break;
- case biTaigaHills: Add = 20; break;
- case biExtremeHillsEdge: Add = 5; break;
- case biJungle: Add = 120; break;
- case biJungleHills: Add = 90; break;
- case biJungleEdge: Add = 90; break;
- case biBirchForest: Add = 30; break;
- case biBirchForestHills: Add = 20; break;
- case biRoofedForest: Add = 50; break;
- case biColdTaiga: Add = 20; break;
- case biColdTaigaHills: Add = 15; break;
- case biMegaTaiga: Add = 30; break;
- case biMegaTaigaHills: Add = 25; break;
- case biExtremeHillsPlus: Add = 3; break;
- case biSavanna: Add = 8; break;
- case biSavannaPlateau: Add = 12; break;
- case biMesa: Add = 2; break;
- case biMesaPlateauF: Add = 8; break;
- case biMesaPlateau: Add = 8; break;
- case biSunflowerPlains: Add = 1; break;
- case biDesertM: Add = 0; break;
- case biExtremeHillsM: Add = 4; break;
- case biFlowerForest: Add = 30; break;
- case biTaigaM: Add = 30; break;
- case biSwamplandM: Add = 8; break;
- case biIcePlainsSpikes: Add = 1; break;
- case biJungleM: Add = 120; break;
- case biJungleEdgeM: Add = 90; break;
- case biBirchForestM: Add = 30; break;
- case biBirchForestHillsM: Add = 20; break;
- case biRoofedForestM: Add = 40; break;
- case biColdTaigaM: Add = 30; break;
- case biMegaSpruceTaiga: Add = 30; break;
- case biMegaSpruceTaigaHills: Add = 30; break;
- case biExtremeHillsPlusM: Add = 4; break;
- case biSavannaM: Add = 8; break;
- case biSavannaPlateauM: Add = 12; break;
- case biMesaBryce: Add = 4; break;
- case biMesaPlateauFM: Add = 12; break;
- case biMesaPlateauM: Add = 12; break;
+ case biOcean: return 2;
+ case biPlains: return 1;
+ case biDesert: return 0;
+ case biExtremeHills: return 3;
+ case biForest: return 30;
+ case biTaiga: return 30;
+ case biSwampland: return 8;
+ case biRiver: return 0;
+ case biNether: return 0;
+ case biEnd: return 0;
+ case biFrozenOcean: return 0;
+ case biFrozenRiver: return 0;
+ case biIcePlains: return 1;
+ case biIceMountains: return 1;
+ case biMushroomIsland: return 3;
+ case biMushroomShore: return 3;
+ case biBeach: return 0;
+ case biDesertHills: return 0;
+ case biForestHills: return 20;
+ case biTaigaHills: return 20;
+ case biExtremeHillsEdge: return 5;
+ case biJungle: return 120;
+ case biJungleHills: return 90;
+ case biJungleEdge: return 90;
+ case biDeepOcean: return 0;
+ case biStoneBeach: return 0;
+ case biColdBeach: return 0;
+ case biBirchForest: return 30;
+ case biBirchForestHills: return 20;
+ case biRoofedForest: return 50;
+ case biColdTaiga: return 20;
+ case biColdTaigaHills: return 15;
+ case biMegaTaiga: return 30;
+ case biMegaTaigaHills: return 25;
+ case biExtremeHillsPlus: return 3;
+ case biSavanna: return 8;
+ case biSavannaPlateau: return 12;
+ case biMesa: return 2;
+ case biMesaPlateauF: return 8;
+ case biMesaPlateau: return 8;
+ // Biome variants
+ case biSunflowerPlains: return 1;
+ case biDesertM: return 0;
+ case biExtremeHillsM: return 4;
+ case biFlowerForest: return 30;
+ case biTaigaM: return 30;
+ case biSwamplandM: return 8;
+ case biIcePlainsSpikes: return 1;
+ case biJungleM: return 120;
+ case biJungleEdgeM: return 90;
+ case biBirchForestM: return 30;
+ case biBirchForestHillsM: return 20;
+ case biRoofedForestM: return 40;
+ case biColdTaigaM: return 30;
+ case biMegaSpruceTaiga: return 30;
+ case biMegaSpruceTaigaHills: return 30;
+ case biExtremeHillsPlusM: return 4;
+ case biSavannaM: return 8;
+ case biSavannaPlateauM: return 12;
+ case biMesaBryce: return 4;
+ case biMesaPlateauFM: return 12;
+ case biMesaPlateauM: return 12;
+ // Non-biomes
+ case biInvalidBiome:
+ case biNumBiomes:
+ case biVariant:
+ case biNumVariantBiomes:
+ {
+ ASSERT(!"Invalid biome in cStructGenTrees::GetNumTrees");
+ return 0;
+ }
}
- NumTrees += Add;
+ };
+
+ int NumTrees = 0;
+ for (auto Biome : a_Biomes)
+ {
+ NumTrees += BiomeTrees(Biome);
}
return NumTrees / 1024;
}
diff --git a/src/HTTP/CMakeLists.txt b/src/HTTP/CMakeLists.txt
index 1e7b0672b..f15c35764 100644
--- a/src/HTTP/CMakeLists.txt
+++ b/src/HTTP/CMakeLists.txt
@@ -32,11 +32,6 @@ SET (HDRS
UrlParser.h
)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(HTTPServer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors ")
- set_source_files_properties(HTTPServerConnection.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
-endif()
-
if(NOT MSVC)
add_library(HTTPServer ${SRCS} ${HDRS})
endif()
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index 72858591a..ba0e4ca9f 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -58,10 +58,6 @@ SET (HDRS
ItemAxe.h
)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(ItemHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
-endif()
-
if(NOT MSVC)
add_library(Items ${SRCS} ${HDRS})
endif()
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index e0c5bb56c..ae913f478 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -659,9 +659,9 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_SUGAR_CANE: return 64;
case E_ITEM_TIPPED_ARROW: return 64;
case E_ITEM_WHEAT: return 64;
+ // By default items don't stack:
+ default: return 1;
}
- // By default items don't stack:
- return 1;
}
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index 55ae36e1e..08df07d71 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -81,10 +81,6 @@ SET (HDRS
Zombie.h
ZombiePigman.h)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(Monster.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch -Wno-error=switch-enum")
-endif()
-
if(NOT MSVC)
add_library(Mobs ${SRCS} ${HDRS})
endif()
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 944e8aa94..2ff1f74d8 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -1034,10 +1034,12 @@ cMonster::eFamily cMonster::FamilyFromType(eMonsterType a_Type)
case mtZombie: return mfHostile;
case mtZombiePigman: return mfHostile;
- case mtInvalidType: break;
+ default:
+ {
+ ASSERT(!"Unhandled mob type");
+ return mfUnhandled;
+ }
}
- ASSERT(!"Unhandled mob type");
- return mfUnhandled;
}
@@ -1053,10 +1055,12 @@ int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily)
case mfAmbient: return 40;
case mfWater: return 400;
case mfNoSpawn: return -1;
- case mfUnhandled: break;
+ default:
+ {
+ ASSERT(!"Unhandled mob family");
+ return -1;
+ }
}
- ASSERT(!"Unhandled mob family");
- return -1;
}
diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt
index f4f266963..ff1a98e6b 100644
--- a/src/Protocol/CMakeLists.txt
+++ b/src/Protocol/CMakeLists.txt
@@ -32,14 +32,6 @@ SET (HDRS
ProtocolRecognizer.h
)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(Protocol_1_9.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
- set_source_files_properties(Protocol_1_8.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
- set_source_files_properties(Protocol_1_10.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
- set_source_files_properties(Protocol_1_11.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
- set_source_files_properties(Protocol_1_12.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch")
-endif()
-
if (NOT MSVC)
add_library(Protocol ${SRCS} ${HDRS})
endif()
diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp
index bb29c58ce..a16ad3143 100644
--- a/src/Protocol/Protocol_1_10.cpp
+++ b/src/Protocol/Protocol_1_10.cpp
@@ -707,6 +707,26 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtBat
+ case mtChicken:
+ {
+ auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Chicken.IsBaby());
+ break;
+ } // case mtChicken
+
+ case mtCow:
+ {
+ auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Cow.IsBaby());
+ break;
+ } // case mtCow
+
case mtCreeper:
{
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
@@ -821,26 +841,6 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtOcelot
- case mtCow:
- {
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Cow.IsBaby());
- break;
- } // case mtCow
-
- case mtChicken:
- {
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Chicken.IsBaby());
- break;
- } // case mtChicken
-
case mtPig:
{
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
@@ -856,6 +856,19 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtPig
+ case mtRabbit:
+ {
+ auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Rabbit.IsBaby());
+
+ a_Pkt.WriteBEUInt8(RABBIT_TYPE);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
+ a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
+ break;
+ } // case mtRabbit
+
case mtSheep:
{
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
@@ -876,19 +889,6 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtSheep
- case mtRabbit:
- {
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Rabbit.IsBaby());
-
- a_Pkt.WriteBEUInt8(RABBIT_TYPE);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
- a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
- break;
- } // case mtRabbit
-
case mtSkeleton:
{
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
@@ -1003,5 +1003,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
a_Pkt.WriteBool(ZombiePigman.IsBaby());
break;
} // case mtZombiePigman
+
+ default: break;
} // switch (a_Mob.GetType())
}
diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp
index ba7742493..c0c8815e8 100644
--- a/src/Protocol/Protocol_1_11.cpp
+++ b/src/Protocol/Protocol_1_11.cpp
@@ -841,6 +841,26 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtBat
+ case mtChicken:
+ {
+ auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Chicken.IsBaby());
+ break;
+ } // case mtChicken
+
+ case mtCow:
+ {
+ auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Cow.IsBaby());
+ break;
+ } // case mtCow
+
case mtCreeper:
{
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
@@ -978,26 +998,6 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtOcelot
- case mtCow:
- {
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Cow.IsBaby());
- break;
- } // case mtCow
-
- case mtChicken:
- {
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Chicken.IsBaby());
- break;
- } // case mtChicken
-
case mtPig:
{
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
@@ -1014,6 +1014,19 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtPig
+ case mtRabbit:
+ {
+ auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Rabbit.IsBaby());
+
+ a_Pkt.WriteBEUInt8(RABBIT_TYPE);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
+ a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
+ break;
+ } // case mtRabbit
+
case mtSheep:
{
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
@@ -1034,19 +1047,6 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
break;
} // case mtSheep
- case mtRabbit:
- {
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Rabbit.IsBaby());
-
- a_Pkt.WriteBEUInt8(RABBIT_TYPE);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
- a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
- break;
- } // case mtRabbit
-
case mtSkeleton:
{
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
@@ -1165,6 +1165,8 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
a_Pkt.WriteBool(ZombiePigman.IsBaby());
break;
} // case mtZombiePigman
+
+ default: break;
} // switch (a_Mob.GetType())
}
diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp
index 166078aef..627131576 100644
--- a/src/Protocol/Protocol_1_12.cpp
+++ b/src/Protocol/Protocol_1_12.cpp
@@ -654,6 +654,26 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
break;
} // case mtBat
+ case mtChicken:
+ {
+ auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Chicken.IsBaby());
+ break;
+ } // case mtChicken
+
+ case mtCow:
+ {
+ auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Cow.IsBaby());
+ break;
+ } // case mtCow
+
case mtCreeper:
{
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
@@ -791,26 +811,6 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
break;
} // case mtOcelot
- case mtCow:
- {
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Cow.IsBaby());
- break;
- } // case mtCow
-
- case mtChicken:
- {
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Chicken.IsBaby());
- break;
- } // case mtChicken
-
case mtPig:
{
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
@@ -827,6 +827,19 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
break;
} // case mtPig
+ case mtRabbit:
+ {
+ auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ a_Pkt.WriteBEUInt8(AGEABLE_BABY);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Rabbit.IsBaby());
+
+ a_Pkt.WriteBEUInt8(RABBIT_TYPE);
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
+ a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
+ break;
+ } // case mtRabbit
+
case mtSheep:
{
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
@@ -847,19 +860,6 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
break;
} // case mtSheep
- case mtRabbit:
- {
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
- a_Pkt.WriteBEUInt8(AGEABLE_BABY);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Rabbit.IsBaby());
-
- a_Pkt.WriteBEUInt8(RABBIT_TYPE);
- a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
- a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
- break;
- } // case mtRabbit
-
case mtSkeleton:
{
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
@@ -978,6 +978,38 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
a_Pkt.WriteBool(ZombiePigman.IsBaby());
break;
} // case mtZombiePigman
+
+ case mtBlaze:
+ case mtEnderDragon:
+ case mtGuardian:
+ case mtIronGolem:
+ case mtSnowGolem:
+ case mtSpider:
+ {
+ // TODO: Mobs with extra fields that aren't implemented
+ break;
+ }
+
+ case mtMooshroom:
+ case mtCaveSpider:
+ {
+ // Not mentioned on http://wiki.vg/Entities
+ break;
+ }
+
+ case mtGiant:
+ case mtSilverfish:
+ case mtSquid:
+ {
+ // Mobs with no extra fields
+ break;
+ }
+
+ case mtInvalidType:
+ {
+ ASSERT(!"cProtocol_1_12::WriteMobMetadata: Recieved mob of invalid type");
+ break;
+ }
} // switch (a_Mob.GetType())
}
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index b6e5b5a38..c384f85b9 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -3414,6 +3414,22 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
break;
} // case mtBat
+ case mtChicken:
+ {
+ auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Chicken.IsBaby() ? -1 : (Chicken.IsInLoveCooldown() ? 1 : 0));
+ break;
+ } // case mtChicken
+
+ case mtCow:
+ {
+ auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Cow.IsBaby() ? -1 : (Cow.IsInLoveCooldown() ? 1 : 0));
+ break;
+ } // case mtCow
+
case mtCreeper:
{
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
@@ -3504,22 +3520,6 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
break;
} // case mtOcelot
- case mtCow:
- {
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
- a_Pkt.WriteBEUInt8(0x0c);
- a_Pkt.WriteBEInt8(Cow.IsBaby() ? -1 : (Cow.IsInLoveCooldown() ? 1 : 0));
- break;
- } // case mtCow
-
- case mtChicken:
- {
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
- a_Pkt.WriteBEUInt8(0x0c);
- a_Pkt.WriteBEInt8(Chicken.IsBaby() ? -1 : (Chicken.IsInLoveCooldown() ? 1 : 0));
- break;
- } // case mtChicken
-
case mtPig:
{
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
@@ -3650,6 +3650,8 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
a_Pkt.WriteBEInt8(ZombiePigman.IsBaby() ? 1 : -1);
break;
} // case mtZombiePigman
+
+ default: break;
} // switch (a_Mob.GetType())
}
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 90eedf91e..fcfc6674a 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -3434,6 +3434,7 @@ void cProtocol_1_9_0::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item)
case cEntityEffect::effInstantDamage: PotionID = "harming"; break;
case cEntityEffect::effWaterBreathing: PotionID = "water_breathing"; break;
case cEntityEffect::effInvisibility: PotionID = "invisibility"; break;
+ default: ASSERT(!"Unknown potion effect"); break;
}
if (cEntityEffect::GetPotionEffectIntensity(a_Item.m_ItemDamage) == 1)
{
@@ -3835,6 +3836,26 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
break;
} // case mtBat
+ case mtChicken:
+ {
+ auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Chicken.IsBaby());
+ break;
+ } // case mtChicken
+
+ case mtCow:
+ {
+ auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+
+ a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Cow.IsBaby());
+ break;
+ } // case mtCow
+
case mtCreeper:
{
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
@@ -3949,26 +3970,6 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
break;
} // case mtOcelot
- case mtCow:
- {
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Cow.IsBaby());
- break;
- } // case mtCow
-
- case mtChicken:
- {
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
-
- a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Chicken.IsBaby());
- break;
- } // case mtChicken
-
case mtPig:
{
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
@@ -3984,6 +3985,19 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
break;
} // case mtPig
+ case mtRabbit:
+ {
+ auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
+ a_Pkt.WriteBool(Rabbit.IsBaby());
+
+ a_Pkt.WriteBEUInt8(12); // Index 12: Type
+ a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
+ a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
+ break;
+ } // case mtRabbit
+
case mtSheep:
{
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
@@ -4004,19 +4018,6 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
break;
} // case mtSheep
- case mtRabbit:
- {
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
- a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
- a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(Rabbit.IsBaby());
-
- a_Pkt.WriteBEUInt8(12); // Index 12: Type
- a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
- a_Pkt.WriteVarInt32(static_cast<UInt32>(Rabbit.GetRabbitType()));
- break;
- } // case mtRabbit
-
case mtSkeleton:
{
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
@@ -4131,6 +4132,8 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
a_Pkt.WriteBool(ZombiePigman.IsBaby());
break;
} // case mtZombiePigman
+
+ default: break;
} // switch (a_Mob.GetType())
}
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
index d71e08ade..54236a929 100644
--- a/src/UI/CMakeLists.txt
+++ b/src/UI/CMakeLists.txt
@@ -34,11 +34,6 @@ SET (HDRS
MinecartWithChestWindow.h
WindowOwner.h)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(SlotArea.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum ")
- set_source_files_properties(Window.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum ")
-endif()
-
if(NOT MSVC)
add_library(UI ${SRCS} ${HDRS})
endif()
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 94fd958d5..865e9cb44 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1235,8 +1235,11 @@ bool cSlotAreaBeacon::IsPlaceableItem(short a_ItemType)
{
return true;
}
+ default:
+ {
+ return false;
+ }
}
- return false;
}
@@ -2406,8 +2409,8 @@ bool cSlotAreaArmor::CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item)
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);
+ default: return false;
}
- return false;
}
diff --git a/src/WorldStorage/CMakeLists.txt b/src/WorldStorage/CMakeLists.txt
index c351420f4..d9e066b32 100644
--- a/src/WorldStorage/CMakeLists.txt
+++ b/src/WorldStorage/CMakeLists.txt
@@ -28,13 +28,6 @@ SET (HDRS
WorldStorage.h
)
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(FireworksSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum ")
- set_source_files_properties(NBTChunkSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum ")
- set_source_files_properties(SchematicFileSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
- set_source_files_properties(WSSAnvil.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch -Wno-error=switch-enum ")
-endif()
-
if(NOT MSVC)
add_library(WorldStorage ${SRCS} ${HDRS})
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 1e8543648..12f767abf 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -643,6 +643,35 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddInt("Size", reinterpret_cast<const cMagmaCube *>(a_Monster)->GetSize());
break;
}
+ case mtOcelot:
+ {
+ const auto *Ocelot = reinterpret_cast<const cOcelot *>(a_Monster);
+ if (!Ocelot->GetOwnerName().empty())
+ {
+ m_Writer.AddString("Owner", Ocelot->GetOwnerName());
+ }
+ if (!Ocelot->GetOwnerUUID().IsNil())
+ {
+ m_Writer.AddString("OwnerUUID", Ocelot->GetOwnerUUID().ToShortString());
+ }
+ m_Writer.AddByte("Sitting", Ocelot->IsSitting() ? 1 : 0);
+ m_Writer.AddInt("CatType", Ocelot->GetOcelotType());
+ m_Writer.AddInt("Age", Ocelot->GetAge());
+ break;
+ }
+ case mtPig:
+ {
+ m_Writer.AddInt("Age", reinterpret_cast<const cPig *>(a_Monster)->GetAge());
+ break;
+ }
+ case mtRabbit:
+ {
+ const cRabbit * Rabbit = reinterpret_cast<const cRabbit *>(a_Monster);
+ m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
+ m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
+ m_Writer.AddInt("Age", Rabbit->GetAge());
+ break;
+ }
case mtSheep:
{
const cSheep *Sheep = reinterpret_cast<const cSheep *>(a_Monster);
@@ -703,36 +732,6 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddInt("Age", reinterpret_cast<const cZombiePigman *>(a_Monster)->GetAge());
break;
}
- case mtOcelot:
- {
- const auto *Ocelot = reinterpret_cast<const cOcelot *>(a_Monster);
- if (!Ocelot->GetOwnerName().empty())
- {
- m_Writer.AddString("Owner", Ocelot->GetOwnerName());
- }
- if (!Ocelot->GetOwnerUUID().IsNil())
- {
- m_Writer.AddString("OwnerUUID", Ocelot->GetOwnerUUID().ToShortString());
- }
- m_Writer.AddByte("Sitting", Ocelot->IsSitting() ? 1 : 0);
- m_Writer.AddInt ("CatType", Ocelot->GetOcelotType());
- m_Writer.AddInt ("Age", Ocelot->GetAge());
- break;
- }
- case mtPig:
- {
- m_Writer.AddInt("Age", reinterpret_cast<const cPig *>(a_Monster)->GetAge());
- break;
- }
- case mtRabbit:
- {
- const cRabbit * Rabbit = reinterpret_cast<const cRabbit *>(a_Monster);
- m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
- m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
- m_Writer.AddInt("Age", Rabbit->GetAge());
- break;
- }
- case mtInvalidType:
case mtBlaze:
case mtCaveSpider:
case mtChicken:
@@ -752,6 +751,11 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
// Other mobs have no special tags.
break;
}
+ case mtInvalidType:
+ {
+ ASSERT(!"cNBTChunkSerializer::AddMonsterEntity: Recieved mob of invalid type");
+ break;
+ }
}
m_Writer.EndCompound();
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 158f7a819..b47d3eddd 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -716,22 +716,25 @@ cBlockEntity * cWSSAnvil::LoadBlockEntityFromNBT(const cParsedNBT & a_NBT, int a
// Blocktypes that have block entities but don't load their contents from disk:
case E_BLOCK_ENDER_CHEST: return nullptr;
- }
- // All the other blocktypes should have no entities assigned to them. Report an error:
- // Get the "id" tag:
- int TagID = a_NBT.FindChildByName(a_Tag, "id");
- AString TypeName("<unknown>");
- if (TagID >= 0)
- {
- TypeName.assign(a_NBT.GetData(TagID), static_cast<size_t>(a_NBT.GetDataLength(TagID)));
+ default:
+ {
+ // All the other blocktypes should have no entities assigned to them. Report an error:
+ // Get the "id" tag:
+ int TagID = a_NBT.FindChildByName(a_Tag, "id");
+ AString TypeName("<unknown>");
+ if (TagID >= 0)
+ {
+ TypeName.assign(a_NBT.GetData(TagID), static_cast<size_t>(a_NBT.GetDataLength(TagID)));
+ }
+ LOGINFO("WorldLoader(%s): Block entity mismatch: block type %s (%d), type \"%s\", at {%d, %d, %d}; the entity will be lost.",
+ m_World->GetName().c_str(),
+ ItemTypeToString(a_BlockType).c_str(), a_BlockType, TypeName.c_str(),
+ a_BlockX, a_BlockY, a_BlockZ
+ );
+ return nullptr;
+ }
}
- LOGINFO("WorldLoader(%s): Block entity mismatch: block type %s (%d), type \"%s\", at {%d, %d, %d}; the entity will be lost.",
- m_World->GetName().c_str(),
- ItemTypeToString(a_BlockType).c_str(), a_BlockType, TypeName.c_str(),
- a_BlockX, a_BlockY, a_BlockZ
- );
- return nullptr;
}
@@ -1645,13 +1648,15 @@ void cWSSAnvil::LoadOldMinecartFromNBT(cEntityList & a_Entities, const cParsedNB
{
return;
}
- switch (a_NBT.GetInt(TypeTag))
+ int MinecartType = a_NBT.GetInt(TypeTag);
+ switch (MinecartType)
{
case 0: LoadMinecartRFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Rideable minecart
case 1: LoadMinecartCFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with chest
case 2: LoadMinecartFFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with furnace
case 3: LoadMinecartTFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with TNT
case 4: LoadMinecartHFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with Hopper
+ default: LOGWARNING("cWSSAnvil::LoadOldMinecartFromNBT: Unhandled minecart type (%d)", MinecartType); break;
}
}