Fix switch warnings (#4013)
* Fix switch warnings * Fix a variety of -Wswitch and -Wswitch-enum warnings * Remove unneeded -Wno-error flags * Reorganise some eMonsterType switches * Alpha sort eMonsterType cases in WriteMobMetadata and in cNBTChunkSerializer::AddMonsterEntity * List all mob types in protocol 1.12 and NBTChunkSerializer * cStructGenTrees::GetNumTrees: remove switch default * cWSSAnvil::LoadOldMinecartFromNBT: Log unhandled minecart type
This commit is contained in:
parent
e24186bb13
commit
307e7aaff5
@ -169,7 +169,6 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPER
|
|||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
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(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()
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
|
@ -64,8 +64,11 @@ bool cBlockEntity::IsBlockEntityBlockType(BLOCKTYPE a_BlockType)
|
|||||||
{
|
{
|
||||||
return true;
|
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_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_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);
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,10 +46,6 @@ SET (HDRS
|
|||||||
SignEntity.h
|
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)
|
if(NOT MSVC)
|
||||||
add_library(BlockEntities ${SRCS} ${HDRS})
|
add_library(BlockEntities ${SRCS} ${HDRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
project (Cuberite)
|
project (Cuberite)
|
||||||
|
|
||||||
|
|
||||||
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/")
|
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")
|
configure_file("BuildInfo.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.h")
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
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(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(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(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")
|
set_source_files_properties(Statistics.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -60,10 +60,6 @@ SET (HDRS
|
|||||||
ThrownSnowballEntity.h
|
ThrownSnowballEntity.h
|
||||||
WitherSkullEntity.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)
|
if(NOT MSVC)
|
||||||
add_library(Entities ${SRCS} ${HDRS})
|
add_library(Entities ${SRCS} ${HDRS})
|
||||||
target_link_libraries(Entities WorldStorage)
|
target_link_libraries(Entities WorldStorage)
|
||||||
|
@ -71,14 +71,7 @@ SET (HDRS
|
|||||||
)
|
)
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
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(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")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
|
@ -586,9 +586,11 @@ bool cFinishGenVines::IsJungleVariant(EMCSBiome a_Biome)
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,65 +198,88 @@ int cStructGenTrees::GetNumTrees(
|
|||||||
const cChunkDef::BiomeMap & a_Biomes
|
const cChunkDef::BiomeMap & a_Biomes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int NumTrees = 0;
|
auto BiomeTrees = [](EMCSBiome a_Biome)
|
||||||
for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++)
|
|
||||||
{
|
{
|
||||||
int Add = 0;
|
switch (a_Biome)
|
||||||
switch (cChunkDef::GetBiome(a_Biomes, x, z))
|
|
||||||
{
|
{
|
||||||
case biOcean: Add = 2; break;
|
case biOcean: return 2;
|
||||||
case biDesert: Add = 0; break;
|
case biPlains: return 1;
|
||||||
case biPlains: Add = 1; break;
|
case biDesert: return 0;
|
||||||
case biExtremeHills: Add = 3; break;
|
case biExtremeHills: return 3;
|
||||||
case biForest: Add = 30; break;
|
case biForest: return 30;
|
||||||
case biTaiga: Add = 30; break;
|
case biTaiga: return 30;
|
||||||
case biSwampland: Add = 8; break;
|
case biSwampland: return 8;
|
||||||
case biIcePlains: Add = 1; break;
|
case biRiver: return 0;
|
||||||
case biIceMountains: Add = 1; break;
|
case biNether: return 0;
|
||||||
case biMushroomIsland: Add = 3; break;
|
case biEnd: return 0;
|
||||||
case biMushroomShore: Add = 3; break;
|
case biFrozenOcean: return 0;
|
||||||
case biForestHills: Add = 20; break;
|
case biFrozenRiver: return 0;
|
||||||
case biTaigaHills: Add = 20; break;
|
case biIcePlains: return 1;
|
||||||
case biExtremeHillsEdge: Add = 5; break;
|
case biIceMountains: return 1;
|
||||||
case biJungle: Add = 120; break;
|
case biMushroomIsland: return 3;
|
||||||
case biJungleHills: Add = 90; break;
|
case biMushroomShore: return 3;
|
||||||
case biJungleEdge: Add = 90; break;
|
case biBeach: return 0;
|
||||||
case biBirchForest: Add = 30; break;
|
case biDesertHills: return 0;
|
||||||
case biBirchForestHills: Add = 20; break;
|
case biForestHills: return 20;
|
||||||
case biRoofedForest: Add = 50; break;
|
case biTaigaHills: return 20;
|
||||||
case biColdTaiga: Add = 20; break;
|
case biExtremeHillsEdge: return 5;
|
||||||
case biColdTaigaHills: Add = 15; break;
|
case biJungle: return 120;
|
||||||
case biMegaTaiga: Add = 30; break;
|
case biJungleHills: return 90;
|
||||||
case biMegaTaigaHills: Add = 25; break;
|
case biJungleEdge: return 90;
|
||||||
case biExtremeHillsPlus: Add = 3; break;
|
case biDeepOcean: return 0;
|
||||||
case biSavanna: Add = 8; break;
|
case biStoneBeach: return 0;
|
||||||
case biSavannaPlateau: Add = 12; break;
|
case biColdBeach: return 0;
|
||||||
case biMesa: Add = 2; break;
|
case biBirchForest: return 30;
|
||||||
case biMesaPlateauF: Add = 8; break;
|
case biBirchForestHills: return 20;
|
||||||
case biMesaPlateau: Add = 8; break;
|
case biRoofedForest: return 50;
|
||||||
case biSunflowerPlains: Add = 1; break;
|
case biColdTaiga: return 20;
|
||||||
case biDesertM: Add = 0; break;
|
case biColdTaigaHills: return 15;
|
||||||
case biExtremeHillsM: Add = 4; break;
|
case biMegaTaiga: return 30;
|
||||||
case biFlowerForest: Add = 30; break;
|
case biMegaTaigaHills: return 25;
|
||||||
case biTaigaM: Add = 30; break;
|
case biExtremeHillsPlus: return 3;
|
||||||
case biSwamplandM: Add = 8; break;
|
case biSavanna: return 8;
|
||||||
case biIcePlainsSpikes: Add = 1; break;
|
case biSavannaPlateau: return 12;
|
||||||
case biJungleM: Add = 120; break;
|
case biMesa: return 2;
|
||||||
case biJungleEdgeM: Add = 90; break;
|
case biMesaPlateauF: return 8;
|
||||||
case biBirchForestM: Add = 30; break;
|
case biMesaPlateau: return 8;
|
||||||
case biBirchForestHillsM: Add = 20; break;
|
// Biome variants
|
||||||
case biRoofedForestM: Add = 40; break;
|
case biSunflowerPlains: return 1;
|
||||||
case biColdTaigaM: Add = 30; break;
|
case biDesertM: return 0;
|
||||||
case biMegaSpruceTaiga: Add = 30; break;
|
case biExtremeHillsM: return 4;
|
||||||
case biMegaSpruceTaigaHills: Add = 30; break;
|
case biFlowerForest: return 30;
|
||||||
case biExtremeHillsPlusM: Add = 4; break;
|
case biTaigaM: return 30;
|
||||||
case biSavannaM: Add = 8; break;
|
case biSwamplandM: return 8;
|
||||||
case biSavannaPlateauM: Add = 12; break;
|
case biIcePlainsSpikes: return 1;
|
||||||
case biMesaBryce: Add = 4; break;
|
case biJungleM: return 120;
|
||||||
case biMesaPlateauFM: Add = 12; break;
|
case biJungleEdgeM: return 90;
|
||||||
case biMesaPlateauM: Add = 12; break;
|
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;
|
return NumTrees / 1024;
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,6 @@ SET (HDRS
|
|||||||
UrlParser.h
|
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)
|
if(NOT MSVC)
|
||||||
add_library(HTTPServer ${SRCS} ${HDRS})
|
add_library(HTTPServer ${SRCS} ${HDRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -58,10 +58,6 @@ SET (HDRS
|
|||||||
ItemAxe.h
|
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)
|
if(NOT MSVC)
|
||||||
add_library(Items ${SRCS} ${HDRS})
|
add_library(Items ${SRCS} ${HDRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -659,9 +659,9 @@ char cItemHandler::GetMaxStackSize(void)
|
|||||||
case E_ITEM_SUGAR_CANE: return 64;
|
case E_ITEM_SUGAR_CANE: return 64;
|
||||||
case E_ITEM_TIPPED_ARROW: return 64;
|
case E_ITEM_TIPPED_ARROW: return 64;
|
||||||
case E_ITEM_WHEAT: 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,10 +81,6 @@ SET (HDRS
|
|||||||
Zombie.h
|
Zombie.h
|
||||||
ZombiePigman.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)
|
if(NOT MSVC)
|
||||||
add_library(Mobs ${SRCS} ${HDRS})
|
add_library(Mobs ${SRCS} ${HDRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -1034,10 +1034,12 @@ cMonster::eFamily cMonster::FamilyFromType(eMonsterType a_Type)
|
|||||||
case mtZombie: return mfHostile;
|
case mtZombie: return mfHostile;
|
||||||
case mtZombiePigman: 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 mfAmbient: return 40;
|
||||||
case mfWater: return 400;
|
case mfWater: return 400;
|
||||||
case mfNoSpawn: return -1;
|
case mfNoSpawn: return -1;
|
||||||
case mfUnhandled: break;
|
default:
|
||||||
|
{
|
||||||
|
ASSERT(!"Unhandled mob family");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ASSERT(!"Unhandled mob family");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,14 +32,6 @@ SET (HDRS
|
|||||||
ProtocolRecognizer.h
|
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)
|
if (NOT MSVC)
|
||||||
add_library(Protocol ${SRCS} ${HDRS})
|
add_library(Protocol ${SRCS} ${HDRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -707,6 +707,26 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
break;
|
break;
|
||||||
} // case mtBat
|
} // 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:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtOcelot
|
} // 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:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtPig
|
} // 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:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtSheep
|
} // 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:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
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());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
break;
|
break;
|
||||||
} // case mtZombiePigman
|
} // case mtZombiePigman
|
||||||
|
|
||||||
|
default: break;
|
||||||
} // switch (a_Mob.GetType())
|
} // switch (a_Mob.GetType())
|
||||||
}
|
}
|
||||||
|
@ -841,6 +841,26 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
break;
|
break;
|
||||||
} // case mtBat
|
} // 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:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtOcelot
|
} // 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:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtPig
|
} // 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:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtSheep
|
} // 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:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
// 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());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
break;
|
break;
|
||||||
} // case mtZombiePigman
|
} // case mtZombiePigman
|
||||||
|
|
||||||
|
default: break;
|
||||||
} // switch (a_Mob.GetType())
|
} // switch (a_Mob.GetType())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,6 +654,26 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
break;
|
break;
|
||||||
} // case mtBat
|
} // 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:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtOcelot
|
} // 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:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtPig
|
} // 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:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtSheep
|
} // 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:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
// 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());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
break;
|
break;
|
||||||
} // case mtZombiePigman
|
} // 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())
|
} // switch (a_Mob.GetType())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3414,6 +3414,22 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
break;
|
break;
|
||||||
} // case mtBat
|
} // 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:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtOcelot
|
} // 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:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
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);
|
a_Pkt.WriteBEInt8(ZombiePigman.IsBaby() ? 1 : -1);
|
||||||
break;
|
break;
|
||||||
} // case mtZombiePigman
|
} // case mtZombiePigman
|
||||||
|
|
||||||
|
default: break;
|
||||||
} // switch (a_Mob.GetType())
|
} // switch (a_Mob.GetType())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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::effInstantDamage: PotionID = "harming"; break;
|
||||||
case cEntityEffect::effWaterBreathing: PotionID = "water_breathing"; break;
|
case cEntityEffect::effWaterBreathing: PotionID = "water_breathing"; break;
|
||||||
case cEntityEffect::effInvisibility: PotionID = "invisibility"; break;
|
case cEntityEffect::effInvisibility: PotionID = "invisibility"; break;
|
||||||
|
default: ASSERT(!"Unknown potion effect"); break;
|
||||||
}
|
}
|
||||||
if (cEntityEffect::GetPotionEffectIntensity(a_Item.m_ItemDamage) == 1)
|
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;
|
break;
|
||||||
} // case mtBat
|
} // 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:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtOcelot
|
} // 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:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtPig
|
} // 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:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
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;
|
break;
|
||||||
} // case mtSheep
|
} // 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:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
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());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
break;
|
break;
|
||||||
} // case mtZombiePigman
|
} // case mtZombiePigman
|
||||||
|
|
||||||
|
default: break;
|
||||||
} // switch (a_Mob.GetType())
|
} // switch (a_Mob.GetType())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,6 @@ SET (HDRS
|
|||||||
MinecartWithChestWindow.h
|
MinecartWithChestWindow.h
|
||||||
WindowOwner.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)
|
if(NOT MSVC)
|
||||||
add_library(UI ${SRCS} ${HDRS})
|
add_library(UI ${SRCS} ${HDRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -1235,8 +1235,11 @@ bool cSlotAreaBeacon::IsPlaceableItem(short a_ItemType)
|
|||||||
{
|
{
|
||||||
return true;
|
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 1: return ItemCategory::IsChestPlate(a_Item.m_ItemType);
|
||||||
case 2: return ItemCategory::IsLeggings(a_Item.m_ItemType);
|
case 2: return ItemCategory::IsLeggings(a_Item.m_ItemType);
|
||||||
case 3: return ItemCategory::IsBoots(a_Item.m_ItemType);
|
case 3: return ItemCategory::IsBoots(a_Item.m_ItemType);
|
||||||
|
default: return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,13 +28,6 @@ SET (HDRS
|
|||||||
WorldStorage.h
|
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)
|
if(NOT MSVC)
|
||||||
add_library(WorldStorage ${SRCS} ${HDRS})
|
add_library(WorldStorage ${SRCS} ${HDRS})
|
||||||
|
|
||||||
|
@ -643,6 +643,35 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
m_Writer.AddInt("Size", reinterpret_cast<const cMagmaCube *>(a_Monster)->GetSize());
|
m_Writer.AddInt("Size", reinterpret_cast<const cMagmaCube *>(a_Monster)->GetSize());
|
||||||
break;
|
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:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
const cSheep *Sheep = reinterpret_cast<const cSheep *>(a_Monster);
|
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());
|
m_Writer.AddInt("Age", reinterpret_cast<const cZombiePigman *>(a_Monster)->GetAge());
|
||||||
break;
|
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 mtBlaze:
|
||||||
case mtCaveSpider:
|
case mtCaveSpider:
|
||||||
case mtChicken:
|
case mtChicken:
|
||||||
@ -752,6 +751,11 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
// Other mobs have no special tags.
|
// Other mobs have no special tags.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case mtInvalidType:
|
||||||
|
{
|
||||||
|
ASSERT(!"cNBTChunkSerializer::AddMonsterEntity: Recieved mob of invalid type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_Writer.EndCompound();
|
m_Writer.EndCompound();
|
||||||
}
|
}
|
||||||
|
@ -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:
|
// Blocktypes that have block entities but don't load their contents from disk:
|
||||||
case E_BLOCK_ENDER_CHEST: return nullptr;
|
case E_BLOCK_ENDER_CHEST: return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
// All the other blocktypes should have no entities assigned to them. Report an error:
|
default:
|
||||||
// Get the "id" tag:
|
{
|
||||||
int TagID = a_NBT.FindChildByName(a_Tag, "id");
|
// All the other blocktypes should have no entities assigned to them. Report an error:
|
||||||
AString TypeName("<unknown>");
|
// Get the "id" tag:
|
||||||
if (TagID >= 0)
|
int TagID = a_NBT.FindChildByName(a_Tag, "id");
|
||||||
{
|
AString TypeName("<unknown>");
|
||||||
TypeName.assign(a_NBT.GetData(TagID), static_cast<size_t>(a_NBT.GetDataLength(TagID)));
|
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;
|
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 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 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 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 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
|
case 4: LoadMinecartHFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with Hopper
|
||||||
|
default: LOGWARNING("cWSSAnvil::LoadOldMinecartFromNBT: Unhandled minecart type (%d)", MinecartType); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user