summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AllocationPool.h6
-rw-r--r--src/Bindings/BindingsProcessor.lua16
-rw-r--r--src/Bindings/CMakeLists.txt9
-rw-r--r--src/Bindings/LuaChunkStay.cpp6
-rw-r--r--src/Bindings/LuaState.cpp138
-rw-r--r--src/Bindings/LuaState.h187
-rw-r--r--src/Bindings/ManualBindings.cpp62
-rw-r--r--src/Bindings/ManualBindings.h12
-rw-r--r--src/Bindings/ManualBindings_Network.cpp7
-rw-r--r--src/Bindings/ManualBindings_World.cpp9
-rw-r--r--src/Bindings/Plugin.h3
-rw-r--r--src/Bindings/PluginLua.cpp84
-rw-r--r--src/Bindings/PluginLua.h5
-rw-r--r--src/Bindings/PluginManager.cpp93
-rw-r--r--src/Bindings/PluginManager.h17
-rw-r--r--src/BiomeDef.cpp4
-rw-r--r--src/BiomeDef.h22
-rw-r--r--src/BlockArea.cpp75
-rw-r--r--src/BlockArea.h11
-rw-r--r--src/BlockEntities/BeaconEntity.cpp6
-rw-r--r--src/BlockEntities/BlockEntity.h3
-rw-r--r--src/BlockEntities/BlockEntityWithItems.h2
-rw-r--r--src/BlockEntities/CMakeLists.txt5
-rw-r--r--src/BlockEntities/ChestEntity.cpp16
-rw-r--r--src/BlockEntities/ChestEntity.h18
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp4
-rw-r--r--src/BlockEntities/EnderChestEntity.cpp12
-rw-r--r--src/BlockEntities/FurnaceEntity.cpp42
-rw-r--r--src/BlockEntities/FurnaceEntity.h8
-rw-r--r--src/BlockEntities/HopperEntity.cpp2
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp18
-rw-r--r--src/BlockEntities/NoteEntity.cpp11
-rw-r--r--src/BlockEntities/NoteEntity.h2
-rw-r--r--src/BlockID.cpp38
-rw-r--r--src/BlockInfo.cpp3
-rw-r--r--src/Blocks/BlockAnvil.h8
-rw-r--r--src/Blocks/BlockBed.h7
-rw-r--r--src/Blocks/BlockButton.h34
-rw-r--r--src/Blocks/BlockCocoaPod.h8
-rw-r--r--src/Blocks/BlockComparator.h79
-rw-r--r--src/Blocks/BlockDirt.h41
-rw-r--r--src/Blocks/BlockDoor.cpp20
-rw-r--r--src/Blocks/BlockDoor.h12
-rw-r--r--src/Blocks/BlockFarmland.h13
-rw-r--r--src/Blocks/BlockFire.h19
-rw-r--r--src/Blocks/BlockFluid.h6
-rw-r--r--src/Blocks/BlockHandler.cpp40
-rw-r--r--src/Blocks/BlockHandler.h23
-rw-r--r--src/Blocks/BlockHopper.h2
-rw-r--r--src/Blocks/BlockLadder.h11
-rw-r--r--src/Blocks/BlockLeaves.h36
-rw-r--r--src/Blocks/BlockLever.h18
-rw-r--r--src/Blocks/BlockPiston.cpp6
-rw-r--r--src/Blocks/BlockQuartz.h7
-rw-r--r--src/Blocks/BlockRail.h43
-rw-r--r--src/Blocks/BlockSapling.h142
-rw-r--r--src/Blocks/BlockSideways.h6
-rw-r--r--src/Blocks/BlockSlab.h10
-rw-r--r--src/Blocks/BlockStairs.h6
-rw-r--r--src/Blocks/BlockTorch.h23
-rw-r--r--src/Blocks/BlockTrapdoor.h11
-rw-r--r--src/Blocks/BlockTripwireHook.h16
-rw-r--r--src/Blocks/BlockVine.h2
-rw-r--r--src/Blocks/BlockWallSign.h12
-rw-r--r--src/Blocks/CMakeLists.txt5
-rw-r--r--src/Blocks/WorldInterface.h12
-rw-r--r--src/BoundingBox.cpp13
-rw-r--r--src/ByteBuffer.cpp15
-rw-r--r--src/CMakeLists.txt52
-rw-r--r--src/Chunk.cpp42
-rw-r--r--src/Chunk.h1
-rw-r--r--src/ChunkDef.h52
-rw-r--r--src/ChunkMap.cpp20
-rw-r--r--src/ChunkMap.h3
-rw-r--r--src/ChunkSender.cpp279
-rw-r--r--src/ChunkSender.h120
-rw-r--r--src/ClientHandle.cpp177
-rw-r--r--src/ClientHandle.h23
-rw-r--r--src/CompositeChat.cpp37
-rw-r--r--src/CraftingRecipes.cpp20
-rw-r--r--src/Defines.h93
-rw-r--r--src/Enchantments.cpp10
-rw-r--r--src/Enchantments.h8
-rw-r--r--src/Endianness.h4
-rw-r--r--src/Entities/ArrowEntity.cpp13
-rw-r--r--src/Entities/CMakeLists.txt8
-rw-r--r--src/Entities/EnderCrystal.cpp2
-rw-r--r--src/Entities/Entity.cpp76
-rw-r--r--src/Entities/Entity.h49
-rw-r--r--src/Entities/ExpOrb.cpp4
-rw-r--r--src/Entities/FallingBlock.cpp2
-rw-r--r--src/Entities/FireChargeEntity.cpp10
-rw-r--r--src/Entities/FireChargeEntity.h2
-rw-r--r--src/Entities/GhastFireballEntity.cpp8
-rw-r--r--src/Entities/GhastFireballEntity.h2
-rw-r--r--src/Entities/HangingEntity.h20
-rw-r--r--src/Entities/ItemFrame.cpp6
-rw-r--r--src/Entities/Minecart.cpp17
-rw-r--r--src/Entities/Minecart.h2
-rw-r--r--src/Entities/Painting.cpp2
-rw-r--r--src/Entities/Pawn.cpp4
-rw-r--r--src/Entities/Pickup.cpp7
-rw-r--r--src/Entities/Player.cpp195
-rw-r--r--src/Entities/Player.h200
-rw-r--r--src/Entities/ProjectileEntity.cpp7
-rw-r--r--src/Entities/SplashPotionEntity.cpp12
-rw-r--r--src/Entities/ThrownEnderPearlEntity.cpp4
-rw-r--r--src/Entities/ThrownSnowballEntity.cpp2
-rw-r--r--src/FastRandom.cpp26
-rw-r--r--src/FurnaceRecipe.cpp12
-rw-r--r--src/Generating/BioGen.cpp116
-rw-r--r--src/Generating/BioGen.h14
-rw-r--r--src/Generating/CMakeLists.txt28
-rw-r--r--src/Generating/ChunkDesc.cpp12
-rw-r--r--src/Generating/ChunkDesc.h8
-rw-r--r--src/Generating/CompoGenBiomal.cpp22
-rw-r--r--src/Generating/ComposableGenerator.cpp10
-rw-r--r--src/Generating/CompositedHeiGen.h7
-rw-r--r--src/Generating/DungeonRoomsFinisher.cpp4
-rw-r--r--src/Generating/FinishGen.cpp37
-rw-r--r--src/Generating/GridStructGen.cpp4
-rw-r--r--src/Generating/HeiGen.cpp51
-rw-r--r--src/Generating/HeiGen.h14
-rw-r--r--src/Generating/IntGen.h4
-rw-r--r--src/Generating/MineShafts.cpp28
-rw-r--r--src/Generating/NetherFortGen.cpp4
-rw-r--r--src/Generating/Noise3DGenerator.cpp7
-rw-r--r--src/Generating/POCPieceGenerator.cpp4
-rw-r--r--src/Generating/PieceGenerator.cpp28
-rw-r--r--src/Generating/Prefab.cpp59
-rw-r--r--src/Generating/Prefab.h25
-rw-r--r--src/Generating/PrefabPiecePool.cpp494
-rw-r--r--src/Generating/PrefabPiecePool.h140
-rw-r--r--src/Generating/Prefabs/AlchemistVillagePrefabs.cpp3590
-rw-r--r--src/Generating/Prefabs/AlchemistVillagePrefabs.h15
-rw-r--r--src/Generating/Prefabs/CMakeLists.txt16
-rw-r--r--src/Generating/Prefabs/JapaneseVillagePrefabs.cpp3386
-rw-r--r--src/Generating/Prefabs/JapaneseVillagePrefabs.h15
-rw-r--r--src/Generating/Prefabs/PlainsVillagePrefabs.cpp6118
-rw-r--r--src/Generating/Prefabs/PlainsVillagePrefabs.h15
-rw-r--r--src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp1669
-rw-r--r--src/Generating/Prefabs/SandFlatRoofVillagePrefabs.h15
-rw-r--r--src/Generating/Prefabs/SandVillagePrefabs.cpp2307
-rw-r--r--src/Generating/Prefabs/SandVillagePrefabs.h15
-rw-r--r--src/Generating/Prefabs/UnderwaterBasePrefabs.cpp185
-rw-r--r--src/Generating/ProtIntGen.h288
-rw-r--r--src/Generating/RainbowRoadsGen.cpp2
-rw-r--r--src/Generating/Ravines.cpp16
-rw-r--r--src/Generating/RoughRavines.cpp16
-rw-r--r--src/Generating/StructGen.cpp28
-rw-r--r--src/Generating/TestRailsGen.cpp2
-rw-r--r--src/Generating/Trees.cpp138
-rw-r--r--src/Generating/Trees.h6
-rw-r--r--src/Generating/TwoHeights.cpp2
-rw-r--r--src/Generating/UnderwaterBaseGen.cpp2
-rw-r--r--src/Generating/VillageGen.cpp174
-rw-r--r--src/Generating/VillageGen.h24
-rw-r--r--src/Globals.h35
-rw-r--r--src/HTTPServer/CMakeLists.txt5
-rw-r--r--src/HTTPServer/HTTPConnection.cpp2
-rw-r--r--src/HTTPServer/HTTPFormParser.cpp7
-rw-r--r--src/HTTPServer/HTTPServer.cpp4
-rw-r--r--src/HTTPServer/SslHTTPConnection.cpp2
-rw-r--r--src/IniFile.cpp66
-rw-r--r--src/IniFile.h56
-rw-r--r--src/Inventory.cpp29
-rw-r--r--src/Inventory.h10
-rw-r--r--src/ItemGrid.cpp2
-rw-r--r--src/Items/CMakeLists.txt4
-rw-r--r--src/Items/ItemBed.h15
-rw-r--r--src/Items/ItemBigFlower.h15
-rw-r--r--src/Items/ItemBow.h11
-rw-r--r--src/Items/ItemBucket.h20
-rw-r--r--src/Items/ItemChest.h75
-rw-r--r--src/Items/ItemDoor.h13
-rw-r--r--src/Items/ItemDye.h2
-rw-r--r--src/Items/ItemEmptyMap.h2
-rw-r--r--src/Items/ItemHandler.cpp71
-rw-r--r--src/Items/ItemHandler.h20
-rw-r--r--src/Items/ItemMobHead.h33
-rw-r--r--src/Items/ItemMushroomSoup.h2
-rw-r--r--src/Items/ItemSign.h2
-rw-r--r--src/LightingThread.cpp14
-rw-r--r--src/LightingThread.h6
-rw-r--r--src/LineBlockTracer.cpp31
-rw-r--r--src/LinearUpscale.h10
-rw-r--r--src/LoggerListeners.cpp36
-rw-r--r--src/LoggerListeners.h2
-rw-r--r--src/Map.cpp6
-rw-r--r--src/MapManager.cpp6
-rw-r--r--src/MapManager.h2
-rw-r--r--src/Matrix4.h8
-rw-r--r--src/MemorySettingsRepository.cpp312
-rw-r--r--src/MemorySettingsRepository.h80
-rw-r--r--src/MobCensus.cpp9
-rw-r--r--src/MobFamilyCollecter.cpp2
-rw-r--r--src/MobSpawner.cpp2
-rw-r--r--src/Mobs/AggressiveMonster.cpp16
-rw-r--r--src/Mobs/Blaze.cpp2
-rw-r--r--src/Mobs/CMakeLists.txt6
-rw-r--r--src/Mobs/CaveSpider.cpp4
-rw-r--r--src/Mobs/Chicken.cpp2
-rw-r--r--src/Mobs/Cow.cpp2
-rw-r--r--src/Mobs/Creeper.cpp8
-rw-r--r--src/Mobs/Enderman.cpp4
-rw-r--r--src/Mobs/Ghast.cpp2
-rw-r--r--src/Mobs/Guardian.cpp11
-rw-r--r--src/Mobs/Horse.cpp10
-rw-r--r--src/Mobs/Horse.h2
-rw-r--r--src/Mobs/Monster.cpp157
-rw-r--r--src/Mobs/Monster.h30
-rw-r--r--src/Mobs/Mooshroom.cpp2
-rw-r--r--src/Mobs/PassiveAggressiveMonster.cpp2
-rw-r--r--src/Mobs/PassiveMonster.cpp2
-rw-r--r--src/Mobs/Path.cpp260
-rw-r--r--src/Mobs/Path.h86
-rw-r--r--src/Mobs/Pig.cpp2
-rw-r--r--src/Mobs/Rabbit.cpp2
-rw-r--r--src/Mobs/Sheep.cpp6
-rw-r--r--src/Mobs/Skeleton.cpp9
-rw-r--r--src/Mobs/Slime.cpp2
-rw-r--r--src/Mobs/Spider.cpp2
-rw-r--r--src/Mobs/Squid.cpp11
-rw-r--r--src/Mobs/Witch.cpp2
-rw-r--r--src/Mobs/Wolf.cpp7
-rw-r--r--src/Mobs/Wolf.h4
-rw-r--r--src/Mobs/Zombie.cpp2
-rw-r--r--src/Mobs/ZombiePigman.cpp2
-rw-r--r--src/MonsterConfig.cpp4
-rw-r--r--src/NetherPortalScanner.cpp296
-rw-r--r--src/NetherPortalScanner.h75
-rw-r--r--src/Noise/CMakeLists.txt4
-rw-r--r--src/Noise/Noise.cpp32
-rw-r--r--src/Noise/Noise.h16
-rw-r--r--src/OSSupport/CMakeLists.txt6
-rw-r--r--src/OSSupport/Errors.cpp2
-rw-r--r--src/OSSupport/Event.cpp60
-rw-r--r--src/OSSupport/Event.h11
-rw-r--r--src/OSSupport/File.cpp30
-rw-r--r--src/OSSupport/File.h8
-rw-r--r--src/OSSupport/GZipFile.h2
-rw-r--r--src/OSSupport/IsThread.cpp4
-rw-r--r--src/OSSupport/IsThread.h15
-rw-r--r--src/OSSupport/NetworkInterfaceEnum.cpp13
-rw-r--r--src/OSSupport/Semaphore.cpp107
-rw-r--r--src/OSSupport/Semaphore.h17
-rw-r--r--src/OSSupport/ServerHandleImpl.cpp4
-rw-r--r--src/OSSupport/StackTrace.cpp9
-rw-r--r--src/OverridesSettingsRepository.cpp273
-rw-r--r--src/OverridesSettingsRepository.h52
-rw-r--r--src/PolarSSL++/BlockingSslClientSocket.cpp8
-rw-r--r--src/PolarSSL++/BlockingSslClientSocket.h5
-rw-r--r--src/PolarSSL++/BufferedSslContext.cpp6
-rw-r--r--src/PolarSSL++/CMakeLists.txt4
-rw-r--r--src/PolarSSL++/CryptoKey.cpp12
-rw-r--r--src/PolarSSL++/CtrDrbgContext.cpp2
-rw-r--r--src/PolarSSL++/SslContext.cpp4
-rw-r--r--src/PolarSSL++/SslContext.h4
-rw-r--r--src/PolarSSL++/X509Cert.cpp2
-rw-r--r--src/Protocol/Authenticator.cpp20
-rw-r--r--src/Protocol/Authenticator.h6
-rw-r--r--src/Protocol/CMakeLists.txt9
-rw-r--r--src/Protocol/ChunkDataSerializer.cpp60
-rw-r--r--src/Protocol/ChunkDataSerializer.h2
-rw-r--r--src/Protocol/MojangAPI.cpp48
-rw-r--r--src/Protocol/MojangAPI.h4
-rw-r--r--src/Protocol/Packetizer.h2
-rw-r--r--src/Protocol/Protocol.h13
-rw-r--r--src/Protocol/Protocol17x.cpp137
-rw-r--r--src/Protocol/Protocol17x.h13
-rw-r--r--src/Protocol/Protocol18x.cpp232
-rw-r--r--src/Protocol/Protocol18x.h13
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp130
-rw-r--r--src/Protocol/ProtocolRecognizer.h13
-rw-r--r--src/RCONServer.cpp8
-rw-r--r--src/RCONServer.h6
-rw-r--r--src/Root.cpp130
-rw-r--r--src/Root.h82
-rw-r--r--src/Scoreboard.cpp10
-rw-r--r--src/SelfTests.cpp71
-rw-r--r--src/SelfTests.h51
-rw-r--r--src/Server.cpp24
-rw-r--r--src/Server.h4
-rw-r--r--src/SettingsRepositoryInterface.h61
-rw-r--r--src/Simulator/CMakeLists.txt7
-rw-r--r--src/Simulator/DelayedFluidSimulator.cpp10
-rw-r--r--src/Simulator/FloodyFluidSimulator.cpp18
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp1070
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.h203
-rw-r--r--src/Simulator/SandSimulator.cpp11
-rw-r--r--src/Simulator/VanillaFluidSimulator.cpp2
-rw-r--r--src/Simulator/VaporizeFluidSimulator.cpp9
-rw-r--r--src/SpawnPrepare.cpp125
-rw-r--r--src/SpawnPrepare.h49
-rw-r--r--src/Statistics.cpp2
-rw-r--r--src/StringUtils.h10
-rw-r--r--src/Tracer.cpp2
-rw-r--r--src/UI/CMakeLists.txt6
-rw-r--r--src/UI/EnchantingWindow.cpp6
-rw-r--r--src/UI/EnderChestWindow.cpp17
-rw-r--r--src/UI/SlotArea.cpp8
-rw-r--r--src/UI/SlotArea.h2
-rw-r--r--src/UI/Window.cpp14
-rw-r--r--src/Vector3.h22
-rw-r--r--src/WebAdmin.cpp6
-rw-r--r--src/World.cpp352
-rw-r--r--src/World.h58
-rw-r--r--src/WorldStorage/CMakeLists.txt18
-rw-r--r--src/WorldStorage/EnchantmentSerializer.cpp6
-rw-r--r--src/WorldStorage/FastNBT.cpp7
-rw-r--r--src/WorldStorage/FastNBT.h60
-rw-r--r--src/WorldStorage/FireworksSerializer.cpp2
-rw-r--r--src/WorldStorage/MapSerializer.cpp12
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp33
-rw-r--r--src/WorldStorage/SchematicFileSerializer.cpp30
-rw-r--r--src/WorldStorage/StatSerializer.cpp6
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp224
-rw-r--r--src/WorldStorage/WorldStorage.cpp4
-rw-r--r--src/main.cpp264
319 files changed, 8310 insertions, 20748 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index 7c358cc84..e82f9807e 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -39,8 +39,8 @@ class cListAllocationPool : public cAllocationPool<T>
{
public:
- cListAllocationPool(std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks) :
- m_Callbacks(a_Callbacks)
+ cListAllocationPool(std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks) :
+ m_Callbacks(std::move(a_Callbacks))
{
for (size_t i = 0; i < NumElementsInReserve; i++)
{
@@ -105,7 +105,7 @@ class cListAllocationPool : public cAllocationPool<T>
private:
std::list<void *> m_FreeList;
- std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
+ std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
};
diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua
index f86be6c6d..a398f5026 100644
--- a/src/Bindings/BindingsProcessor.lua
+++ b/src/Bindings/BindingsProcessor.lua
@@ -98,10 +98,12 @@ local function OutputLuaStateHelpers(a_Package)
f:write("// This file expects to be included form inside the cLuaState class definition\n")
f:write("\n\n\n\n\n")
for _, item in ipairs(types) do
- f:write("void Push(" .. item.name .. " * a_Value);\n")
+ if not(g_HasCustomPushImplementation[item.name]) then
+ f:write("void Push(" .. item.name .. " * a_Value);\n")
+ end
end
for _, item in ipairs(types) do
- f:write("void GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal);\n")
+ f:write("bool GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal);\n")
end
f:write("\n\n\n\n\n")
f:close()
@@ -125,15 +127,17 @@ local function OutputLuaStateHelpers(a_Package)
end
end
for _, item in ipairs(types) do
- f:write("void cLuaState::GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal)\n{\n\tASSERT(IsValid());\n")
+ f:write("bool cLuaState::GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal)\n{\n\tASSERT(IsValid());\n")
f:write("\tif (lua_isnil(m_LuaState, a_StackPos))\n\t{\n")
- f:write("\t a_ReturnedVal = nullptr;\n")
- f:write("\t return;\n\t}\n")
+ f:write("\t\ta_ReturnedVal = nullptr;\n")
+ f:write("\t\treturn false;\n\t}\n")
f:write("\ttolua_Error err;\n")
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"" .. item.name .. "\", false, &err))\n")
f:write("\t{\n")
- f:write("\t a_ReturnedVal = *(reinterpret_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
+ f:write("\t\ta_ReturnedVal = *(reinterpret_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
+ f:write("\t\treturn true;\n");
f:write("\t}\n")
+ f:write("\treturn false;\n")
f:write("}\n\n\n\n\n\n")
end
f:close()
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
index 133c2224d..0a069ad85 100644
--- a/src/Bindings/CMakeLists.txt
+++ b/src/Bindings/CMakeLists.txt
@@ -145,6 +145,15 @@ set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE)
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS -Wno-error)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(DeprecatedBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(LuaState.cpp COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(LuaWindow.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+ set_source_files_properties(ManualBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(ManualBindings_World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(PluginLua.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Bindings ${SRCS} ${HDRS})
diff --git a/src/Bindings/LuaChunkStay.cpp b/src/Bindings/LuaChunkStay.cpp
index e50ffb75b..1afd09d11 100644
--- a/src/Bindings/LuaChunkStay.cpp
+++ b/src/Bindings/LuaChunkStay.cpp
@@ -41,7 +41,7 @@ bool cLuaChunkStay::AddChunks(int a_ChunkCoordTableStackPos)
// Add each set of coords:
int NumChunks = luaL_getn(L, a_ChunkCoordTableStackPos);
- m_Chunks.reserve((size_t)NumChunks);
+ m_Chunks.reserve(static_cast<size_t>(NumChunks));
for (int idx = 1; idx <= NumChunks; idx++)
{
// Push the idx-th element of the array onto stack top, check that it's a table:
@@ -133,7 +133,7 @@ void cLuaChunkStay::OnChunkAvailable(int a_ChunkX, int a_ChunkZ)
if (m_OnChunkAvailable.IsValid())
{
cPluginLua::cOperation Op(m_Plugin);
- Op().Call((int)m_OnChunkAvailable, a_ChunkX, a_ChunkZ);
+ Op().Call(static_cast<int>(m_OnChunkAvailable), a_ChunkX, a_ChunkZ);
}
}
@@ -147,7 +147,7 @@ bool cLuaChunkStay::OnAllChunksAvailable(void)
{
// Call the callback:
cPluginLua::cOperation Op(m_Plugin);
- Op().Call((int)m_OnAllChunksAvailable);
+ Op().Call(static_cast<int>(m_OnAllChunksAvailable));
// Remove the callback references - they won't be needed anymore
m_OnChunkAvailable.UnRef();
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index ccf812417..a0fdecb8b 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -211,23 +211,31 @@ void cLuaState::AddPackagePath(const AString & a_PathVariable, const AString & a
-bool cLuaState::LoadFile(const AString & a_FileName)
+bool cLuaState::LoadFile(const AString & a_FileName, bool a_LogWarnings)
{
ASSERT(IsValid());
// Load the file:
int s = luaL_loadfile(m_LuaState, a_FileName.c_str());
- if (ReportErrors(s))
+ if (s != 0)
{
- LOGWARNING("Can't load %s because of an error in file %s", m_SubsystemName.c_str(), a_FileName.c_str());
+ if (a_LogWarnings)
+ {
+ LOGWARNING("Can't load %s because of a load error in file %s: %d (%s)", m_SubsystemName.c_str(), a_FileName.c_str(), s, lua_tostring(m_LuaState, -1));
+ }
+ lua_pop(m_LuaState, 1);
return false;
}
// Execute the globals:
s = lua_pcall(m_LuaState, 0, LUA_MULTRET, 0);
- if (ReportErrors(s))
+ if (s != 0)
{
- LOGWARNING("Error in %s in file %s", m_SubsystemName.c_str(), a_FileName.c_str());
+ if (a_LogWarnings)
+ {
+ LOGWARNING("Can't load %s because of an initialization error in file %s: %d (%s)", m_SubsystemName.c_str(), a_FileName.c_str(), s, lua_tostring(m_LuaState, -1));
+ }
+ lua_pop(m_LuaState, 1);
return false;
}
@@ -446,6 +454,18 @@ void cLuaState::Push(const cPlayer * a_Player)
+void cLuaState::Push(const cLuaState::cRef & a_Ref)
+{
+ ASSERT(IsValid());
+
+ lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, static_cast<int>(a_Ref));
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
void cLuaState::Push(const HTTPRequest * a_Request)
{
ASSERT(IsValid());
@@ -701,108 +721,142 @@ void cLuaState::PushUserType(void * a_Object, const char * a_Type)
-void cLuaState::GetStackValue(int a_StackPos, AString & a_Value)
+bool cLuaState::GetStackValue(int a_StackPos, AString & a_Value)
{
size_t len = 0;
const char * data = lua_tolstring(m_LuaState, a_StackPos, &len);
if (data != nullptr)
{
a_Value.assign(data, len);
+ return true;
}
+ return false;
}
-void cLuaState::GetStackValue(int a_StackPos, BLOCKTYPE & a_ReturnedVal)
-{
- if (lua_isnumber(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = static_cast<BLOCKTYPE>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, bool & a_ReturnedVal)
+bool cLuaState::GetStackValue(int a_StackPos, bool & a_ReturnedVal)
{
a_ReturnedVal = (tolua_toboolean(m_LuaState, a_StackPos, a_ReturnedVal ? 1 : 0) > 0);
+ return true;
}
-void cLuaState::GetStackValue(int a_StackPos, cPluginManager::CommandResult & a_Result)
+bool cLuaState::GetStackValue(int a_StackPos, cPluginManager::CommandResult & a_Result)
{
if (lua_isnumber(m_LuaState, a_StackPos))
{
a_Result = static_cast<cPluginManager::CommandResult>(static_cast<int>((tolua_tonumber(m_LuaState, a_StackPos, a_Result))));
+ return true;
}
+ return false;
}
-void cLuaState::GetStackValue(int a_StackPos, cRef & a_Ref)
+bool cLuaState::GetStackValue(int a_StackPos, cRef & a_Ref)
{
a_Ref.RefStack(*this, a_StackPos);
+ return true;
}
-void cLuaState::GetStackValue(int a_StackPos, double & a_ReturnedVal)
+bool cLuaState::GetStackValue(int a_StackPos, double & a_ReturnedVal)
{
if (lua_isnumber(m_LuaState, a_StackPos))
{
a_ReturnedVal = tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal);
+ return true;
}
+ return false;
}
-void cLuaState::GetStackValue(int a_StackPos, float & a_ReturnedVal)
+bool cLuaState::GetStackValue(int a_StackPos, eBlockFace & a_ReturnedVal)
{
- if (lua_isnumber(m_LuaState, a_StackPos))
+ if (!lua_isnumber(m_LuaState, a_StackPos))
{
- a_ReturnedVal = static_cast<float>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal));
+ return false;
}
+ a_ReturnedVal = static_cast<eBlockFace>(Clamp(
+ static_cast<int>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal)),
+ static_cast<int>(BLOCK_FACE_MIN), static_cast<int>(BLOCK_FACE_MAX))
+ );
+ return true;
}
-void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal)
+bool cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal)
{
if (!lua_isnumber(m_LuaState, a_StackPos))
{
- return;
+ return false;
}
a_ReturnedVal = static_cast<eWeather>(Clamp(
static_cast<int>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal)),
static_cast<int>(wSunny), static_cast<int>(wThunderstorm))
);
+ return true;
}
-void cLuaState::GetStackValue(int a_StackPos, int & a_ReturnedVal)
+bool cLuaState::GetStackValue(int a_StackPos, float & a_ReturnedVal)
{
if (lua_isnumber(m_LuaState, a_StackPos))
{
- a_ReturnedVal = static_cast<int>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal));
+ a_ReturnedVal = static_cast<float>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal));
+ return true;
}
+ return false;
+}
+
+
+
+
+
+cLuaState::cStackValue cLuaState::WalkToValue(const AString & a_Name)
+{
+ // There needs to be at least one value on the stack:
+ ASSERT(lua_gettop(m_LuaState) > 0);
+
+ // Iterate over path and replace the top of the stack with the walked element
+ lua_pushvalue(m_LuaState, -1); // Copy the stack value into the "working area"
+ auto path = StringSplit(a_Name, ".");
+ for (const auto & elem: path)
+ {
+ // If the value is not a table, bail out (error):
+ if (!lua_istable(m_LuaState, -1))
+ {
+ lua_pop(m_LuaState, 1);
+ return cStackValue();
+ }
+
+ // Get the next part of the path:
+ lua_getfield(m_LuaState, -1, elem.c_str());
+
+ // Remove the previous value from the stack (keep only the new one):
+ lua_remove(m_LuaState, -2);
+ } // for elem - path[]
+ return std::move(cStackValue(*this));
}
@@ -927,6 +981,9 @@ bool cLuaState::CheckParamTable(int a_StartParam, int a_EndParam)
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != nullptr) ? entry.name : "?");
+
+ BreakIntoDebugger(m_LuaState);
+
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
} // for i - Param
@@ -1366,6 +1423,7 @@ int cLuaState::ReportFnCallErrors(lua_State * a_LuaState)
{
LOGWARNING("LUA: %s", lua_tostring(a_LuaState, -1));
LogStackTrace(a_LuaState, 1);
+ BreakIntoDebugger(a_LuaState);
return 1; // We left the error message on the stack as the return value
}
@@ -1373,6 +1431,28 @@ int cLuaState::ReportFnCallErrors(lua_State * a_LuaState)
+int cLuaState::BreakIntoDebugger(lua_State * a_LuaState)
+{
+ // Call the BreakIntoDebugger function, if available:
+ lua_getglobal(a_LuaState, "BreakIntoDebugger");
+ if (!lua_isfunction(a_LuaState, -1))
+ {
+ LOGD("LUA: BreakIntoDebugger() not found / not a function");
+ lua_pop(a_LuaState, 1);
+ return 1;
+ }
+ lua_insert(a_LuaState, -2); // Copy the string that has been passed to us
+ LOGD("Calling BreakIntoDebugger()...");
+ lua_call(a_LuaState, 1, 0);
+ LOGD("Returned from BreakIntoDebugger().");
+
+ return 0;
+}
+
+
+
+
+
////////////////////////////////////////////////////////////////////////////////
// cLuaState::cRef:
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index b38401fd8..cc8214646 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -78,11 +78,14 @@ public:
bool IsValid(void) const {return (m_Ref != LUA_REFNIL); }
/** Allows to use this class wherever an int (i. e. ref) is to be used */
- operator int(void) const { return m_Ref; }
-
+ explicit operator int(void) const { return m_Ref; }
+
protected:
cLuaState * m_LuaState;
int m_Ref;
+
+ // Remove the copy-constructor:
+ cRef(const cRef &) = delete;
} ;
@@ -98,6 +101,12 @@ public:
{
}
+ cTableRef(const cRef & a_TableRef, const char * a_FnName) :
+ m_TableRef(static_cast<int>(a_TableRef)),
+ m_FnName(a_FnName)
+ {
+ }
+
int GetTableRef(void) const { return m_TableRef; }
const char * GetFnName(void) const { return m_FnName; }
} ;
@@ -111,6 +120,61 @@ public:
static const cRet Return; // Use this constant to delimit function args from return values for cLuaState::Call()
+ /** A RAII class for values pushed onto the Lua stack.
+ Will pop the value off the stack in the destructor. */
+ class cStackValue
+ {
+ public:
+ cStackValue(void):
+ m_LuaState(nullptr)
+ {
+ }
+
+ cStackValue(cLuaState & a_LuaState):
+ m_LuaState(a_LuaState)
+ {
+ m_StackLen = lua_gettop(a_LuaState);
+ }
+
+ cStackValue(cStackValue && a_Src):
+ m_LuaState(nullptr),
+ m_StackLen(-1)
+ {
+ std::swap(m_LuaState, a_Src.m_LuaState);
+ std::swap(m_StackLen, a_Src.m_StackLen);
+ }
+
+ ~cStackValue()
+ {
+ if (m_LuaState != nullptr)
+ {
+ auto top = lua_gettop(m_LuaState);
+ ASSERT(m_StackLen == top);
+ lua_pop(m_LuaState, 1);
+ }
+ }
+
+ void Set(cLuaState & a_LuaState)
+ {
+ m_LuaState = a_LuaState;
+ m_StackLen = lua_gettop(a_LuaState);
+ }
+
+ bool IsValid(void) const
+ {
+ return (m_LuaState != nullptr);
+ }
+
+ protected:
+ lua_State * m_LuaState;
+
+ int m_StackLen;
+
+ // Remove the copy-constructor:
+ cStackValue(const cStackValue &) = delete;
+ };
+
+
/** Creates a new instance. The LuaState is not initialized.
a_SubsystemName is used for reporting problems in the console, it is "plugin %s" for plugins,
or "LuaScript" for the cLuaScript template
@@ -151,10 +215,9 @@ public:
void AddPackagePath(const AString & a_PathVariable, const AString & a_Path);
/** Loads the specified file
- Returns false and logs a warning to the console if not successful (but the LuaState is kept open).
- m_SubsystemName is displayed in the warning log message.
- */
- bool LoadFile(const AString & a_FileName);
+ Returns false and optionally logs a warning to the console if not successful (but the LuaState is kept open).
+ m_SubsystemName is displayed in the warning log message. */
+ bool LoadFile(const AString & a_FileName, bool a_LogWarnings = true);
/** Returns true if a_FunctionName is a valid Lua function that can be called */
bool HasFunction(const char * a_FunctionName);
@@ -169,6 +232,7 @@ public:
void Push(const char * a_Value);
void Push(const cItems & a_Items);
void Push(const cPlayer * a_Player);
+ void Push(const cRef & a_Ref);
void Push(const HTTPRequest * a_Request);
void Push(const HTTPTemplateRequest * a_Request);
void Push(const Vector3d & a_Vector);
@@ -178,25 +242,80 @@ public:
// Push a simple value onto the stack (keep alpha-sorted):
void Push(bool a_Value);
+ void Push(cEntity * a_Entity);
+ void Push(cLuaServerHandle * a_ServerHandle);
+ void Push(cLuaTCPLink * a_TCPLink);
+ void Push(cLuaUDPEndpoint * a_UDPEndpoint);
void Push(double a_Value);
void Push(int a_Value);
void Push(void * a_Ptr);
void Push(std::chrono::milliseconds a_time);
- void Push(cLuaServerHandle * a_ServerHandle);
- void Push(cLuaTCPLink * a_TCPLink);
- void Push(cLuaUDPEndpoint * a_UDPEndpoint);
// GetStackValue() retrieves the value at a_StackPos, if it is a valid type. If not, a_Value is unchanged.
- // Enum values are clamped to their allowed range.
- void GetStackValue(int a_StackPos, AString & a_Value);
- void GetStackValue(int a_StackPos, BLOCKTYPE & a_Value);
- void GetStackValue(int a_StackPos, bool & a_Value);
- void GetStackValue(int a_StackPos, cPluginManager::CommandResult & a_Result);
- void GetStackValue(int a_StackPos, cRef & a_Ref);
- void GetStackValue(int a_StackPos, double & a_Value);
- void GetStackValue(int a_StackPos, eWeather & a_Value);
- void GetStackValue(int a_StackPos, float & a_ReturnedVal);
- void GetStackValue(int a_StackPos, int & a_Value);
+ // Returns whether value was changed
+ // Enum values are checked for their allowed values and fail if the value is not assigned.
+ bool GetStackValue(int a_StackPos, AString & a_Value);
+ bool GetStackValue(int a_StackPos, bool & a_Value);
+ bool GetStackValue(int a_StackPos, cPluginManager::CommandResult & a_Result);
+ bool GetStackValue(int a_StackPos, cRef & a_Ref);
+ bool GetStackValue(int a_StackPos, double & a_Value);
+ bool GetStackValue(int a_StackPos, eBlockFace & a_Value);
+ bool GetStackValue(int a_StackPos, eWeather & a_Value);
+ bool GetStackValue(int a_StackPos, float & a_ReturnedVal);
+
+ // template to catch all of the various c++ integral types without overload conflicts
+ template <class T>
+ bool GetStackValue(int a_StackPos, T & a_ReturnedVal, typename std::enable_if<std::is_integral<T>::value>::type * unused = nullptr)
+ {
+ UNUSED(unused);
+ if (!lua_isnumber(m_LuaState, a_StackPos)) // Also accepts strings representing a number: http://pgl.yoyo.org/luai/i/lua_isnumber
+ {
+ return false;
+ }
+ lua_Number Val = lua_tonumber(m_LuaState, a_StackPos);
+ if (Val > std::numeric_limits<T>::max())
+ {
+ return false;
+ }
+ if (Val < std::numeric_limits<T>::min())
+ {
+ return false;
+ }
+ a_ReturnedVal = static_cast<T>(Val);
+ return true;
+ }
+
+ /** Pushes the named value in the table at the top of the stack.
+ a_Name may be a path containing multiple table levels, such as "_G.cChatColor.Blue".
+ If the value is found, it is pushed on top of the stack and the returned cStackValue is valid.
+ If the value is not found, the stack is unchanged and the returned cStackValue is invalid. */
+ cStackValue WalkToValue(const AString & a_Name);
+
+ /** Retrieves the named value in the table at the top of the Lua stack.
+ a_Name may be a path containing multiple table levels, such as "_G.cChatColor.Blue".
+ Returns true if the value was successfully retrieved, false on error. */
+ template <typename T> bool GetNamedValue(const AString & a_Name, T & a_Value)
+ {
+ auto stk = WalkToValue(a_Name);
+ if (!stk.IsValid())
+ {
+ // Name not found
+ return false;
+ }
+ return GetStackValue(-1, a_Value);
+ }
+
+ /** Retrieves the named global value. a_Name may be a path containing multiple table levels, such as "_G.cChatColor.Blue".
+ Returns true if the value was successfully retrieved, false on error. */
+ template <typename T> bool GetNamedGlobal(const AString & a_Name, T & a_Value)
+ {
+ // Push the globals table onto the stack and make it RAII-removed:
+ lua_getglobal(m_LuaState, "_G");
+ cStackValue stk(*this);
+
+ // Get the named global:
+ return GetNamedValue(a_Name, a_Value);
+ }
// Include the auto-generated Push and GetStackValue() functions:
#include "LuaState_Declaration.inc"
@@ -208,20 +327,23 @@ public:
template <typename FnT, typename... Args>
bool Call(const FnT & a_Function, Args &&... args)
{
- if (!PushFunction(a_Function))
+ if (!PushFunction(std::forward<const FnT &>(a_Function)))
{
// Pushing the function failed
return false;
}
- return PushCallPop(args...);
+ return PushCallPop(std::forward<Args>(args)...);
}
/** Retrieves a list of values from the Lua stack, starting at the specified index. */
template <typename T, typename... Args>
- inline void GetStackValues(int a_StartStackPos, T & a_Ret, Args &&... args)
+ inline bool GetStackValues(int a_StartStackPos, T & a_Ret, Args &&... args)
{
- GetStackValue(a_StartStackPos, a_Ret);
- GetStackValues(a_StartStackPos + 1, args...);
+ if (!GetStackValue(a_StartStackPos, a_Ret))
+ {
+ return false;
+ }
+ return GetStackValues(a_StartStackPos + 1, args...);
}
/** Returns true if the specified parameters on the stack are of the specified usertable type; also logs warning if not. Used for static functions */
@@ -319,10 +441,10 @@ protected:
/** Variadic template recursor: More params to push. Push them and recurse. */
template <typename T, typename... Args>
- inline bool PushCallPop(T a_Param, Args &&... args)
+ inline bool PushCallPop(T && a_Param, Args &&... args)
{
- Push(a_Param);
- return PushCallPop(args...);
+ Push(std::forward<T>(a_Param));
+ return PushCallPop(std::forward<Args>(args)...);
}
/** Variadic template terminator: If there's nothing more to push, but return values to collect, call the function and collect the returns. */
@@ -339,7 +461,7 @@ protected:
}
// Collect the return values:
- GetStackValues(-NumReturns, args...);
+ GetStackValues(-NumReturns, std::forward<Args>(args)...);
lua_pop(m_LuaState, NumReturns);
// All successful:
@@ -349,9 +471,9 @@ protected:
/** Variadic template terminator: If there are no more values to get, bail out.
This function is not available in the public API, because it's an error to request no values directly; only internal functions can do that.
If you get a compile error saying this function is not accessible, check your calling code, you aren't reading any stack values. */
- void GetStackValues(int a_StartingStackPos)
+ bool GetStackValues(int a_StartingStackPos)
{
- // Do nothing
+ return true;
}
/** Pushes the function of the specified name onto the stack.
@@ -369,7 +491,7 @@ protected:
*/
bool PushFunction(const cRef & a_FnRef)
{
- return PushFunction((int)a_FnRef);
+ return PushFunction(static_cast<int>(a_FnRef));
}
/** Pushes a function that is stored in a referenced table by name
@@ -389,6 +511,9 @@ protected:
/** Used as the error reporting function for function calls */
static int ReportFnCallErrors(lua_State * a_LuaState);
+
+ /** Tries to break into the MobDebug debugger, if it is installed. */
+ static int BreakIntoDebugger(lua_State * a_LuaState);
} ;
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index ff904d74a..7655d8c83 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -34,6 +34,7 @@
#include "../CompositeChat.h"
#include "../StringCompression.h"
#include "../CommandOutput.h"
+#include "../BuildInfo.h"
@@ -158,7 +159,7 @@ static int tolua_UncompressStringZLIB(lua_State * tolua_S)
// Get the params:
AString ToUncompress;
- int UncompressedSize;
+ size_t UncompressedSize;
S.GetStackValues(1, ToUncompress, UncompressedSize);
// Compress the string:
@@ -1801,7 +1802,7 @@ static int tolua_cMojangAPI_GetUUIDsFromPlayerNames(lua_State * L)
// Convert the input table into AStringVector:
AStringVector PlayerNames;
int NumNames = luaL_getn(L, 2);
- PlayerNames.reserve(NumNames);
+ PlayerNames.reserve(static_cast<size_t>(NumNames));
for (int i = 1; i <= NumNames; i++)
{
lua_rawgeti(L, 2, i);
@@ -2079,6 +2080,50 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S)
+static int tolua_cRoot_GetBuildCommitID(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ L.Push(BUILD_COMMIT_ID);
+ return 1;
+}
+
+
+
+
+
+static int tolua_cRoot_GetBuildDateTime(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ L.Push(BUILD_DATETIME);
+ return 1;
+}
+
+
+
+
+
+static int tolua_cRoot_GetBuildID(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ L.Push(BUILD_ID);
+ return 1;
+}
+
+
+
+
+
+static int tolua_cRoot_GetBuildSeriesName(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ L.Push(BUILD_SERIES_NAME);
+ return 1;
+}
+
+
+
+
+
static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
{
cLuaState L(tolua_S);
@@ -2092,7 +2137,8 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
}
// Check the input param:
- cItem * Input = (cItem *)tolua_tousertype(L, 2, nullptr);
+ cItem * Input = nullptr;
+ L.GetStackValue(2, Input);
if (Input == nullptr)
{
LOGWARNING("cRoot:GetFurnaceRecipe: the Input parameter is nil or missing.");
@@ -2109,9 +2155,9 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
}
// Push the output, number of ticks and input as the three return values:
- tolua_pushusertype(L, Recipe->Out, "const cItem");
- tolua_pushnumber (L, (lua_Number)(Recipe->CookTime));
- tolua_pushusertype(L, Recipe->In, "const cItem");
+ L.Push(Recipe->Out);
+ L.Push(Recipe->CookTime);
+ L.Push(Recipe->In);
return 3;
}
@@ -2868,6 +2914,10 @@ void cManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "DoWithPlayerByUUID", DoWith <cRoot, cPlayer, &cRoot::DoWithPlayerByUUID>);
tolua_function(tolua_S, "ForEachPlayer", ForEach<cRoot, cPlayer, &cRoot::ForEachPlayer>);
tolua_function(tolua_S, "ForEachWorld", ForEach<cRoot, cWorld, &cRoot::ForEachWorld>);
+ tolua_function(tolua_S, "GetBuildCommitID", tolua_cRoot_GetBuildCommitID);
+ tolua_function(tolua_S, "GetBuildDateTime", tolua_cRoot_GetBuildDateTime);
+ tolua_function(tolua_S, "GetBuildID", tolua_cRoot_GetBuildID);
+ tolua_function(tolua_S, "GetBuildSeriesName", tolua_cRoot_GetBuildSeriesName);
tolua_function(tolua_S, "GetFurnaceRecipe", tolua_cRoot_GetFurnaceRecipe);
tolua_endmodule(tolua_S);
diff --git a/src/Bindings/ManualBindings.h b/src/Bindings/ManualBindings.h
index e7a576588..f8c9b96de 100644
--- a/src/Bindings/ManualBindings.h
+++ b/src/Bindings/ManualBindings.h
@@ -199,7 +199,7 @@ public:
// Get parameters:
Ty1 * Self = nullptr;
- int ItemID;
+ UInt32 ItemID;
cLuaState::cRef FnRef;
L.GetStackValues(1, Self, ItemID, FnRef);
if (Self == nullptr)
@@ -253,8 +253,9 @@ public:
// Check params:
cLuaState L(tolua_S);
if (
- !L.CheckParamNumber(2, 5) ||
- !L.CheckParamFunction(6)
+ !L.CheckParamNumber(2, 4) ||
+ !L.CheckParamFunction(5) ||
+ !L.CheckParamEnd(6)
)
{
return 0;
@@ -316,8 +317,9 @@ public:
// Check params:
cLuaState L(tolua_S);
if (
- !L.CheckParamNumber(2, 4) ||
- !L.CheckParamFunction(5)
+ !L.CheckParamNumber(2, 3) ||
+ !L.CheckParamFunction(4) ||
+ !L.CheckParamEnd(5)
)
{
return 0;
diff --git a/src/Bindings/ManualBindings_Network.cpp b/src/Bindings/ManualBindings_Network.cpp
index df97d60b3..b5fb5b046 100644
--- a/src/Bindings/ManualBindings_Network.cpp
+++ b/src/Bindings/ManualBindings_Network.cpp
@@ -101,13 +101,12 @@ static int tolua_cNetwork_CreateUDPEndpoint(lua_State * L)
}
// Read the params:
- int Port;
- S.GetStackValues(2, Port);
+ UInt16 Port;
// Check validity:
- if ((Port < 0) || (Port > 65535))
+ if (!S.GetStackValues(2, Port))
{
- LOGWARNING("cNetwork:CreateUDPEndpoint() called with invalid port (%d), failing the request.", Port);
+ LOGWARNING("cNetwork:CreateUDPEndpoint() called with invalid port, failing the request.");
S.Push(false);
return 1;
}
diff --git a/src/Bindings/ManualBindings_World.cpp b/src/Bindings/ManualBindings_World.cpp
index 3ee5ca498..d9590de33 100644
--- a/src/Bindings/ManualBindings_World.cpp
+++ b/src/Bindings/ManualBindings_World.cpp
@@ -50,7 +50,7 @@ static int tolua_cWorld_BroadcastParticleEffect(lua_State * tolua_S)
std::array<int, 2> data;
for (int i = 0; (i < 2) && L.IsParamNumber(11 + i); i++)
{
- L.GetStackValue(11 + i, data[i]);
+ L.GetStackValue(11 + i, data[static_cast<size_t>(i)]);
}
World->GetBroadcaster().BroadcastParticleEffect(Name, Vector3f(PosX, PosY, PosZ), Vector3f(OffX, OffY, OffZ), ParticleData, ParticleAmmount, ExcludeClient);
@@ -303,10 +303,9 @@ static int tolua_cWorld_PrepareChunk(lua_State * tolua_S)
cLuaState m_LuaState;
cLuaState::cRef m_Callback;
};
- cCallback * callback = new cCallback(tolua_S);
// Call the chunk preparation:
- world->PrepareChunk(chunkX, chunkZ, callback);
+ world->PrepareChunk(chunkX, chunkZ, cpp14::make_unique<cCallback>(tolua_S));
return 0;
}
@@ -491,7 +490,7 @@ static int tolua_cWorld_ScheduleTask(lua_State * tolua_S)
auto task = std::make_shared<cLuaScheduledWorldTask>(*Plugin, FnRef);
Plugin->AddResettable(task);
- World->ScheduleTask(DelayTicks, task);
+ World->ScheduleTask(DelayTicks, static_cast<cWorld::cTaskPtr>(task));
return 0;
}
@@ -530,7 +529,7 @@ static int tolua_cWorld_TryGetHeight(lua_State * tolua_S)
// Call the implementation:
int Height = 0;
bool res = self->TryGetHeight(BlockX, BlockZ, Height);
- L.Push(res ? 1 : 0);
+ L.Push(res);
if (res)
{
L.Push(Height);
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h
index d0c2bcefa..2fdf73a65 100644
--- a/src/Bindings/Plugin.h
+++ b/src/Bindings/Plugin.h
@@ -56,12 +56,15 @@ public:
virtual bool OnDisconnect (cClientHandle & a_Client, const AString & a_Reason) = 0;
virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) = 0;
virtual bool OnEntityTeleport (cEntity & a_Entity, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) = 0;
+ virtual bool OnEntityChangingWorld (cEntity & a_Entity, cWorld & a_World) = 0;
+ virtual bool OnEntityChangedWorld (cEntity & a_Entity, cWorld & a_World) = 0;
virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split, const AString & a_EntireCommand, cPluginManager::CommandResult & a_Result) = 0;
virtual bool OnExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) = 0;
virtual bool OnExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) = 0;
virtual bool OnHandshake (cClientHandle & a_Client, const AString & a_Username) = 0;
virtual bool OnHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) = 0;
virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) = 0;
+ virtual bool OnKilled (cEntity & a_Victim, TakeDamageInfo & a_TDI, AString & a_DeathMessage) = 0;
virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI) = 0;
virtual bool OnLogin (cClientHandle & a_Client, int a_ProtocolVersion, const AString & a_Username) = 0;
virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0;
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 76d3557a4..9be4e0eb4 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -534,6 +534,54 @@ bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_E
+bool cPluginLua::OnEntityChangingWorld(cEntity & a_Entity, cWorld & a_World)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!m_LuaState.IsValid())
+ {
+ return false;
+ }
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_CHANGING_WORLD];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Entity, &a_World, cLuaState::Return, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
+bool cPluginLua::OnEntityChangedWorld(cEntity & a_Entity, cWorld & a_World)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!m_LuaState.IsValid())
+ {
+ return false;
+ }
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_CHANGED_WORLD];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Entity, &a_World, res);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split, const AString & a_EntireCommand, cPluginManager::CommandResult & a_Result)
{
cCSLock Lock(m_CriticalSection);
@@ -581,11 +629,6 @@ bool cPluginLua::OnExploded(cWorld & a_World, double a_ExplosionSize, bool a_Can
case esWitherSkullBlue: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break;
case esWitherBirth: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break;
case esPlugin: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break;
- default:
- {
- ASSERT(!"Unhandled ExplosionSource");
- return false;
- }
}
if (res)
{
@@ -622,11 +665,6 @@ bool cPluginLua::OnExploding(cWorld & a_World, double & a_ExplosionSize, bool &
case esWitherSkullBlue: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esWitherBirth: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esPlugin: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- default:
- {
- ASSERT(!"Unhandled ExplosionSource");
- return false;
- }
}
if (res)
{
@@ -712,6 +750,30 @@ bool cPluginLua::OnHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper,
+bool cPluginLua::OnKilled(cEntity & a_Victim, TakeDamageInfo & a_TDI, AString & a_DeathMessage)
+{
+ cCSLock Lock(m_CriticalSection);
+ if (!m_LuaState.IsValid())
+ {
+ return false;
+ }
+ bool res = false;
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_KILLED];
+ for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
+ {
+ m_LuaState.Call((int)(**itr), &a_Victim, &a_TDI, a_DeathMessage, cLuaState::Return, res, a_DeathMessage);
+ if (res)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginLua::OnKilling(cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI)
{
cCSLock Lock(m_CriticalSection);
@@ -1884,6 +1946,8 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect";
case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation";
case cPluginManager::HOOK_ENTITY_ADD_EFFECT: return "OnEntityAddEffect";
+ case cPluginManager::HOOK_ENTITY_CHANGING_WORLD: return "OnEntityChangingWorld";
+ case cPluginManager::HOOK_ENTITY_CHANGED_WORLD: return "OnEntityChangedWorld";
case cPluginManager::HOOK_ENTITY_TELEPORT: return "OnEntityTeleport";
case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand";
case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake";
diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h
index 524c249b0..7de70ef1f 100644
--- a/src/Bindings/PluginLua.h
+++ b/src/Bindings/PluginLua.h
@@ -115,12 +115,15 @@ public:
virtual bool OnCraftingNoRecipe (cPlayer & a_Player, cCraftingGrid & a_Grid, cCraftingRecipe & a_Recipe) override;
virtual bool OnDisconnect (cClientHandle & a_Client, const AString & a_Reason) override;
virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) override;
+ virtual bool OnEntityChangingWorld (cEntity & a_Entity, cWorld & a_World) override;
+ virtual bool OnEntityChangedWorld (cEntity & a_Entity, cWorld & a_World) override;
virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split, const AString & a_EntireCommand, cPluginManager::CommandResult & a_Result) override;
virtual bool OnExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) override;
virtual bool OnExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) override;
virtual bool OnHandshake (cClientHandle & a_Client, const AString & a_Username) override;
virtual bool OnHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) override;
virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override;
+ virtual bool OnKilled (cEntity & a_Victim, TakeDamageInfo & a_TDI, AString & a_DeathMessage) override;
virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI) override;
virtual bool OnLogin (cClientHandle & a_Client, int a_ProtocolVersion, const AString & a_Username) override;
virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override;
@@ -177,7 +180,7 @@ public:
bool CanAddOldStyleHook(int a_HookType);
// cWebPlugin overrides
- virtual const AString GetWebTitle(void) const {return GetName(); }
+ virtual const AString GetWebTitle(void) const override {return GetName(); }
virtual AString HandleWebRequest(const HTTPRequest & a_Request) override;
/** Adds a new web tab to webadmin.
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index db2493955..712c385c7 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -118,7 +118,7 @@ void cPluginManager::ReloadPluginsNow(void)
-void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
+void cPluginManager::ReloadPluginsNow(cSettingsRepositoryInterface & a_Settings)
{
LOG("-- Loading Plugins --");
@@ -130,7 +130,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
RefreshPluginList();
// Load the plugins:
- AStringVector ToLoad = GetFoldersToLoad(a_SettingsIni);
+ AStringVector ToLoad = GetFoldersToLoad(a_Settings);
for (auto & pluginFolder: ToLoad)
{
LoadPlugin(pluginFolder);
@@ -157,16 +157,16 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
-void cPluginManager::InsertDefaultPlugins(cIniFile & a_SettingsIni)
+void cPluginManager::InsertDefaultPlugins(cSettingsRepositoryInterface & a_Settings)
{
- a_SettingsIni.AddKeyName("Plugins");
- a_SettingsIni.AddKeyComment("Plugins", " Plugin=Debuggers");
- a_SettingsIni.AddKeyComment("Plugins", " Plugin=HookNotify");
- a_SettingsIni.AddKeyComment("Plugins", " Plugin=ChunkWorx");
- a_SettingsIni.AddKeyComment("Plugins", " Plugin=APIDump");
- a_SettingsIni.AddValue("Plugins", "Plugin", "Core");
- a_SettingsIni.AddValue("Plugins", "Plugin", "TransAPI");
- a_SettingsIni.AddValue("Plugins", "Plugin", "ChatLog");
+ a_Settings.AddKeyName("Plugins");
+ a_Settings.AddKeyComment("Plugins", " Plugin=Debuggers");
+ a_Settings.AddKeyComment("Plugins", " Plugin=HookNotify");
+ a_Settings.AddKeyComment("Plugins", " Plugin=ChunkWorx");
+ a_Settings.AddKeyComment("Plugins", " Plugin=APIDump");
+ a_Settings.AddValue("Plugins", "Plugin", "Core");
+ a_Settings.AddValue("Plugins", "Plugin", "TransAPI");
+ a_Settings.AddValue("Plugins", "Plugin", "ChatLog");
}
@@ -525,6 +525,42 @@ bool cPluginManager::CallHookEntityTeleport(cEntity & a_Entity, const Vector3d &
+bool cPluginManager::CallHookEntityChangingWorld(cEntity & a_Entity, cWorld & a_World)
+{
+ FIND_HOOK(HOOK_ENTITY_CHANGING_WORLD);
+ VERIFY_HOOK;
+
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnEntityChangingWorld(a_Entity, a_World))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+bool cPluginManager::CallHookEntityChangedWorld(cEntity & a_Entity, cWorld & a_World)
+{
+ FIND_HOOK(HOOK_ENTITY_CHANGED_WORLD);
+ VERIFY_HOOK;
+
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnEntityChangedWorld(a_Entity, a_World))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
bool cPluginManager::CallHookExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split, const AString & a_EntireCommand, CommandResult & a_Result)
{
FIND_HOOK(HOOK_EXECUTE_COMMAND);
@@ -639,6 +675,25 @@ bool cPluginManager::CallHookHopperPushingItem(cWorld & a_World, cHopperEntity &
+bool cPluginManager::CallHookKilled(cEntity & a_Victim, TakeDamageInfo & a_TDI, AString & a_DeathMessage)
+{
+ FIND_HOOK(HOOK_KILLED);
+ VERIFY_HOOK;
+
+ for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
+ {
+ if ((*itr)->OnKilled(a_Victim, a_TDI, a_DeathMessage))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
bool cPluginManager::CallHookKilling(cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI)
{
FIND_HOOK(HOOK_KILLING);
@@ -1896,25 +1951,23 @@ size_t cPluginManager::GetNumLoadedPlugins(void) const
-AStringVector cPluginManager::GetFoldersToLoad(cIniFile & a_SettingsIni)
+AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_Settings)
{
// Check if the Plugins section exists.
- int KeyNum = a_SettingsIni.FindKey("Plugins");
- if (KeyNum == -1)
+ if (!a_Settings.KeyExists("Plugins"))
{
- InsertDefaultPlugins(a_SettingsIni);
- KeyNum = a_SettingsIni.FindKey("Plugins");
+ InsertDefaultPlugins(a_Settings);
}
// Get the list of plugins to load:
AStringVector res;
- int NumPlugins = a_SettingsIni.GetNumValues(KeyNum);
- for (int i = 0; i < NumPlugins; i++)
+ auto Values = a_Settings.GetValues("Plugins");
+ for (auto NameValue : Values)
{
- AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
+ AString ValueName = NameValue.first;
if (ValueName.compare("Plugin") == 0)
{
- AString PluginFile = a_SettingsIni.GetValue(KeyNum, i);
+ AString PluginFile = NameValue.second;
if (!PluginFile.empty())
{
res.push_back(PluginFile);
diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h
index d8c886b62..153f4996d 100644
--- a/src/Bindings/PluginManager.h
+++ b/src/Bindings/PluginManager.h
@@ -24,6 +24,7 @@ class cPlayer;
class cPlugin;
class cProjectileEntity;
class cWorld;
+class cSettingsRepositoryInterface;
struct TakeDamageInfo;
typedef SharedPtr<cPlugin> cPluginPtr;
@@ -85,12 +86,15 @@ public:
HOOK_DISCONNECT,
HOOK_PLAYER_ANIMATION,
HOOK_ENTITY_ADD_EFFECT,
+ HOOK_ENTITY_CHANGING_WORLD,
+ HOOK_ENTITY_CHANGED_WORLD,
HOOK_EXECUTE_COMMAND,
HOOK_EXPLODED,
HOOK_EXPLODING,
HOOK_HANDSHAKE,
HOOK_HOPPER_PULLING_ITEM,
HOOK_HOPPER_PUSHING_ITEM,
+ HOOK_KILLED,
HOOK_KILLING,
HOOK_LOGIN,
HOOK_PLAYER_BREAKING_BLOCK,
@@ -200,12 +204,15 @@ public:
bool CallHookDisconnect (cClientHandle & a_Client, const AString & a_Reason);
bool CallHookEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier);
bool CallHookEntityTeleport (cEntity & a_Entity, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition);
+ bool CallHookEntityChangingWorld (cEntity & a_Entity, cWorld & a_World);
+ bool CallHookEntityChangedWorld (cEntity & a_Entity, cWorld & a_World);
bool CallHookExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split, const AString & a_EntireCommand, CommandResult & a_Result); // If a_Player == nullptr, it is a console cmd
bool CallHookExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData);
bool CallHookExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData);
bool CallHookHandshake (cClientHandle & a_ClientHandle, const AString & a_Username);
bool CallHookHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum);
bool CallHookHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum);
+ bool CallHookKilled (cEntity & a_Victim, TakeDamageInfo & a_TDI, AString & a_DeathMessage);
bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI);
bool CallHookLogin (cClientHandle & a_Client, int a_ProtocolVersion, const AString & a_Username);
bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation);
@@ -364,20 +371,20 @@ private:
/** Reloads all plugins, defaulting to settings.ini for settings location */
void ReloadPluginsNow(void);
- /** Reloads all plugins with a cIniFile object expected to be initialised to settings.ini */
- void ReloadPluginsNow(cIniFile & a_SettingsIni);
+ /** Reloads all plugins with a settings repo expected to be initialised to settings.ini */
+ void ReloadPluginsNow(cSettingsRepositoryInterface & a_Settings);
/** Unloads all plugins */
void UnloadPluginsNow(void);
- /** Handles writing default plugins if 'Plugins' key not found using a cIniFile object expected to be intialised to settings.ini */
- void InsertDefaultPlugins(cIniFile & a_SettingsIni);
+ /** Handles writing default plugins if 'Plugins' key not found using a settings repo expected to be intialised to settings.ini */
+ void InsertDefaultPlugins(cSettingsRepositoryInterface & a_Settings);
/** Tries to match a_Command to the internal table of commands, if a match is found, the corresponding plugin is called. Returns crExecuted if the command is executed. */
CommandResult HandleCommand(cPlayer & a_Player, const AString & a_Command, bool a_ShouldCheckPermissions);
/** Returns the folders that are specified in the settings ini to load plugins from. */
- AStringVector GetFoldersToLoad(cIniFile & a_SettingsIni);
+ AStringVector GetFoldersToLoad(cSettingsRepositoryInterface & a_Settings);
} ; // tolua_export
diff --git a/src/BiomeDef.cpp b/src/BiomeDef.cpp
index a2a06f10c..9dbdf05a2 100644
--- a/src/BiomeDef.cpp
+++ b/src/BiomeDef.cpp
@@ -98,11 +98,11 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
{
if ((res >= biFirstBiome) && (res < biNumBiomes))
{
- return (EMCSBiome)res;
+ return static_cast<EMCSBiome>(res);
}
else if ((res >= biFirstVariantBiome) && (res < biNumVariantBiomes))
{
- return (EMCSBiome)res;
+ return static_cast<EMCSBiome>(res);
}
// It was an invalid number
return biInvalidBiome;
diff --git a/src/BiomeDef.h b/src/BiomeDef.h
index cda12556a..32d3a5cfd 100644
--- a/src/BiomeDef.h
+++ b/src/BiomeDef.h
@@ -104,6 +104,28 @@ enum EMCSBiome
biMaxVariantBiome = biNumVariantBiomes - 1, // The maximum biome value
} ;
+// tolua_end
+
+
+
+
+
+/** Hash for EMCSBiome, so that it can be used in std::unordered_map etc. */
+struct BiomeHasher
+{
+public:
+ std::size_t operator() (const EMCSBiome a_Biome) const
+ {
+ return static_cast<std::size_t>(a_Biome);
+ }
+};
+
+
+
+
+
+// tolua_begin
+
/** Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns biInvalidBiome on failure. */
extern EMCSBiome StringToBiome(const AString & a_BiomeString);
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 89cf18d4a..eb25d624d 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -60,7 +60,7 @@ void InternalMergeBlocks(
else
{
NIBBLETYPE FakeDestMeta = 0;
- Combinator(a_DstTypes[DstIdx], a_SrcTypes[SrcIdx], FakeDestMeta, (NIBBLETYPE)0);
+ Combinator(a_DstTypes[DstIdx], a_SrcTypes[SrcIdx], FakeDestMeta, static_cast<NIBBLETYPE>(0));
}
++DstIdx;
++SrcIdx;
@@ -336,6 +336,12 @@ void cBlockArea::Create(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
);
return;
}
+
+ // Warn if the height is too much, but proceed with the creation:
+ if (a_SizeY > cChunkDef::Height)
+ {
+ LOGWARNING("Creating a cBlockArea with height larger than world height (%d). Continuing, but the area may misbehave.", a_SizeY);
+ }
Clear();
int BlockCount = a_SizeX * a_SizeY * a_SizeZ;
@@ -540,7 +546,7 @@ bool cBlockArea::Write(cForEachChunkProvider * a_ForEachChunkProvider, int a_Min
else if (a_MinBlockY > cChunkDef::Height - m_Size.y)
{
LOGWARNING("%s: MinBlockY + m_SizeY more than chunk height, adjusting to chunk height", __FUNCTION__);
- a_MinBlockY = cChunkDef::Height - m_Size.y;
+ a_MinBlockY = std::max(cChunkDef::Height - m_Size.y, 0);
}
return a_ForEachChunkProvider->WriteBlockArea(*this, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes);
@@ -620,7 +626,7 @@ void cBlockArea::DumpToRawFile(const AString & a_FileName)
f.Write(&SizeX, 4);
f.Write(&SizeY, 4);
f.Write(&SizeZ, 4);
- unsigned char DataTypes = (unsigned char)GetDataTypes();
+ unsigned char DataTypes = static_cast<unsigned char>(GetDataTypes());
f.Write(&DataTypes, 1);
size_t NumBlocks = GetBlockCount();
if (HasBlockTypes())
@@ -1665,6 +1671,65 @@ size_t cBlockArea::CountNonAirBlocks(void) const
+size_t cBlockArea::CountSpecificBlocks(BLOCKTYPE a_BlockType) const
+{
+ // If blocktypes are not valid, log a warning and return zero occurences:
+ if (m_BlockTypes == nullptr)
+ {
+ LOGWARNING("%s: BlockTypes not available!", __FUNCTION__);
+ return 0;
+ }
+
+ // Count the blocks:
+ size_t num = GetBlockCount();
+ size_t res = 0;
+ for (size_t i = 0; i < num; i++)
+ {
+ if (m_BlockTypes[i] == a_BlockType)
+ {
+ res++;
+ }
+ }
+ return res;
+}
+
+
+
+
+
+size_t cBlockArea::CountSpecificBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) const
+{
+ // If blocktypes are not valid, log a warning and return zero occurences:
+ if (m_BlockTypes == nullptr)
+ {
+ LOGWARNING("%s: BlockTypes not available!", __FUNCTION__);
+ return 0;
+ }
+
+ // If blockmetas are not valid, log a warning and count only blocktypes:
+ if (m_BlockMetas == nullptr)
+ {
+ LOGWARNING("%s: BlockMetas not available, comparing blocktypes only!", __FUNCTION__);
+ return CountSpecificBlocks(a_BlockType);
+ }
+
+ // Count the blocks:
+ size_t num = GetBlockCount();
+ size_t res = 0;
+ for (size_t i = 0; i < num; i++)
+ {
+ if ((m_BlockTypes[i] == a_BlockType) && (m_BlockMetas[i] == a_BlockMeta))
+ {
+ res++;
+ }
+ }
+ return res;
+}
+
+
+
+
+
void cBlockArea::GetNonAirCropRelCoords(int & a_MinRelX, int & a_MinRelY, int & a_MinRelZ, int & a_MaxRelX, int & a_MaxRelY, int & a_MaxRelZ, BLOCKTYPE a_IgnoreBlockType)
{
// Check if blocktypes are valid:
@@ -2157,7 +2222,7 @@ void cBlockArea::ExpandBlockTypes(int a_SubMinX, int a_AddMaxX, int a_SubMinY, i
int NewSizeX = m_Size.x + a_SubMinX + a_AddMaxX;
int NewSizeY = m_Size.y + a_SubMinY + a_AddMaxY;
int NewSizeZ = m_Size.z + a_SubMinZ + a_AddMaxZ;
- size_t BlockCount = (size_t)(NewSizeX * NewSizeY * NewSizeZ);
+ size_t BlockCount = static_cast<size_t>(NewSizeX * NewSizeY * NewSizeZ);
BLOCKTYPE * NewBlockTypes = new BLOCKTYPE[BlockCount];
memset(NewBlockTypes, 0, BlockCount * sizeof(BLOCKTYPE));
int OldIndex = 0;
@@ -2187,7 +2252,7 @@ void cBlockArea::ExpandNibbles(NIBBLEARRAY & a_Array, int a_SubMinX, int a_AddMa
int NewSizeX = m_Size.x + a_SubMinX + a_AddMaxX;
int NewSizeY = m_Size.y + a_SubMinY + a_AddMaxY;
int NewSizeZ = m_Size.z + a_SubMinZ + a_AddMaxZ;
- size_t BlockCount = (size_t)(NewSizeX * NewSizeY * NewSizeZ);
+ size_t BlockCount = static_cast<size_t>(NewSizeX * NewSizeY * NewSizeZ);
NIBBLETYPE * NewNibbles = new NIBBLETYPE[BlockCount];
memset(NewNibbles, 0, BlockCount * sizeof(NIBBLETYPE));
int OldIndex = 0;
diff --git a/src/BlockArea.h b/src/BlockArea.h
index 856df542f..a9963b4ef 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -308,6 +308,15 @@ public:
Returns 0 if blocktypes not available. Block metas are ignored (if present, air with any meta is still considered air). */
size_t CountNonAirBlocks(void) const;
+ /** Returns how many times the specified block is contained in the area.
+ The blocks' meta values are ignored, only the blocktype is compared. */
+ size_t CountSpecificBlocks(BLOCKTYPE a_BlockType) const;
+
+ /** Returns how many times the specified block is contained in the area.
+ Both the block's type and meta must match in order to be counted in.
+ If the block metas aren't present in the area, logs a warning and ignores the meta specification. */
+ size_t CountSpecificBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) const;
+
// tolua_end
/** Returns the minimum and maximum coords in each direction for the first non-ignored block in each direction.
@@ -321,7 +330,7 @@ public:
NIBBLETYPE * GetBlockMetas (void) const { return m_BlockMetas; } // NOTE: one byte per block!
NIBBLETYPE * GetBlockLight (void) const { return m_BlockLight; } // NOTE: one byte per block!
NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight; } // NOTE: one byte per block!
- size_t GetBlockCount(void) const { return (size_t)(m_Size.x * m_Size.y * m_Size.z); }
+ size_t GetBlockCount(void) const { return static_cast<size_t>(m_Size.x * m_Size.y * m_Size.z); }
int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const;
protected:
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index fb3940ce9..a945c6ea9 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -77,7 +77,7 @@ bool cBeaconEntity::IsValidEffect(cEntityEffect::eType a_Effect, char a_BeaconLe
default:
{
- LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, (int)a_Effect);
+ LOGD("%s: Invalid beacon effect: %d", __FUNCTION__, static_cast<int>(a_Effect));
return false;
}
}
@@ -228,9 +228,9 @@ void cBeaconEntity::GiveEffects(void)
virtual bool Item(cPlayer * a_Player)
{
Vector3d PlayerPosition = Vector3d(a_Player->GetPosition());
- if (PlayerPosition.y > (double)m_PosY)
+ if (PlayerPosition.y > static_cast<double>(m_PosY))
{
- PlayerPosition.y = (double)m_PosY;
+ PlayerPosition.y = static_cast<double>(m_PosY);
}
// TODO: Vanilla minecraft uses an AABB check instead of a radius one
diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h
index 85f75a523..785ee978a 100644
--- a/src/BlockEntities/BlockEntity.h
+++ b/src/BlockEntities/BlockEntity.h
@@ -85,13 +85,14 @@ public:
// tolua_begin
// Position, in absolute block coordinates:
+ Vector3i GetPos(void) const { return Vector3i{m_PosX, m_PosY, m_PosZ}; }
int GetPosX(void) const { return m_PosX; }
int GetPosY(void) const { return m_PosY; }
int GetPosZ(void) const { return m_PosZ; }
BLOCKTYPE GetBlockType(void) const { return m_BlockType; }
- cWorld * GetWorld(void) const {return m_World; }
+ cWorld * GetWorld(void) const { return m_World; }
int GetChunkX(void) const { return FAST_FLOOR_DIV(m_PosX, cChunkDef::Width); }
int GetChunkZ(void) const { return FAST_FLOOR_DIV(m_PosZ, cChunkDef::Width); }
diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h
index 740dbca51..30a09bc02 100644
--- a/src/BlockEntities/BlockEntityWithItems.h
+++ b/src/BlockEntities/BlockEntityWithItems.h
@@ -76,7 +76,7 @@ protected:
cItemGrid m_Contents;
// cItemGrid::cListener overrides:
- virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum)
+ virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override
{
UNUSED(a_SlotNum);
ASSERT(a_Grid == &m_Contents);
diff --git a/src/BlockEntities/CMakeLists.txt b/src/BlockEntities/CMakeLists.txt
index 5f4af288d..b0bfca5e4 100644
--- a/src/BlockEntities/CMakeLists.txt
+++ b/src/BlockEntities/CMakeLists.txt
@@ -41,6 +41,11 @@ SET (HDRS
NoteEntity.h
SignEntity.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(BeaconEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=switch-enum")
+ set_source_files_properties(NoteEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion")
+endif()
+
if(NOT MSVC)
add_library(BlockEntities ${SRCS} ${HDRS})
endif()
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp
index 1c186310c..21baac977 100644
--- a/src/BlockEntities/ChestEntity.cpp
+++ b/src/BlockEntities/ChestEntity.cpp
@@ -37,7 +37,7 @@ void cChestEntity::SendTo(cClientHandle & a_Client)
{
// The chest entity doesn't need anything sent to the client when it's created / gets in the viewdistance
// All the actual handling is in the cWindow UI code that gets called when the chest is rclked
-
+
UNUSED(a_Client);
}
@@ -54,7 +54,7 @@ void cChestEntity::UsedBy(cPlayer * a_Player)
OpenNewWindow();
Window = GetWindow();
}
-
+
// Open the window for the player:
if (Window != nullptr)
{
@@ -80,7 +80,7 @@ void cChestEntity::UsedBy(cPlayer * a_Player)
void cChestEntity::OpenNewWindow(void)
{
// TODO: cats are an obstruction
- if ((GetPosY() < cChunkDef::Height - 1) && cBlockInfo::IsSolid(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
+ if ((GetPosY() < cChunkDef::Height - 1) && !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
{
// Obstruction, don't open
return;
@@ -96,10 +96,10 @@ void cChestEntity::OpenNewWindow(void)
m_ThisChest(a_ThisChest)
{
}
-
+
virtual bool Item(cChestEntity * a_Chest) override
{
- if ((a_Chest->GetPosY() < cChunkDef::Height - 1) && cBlockInfo::IsSolid(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
+ if ((a_Chest->GetPosY() < cChunkDef::Height - 1) && !cBlockInfo::IsTransparent(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
{
// Obstruction, don't open
return false;
@@ -119,7 +119,7 @@ void cChestEntity::OpenNewWindow(void)
return false;
}
} ;
-
+
// Scan neighbors for adjacent chests:
cOpenDouble OpenDbl(this);
if (
@@ -136,7 +136,3 @@ void cChestEntity::OpenNewWindow(void)
// There is no chest neighbor, open a single-chest window:
OpenWindow(new cChestWindow(this));
}
-
-
-
-
diff --git a/src/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h
index 645dbf4bc..6eb72fc77 100644
--- a/src/BlockEntities/ChestEntity.h
+++ b/src/BlockEntities/ChestEntity.h
@@ -53,6 +53,24 @@ private:
/** Number of players who currently have this chest open */
int m_NumActivePlayers;
+
+ /** cItemGrid::cListener overrides: */
+ virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override
+ {
+ UNUSED(a_SlotNum);
+ ASSERT(a_Grid == &m_Contents);
+ if (m_World != nullptr)
+ {
+ if (GetWindow() != nullptr)
+ {
+ GetWindow()->BroadcastWholeWindow();
+ }
+
+ m_World->MarkChunkDirty(GetChunkX(), GetChunkZ());
+ m_World->MarkRedstoneDirty(GetChunkX(), GetChunkZ());
+ }
+ }
+
} ; // tolua_export
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index 039f5d360..3a93e85a1 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -75,7 +75,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
if (SlotsCnt == 0)
{
// Nothing in the dropspenser, play the click sound
- m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.2f);
+ m_World->BroadcastSoundEffect("random.click", static_cast<double>(m_PosX), static_cast<double>(m_PosY), static_cast<double>(m_PosZ), 1.0f, 1.2f);
return;
}
@@ -97,7 +97,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
case E_META_DROPSPENSER_FACING_ZP: SmokeDir = 7; break;
}
m_World->BroadcastSoundParticleEffect(2000, m_PosX, m_PosY, m_PosZ, SmokeDir);
- m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
+ m_World->BroadcastSoundEffect("random.click", static_cast<double>(m_PosX), static_cast<double>(m_PosY), static_cast<double>(m_PosZ), 1.0f, 1.0f);
}
diff --git a/src/BlockEntities/EnderChestEntity.cpp b/src/BlockEntities/EnderChestEntity.cpp
index ab5c5a2de..00e203520 100644
--- a/src/BlockEntities/EnderChestEntity.cpp
+++ b/src/BlockEntities/EnderChestEntity.cpp
@@ -35,6 +35,12 @@ cEnderChestEntity::~cEnderChestEntity()
void cEnderChestEntity::UsedBy(cPlayer * a_Player)
{
+ // TODO: cats are an obstruction
+ if ((GetPosY() < cChunkDef::Height - 1) && !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
+ {
+ // Obstruction, don't open
+ return;
+ }
// If the window is not created, open it anew:
cWindow * Window = GetWindow();
if (Window == nullptr)
@@ -42,7 +48,7 @@ void cEnderChestEntity::UsedBy(cPlayer * a_Player)
OpenNewWindow();
Window = GetWindow();
}
-
+
// Open the window for the player:
if (Window != nullptr)
{
@@ -91,7 +97,3 @@ void cEnderChestEntity::SaveToJson(Json::Value & a_Value, const cItemGrid & a_Gr
a_Value.append(Slot);
}
}
-
-
-
-
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp
index 2621b560b..d1588160d 100644
--- a/src/BlockEntities/FurnaceEntity.cpp
+++ b/src/BlockEntities/FurnaceEntity.cpp
@@ -32,7 +32,8 @@ cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY
m_NeedCookTime(0),
m_TimeCooked(0),
m_FuelBurnTime(0),
- m_TimeBurned(0)
+ m_TimeBurned(0),
+ m_IsLoading(false)
{
m_Contents.AddListener(*this);
}
@@ -178,20 +179,15 @@ void cFurnaceEntity::BurnNewFuel(void)
{
cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe();
int NewTime = FR->GetBurnTime(m_Contents.GetSlot(fsFuel));
- if (NewTime == 0)
+ if ((NewTime == 0) || !CanCookInputToOutput())
{
// The item in the fuel slot is not suitable
+ // or the input and output isn't available for cooking
SetBurnTimes(0, 0);
SetIsCooking(false);
return;
}
- // Is the input and output ready for cooking?
- if (!CanCookInputToOutput())
- {
- return;
- }
-
// Burn one new fuel:
SetBurnTimes(NewTime, 0);
SetIsCooking(true);
@@ -218,6 +214,11 @@ void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
return;
}
+ if (m_IsLoading)
+ {
+ return;
+ }
+
ASSERT(a_ItemGrid == &m_Contents);
switch (a_SlotNum)
{
@@ -238,7 +239,10 @@ void cFurnaceEntity::UpdateInput(void)
if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput))
{
// The input is different from what we had before, reset the cooking time
- m_TimeCooked = 0;
+ if (!m_IsLoading)
+ {
+ m_TimeCooked = 0;
+ }
}
m_LastInput = m_Contents.GetSlot(fsInput);
@@ -253,13 +257,17 @@ void cFurnaceEntity::UpdateInput(void)
else
{
m_NeedCookTime = m_CurrentRecipe->CookTime;
- SetIsCooking(true);
// Start burning new fuel if there's no flame now:
if (GetFuelBurnTimeLeft() <= 0)
{
BurnNewFuel();
}
+ // Already burning, set cooking to ensure that cooking is occuring
+ else
+ {
+ SetIsCooking(true);
+ }
}
}
@@ -293,11 +301,19 @@ void cFurnaceEntity::UpdateOutput(void)
return;
}
- // No need to burn new fuel, the Tick() function will take care of that
-
// Can cook, start cooking if not already underway:
m_NeedCookTime = m_CurrentRecipe->CookTime;
- SetIsCooking(m_FuelBurnTime > 0);
+
+ // Check if fuel needs to start a burn
+ if (GetFuelBurnTimeLeft() <= 0)
+ {
+ BurnNewFuel();
+ }
+ // Already burning, set cooking to ensure that cooking is occuring
+ else
+ {
+ SetIsCooking(true);
+ }
}
diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h
index 8b3ba3e36..8734d763c 100644
--- a/src/BlockEntities/FurnaceEntity.h
+++ b/src/BlockEntities/FurnaceEntity.h
@@ -101,6 +101,11 @@ public:
m_TimeCooked = a_TimeCooked;
}
+ void SetLoading(bool a_IsLoading)
+ {
+ m_IsLoading = a_IsLoading;
+ }
+
protected:
/** Block meta of the block currently represented by this entity */
@@ -129,6 +134,9 @@ protected:
/** Amount of ticks that the current fuel has been burning */
int m_TimeBurned;
+
+ /** Is the block currently being loaded into the world? */
+ bool m_IsLoading;
/** Sends the specified progressbar value to all clients of the window */
void BroadcastProgress(short a_ProgressbarID, short a_Value);
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index 203f47534..662212c4d 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -507,7 +507,7 @@ bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_Sl
auto PreviousCount = m_Contents.GetSlot(i).m_ItemCount;
m_Contents.ChangeSlotCount(i, 1);
- if (PreviousCount == m_Contents.GetSlot(i).m_ItemCount + 1)
+ if (PreviousCount + 1 == m_Contents.GetSlot(i).m_ItemCount)
{
// Successfully added a new item. (Failure condition consistutes: stack full)
return true;
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index 764d7af84..1a0ce5b22 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -145,9 +145,9 @@ void cMobSpawnerEntity::SpawnEntity(void)
break;
}
- int RelX = (int) (m_RelX + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0);
+ int RelX = static_cast<int>(m_RelX + static_cast<double>(Random.NextFloat() - Random.NextFloat()) * 4.0);
int RelY = m_RelY + Random.NextInt(3) - 1;
- int RelZ = (int) (m_RelZ + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0);
+ int RelZ = static_cast<int>(m_RelZ + static_cast<double>(Random.NextFloat() - Random.NextFloat()) * 4.0);
cChunk * Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(RelX, RelZ);
if ((Chunk == nullptr) || !Chunk->IsValid())
@@ -172,7 +172,13 @@ void cMobSpawnerEntity::SpawnEntity(void)
if (Chunk->GetWorld()->SpawnMobFinalize(Monster) != cEntity::INVALID_ID)
{
EntitiesSpawned = true;
- Chunk->BroadcastSoundParticleEffect(2004, (int)(PosX * 8.0), (int)(RelY * 8.0), (int)(PosZ * 8.0), 0);
+ Chunk->BroadcastSoundParticleEffect(
+ 2004,
+ static_cast<int>(PosX * 8.0),
+ static_cast<int>(RelY * 8.0),
+ static_cast<int>(PosZ * 8.0),
+ 0
+ );
m_NearbyEntitiesNum++;
}
}
@@ -246,9 +252,9 @@ int cMobSpawnerEntity::GetNearbyMonsterNum(eMonsterType a_EntityType)
class cCallback : public cChunkDataCallback
{
public:
- cCallback(Vector3d a_SpawnerPos, eMonsterType a_EntityType, int & a_NumEntities) :
+ cCallback(Vector3d a_SpawnerPos, eMonsterType a_CallbackEntityType, int & a_NumEntities) :
m_SpawnerPos(a_SpawnerPos),
- m_EntityType(a_EntityType),
+ m_EntityType(a_CallbackEntityType),
m_NumEntities(a_NumEntities)
{
}
@@ -260,7 +266,7 @@ int cMobSpawnerEntity::GetNearbyMonsterNum(eMonsterType a_EntityType)
return;
}
- cMonster * Mob = (cMonster *)a_Entity;
+ cMonster * Mob = static_cast<cMonster *>(a_Entity);
if (Mob->GetMobType() != m_EntityType)
{
return;
diff --git a/src/BlockEntities/NoteEntity.cpp b/src/BlockEntities/NoteEntity.cpp
index a9af13c55..29839bae1 100644
--- a/src/BlockEntities/NoteEntity.cpp
+++ b/src/BlockEntities/NoteEntity.cpp
@@ -90,8 +90,15 @@ void cNoteEntity::MakeSound(void)
m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK);
// TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all
- float calcPitch = pow(2.0f, ((float)m_Pitch - 12.0f) / 12.0f);
- m_World->BroadcastSoundEffect(sampleName, (double)m_PosX, (double)m_PosY, (double)m_PosZ, 3.0f, calcPitch);
+ float calcPitch = pow(2.0f, static_cast<float>(m_Pitch - 12.0f) / 12.0f);
+ m_World->BroadcastSoundEffect(
+ sampleName,
+ static_cast<double>(m_PosX),
+ static_cast<double>(m_PosY),
+ static_cast<double>(m_PosZ),
+ 3.0f,
+ calcPitch
+ );
}
diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h
index d3f85e9d2..f350ef4c4 100644
--- a/src/BlockEntities/NoteEntity.h
+++ b/src/BlockEntities/NoteEntity.h
@@ -52,7 +52,7 @@ public:
virtual void UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle &) override {}
- virtual void SetRedstonePower(bool a_Value)
+ virtual void SetRedstonePower(bool a_Value) override
{
if (a_Value)
{
diff --git a/src/BlockID.cpp b/src/BlockID.cpp
index 7f0db3cfc..c598df0aa 100644
--- a/src/BlockID.cpp
+++ b/src/BlockID.cpp
@@ -96,8 +96,7 @@ public:
else
{
// Not a resolvable string, try pure numbers: "45:6", "45^6" etc.
- a_Item.m_ItemType = (short)atoi(Split[0].c_str());
- if ((a_Item.m_ItemType == 0) && (Split[0] != "0"))
+ if (!StringToInteger(Split[0], a_Item.m_ItemType))
{
// Parsing the number failed
return false;
@@ -111,9 +110,8 @@ public:
a_Item.m_ItemCount = 1;
return true;
}
-
- a_Item.m_ItemDamage = (short)atoi(Split[1].c_str());
- if ((a_Item.m_ItemDamage == 0) && (Split[1] != "0"))
+
+ if (!StringToInteger(Split[1], a_Item.m_ItemDamage))
{
// Parsing the number failed
return false;
@@ -175,8 +173,16 @@ protected:
{
return;
}
- short ItemType = (short)atoi(Split[0].c_str());
- short ItemDamage = (Split.size() > 1) ? (short)atoi(Split[1].c_str()) : -1;
+ short ItemType;
+ if (!StringToInteger(Split[0], ItemType))
+ {
+ ASSERT(!"Invalid item type");
+ }
+ short ItemDamage = -1;
+ if (Split.size() > 1 && !StringToInteger(Split[1], ItemDamage))
+ {
+ ASSERT(!"Invalid item damage");
+ }
m_Map[a_Name] = std::make_pair(ItemType, ItemDamage);
}
} ;
@@ -288,11 +294,11 @@ AString ItemToFullString(const cItem & a_Item)
eDimension StringToDimension(const AString & a_DimensionString)
{
// First try decoding as a number
- int res = atoi(a_DimensionString.c_str());
- if ((res != 0) || (a_DimensionString == "0"))
+ int res;
+ if (StringToInteger(a_DimensionString, res))
{
// It was a valid number
- return (eDimension)res;
+ return static_cast<eDimension>(res);
}
// Decode using a built-in map:
@@ -350,7 +356,7 @@ AString DimensionToString(eDimension a_Dimension)
} // for i - DimensionMap[]
// Not found
- LOGWARNING("Unknown dimension: \"%i\". Setting to Overworld", (int)a_Dimension);
+ LOGWARNING("Unknown dimension: \"%i\". Setting to Overworld", static_cast<int>(a_Dimension));
return "Overworld";
}
@@ -386,7 +392,7 @@ AString DamageTypeToString(eDamageType a_DamageType)
// Unknown damage type:
ASSERT(!"Unknown DamageType");
- return Printf("dtUnknown_%d", (int)a_DamageType);
+ return Printf("dtUnknown_%d", static_cast<int>(a_DamageType));
}
@@ -397,11 +403,11 @@ AString DamageTypeToString(eDamageType a_DamageType)
eDamageType StringToDamageType(const AString & a_DamageTypeString)
{
// First try decoding as a number:
- int res = atoi(a_DamageTypeString.c_str());
- if ((res != 0) || (a_DamageTypeString == "0"))
+ int res;
+ if (!StringToInteger(a_DamageTypeString, res))
{
// It was a valid number
- return (eDamageType)res;
+ return static_cast<eDamageType>(res);
}
// Decode using a built-in map:
@@ -462,7 +468,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
} // for i - DamageTypeMap[]
// Not found:
- return (eDamageType)-1;
+ return static_cast<eDamageType>(-1);
}
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index 3c5e8d7b7..c0ae5e945 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -19,7 +19,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
{
if (a_Info[i].m_Handler == nullptr)
{
- a_Info[i].m_Handler = cBlockHandler::CreateBlockHandler((BLOCKTYPE) i);
+ a_Info[i].m_Handler = cBlockHandler::CreateBlockHandler(static_cast<BLOCKTYPE>(i));
}
}
@@ -204,7 +204,6 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_ENDER_CHEST ].m_Transparent = true;
a_Info[E_BLOCK_END_PORTAL ].m_Transparent = true;
a_Info[E_BLOCK_END_PORTAL_FRAME ].m_Transparent = true;
- a_Info[E_BLOCK_FARMLAND ].m_Transparent = true;
a_Info[E_BLOCK_FENCE ].m_Transparent = true;
a_Info[E_BLOCK_FENCE_GATE ].m_Transparent = true;
a_Info[E_BLOCK_FIRE ].m_Transparent = true;
diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h
index abfa0f782..154394550 100644
--- a/src/Blocks/BlockAnvil.h
+++ b/src/Blocks/BlockAnvil.h
@@ -46,10 +46,10 @@ public:
switch (Direction)
{
- case 0: a_BlockMeta = 0x2 | Meta << 2; break;
- case 1: a_BlockMeta = 0x3 | Meta << 2; break;
- case 2: a_BlockMeta = 0x0 | Meta << 2; break;
- case 3: a_BlockMeta = 0x1 | Meta << 2; break;
+ case 0: a_BlockMeta = static_cast<NIBBLETYPE>(0x2 | Meta << 2); break;
+ case 1: a_BlockMeta = static_cast<NIBBLETYPE>(0x3 | Meta << 2); break;
+ case 2: a_BlockMeta = static_cast<NIBBLETYPE>(0x0 | Meta << 2); break;
+ case 3: a_BlockMeta = static_cast<NIBBLETYPE>(0x1 | Meta << 2); break;
default:
{
return false;
diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h
index 46f361686..905c0ea76 100644
--- a/src/Blocks/BlockBed.h
+++ b/src/Blocks/BlockBed.h
@@ -36,11 +36,6 @@ public:
a_Pickups.push_back(cItem(E_ITEM_BED, 1, 0));
}
- virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override
- {
- return true;
- }
-
// Bed specific helper functions
static NIBBLETYPE RotationToMetaData(double a_Rotation)
@@ -53,7 +48,7 @@ public:
a_Rotation = (a_Rotation / 360) * 4;
- return ((char)a_Rotation + 2) % 4;
+ return (static_cast<NIBBLETYPE>(a_Rotation + 2)) % 4;
}
static Vector3i MetaDataToDirection(NIBBLETYPE a_MetaData)
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index d24c7d952..3558729bb 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -19,15 +19,35 @@ public:
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
{
+ NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+
+ double x(a_BlockX);
+ double y(a_BlockY);
+ double z(a_BlockZ);
+
+ // If button is already on do nothing
+ if (Meta & 0x08)
+ {
+ return;
+ }
+
// Set p the ON bit to on
- NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08);
+ Meta |= 0x08;
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
a_WorldInterface.WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ);
- a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
+ a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", x, y, z, 0.5f, 0.6f);
// Queue a button reset (unpress)
- a_ChunkInterface.QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30, m_BlockType, a_WorldInterface);
+ int delay = (m_BlockType == E_BLOCK_STONE_BUTTON) ? 20 : 30;
+
+ a_ChunkInterface.QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), delay, m_BlockType, a_WorldInterface);
+
+ a_Player->GetWorld()->ScheduleTask(delay, [x, y, z](cWorld & a_World)
+ {
+ a_World.BroadcastSoundEffect("random.click", x, y, z, 0.5f, 0.5f);
+ });
+
}
@@ -67,14 +87,19 @@ public:
case BLOCK_FACE_XM: return 0x2;
case BLOCK_FACE_XP: return 0x1;
case BLOCK_FACE_YM: return 0x0;
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled block face!");
return 0x0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
+
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{
switch (a_Meta & 0x7)
@@ -93,6 +118,7 @@ public:
}
}
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
NIBBLETYPE Meta;
diff --git a/src/Blocks/BlockCocoaPod.h b/src/Blocks/BlockCocoaPod.h
index 1b659d48f..4d16d2552 100644
--- a/src/Blocks/BlockCocoaPod.h
+++ b/src/Blocks/BlockCocoaPod.h
@@ -81,12 +81,18 @@ public:
case BLOCK_FACE_XM: return 3;
case BLOCK_FACE_XP: return 1;
case BLOCK_FACE_ZP: return 2;
- default:
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
{
ASSERT(!"Unknown face");
return 0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
} ;
diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h
index ed73a162e..3babeddad 100644
--- a/src/Blocks/BlockComparator.h
+++ b/src/Blocks/BlockComparator.h
@@ -64,6 +64,85 @@ public:
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw());
return true;
}
+
+
+ inline static Vector3i GetSideCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta, bool a_bInverse)
+ {
+ if (!a_bInverse)
+ {
+ switch (a_Meta)
+ {
+ case 0x0: a_BlockX++; break;
+ case 0x1: a_BlockZ--; break;
+ case 0x2: a_BlockX--; break;
+ case 0x3: a_BlockZ++; break;
+ default:
+ {
+ LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
+ ASSERT(!"Unknown metadata while determining orientation of comparator!");
+ break;
+ }
+ }
+ }
+ else
+ {
+ switch (a_Meta)
+ {
+ case 0x0: a_BlockX--; break;
+ case 0x1: a_BlockZ++; break;
+ case 0x2: a_BlockX++; break;
+ case 0x3: a_BlockZ--; break;
+ default:
+ {
+ LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
+ ASSERT(!"Unknown metadata while determining orientation of comparator!");
+ break;
+ }
+ }
+ }
+
+ return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
+ }
+
+
+ inline static Vector3i GetRearCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
+ {
+ switch (a_Meta)
+ {
+ case 0x0: a_BlockZ++; break;
+ case 0x1: a_BlockX--; break;
+ case 0x2: a_BlockZ--; break;
+ case 0x3: a_BlockX++; break;
+ default:
+ {
+ LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
+ ASSERT(!"Unknown metadata while determining orientation of comparator!");
+ break;
+ }
+ }
+
+ return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
+ }
+
+
+ inline static Vector3i GetFrontCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
+ {
+ switch (a_Meta)
+ {
+ case 0x0: a_BlockZ--; break;
+ case 0x1: a_BlockX++; break;
+ case 0x2: a_BlockZ++; break;
+ case 0x3: a_BlockX--; break;
+ default:
+ {
+ LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
+ ASSERT(!"Unknown metadata while determining orientation of comparator!");
+ break;
+ }
+ }
+
+ return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
+ }
} ;
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index 32512a2ef..3d671d218 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -3,6 +3,7 @@
#include "BlockHandler.h"
#include "../FastRandom.h"
+#include "../BlockInfo.h"
#include "Root.h"
#include "Bindings/PluginManager.h"
@@ -39,19 +40,6 @@ public:
{
return;
}
-
- // Grass becomes dirt if there is something on top of it:
- if (a_RelY < cChunkDef::Height - 1)
- {
- BLOCKTYPE Above;
- NIBBLETYPE AboveMeta;
- a_Chunk.GetBlockTypeMeta(a_RelX, a_RelY + 1, a_RelZ, Above, AboveMeta);
- if (!cBlockInfo::GetHandler(Above)->CanDirtGrowGrass(AboveMeta))
- {
- a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_DIRT, E_META_DIRT_NORMAL);
- return;
- }
- }
// Make sure that there is enough light at the source block to spread
if (!a_Chunk.GetWorld()->IsChunkLighted(a_Chunk.GetPosX(), a_Chunk.GetPosZ()))
@@ -59,10 +47,24 @@ public:
a_Chunk.GetWorld()->QueueLightChunk(a_Chunk.GetPosX(), a_Chunk.GetPosZ());
return;
}
- else if ((a_RelY < cChunkDef::Height - 1) && std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY + 1, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY + 1, a_RelZ))) < 9)
+ else if ((a_RelY < cChunkDef::Height - 1))
{
+ BLOCKTYPE above = a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ);
+
+ // Grass turns back to dirt when the block above is not transparent
+ if (!cBlockInfo::IsTransparent(above))
+ {
+ a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_DIRT, E_META_DIRT_NORMAL);
+ return;
+ }
+
+ NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY + 1, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY + 1, a_RelZ)));
// Source block is not bright enough to spread
- return;
+ if (light < 9)
+ {
+ return;
+ }
+
}
// Grass spreads to adjacent dirt blocks:
@@ -95,11 +97,10 @@ public:
// Not a regular dirt block
continue;
}
-
- BLOCKTYPE AboveDest;
- NIBBLETYPE AboveMeta;
- Chunk->GetBlockTypeMeta(BlockX, BlockY + 1, BlockZ, AboveDest, AboveMeta);
- if (cBlockInfo::GetHandler(AboveDest)->CanDirtGrowGrass(AboveMeta))
+ BLOCKTYPE above = a_Chunk.GetBlock(BlockX, BlockY + 1, BlockZ);
+ NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(BlockX, BlockY + 1, BlockZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(BlockX, BlockY + 1, BlockZ)));
+ // Grass does not spread to blocks with a light level less than 5
+ if ((light > 4) && cBlockInfo::IsTransparent(above))
{
if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(*Chunk->GetWorld(), Chunk->GetPosX() * cChunkDef::Width + BlockX, BlockY, Chunk->GetPosZ() * cChunkDef::Width + BlockZ, ssGrassSpread))
{
diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp
index d13c8d657..a4e375cf0 100644
--- a/src/Blocks/BlockDoor.cpp
+++ b/src/Blocks/BlockDoor.cpp
@@ -50,10 +50,24 @@ void cBlockDoorHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterfac
UNUSED(a_CursorY);
UNUSED(a_CursorZ);
- if (a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_DOOR)
+ switch (a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ))
{
- ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
- a_Player->GetWorld()->BroadcastSoundParticleEffect(1003, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player->GetClientHandle());
+ default:
+ {
+ ASSERT(!"Unhandled door block type");
+ }
+ case E_BLOCK_ACACIA_DOOR:
+ case E_BLOCK_BIRCH_DOOR:
+ case E_BLOCK_DARK_OAK_DOOR:
+ case E_BLOCK_JUNGLE_DOOR:
+ case E_BLOCK_SPRUCE_DOOR:
+ case E_BLOCK_IRON_DOOR:
+ case E_BLOCK_WOODEN_DOOR:
+ {
+ ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
+ a_Player->GetWorld()->BroadcastSoundParticleEffect(1003, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player->GetClientHandle());
+ break;
+ }
}
}
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index 445383e7c..79ed4f723 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -55,6 +55,10 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
+ if ((a_BlockMeta & 0x08) != 0) // is top part of door
+ {
+ return;
+ }
switch (m_BlockType)
{
case E_BLOCK_WOODEN_DOOR:
@@ -242,13 +246,13 @@ public:
if ((Meta & 0x08) != 0)
{
// The coords are pointing at the top part of the door
- if (a_BlockX > 0)
+ if (a_BlockY > 0)
{
NIBBLETYPE DownMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
- return (NIBBLETYPE) ((DownMeta & 0x07) | 0x08 | (Meta << 4));
+ return static_cast<NIBBLETYPE>((DownMeta & 0x07) | 0x08 | (Meta << 4));
}
// This is the top part of the door at the bottommost layer of the world, there's no bottom:
- return (NIBBLETYPE) (0x08 | (Meta << 4));
+ return static_cast<NIBBLETYPE>(0x08 | (Meta << 4));
}
else
{
@@ -256,7 +260,7 @@ public:
if (a_BlockY < cChunkDef::Height - 1)
{
NIBBLETYPE UpMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY + 1, a_BlockZ);
- return (NIBBLETYPE) (Meta | (UpMeta << 4));
+ return static_cast<NIBBLETYPE>(Meta | (UpMeta << 4));
}
// This is the bottom part of the door at the topmost layer of the world, there's no top:
return Meta;
diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h
index 23a7392da..8d43632ff 100644
--- a/src/Blocks/BlockFarmland.h
+++ b/src/Blocks/BlockFarmland.h
@@ -65,13 +65,22 @@ public:
}
}
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
+
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) override
{
+ // Don't care about any neighbor but the one above us (fix recursion loop in #2213):
+ if (a_WhichNeighbor != BLOCK_FACE_YP)
+ {
+ return;
+ }
+
+ // Don't care about anything if we're at the top of the world:
if (a_BlockY >= cChunkDef::Height)
{
return;
}
+ // Check whether we should revert to dirt:
BLOCKTYPE UpperBlock = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ);
if (cBlockInfo::FullyOccupiesVoxel(UpperBlock))
{
@@ -79,11 +88,13 @@ public:
}
}
+
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta
}
+
bool IsWaterInNear(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
{
if (a_Chunk.GetWorld()->IsWeatherWetAt(a_RelX, a_RelZ))
diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h
index 2038df94b..3f75455da 100644
--- a/src/Blocks/BlockFire.h
+++ b/src/Blocks/BlockFire.h
@@ -121,6 +121,20 @@ public:
}
}
+ int PortalHeight = MaxY - Y - 1;
+ int PortalWidth = XZP - XZM + 1;
+ if ((PortalHeight < a_WorldInterface.GetMinNetherPortalHeight()) || (PortalHeight > a_WorldInterface.GetMaxNetherPortalHeight()))
+ {
+ // The portal isn't high enough, or is too high
+ return;
+ }
+
+ if ((PortalWidth < a_WorldInterface.GetMinNetherPortalWidth()) || (PortalWidth > a_WorldInterface.GetMaxNetherPortalWidth()))
+ {
+ // The portal isn't wide enough, or is too wide
+ return;
+ }
+
for (int Height = Y + 1; Height <= MaxY - 1; Height++) // Loop through boundary to set portal blocks
{
for (int Width = XZM; Width <= XZP; Width++)
@@ -217,6 +231,11 @@ public:
return (FoundFrameZP && FoundFrameZM);
}
+
+ virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) override
+ {
+ return true;
+ }
};
diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h
index 2823baedc..58b3ce042 100644
--- a/src/Blocks/BlockFluid.h
+++ b/src/Blocks/BlockFluid.h
@@ -49,12 +49,6 @@ public:
}
super::Check(a_ChunkInterface, a_PluginInterface, a_RelX, a_RelY, a_RelZ, a_Chunk);
}
-
-
- virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override
- {
- return false;
- }
} ;
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 452cc94a5..412fc3aeb 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -389,12 +389,12 @@ void cBlockHandler::OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWor
void cBlockHandler::OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
{
// Notify the neighbors
- NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1);
+ NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ, BLOCK_FACE_XP);
+ NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ, BLOCK_FACE_XM);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_YP);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_YM);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1, BLOCK_FACE_ZP);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1, BLOCK_FACE_ZM);
}
@@ -404,29 +404,30 @@ void cBlockHandler::OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface
void cBlockHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
{
// Notify the neighbors
- NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1);
- NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1);
+ NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ, BLOCK_FACE_XP);
+ NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ, BLOCK_FACE_XM);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_YP);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_YM);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1, BLOCK_FACE_ZP);
+ NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1, BLOCK_FACE_ZM);
}
-void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_NeighborX, int a_NeighborY, int a_NeighborZ, eBlockFace a_WhichNeighbor)
{
- if ((a_BlockY >= 0) && (a_BlockY < cChunkDef::Height))
+ if ((a_NeighborY >= 0) && (a_NeighborY < cChunkDef::Height))
{
- cBlockInfo::GetHandler(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
+ cBlockInfo::GetHandler(a_ChunkInterface.GetBlock(a_NeighborX, a_NeighborY, a_NeighborZ))->OnNeighborChanged(a_ChunkInterface, a_NeighborX, a_NeighborY, a_NeighborZ, a_WhichNeighbor);
}
}
+
void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
{
// Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this.
@@ -512,15 +513,6 @@ bool cBlockHandler::CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, in
-bool cBlockHandler::CanDirtGrowGrass(NIBBLETYPE a_Meta)
-{
- return ((cBlockInfo::IsTransparent(m_BlockType)) || (cBlockInfo::IsOneHitDig(m_BlockType)));
-}
-
-
-
-
-
bool cBlockHandler::IsUseable()
{
return false;
diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h
index 4dec0dc95..1b357c3f1 100644
--- a/src/Blocks/BlockHandler.h
+++ b/src/Blocks/BlockHandler.h
@@ -56,13 +56,19 @@ public:
/// Called before a block gets destroyed / replaced with air
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
- /// Called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position)
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) {}
-
- /// Notifies all neighbors of the given block about a change
- static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
-
- /// Called while the player diggs the block.
+ /** Called when a direct neighbor of this block has been changed (The position is the block's own position, not the changing neighbor's position)
+ a_WhichNeighbor indicates which neighbor has changed. For example, BLOCK_FACE_YP meant the neighbor above has changed.
+ BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.) */
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) {}
+
+ /** Notifies the specified neighbor that the current block has changed.
+ a_NeighborXYZ coords are the coords of the neighbor
+ a_WhichNeighbor specifies which neighbor (relative to a_NeighborXYZ) has changed.
+ For example BLOCK_FACE_YP means that the block at {a_NeighborX, a_NeighborY + 1, a_NeighborZ} has changed.
+ BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.) */
+ static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_NeighborX, int a_NeighborY, int a_NeighborZ, eBlockFace a_WhichNeighbor);
+
+ /** Called when the player starts digging the block. */
virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {}
/// Called if the user right clicks the block and the block is useable
@@ -83,9 +89,6 @@ public:
/// Checks if the block can stay at the specified relative coords in the chunk
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk);
-
- /** Can the dirt under this block grow to grass? */
- virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta);
/** Checks if the block can be placed at this point.
Default: CanBeAt(...)
diff --git a/src/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h
index 4a5d32dd5..06e2b0e9f 100644
--- a/src/Blocks/BlockHopper.h
+++ b/src/Blocks/BlockHopper.h
@@ -35,7 +35,7 @@ public:
case BLOCK_FACE_NORTH: a_BlockMeta = E_META_HOPPER_FACING_ZP; break;
case BLOCK_FACE_SOUTH: a_BlockMeta = E_META_HOPPER_FACING_ZM; break;
case BLOCK_FACE_WEST: a_BlockMeta = E_META_HOPPER_FACING_XP; break;
- default: a_BlockMeta = E_META_HOPPER_UNATTACHED; break;
+ case BLOCK_FACE_NONE: a_BlockMeta = E_META_HOPPER_UNATTACHED; break;
}
return true;
}
diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h
index ab3f55439..d727f8f8e 100644
--- a/src/Blocks/BlockLadder.h
+++ b/src/Blocks/BlockLadder.h
@@ -57,8 +57,17 @@ public:
case BLOCK_FACE_ZP: return 0x3;
case BLOCK_FACE_XM: return 0x4;
case BLOCK_FACE_XP: return 0x5;
- default: return 0x2;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ return 0x2;
+ }
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index bd9a7414e..2368eab7b 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -40,33 +40,49 @@ public:
{
cFastRandom rand;
- // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand
- if (rand.NextInt(6) == 0)
+ // There is a chance to drop a sapling that varies depending on the type of leaf broken.
+ // TODO: Take into account fortune for sapling drops.
+ int chance;
+ if ((m_BlockType == E_BLOCK_LEAVES) && ((a_BlockMeta & 0x03) == E_META_LEAVES_JUNGLE))
+ {
+ // Jungle leaves have a 2.5% chance of dropping a sapling.
+ chance = rand.NextInt(40);
+ }
+ else
+ {
+ // Other leaves have a 5% chance of dropping a sapling.
+ chance = rand.NextInt(20);
+ }
+ if (chance == 0)
{
a_Pickups.push_back(
cItem(
E_BLOCK_SAPLING,
1,
- (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01))
+ (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : static_cast<short>(4 + (a_BlockMeta & 0x01))
)
);
}
-
- // 1 % chance of dropping an apple, if the leaves' type is Apple Leaves
+
+ // 0.5 % chance of dropping an apple, if the leaves' type is Apple Leaves
if ((m_BlockType == E_BLOCK_LEAVES) && ((a_BlockMeta & 0x03) == E_META_LEAVES_APPLE))
{
- if (rand.NextInt(101) == 0)
+ if (rand.NextInt(200) == 0)
{
a_Pickups.push_back(cItem(E_ITEM_RED_APPLE, 1, 0));
}
}
}
-
-
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
+
+
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) override
{
+ // Unset 0x8 bit so this block gets checked for decay:
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay
+ if ((Meta & 0x08) != 0)
+ {
+ a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7);
+ }
}
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h
index 2da138e5f..8d676b56f 100644
--- a/src/Blocks/BlockLever.h
+++ b/src/Blocks/BlockLever.h
@@ -59,14 +59,18 @@ public:
// Determine lever direction:
switch (a_Dir)
{
- case BLOCK_FACE_YP: return 0x6;
- case BLOCK_FACE_XP: return 0x1;
- case BLOCK_FACE_XM: return 0x2;
- case BLOCK_FACE_ZP: return 0x3;
- case BLOCK_FACE_ZM: return 0x4;
- case BLOCK_FACE_YM: return 0x0;
- default: return 0x6;
+ case BLOCK_FACE_YP: return 0x6;
+ case BLOCK_FACE_XP: return 0x1;
+ case BLOCK_FACE_XM: return 0x2;
+ case BLOCK_FACE_ZP: return 0x3;
+ case BLOCK_FACE_ZM: return 0x4;
+ case BLOCK_FACE_YM: return 0x0;
+ case BLOCK_FACE_NONE: return 0x6;
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp
index d9f4913d8..75f8621a7 100644
--- a/src/Blocks/BlockPiston.cpp
+++ b/src/Blocks/BlockPiston.cpp
@@ -179,7 +179,7 @@ void cBlockPistonHandler::ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ,
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, pistonBlock, pistonMeta | 0x8);
a_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0), false);
- a_World->ScheduleTask(PISTON_TICK_DELAY, std::make_shared<cWorld::cTaskSendBlockToAllPlayers>(ScheduledBlocks));
+ a_World->ScheduleTask(PISTON_TICK_DELAY, static_cast<cWorld::cTaskPtr>(std::make_shared<cWorld::cTaskSendBlockToAllPlayers>(ScheduledBlocks)));
}
@@ -229,7 +229,7 @@ void cBlockPistonHandler::RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ
std::vector<Vector3i> ScheduledBlocks;
ScheduledBlocks.push_back(Vector3i(a_BlockX, a_BlockY, a_BlockZ));
ScheduledBlocks.push_back(Vector3i(tempx, tempy, tempz));
- a_World->ScheduleTask(PISTON_TICK_DELAY + 1, std::make_shared<cWorld::cTaskSendBlockToAllPlayers>(ScheduledBlocks));
+ a_World->ScheduleTask(PISTON_TICK_DELAY + 1, static_cast<cWorld::cTaskPtr>(std::make_shared<cWorld::cTaskSendBlockToAllPlayers>(ScheduledBlocks)));
return;
}
}
@@ -239,7 +239,7 @@ void cBlockPistonHandler::RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ
std::vector<Vector3i> ScheduledBlocks;
ScheduledBlocks.push_back(Vector3i(a_BlockX, a_BlockY, a_BlockZ));
- a_World->ScheduleTask(PISTON_TICK_DELAY + 1, std::make_shared<cWorld::cTaskSendBlockToAllPlayers>(ScheduledBlocks));
+ a_World->ScheduleTask(PISTON_TICK_DELAY + 1, static_cast<cWorld::cTaskPtr>(std::make_shared<cWorld::cTaskSendBlockToAllPlayers>(ScheduledBlocks)));
}
diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h
index edc4fb9c5..b936a7e4a 100644
--- a/src/Blocks/BlockQuartz.h
+++ b/src/Blocks/BlockQuartz.h
@@ -36,6 +36,7 @@ public:
return true;
}
+
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_QuartzMeta)
{
switch (a_BlockFace)
@@ -58,11 +59,15 @@ public:
return 0x3; // East or west
}
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled block face!");
return a_QuartzMeta; // No idea, give a special meta (all sides the same)
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
} ;
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index a2e27a351..7fb910e8c 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -47,15 +47,14 @@ public:
super::OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
// Alert diagonal rails
- OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY + 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY + 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ + 1);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ - 1);
-
- OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY - 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY - 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ + 1);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ + 1, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ - 1, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY - 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY - 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ + 1, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1, BLOCK_FACE_NONE);
}
@@ -64,19 +63,18 @@ public:
super::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
// Alert diagonal rails
- OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY + 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY + 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ + 1);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ - 1);
-
- OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY - 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY - 1, a_BlockZ);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ + 1);
- OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ + 1, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ - 1, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY - 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY - 1, a_BlockZ, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ + 1, BLOCK_FACE_NONE);
+ OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1, BLOCK_FACE_NONE);
}
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) override
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ) && (Meta != FindMeta(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ)))
@@ -487,7 +485,12 @@ public:
}
break;
}
- default: break;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ break;
+ }
}
return true;
}
diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h
index bec79c6f3..c15e0a195 100644
--- a/src/Blocks/BlockSapling.h
+++ b/src/Blocks/BlockSapling.h
@@ -3,6 +3,7 @@
#include "BlockHandler.h"
#include "../World.h"
+#include "../FastRandom.h"
@@ -34,17 +35,144 @@ public:
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
-
- if ((Meta & 0x08) != 0)
+ NIBBLETYPE Light = std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY, a_RelZ)));
+
+ // Only grow if we have the right amount of light
+ if (Light > 8)
+ {
+ cFastRandom random;
+ // Only grow if we are in the right growth stage and have the right amount of space around them.
+ if (((Meta & 0x08) != 0) && (random.NextInt(99) < 45) && CanGrowAt(a_Chunk, a_RelX, a_RelY, a_RelZ, Meta))
+ {
+ int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
+ int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
+ a_Chunk.GetWorld()->GrowTree(BlockX, a_RelY, BlockZ);
+ }
+ // Only move to the next growth stage if we haven't gone there yet
+ else if (((Meta & 0x08) == 0) && (random.NextInt(99) < 45))
+ {
+ a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x08);
+ }
+ }
+ }
+
+ bool CanGrowAt(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta)
+ {
+ a_Meta = a_Meta & 0x07;
+ int CheckHeight = 0;
+ bool LargeTree = false;
+
+ // Get the height to check against
+ switch (a_Meta)
{
- int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
- int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
- a_Chunk.GetWorld()->GrowTree(BlockX, a_RelY, BlockZ);
+ case E_META_SAPLING_APPLE:
+ {
+ CheckHeight = 5;
+ break;
+ }
+ case E_META_SAPLING_CONIFER:
+ {
+ CheckHeight = 7;
+ if (IsLargeTree(a_Chunk, a_RelX, a_RelY, a_RelZ, a_Meta))
+ {
+ CheckHeight = 16;
+ LargeTree = true;
+ }
+ break;
+ }
+ case E_META_SAPLING_BIRCH:
+ {
+ CheckHeight = 6;
+ break;
+ }
+ case E_META_SAPLING_JUNGLE:
+ {
+ CheckHeight = 7;
+ if (IsLargeTree(a_Chunk, a_RelX, a_RelY, a_RelZ, a_Meta))
+ {
+ CheckHeight = 13;
+ LargeTree = true;
+ }
+ break;
+ }
+ // Dark Oaks only grow in a 2x2 area
+ case E_META_SAPLING_DARK_OAK:
+ {
+ if (!IsLargeTree(a_Chunk, a_RelX, a_RelY, a_RelZ, a_Meta))
+ {
+ return false;
+ }
+ CheckHeight = 7;
+ LargeTree = true;
+ break;
+ }
}
- else
+ // We should always get a valid CheckHeight
+ ASSERT(CheckHeight != 0);
+
+ // Don't grow a tree if we don't have enough space left above it in the chunk
+ if ((a_RelY + CheckHeight) > cChunkDef::Height)
+ {
+ return false;
+ }
+ bool CanGrow = true;
+
+ // Validate the neighbor blocks. They cannot be solid.
+ BLOCKTYPE check = E_BLOCK_AIR;
+ a_Chunk.UnboundedRelGetBlockType(a_RelX - 1, a_RelY, a_RelZ, check);
+ CanGrow = CanGrow && cBlockInfo::IsTransparent(check);
+
+ a_Chunk.UnboundedRelGetBlockType(a_RelX + 1, a_RelY, a_RelZ, check);
+ CanGrow = CanGrow && cBlockInfo::IsTransparent(check);
+
+ a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ - 1, check);
+ CanGrow = CanGrow && cBlockInfo::IsTransparent(check);
+
+ a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ + 1, check);
+ CanGrow = CanGrow && cBlockInfo::IsTransparent(check);
+
+
+
+ while (CheckHeight && CanGrow)
{
- a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x08);
+ check = a_Chunk.GetBlock(a_RelX, a_RelY + CheckHeight, a_RelZ);
+ CanGrow = CanGrow && ((check == E_BLOCK_AIR) || (check == E_BLOCK_LEAVES));
+
+ // We have to check above the neighboring saplings as well
+ if (LargeTree)
+ {
+ a_Chunk.UnboundedRelGetBlockType(a_RelX + 1, a_RelY + CheckHeight, a_RelZ, check);
+ CanGrow = CanGrow && ((check == E_BLOCK_AIR) || (check == E_BLOCK_LEAVES));
+
+ a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY + CheckHeight, a_RelZ + 1, check);
+ CanGrow = CanGrow && ((check == E_BLOCK_AIR) || (check == E_BLOCK_LEAVES));
+
+ a_Chunk.UnboundedRelGetBlockType(a_RelX + 1, a_RelY + CheckHeight, a_RelZ + 1, check);
+ CanGrow = CanGrow && ((check == E_BLOCK_AIR) || (check == E_BLOCK_LEAVES));
+ }
+
+ --CheckHeight;
}
+
+ return CanGrow;
+ }
+
+private:
+ bool IsLargeTree(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta)
+ {
+ BLOCKTYPE type;
+ NIBBLETYPE meta;
+ bool LargeTree = true;
+ a_Chunk.UnboundedRelGetBlock(a_RelX + 1, a_RelY, a_RelZ, type, meta);
+ LargeTree = LargeTree && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+
+ a_Chunk.UnboundedRelGetBlock(a_RelX + 1, a_RelY, a_RelZ + 1, type, meta);
+ LargeTree = LargeTree && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+
+ a_Chunk.UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ + 1, type, meta);
+ LargeTree = LargeTree && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+
+ return LargeTree;
}
} ;
diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h
index 4b1e38d6d..e52fbaa2f 100644
--- a/src/Blocks/BlockSideways.h
+++ b/src/Blocks/BlockSideways.h
@@ -58,12 +58,16 @@ public:
return a_Meta | 0x4; // East or west
}
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled block face!");
return a_Meta | 0xC; // No idea, give a special meta
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
} ;
diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h
index d762154df..58e85013e 100644
--- a/src/Blocks/BlockSlab.h
+++ b/src/Blocks/BlockSlab.h
@@ -41,7 +41,7 @@ public:
) override
{
a_BlockType = m_BlockType;
- NIBBLETYPE Meta = (NIBBLETYPE) a_Player->GetEquippedItem().m_ItemDamage;
+ NIBBLETYPE Meta = static_cast<NIBBLETYPE>(a_Player->GetEquippedItem().m_ItemDamage);
// Set the correct metadata based on player equipped item (i.e. a_BlockMeta not initialised yet)
switch (a_BlockFace)
@@ -88,12 +88,6 @@ public:
return true;
}
-
- virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override
- {
- return ((a_Meta & 0x8) != 0);
- }
-
/// Returns true if the specified blocktype is one of the slabs handled by this handler
static bool IsAnySlabType(BLOCKTYPE a_BlockType)
@@ -104,7 +98,7 @@ public:
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
{
- if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != (short)m_BlockType))
+ if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != static_cast<short>(m_BlockType)))
{
return;
}
diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h
index d396204e0..7ef69d2ec 100644
--- a/src/Blocks/BlockStairs.h
+++ b/src/Blocks/BlockStairs.h
@@ -62,12 +62,6 @@ public:
}
- virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override
- {
- return true;
- }
-
-
static NIBBLETYPE RotationToMetaData(double a_Rotation)
{
a_Rotation += 90 + 45; // So its not aligned with axis
diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h
index d63df94cf..0a834d13d 100644
--- a/src/Blocks/BlockTorch.h
+++ b/src/Blocks/BlockTorch.h
@@ -59,7 +59,7 @@ public:
case BLOCK_FACE_WEST: return E_META_TORCH_WEST;
case BLOCK_FACE_NORTH: return E_META_TORCH_NORTH;
case BLOCK_FACE_SOUTH: return E_META_TORCH_SOUTH;
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled torch direction!");
break;
@@ -103,6 +103,11 @@ public:
case E_BLOCK_STAINED_GLASS:
case E_BLOCK_FENCE:
case E_BLOCK_NETHER_BRICK_FENCE:
+ case E_BLOCK_SPRUCE_FENCE:
+ case E_BLOCK_BIRCH_FENCE:
+ case E_BLOCK_JUNGLE_FENCE:
+ case E_BLOCK_DARK_OAK_FENCE:
+ case E_BLOCK_ACACIA_FENCE:
case E_BLOCK_COBBLESTONE_WALL:
{
// Torches can only be placed on top of these blocks
@@ -114,6 +119,22 @@ public:
// Toches can be placed on the top of these slabs only if the occupy the top half of the voxel
return ((a_BlockFace == BLOCK_FACE_YP) && ((a_BlockMeta & 0x08) == 0x08));
}
+ case E_BLOCK_WOODEN_STAIRS:
+ case E_BLOCK_COBBLESTONE_STAIRS:
+ case E_BLOCK_BRICK_STAIRS:
+ case E_BLOCK_STONE_BRICK_STAIRS:
+ case E_BLOCK_NETHER_BRICK_STAIRS:
+ case E_BLOCK_SANDSTONE_STAIRS:
+ case E_BLOCK_SPRUCE_WOOD_STAIRS:
+ case E_BLOCK_BIRCH_WOOD_STAIRS:
+ case E_BLOCK_JUNGLE_WOOD_STAIRS:
+ case E_BLOCK_QUARTZ_STAIRS:
+ case E_BLOCK_ACACIA_WOOD_STAIRS:
+ case E_BLOCK_DARK_OAK_WOOD_STAIRS:
+ case E_BLOCK_RED_SANDSTONE_STAIRS:
+ {
+ return (a_BlockFace == BLOCK_FACE_TOP) && (a_BlockMeta & E_BLOCK_STAIRS_UPSIDE_DOWN);
+ }
default:
{
if (cBlockInfo::FullyOccupiesVoxel(a_BlockType))
diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h
index dbb0b5a5b..a1d2dff6f 100644
--- a/src/Blocks/BlockTrapdoor.h
+++ b/src/Blocks/BlockTrapdoor.h
@@ -66,6 +66,7 @@ public:
return true;
}
+
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
{
switch (a_BlockFace)
@@ -74,14 +75,21 @@ public:
case BLOCK_FACE_ZM: return 0x0;
case BLOCK_FACE_XP: return 0x3;
case BLOCK_FACE_XM: return 0x2;
- default:
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
{
ASSERT(!"Unhandled block face!");
return 0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
+
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{
switch (a_Meta & 0x3)
@@ -98,6 +106,7 @@ public:
}
}
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
NIBBLETYPE Meta;
diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h
index 88d389711..39892af5a 100644
--- a/src/Blocks/BlockTripwireHook.h
+++ b/src/Blocks/BlockTripwireHook.h
@@ -16,6 +16,7 @@ public:
{
}
+
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@@ -29,6 +30,7 @@ public:
return true;
}
+
inline static NIBBLETYPE DirectionToMetadata(eBlockFace a_Direction)
{
switch (a_Direction)
@@ -37,10 +39,21 @@ public:
case BLOCK_FACE_XP: return 0x3;
case BLOCK_FACE_ZM: return 0x2;
case BLOCK_FACE_ZP: return 0x0;
- default: ASSERT(!"Unhandled tripwire hook direction!"); return 0x0;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ ASSERT(!"Unhandled tripwire hook direction!");
+ return 0x0;
+ }
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
+
inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta)
{
switch (a_Meta & 0x03)
@@ -53,6 +66,7 @@ public:
}
}
+
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to zero
diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h
index 00d7a69b8..3d06a8223 100644
--- a/src/Blocks/BlockVine.h
+++ b/src/Blocks/BlockVine.h
@@ -177,7 +177,7 @@ public:
}
- virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
+ virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
UNUSED(a_ChunkInterface);
UNUSED(a_WorldInterface);
diff --git a/src/Blocks/BlockWallSign.h b/src/Blocks/BlockWallSign.h
index b6599d033..9b90b78bf 100644
--- a/src/Blocks/BlockWallSign.h
+++ b/src/Blocks/BlockWallSign.h
@@ -55,11 +55,13 @@ public:
{
switch (a_Direction)
{
- case 0x2: return 0x2;
- case 0x3: return 0x3;
- case 0x4: return 0x4;
- case 0x5: return 0x5;
- default:
+ case BLOCK_FACE_ZM: return 0x2;
+ case BLOCK_FACE_ZP: return 0x3;
+ case BLOCK_FACE_XM: return 0x4;
+ case BLOCK_FACE_XP: return 0x5;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YP:
+ case BLOCK_FACE_YM:
{
break;
}
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index ed3e321d4..d8affd9cf 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -95,6 +95,11 @@ SET (HDRS
MetaRotator.h
WorldInterface.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(BlockHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(BlockPiston.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Blocks ${SRCS} ${HDRS})
endif()
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h
index 44c118195..826df7034 100644
--- a/src/Blocks/WorldInterface.h
+++ b/src/Blocks/WorldInterface.h
@@ -55,6 +55,18 @@ public:
/** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */
virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0;
+ /** Returns or sets the minumim or maximum netherportal width */
+ virtual int GetMinNetherPortalWidth(void) const = 0;
+ virtual int GetMaxNetherPortalWidth(void) const = 0;
+ virtual void SetMinNetherPortalWidth(int a_NewMinWidth) = 0;
+ virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) = 0;
+
+ /** Returns or sets the minumim or maximum netherportal height */
+ virtual int GetMinNetherPortalHeight(void) const = 0;
+ virtual int GetMaxNetherPortalHeight(void) const = 0;
+ virtual void SetMinNetherPortalHeight(int a_NewMinHeight) = 0;
+ virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) = 0;
+
/** Returns the world height at the specified coords; waits for the chunk to get loaded / generated */
virtual int GetHeight(int a_BlockX, int a_BlockZ) = 0;
diff --git a/src/BoundingBox.cpp b/src/BoundingBox.cpp
index 6b163b01e..64e3c02d2 100644
--- a/src/BoundingBox.cpp
+++ b/src/BoundingBox.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "BoundingBox.h"
#include "Defines.h"
+#include "SelfTests.h"
@@ -18,6 +19,11 @@ static class SelfTest_BoundingBox
public:
SelfTest_BoundingBox(void)
{
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&Test), "Bounding box intersections");
+ }
+
+ static void Test(void)
+ {
Vector3d Min(1, 1, 1);
Vector3d Max(2, 2, 2);
Vector3d LineDefs[] =
@@ -41,7 +47,7 @@ public:
bool res = cBoundingBox::CalcLineIntersection(Min, Max, Line1, Line2, LineCoeff, Face);
if (res != Results[i])
{
- fprintf(stderr, "LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d\n",
+ LOGERROR("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d",
Line1.x, Line1.y, Line1.z,
Line2.x, Line2.y, Line2.z,
res ? 1 : 0, LineCoeff, Face
@@ -52,7 +58,7 @@ public:
{
if (LineCoeff != LineCoeffs[i])
{
- fprintf(stderr, "LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d\n",
+ LOGERROR("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d",
Line1.x, Line1.y, Line1.z,
Line2.x, Line2.y, Line2.z,
res ? 1 : 0, LineCoeff, Face
@@ -61,9 +67,8 @@ public:
}
}
} // for i - LineDefs[]
- fprintf(stderr, "BoundingBox selftest complete.\n");
}
-} gTest;
+} g_BoundingBoxTest;
#endif
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index dc757d8f6..f50e3845b 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -8,6 +8,7 @@
#include "ByteBuffer.h"
#include "Endianness.h"
#include "OSSupport/IsThread.h"
+#include "SelfTests.h"
@@ -55,18 +56,18 @@ Unfortunately it is very slow, so it is disabled even for regular DEBUG builds.
#ifdef SELF_TEST
-/// Self-test of the VarInt-reading and writing code
+/** Self-test of the VarInt-reading and writing code */
static class cByteBufferSelfTest
{
public:
cByteBufferSelfTest(void)
{
- TestRead();
- TestWrite();
- TestWrap();
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestRead), "ByteBuffer read");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestWrite), "ByteBuffer write");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestWrap), "ByteBuffer wraparound");
}
- void TestRead(void)
+ static void TestRead(void)
{
cByteBuffer buf(50);
buf.Write("\x05\xac\x02\x00", 4);
@@ -78,7 +79,7 @@ public:
assert_test(buf.ReadVarInt(v3) && (v3 == 0));
}
- void TestWrite(void)
+ static void TestWrite(void)
{
cByteBuffer buf(50);
buf.WriteVarInt32(5);
@@ -90,7 +91,7 @@ public:
assert_test(memcmp(All.data(), "\x05\xac\x02\x00", All.size()) == 0);
}
- void TestWrap(void)
+ static void TestWrap(void)
{
cByteBuffer buf(3);
for (int i = 0; i < 1000; i++)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2e367bcf5..6c8fe7d0c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -48,18 +48,23 @@ SET (SRCS
Logger.cpp
Map.cpp
MapManager.cpp
+ MemorySettingsRepository.cpp
MobCensus.cpp
MobFamilyCollecter.cpp
MobProximityCounter.cpp
MobSpawner.cpp
MonsterConfig.cpp
+ NetherPortalScanner.cpp
+ OverridesSettingsRepository.cpp
ProbabDistrib.cpp
RankManager.cpp
RCONServer.cpp
Root.cpp
Scoreboard.cpp
+ SelfTests.cpp
Server.cpp
SetChunkData.cpp
+ SpawnPrepare.cpp
Statistics.cpp
StringCompression.cpp
StringUtils.cpp
@@ -80,6 +85,7 @@ SET (HDRS
BlockTracer.h
Broadcaster.h
BoundingBox.h
+ BuildInfo.h
BuildInfo.h.cmake
ByteBuffer.h
ChatColor.h
@@ -116,18 +122,24 @@ SET (HDRS
Map.h
MapManager.h
Matrix4.h
+ MemorySettingsRepository.h
MobCensus.h
MobFamilyCollecter.h
MobProximityCounter.h
MobSpawner.h
MonsterConfig.h
+ NetherPortalScanner.h
+ OverridesSettingsRepository.h
ProbabDistrib.h
RankManager.h
RCONServer.h
Root.h
Scoreboard.h
+ SelfTests.h
Server.h
SetChunkData.h
+ SettingsRepositoryInterface.h
+ SpawnPrepare.h
Statistics.h
StringCompression.h
StringUtils.h
@@ -142,9 +154,42 @@ SET (HDRS
include_directories(".")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/SQLiteCpp/include")
+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(BlockArea.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
+ 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 -Wno-error=float-equal")
+ set_source_files_properties(ByteBuffer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast -Wno-error=global-constructors")
+ set_source_files_properties(Chunk.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(ChunkData.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(ChunkMap.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(ClientHandle.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=old-style-cast")
+ set_source_files_properties(CompositeChat.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=missing-variable-declarations")
+ set_source_files_properties(Enchantments.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(IniFile.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(Inventory.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
+ set_source_files_properties(Item.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
+ set_source_files_properties(ItemGrid.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion")
+ set_source_files_properties(LightingThread.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=sign-conversion")
+ set_source_files_properties(LinearInterpolation.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(Map.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
+ set_source_files_properties(MobProximityCounter.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal")
+ set_source_files_properties(MobSpawner.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+ set_source_files_properties(RCONServer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
+ set_source_files_properties(Root.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shadow -Wno-error=old-style-cast")
+ set_source_files_properties(Server.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(Statistics.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
+ set_source_files_properties(StringCompression.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(StringUtils.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
+ set_source_files_properties(Tracer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
+ set_source_files_properties(World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=missing-variable-declarations -Wno-error=missing-prototypes")
+endif()
+
if (NOT MSVC)
# Bindings need to reference other folders, so they are done here instead
# lib dependencies are not included
@@ -326,4 +371,9 @@ endif ()
if (WIN32)
target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib)
endif()
-target_link_libraries(${EXECUTABLE} luaexpat jsoncpp mbedtls zlib sqlite lua SQLiteCpp event_core event_extra)
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+ add_flags_lnk(-L/usr/local/lib)
+endif()
+
+target_link_libraries(${EXECUTABLE} luaexpat jsoncpp_lib_static mbedtls zlib sqlite lua SQLiteCpp event_core event_extra)
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 7d5f54373..b6ec39294 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -411,7 +411,7 @@ void cChunk::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlock
int OffZ = BlockStartZ - m_PosZ * cChunkDef::Width;
int BaseX = BlockStartX - a_MinBlockX;
int BaseZ = BlockStartZ - a_MinBlockZ;
- int SizeY = a_Area.GetSizeY();
+ int SizeY = std::min(a_Area.GetSizeY(), cChunkDef::Height - a_MinBlockY);
// TODO: Improve this by not calling FastSetBlock() and doing the processing here
// so that the heightmap is touched only once for each column.
@@ -640,6 +640,7 @@ void cChunk::Tick(std::chrono::milliseconds a_Dt)
else if ((*itr)->IsWorldTravellingFrom(m_World))
{
// Remove all entities that are travelling to another world
+ LOGD("Removing entity from [%d, %d] that's travelling between worlds.", m_PosX, m_PosZ);
MarkDirty();
(*itr)->SetWorldTravellingFrom(nullptr);
itr = m_Entities.erase(itr);
@@ -695,7 +696,6 @@ void cChunk::MoveEntityToNewChunk(cEntity * a_Entity)
}
ASSERT(Neighbor != this); // Moving into the same chunk? wtf?
-
Neighbor->AddEntity(a_Entity);
class cMover :
@@ -714,8 +714,8 @@ void cChunk::MoveEntityToNewChunk(cEntity * a_Entity)
cEntity * m_Entity;
public:
- cMover(cEntity * a_Entity) :
- m_Entity(a_Entity)
+ cMover(cEntity * a_CallbackEntity) :
+ m_Entity(a_CallbackEntity)
{}
} Mover(a_Entity);
@@ -1018,20 +1018,26 @@ void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_Bl
// Check if there's soil under the neighbor. We already know the neighbors are valid. Place produce if ok
BLOCKTYPE Soil;
- UnboundedRelGetBlock(a_RelX + x, a_RelY - 1, a_RelZ + z, Soil, BlockMeta);
+ VERIFY(UnboundedRelGetBlock(a_RelX + x, a_RelY - 1, a_RelZ + z, Soil, BlockMeta));
switch (Soil)
{
case E_BLOCK_DIRT:
case E_BLOCK_GRASS:
case E_BLOCK_FARMLAND:
{
- // DEBUG: This is here to catch FS #349 - melons growing over other crops.
- LOG("Growing melon / pumpkin overwriting %s, growing on %s",
+ // Place a randomly-facing produce:
+ NIBBLETYPE Meta = (ProduceType == E_BLOCK_MELON) ? 0 : static_cast<NIBBLETYPE>(a_TickRandom.randInt(4) % 4);
+ LOGD("Growing melon / pumpkin at {%d, %d, %d} (<%d, %d> from stem), overwriting %s, growing on top of %s, meta %d",
+ a_RelX + x + m_PosX * cChunkDef::Width, a_RelY, a_RelZ + z + m_PosZ * cChunkDef::Width,
+ x, z,
ItemTypeToString(BlockType[CheckType]).c_str(),
- ItemTypeToString(Soil).c_str()
+ ItemTypeToString(Soil).c_str(),
+ Meta
);
- // Place a randomly-facing produce:
- UnboundedRelFastSetBlock(a_RelX + x, a_RelY, a_RelZ + z, ProduceType, (NIBBLETYPE)(a_TickRandom.randInt(4) % 4));
+ VERIFY(UnboundedRelFastSetBlock(a_RelX + x, a_RelY, a_RelZ + z, ProduceType, Meta));
+ auto Absolute = RelativeToAbsolute(Vector3i{a_RelX + x, a_RelY, a_RelZ + z}, m_PosX, m_PosZ);
+ cChunkInterface ChunkInterface(this->GetWorld()->GetChunkMap());
+ cBlockHandler::NeighborChanged(ChunkInterface, Absolute.x, Absolute.y - 1, Absolute.z, BLOCK_FACE_YP);
break;
}
}
@@ -2852,22 +2858,6 @@ void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cons
-void cChunk::BroadcastChunkData(cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude)
-{
- for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
- {
- if (*itr == a_Exclude)
- {
- continue;
- }
- (*itr)->SendChunkData(m_PosX, m_PosZ, a_Serializer);
- } // for itr - LoadedByClient[]
-}
-
-
-
-
-
void cChunk::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude)
{
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
diff --git a/src/Chunk.h b/src/Chunk.h
index f57769107..fd9ea0b0c 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -319,7 +319,6 @@ public:
void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr);
void BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = nullptr);
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = nullptr);
- void BroadcastChunkData (cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude = nullptr);
void BroadcastCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
void BroadcastDestroyEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr);
void BroadcastEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration, const cClientHandle * a_Exclude = nullptr);
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index 2bfa2949c..57c4e6918 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -96,6 +96,25 @@ public:
a_Z = a_Z - a_ChunkZ * Width;
}
+ inline static Vector3i AbsoluteToRelative(Vector3i a_BlockPosition)
+ {
+ int ChunkX, ChunkZ;
+ BlockToChunk(a_BlockPosition.x, a_BlockPosition.z, ChunkX, ChunkZ);
+
+ return {a_BlockPosition.x - ChunkX * Width, a_BlockPosition.y, a_BlockPosition.z - ChunkZ * Width};
+ }
+
+ inline static Vector3i AbsoluteToRelative(Vector3i a_BlockPosition, int a_ChunkX, int a_ChunkZ)
+ {
+ return {a_BlockPosition.x - a_ChunkX * Width, a_BlockPosition.y, a_BlockPosition.z - a_ChunkZ * Width};
+ }
+
+ /** Converts relative block coordinates into absolute coordinates with a known chunk location */
+ inline static Vector3i RelativeToAbsolute(const Vector3i & a_RelBlockPosition, int a_ChunkX, int a_ChunkZ)
+ {
+ return Vector3i(a_RelBlockPosition.x + a_ChunkX * Width, a_RelBlockPosition.y, a_RelBlockPosition.z + a_ChunkZ * Width);
+ }
+
/// Converts absolute block coords to chunk coords:
inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ)
@@ -190,7 +209,7 @@ public:
}
- inline static int GetHeight(const HeightMap & a_HeightMap, int a_X, int a_Z)
+ inline static HEIGHTTYPE GetHeight(const HeightMap & a_HeightMap, int a_X, int a_Z)
{
ASSERT((a_X >= 0) && (a_X < Width));
ASSERT((a_Z >= 0) && (a_Z < Width));
@@ -198,7 +217,7 @@ public:
}
- inline static void SetHeight(HeightMap & a_HeightMap, int a_X, int a_Z, unsigned char a_Height)
+ inline static void SetHeight(HeightMap & a_HeightMap, int a_X, int a_Z, HEIGHTTYPE a_Height)
{
ASSERT((a_X >= 0) && (a_X < Width));
ASSERT((a_Z >= 0) && (a_Z < Width));
@@ -495,32 +514,3 @@ typedef cCoordWithData<BLOCKTYPE> cCoordWithBlock;
typedef std::list<cCoordWithInt> cCoordWithIntList;
typedef std::vector<cCoordWithInt> cCoordWithIntVector;
-
-
-
-
-
-/** Generic template that can store two types of any kind of data together with a triplet of 3 coords */
-template <typename X, typename Z> class cCoordWithDoubleData
-{
-public:
- int x;
- int y;
- int z;
- X Data;
- Z DataTwo;
-
- cCoordWithDoubleData(int a_X, int a_Y, int a_Z) :
- x(a_X), y(a_Y), z(a_Z)
- {
- }
-
- cCoordWithDoubleData(int a_X, int a_Y, int a_Z, const X & a_Data, const Z & a_DataTwo) :
- x(a_X), y(a_Y), z(a_Z), Data(a_Data), DataTwo(a_DataTwo)
- {
- }
-};
-
-typedef cCoordWithDoubleData <BLOCKTYPE, bool> cCoordWithBlockAndBool;
-
-typedef std::vector<cCoordWithBlockAndBool> cCoordWithBlockAndBoolVector;
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 44acc2013..4db73971c 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -409,22 +409,6 @@ void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, c
-void cChunkMap::BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude)
-{
- cCSLock Lock(m_CSLayers);
- cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, a_ChunkZ);
- if (Chunk == nullptr)
- {
- return;
- }
- // It's perfectly legal to broadcast packets even to invalid chunks!
- Chunk->BroadcastChunkData(a_Serializer, a_Exclude);
-}
-
-
-
-
-
void cChunkMap::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude)
{
cCSLock Lock(m_CSLayers);
@@ -2401,7 +2385,7 @@ void cChunkMap::TouchChunk(int a_ChunkX, int a_ChunkZ)
-void cChunkMap::PrepareChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback)
+void cChunkMap::PrepareChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_Callback)
{
cCSLock Lock(m_CSLayers);
cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, a_ChunkZ);
@@ -2409,7 +2393,7 @@ void cChunkMap::PrepareChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a
// If the chunk is not prepared, queue it in the lighting thread, that will do all the needed processing:
if ((Chunk == nullptr) || !Chunk->IsValid() || !Chunk->IsLightValid())
{
- m_World->GetLightingThread().QueueChunk(a_ChunkX, a_ChunkZ, a_Callback);
+ m_World->GetLightingThread().QueueChunk(a_ChunkX, a_ChunkZ, std::move(a_Callback));
return;
}
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 35f66f339..916a3433d 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -73,7 +73,6 @@ public:
void BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr);
void BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = nullptr);
void BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude);
- void BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude = nullptr);
void BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
void BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
void BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr);
@@ -322,7 +321,7 @@ public:
The specified chunk is queued to be loaded or generated, and lit if needed.
The specified callback is called after the chunk has been prepared. If there's no preparation to do, only the callback is called.
It is legal to call without the callback. */
- void PrepareChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallAfter = nullptr); // Lua-accessible
+ void PrepareChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallAfter = {}); // Lua-accessible
/** Queues the chunk for generating.
First attempts to load the chunk from the storage. If that fails, queues the chunk for generating.
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp
index 83d82884e..de886b497 100644
--- a/src/ChunkSender.cpp
+++ b/src/ChunkSender.cpp
@@ -13,6 +13,7 @@
#include "BlockEntities/BlockEntity.h"
#include "Protocol/ChunkDataSerializer.h"
#include "ClientHandle.h"
+#include "Chunk.h"
@@ -21,25 +22,37 @@
////////////////////////////////////////////////////////////////////////////////
// cNotifyChunkSender:
-void cNotifyChunkSender::Call(int a_ChunkX, int a_ChunkZ)
-{
- m_ChunkSender->ChunkReady(a_ChunkX, a_ChunkZ);
-}
+/// Callback that can be used to notify chunk sender upon another chunkcoord notification
+class cNotifyChunkSender :
+ public cChunkCoordCallback
+{
+ virtual void Call(int a_ChunkX, int a_ChunkZ) override
+ {
+ cChunkSender & ChunkSender = m_ChunkSender;
+ m_World.DoWithChunk(
+ a_ChunkX, a_ChunkZ,
+ [&ChunkSender] (cChunk & a_Chunk) -> bool
+ {
+ ChunkSender.QueueSendChunkTo(a_Chunk.GetPosX(), a_Chunk.GetPosZ(), cChunkSender::E_CHUNK_PRIORITY_MIDHIGH, a_Chunk.GetAllClients());
+ return true;
+ }
+ );
+ }
+ cChunkSender & m_ChunkSender;
+ cWorld & m_World;
+public:
+ cNotifyChunkSender(cChunkSender & a_ChunkSender, cWorld & a_World) : m_ChunkSender(a_ChunkSender), m_World(a_World) {}
-////////////////////////////////////////////////////////////////////////////////
-// cChunkSender:
+};
-cChunkSender::cChunkSender(void) :
+cChunkSender::cChunkSender(cWorld & a_World) :
super("ChunkSender"),
- m_World(nullptr),
- m_RemoveCount(0),
- m_Notify(nullptr)
+ m_World(a_World)
{
- m_Notify.SetChunkSender(this);
}
@@ -55,10 +68,9 @@ cChunkSender::~cChunkSender()
-bool cChunkSender::Start(cWorld * a_World)
+bool cChunkSender::Start()
{
m_ShouldTerminate = false;
- m_World = a_World;
return super::Start();
}
@@ -77,12 +89,30 @@ void cChunkSender::Stop(void)
-void cChunkSender::ChunkReady(int a_ChunkX, int a_ChunkZ)
+void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, cClientHandle * a_Client)
{
- // This is probably never gonna be called twice for the same chunk, and if it is, we don't mind, so we don't check
+ ASSERT(a_Client != nullptr);
{
+ cChunkCoords Chunk{a_ChunkX, a_ChunkZ};
cCSLock Lock(m_CS);
- m_ChunksReady.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
+ auto iter = m_ChunkInfo.find(Chunk);
+ if (iter != m_ChunkInfo.end())
+ {
+ auto & info = iter->second;
+ if (info.m_Priority > a_Priority)
+ {
+ m_SendChunks.push(sChunkQueue{a_Priority, Chunk});
+ info.m_Priority = a_Priority;
+ }
+ info.m_Clients.insert(a_Client);
+ }
+ else
+ {
+ m_SendChunks.push(sChunkQueue{a_Priority, Chunk});
+ auto info = sSendChunk{Chunk, a_Priority};
+ info.m_Clients.insert(a_Client);
+ m_ChunkInfo.emplace(Chunk, info);
+ }
}
m_evtQueue.Set();
}
@@ -91,44 +121,29 @@ void cChunkSender::ChunkReady(int a_ChunkX, int a_ChunkZ)
-void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, cClientHandle * a_Client)
+
+void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, std::list<cClientHandle *> a_Clients)
{
- ASSERT(a_Client != nullptr);
{
- sSendChunk Chunk(a_ChunkX, a_ChunkZ, a_Client);
-
+ cChunkCoords Chunk{a_ChunkX, a_ChunkZ};
cCSLock Lock(m_CS);
- if (
- std::find(m_SendChunksLowPriority.begin(), m_SendChunksLowPriority.end(), Chunk) != m_SendChunksLowPriority.end() ||
- std::find(m_SendChunksMediumPriority.begin(), m_SendChunksMediumPriority.end(), Chunk) != m_SendChunksMediumPriority.end() ||
- std::find(m_SendChunksHighPriority.begin(), m_SendChunksHighPriority.end(), Chunk) != m_SendChunksHighPriority.end()
- )
- {
- // Already queued, bail out
- return;
- }
-
- switch (a_Priority)
+ auto iter = m_ChunkInfo.find(Chunk);
+ if (iter != m_ChunkInfo.end())
{
- case E_CHUNK_PRIORITY_LOW:
+ auto & info = iter->second;
+ if (info.m_Priority > a_Priority)
{
- m_SendChunksLowPriority.push_back(Chunk);
- break;
- }
- case E_CHUNK_PRIORITY_MEDIUM:
- {
- m_SendChunksMediumPriority.push_back(Chunk);
- break;
- }
- case E_CHUNK_PRIORITY_HIGH:
- {
- m_SendChunksHighPriority.push_back(Chunk);
- break;
- }
- default:
- {
- ASSERT(!"Unknown chunk priority!");
+ m_SendChunks.push(sChunkQueue{a_Priority, Chunk});
+ info.m_Priority = a_Priority;
}
+ info.m_Clients.insert(a_Clients.begin(), a_Clients.end());
+ }
+ else
+ {
+ m_SendChunks.push(sChunkQueue{a_Priority, Chunk});
+ auto info = sSendChunk{Chunk, a_Priority};
+ info.m_Clients.insert(a_Clients.begin(), a_Clients.end());
+ m_ChunkInfo.emplace(Chunk, info);
}
}
m_evtQueue.Set();
@@ -142,37 +157,14 @@ void cChunkSender::RemoveClient(cClientHandle * a_Client)
{
{
cCSLock Lock(m_CS);
- for (sSendChunkList::iterator itr = m_SendChunksLowPriority.begin(); itr != m_SendChunksLowPriority.end();)
+ for (auto && pair : m_ChunkInfo)
{
- if (itr->m_Client == a_Client)
- {
- itr = m_SendChunksLowPriority.erase(itr);
- continue;
- }
- ++itr;
- } // for itr - m_SendChunksLowPriority[]
- for (sSendChunkList::iterator itr = m_SendChunksMediumPriority.begin(); itr != m_SendChunksMediumPriority.end();)
- {
- if (itr->m_Client == a_Client)
- {
- itr = m_SendChunksMediumPriority.erase(itr);
- continue;
- }
- ++itr;
- } // for itr - m_SendChunksMediumPriority[]
- for (sSendChunkList::iterator itr = m_SendChunksHighPriority.begin(); itr != m_SendChunksHighPriority.end();)
- {
- if (itr->m_Client == a_Client)
- {
- itr = m_SendChunksHighPriority.erase(itr);
- continue;
- }
- ++itr;
- } // for itr - m_SendChunksHighPriority[]
- m_RemoveCount++;
+ auto && clients = pair.second.m_Clients;
+ clients.erase(a_Client); // nop for sets that do not contain a_Client
+ }
}
m_evtQueue.Set();
- m_evtRemoved.Wait(); // Wait for removal confirmation
+ m_evtRemoved.Wait(); // Wait for all remaining instances of a_Client to be processed (Execute() makes a copy of m_ChunkInfo)
}
@@ -183,132 +175,91 @@ void cChunkSender::Execute(void)
{
while (!m_ShouldTerminate)
{
- cCSLock Lock(m_CS);
- while (m_ChunksReady.empty() && m_SendChunksLowPriority.empty() && m_SendChunksMediumPriority.empty() && m_SendChunksHighPriority.empty())
+ m_evtQueue.Wait();
+
{
- int RemoveCount = m_RemoveCount;
- m_RemoveCount = 0;
- cCSUnlock Unlock(Lock);
- for (int i = 0; i < RemoveCount; i++)
- {
- m_evtRemoved.Set(); // Notify that the removed clients are safe to be deleted
- }
- m_evtQueue.Wait();
- if (m_ShouldTerminate)
+ cCSLock Lock(m_CS);
+ while (!m_SendChunks.empty())
{
- return;
+ // Take one from the queue:
+ auto Chunk = m_SendChunks.top().m_Chunk;
+ m_SendChunks.pop();
+ auto itr = m_ChunkInfo.find(Chunk);
+ if (itr == m_ChunkInfo.end())
+ {
+ continue;
+ }
+
+ std::unordered_set<cClientHandle *> clients;
+ std::swap(itr->second.m_Clients, clients);
+ m_ChunkInfo.erase(itr);
+
+ cCSUnlock Unlock(Lock);
+ SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ, clients);
}
- } // while (empty)
-
- if (!m_SendChunksHighPriority.empty())
- {
- // Take one from the queue:
- sSendChunk Chunk(m_SendChunksHighPriority.front());
- m_SendChunksHighPriority.pop_front();
- Lock.Unlock();
-
- SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ, Chunk.m_Client);
- }
- else if (!m_ChunksReady.empty())
- {
- // Take one from the queue:
- cChunkCoords Coords(m_ChunksReady.front());
- m_ChunksReady.pop_front();
- Lock.Unlock();
-
- SendChunk(Coords.m_ChunkX, Coords.m_ChunkZ, nullptr);
}
- else if (!m_SendChunksMediumPriority.empty())
- {
- // Take one from the queue:
- sSendChunk Chunk(m_SendChunksMediumPriority.front());
- m_SendChunksMediumPriority.pop_front();
- Lock.Unlock();
- SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ, Chunk.m_Client);
- }
- else
- {
- // Take one from the queue:
- sSendChunk Chunk(m_SendChunksLowPriority.front());
- m_SendChunksLowPriority.pop_front();
- Lock.Unlock();
-
- SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ, Chunk.m_Client);
- }
- Lock.Lock();
- int RemoveCount = m_RemoveCount;
- m_RemoveCount = 0;
- Lock.Unlock();
- for (int i = 0; i < RemoveCount; i++)
- {
- m_evtRemoved.Set(); // Notify that the removed clients are safe to be deleted
- }
- } // while (!mShouldTerminate)
+ m_evtRemoved.SetAll(); // Notify all waiting threads that all clients are processed and thus safe to destroy
+ } // while (!m_ShouldTerminate)
}
-void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client)
+void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, std::unordered_set<cClientHandle *> a_Clients)
{
- ASSERT(m_World != nullptr);
-
// Ask the client if it still wants the chunk:
- if ((a_Client != nullptr) && !a_Client->WantsSendChunk(a_ChunkX, a_ChunkZ))
+ for (auto itr = a_Clients.begin(); itr != a_Clients.end();)
{
- return;
+ if (!(*itr)->WantsSendChunk(a_ChunkX, a_ChunkZ))
+ {
+ itr = a_Clients.erase(itr);
+ }
+ else
+ {
+ itr++;
+ }
}
// If the chunk has no clients, no need to packetize it:
- if (!m_World->HasChunkAnyClients(a_ChunkX, a_ChunkZ))
+ if (!m_World.HasChunkAnyClients(a_ChunkX, a_ChunkZ))
{
return;
}
// If the chunk is not valid, do nothing - whoever needs it has queued it for loading / generating
- if (!m_World->IsChunkValid(a_ChunkX, a_ChunkZ))
+ if (!m_World.IsChunkValid(a_ChunkX, a_ChunkZ))
{
return;
}
// If the chunk is not lighted, queue it for relighting and get notified when it's ready:
- if (!m_World->IsChunkLighted(a_ChunkX, a_ChunkZ))
+ if (!m_World.IsChunkLighted(a_ChunkX, a_ChunkZ))
{
- m_World->QueueLightChunk(a_ChunkX, a_ChunkZ, &m_Notify);
+ m_World.QueueLightChunk(a_ChunkX, a_ChunkZ, cpp14::make_unique<cNotifyChunkSender>(*this, m_World));
return;
}
// Query and prepare chunk data:
- if (!m_World->GetChunkData(a_ChunkX, a_ChunkZ, *this))
+ if (!m_World.GetChunkData(a_ChunkX, a_ChunkZ, *this))
{
return;
}
cChunkDataSerializer Data(m_BlockTypes, m_BlockMetas, m_BlockLight, m_BlockSkyLight, m_BiomeMap);
- // Send:
- if (a_Client == nullptr)
- {
- m_World->BroadcastChunkData(a_ChunkX, a_ChunkZ, Data);
- }
- else
+ for (const auto client : a_Clients)
{
- a_Client->SendChunkData(a_ChunkX, a_ChunkZ, Data);
- }
+ // Send:
+ client->SendChunkData(a_ChunkX, a_ChunkZ, Data);
- // Send block-entity packets:
- for (sBlockCoords::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
- {
- if (a_Client == nullptr)
+ // Send block-entity packets:
+ for (const auto & Pos : m_BlockEntities)
{
- m_World->BroadcastBlockEntity(itr->m_BlockX, itr->m_BlockY, itr->m_BlockZ);
- }
- else
- {
- m_World->SendBlockEntity(itr->m_BlockX, itr->m_BlockY, itr->m_BlockZ, *a_Client);
- }
- } // for itr - m_Packets[]
+ m_World.SendBlockEntity(Pos.x, Pos.y, Pos.z, *client);
+ } // for itr - m_Packets[]
+
+ }
m_BlockEntities.clear();
// TODO: Send entity spawn packets
@@ -320,7 +271,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Clien
void cChunkSender::BlockEntity(cBlockEntity * a_Entity)
{
- m_BlockEntities.push_back(sBlockCoord(a_Entity->GetPosX(), a_Entity->GetPosY(), a_Entity->GetPosZ()));
+ m_BlockEntities.push_back(a_Entity->GetPos());
}
@@ -342,7 +293,7 @@ void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
if ((*a_BiomeMap)[i] < 255)
{
// Normal MC biome, copy as-is:
- m_BiomeMap[i] = (unsigned char)((*a_BiomeMap)[i]);
+ m_BiomeMap[i] = static_cast<unsigned char>((*a_BiomeMap)[i]);
}
else
{
diff --git a/src/ChunkSender.h b/src/ChunkSender.h
index 8b187c5f9..fd9275794 100644
--- a/src/ChunkSender.h
+++ b/src/ChunkSender.h
@@ -1,4 +1,4 @@
-
+
// ChunkSender.h
// Interfaces to the cChunkSender class representing the thread that waits for chunks becoming ready (loaded / generated) and sends them to clients
@@ -29,6 +29,9 @@ Note that it may be called by world's BroadcastToChunk() if the client is still
#include "ChunkDef.h"
#include "ChunkDataCallback.h"
+#include <unordered_set>
+#include <unordered_map>
+
@@ -47,115 +50,79 @@ class cChunkSender;
-/// Callback that can be used to notify chunk sender upon another chunkcoord notification
-class cNotifyChunkSender :
- public cChunkCoordCallback
-{
- virtual void Call(int a_ChunkX, int a_ChunkZ) override;
-
- cChunkSender * m_ChunkSender;
-public:
- cNotifyChunkSender(cChunkSender * a_ChunkSender) : m_ChunkSender(a_ChunkSender) {}
-
- void SetChunkSender(cChunkSender * a_ChunkSender)
- {
- m_ChunkSender = a_ChunkSender;
- }
-} ;
-
-
-
-
-
class cChunkSender:
public cIsThread,
public cChunkDataSeparateCollector
{
typedef cIsThread super;
public:
- cChunkSender(void);
+ cChunkSender(cWorld & a_World);
~cChunkSender();
enum eChunkPriority
{
- E_CHUNK_PRIORITY_HIGH = 0,
- E_CHUNK_PRIORITY_MEDIUM = 1,
- E_CHUNK_PRIORITY_LOW = 2,
+ E_CHUNK_PRIORITY_HIGH = 0,
+ E_CHUNK_PRIORITY_MIDHIGH,
+ E_CHUNK_PRIORITY_MEDIUM,
+ E_CHUNK_PRIORITY_LOW,
+
};
- bool Start(cWorld * a_World);
+ bool Start();
void Stop(void);
- /// Notifies that a chunk has become ready and it should be sent to all its clients
- void ChunkReady(int a_ChunkX, int a_ChunkZ);
-
/// Queues a chunk to be sent to a specific client
void QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, cClientHandle * a_Client);
+ void QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, std::list<cClientHandle *> a_Client);
/// Removes the a_Client from all waiting chunk send operations
void RemoveClient(cClientHandle * a_Client);
protected:
-
- /// Used for sending chunks to specific clients
- struct sSendChunk
+
+ struct sChunkQueue
{
- int m_ChunkX;
- int m_ChunkZ;
- cClientHandle * m_Client;
-
- sSendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) :
- m_ChunkX(a_ChunkX),
- m_ChunkZ(a_ChunkZ),
- m_Client(a_Client)
- {
- }
-
- bool operator ==(const sSendChunk & a_Other)
+ eChunkPriority m_Priority;
+ cChunkCoords m_Chunk;
+
+ bool operator <(const sChunkQueue & a_Other) const
{
- return (
- (a_Other.m_ChunkX == m_ChunkX) &&
- (a_Other.m_ChunkZ == m_ChunkZ) &&
- (a_Other.m_Client == m_Client)
- );
+ /* The Standard Priority Queue sorts from biggest to smallest
+ return true here means you are smaller than the other object, and you get pushed down.
+
+ The priorities go from HIGH (0) to LOW (2), so a smaller priority should mean further up the list
+ therefore, return true (affirm we're "smaller", and get pushed down) only if our priority is bigger than theirs (they're more urgent)
+ */
+ return this->m_Priority > a_Other.m_Priority;
}
- } ;
- typedef std::list<sSendChunk> sSendChunkList;
+ };
- struct sBlockCoord
+ /// Used for sending chunks to specific clients
+ struct sSendChunk
{
- int m_BlockX;
- int m_BlockY;
- int m_BlockZ;
-
- sBlockCoord(int a_BlockX, int a_BlockY, int a_BlockZ) :
- m_BlockX(a_BlockX),
- m_BlockY(a_BlockY),
- m_BlockZ(a_BlockZ)
+ cChunkCoords m_Chunk;
+ std::unordered_set<cClientHandle *> m_Clients;
+ eChunkPriority m_Priority;
+ sSendChunk(cChunkCoords a_Chunk, eChunkPriority a_Priority) :
+ m_Chunk(a_Chunk),
+ m_Priority(a_Priority)
{
}
- } ;
-
- typedef std::vector<sBlockCoord> sBlockCoords;
+ };
- cWorld * m_World;
+ cWorld & m_World;
cCriticalSection m_CS;
- cChunkCoordsList m_ChunksReady;
- sSendChunkList m_SendChunksLowPriority;
- sSendChunkList m_SendChunksMediumPriority;
- sSendChunkList m_SendChunksHighPriority;
- cEvent m_evtQueue; // Set when anything is added to m_ChunksReady
- cEvent m_evtRemoved; // Set when removed clients are safe to be deleted
- int m_RemoveCount; // Number of threads waiting for a client removal (m_evtRemoved needs to be set this many times)
-
- cNotifyChunkSender m_Notify; // Used for chunks that don't have a valid lighting - they will be re-queued after lightcalc
-
+ std::priority_queue<sChunkQueue> m_SendChunks;
+ std::unordered_map<cChunkCoords, sSendChunk, cChunkCoordsHash> m_ChunkInfo;
+ cEvent m_evtQueue; // Set when anything is added to m_ChunksReady
+ cEvent m_evtRemoved; // Set when removed clients are safe to be deleted
+
// Data about the chunk that is being sent:
// NOTE that m_BlockData[] is inherited from the cChunkDataCollector
unsigned char m_BiomeMap[cChunkDef::Width * cChunkDef::Width];
- sBlockCoords m_BlockEntities; // Coords of the block entities to send
+ std::vector<Vector3i> m_BlockEntities; // Coords of the block entities to send
// TODO: sEntityIDs m_Entities; // Entity-IDs of the entities to send
// cIsThread override:
@@ -168,9 +135,8 @@ protected:
virtual void BlockEntity (cBlockEntity * a_Entity) override;
/// Sends the specified chunk to a_Client, or to all chunk clients if a_Client == nullptr
- void SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client);
+ void SendChunk(int a_ChunkX, int a_ChunkZ, std::unordered_set<cClientHandle *> a_Clients);
} ;
-
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index c8ccc1cf5..6ca43da6f 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -381,8 +381,8 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID,
// Send player list items
SendPlayerListAddPlayer(*m_Player);
- World->BroadcastPlayerListAddPlayer(*m_Player);
- World->SendPlayerList(m_Player);
+ cRoot::Get()->BroadcastPlayerListsAddPlayer(*m_Player);
+ cRoot::Get()->SendPlayerLists(m_Player);
m_Player->Initialize(*World);
m_State = csAuthenticated;
@@ -440,9 +440,9 @@ bool cClientHandle::StreamNextChunk(void)
int RangeX, RangeZ = 0;
cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ);
- for (size_t X = 0; X < 7; X++)
+ for (int X = 0; X < 7; X++)
{
- for (size_t Z = 0; Z < 7; Z++)
+ for (int Z = 0; Z < 7; Z++)
{
int ChunkX = RangeX + ((X >= 4) ? (3 - X) : X);
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
@@ -456,7 +456,7 @@ bool cClientHandle::StreamNextChunk(void)
// If the chunk already loading / loaded -> skip
if (
- (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
+ (m_ChunksToSend.find(Coords) != m_ChunksToSend.end()) ||
(std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end())
)
{
@@ -494,7 +494,7 @@ bool cClientHandle::StreamNextChunk(void)
// If the chunk already loading / loaded -> skip
if (
- (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
+ (m_ChunksToSend.find(Coords) != m_ChunksToSend.end()) ||
(std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end())
)
{
@@ -541,7 +541,7 @@ void cClientHandle::UnloadOutOfRangeChunks(void)
}
}
- for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end();)
+ for (auto itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end();)
{
int DiffX = Diff((*itr).m_ChunkX, ChunkPosX);
int DiffZ = Diff((*itr).m_ChunkZ, ChunkPosZ);
@@ -583,7 +583,7 @@ void cClientHandle::StreamChunk(int a_ChunkX, int a_ChunkZ, cChunkSender::eChunk
{
cCSLock Lock(m_CSChunkLists);
m_LoadedChunks.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
- m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
+ m_ChunksToSend.emplace(a_ChunkX, a_ChunkZ);
}
World->SendChunkTo(a_ChunkX, a_ChunkZ, a_Priority, this);
}
@@ -1475,7 +1475,7 @@ void cClientHandle::HandleChat(const AString & a_Message)
Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
Msg.ParseText(Message);
Msg.UnderlineUrls();
- m_Player->GetWorld()->BroadcastChat(Msg);
+ cRoot::Get()->BroadcastChat(Msg);
}
@@ -1902,7 +1902,7 @@ void cClientHandle::Tick(float a_Dt)
if (m_TicksSinceLastPacket > 600) // 30 seconds time-out
{
SendDisconnect("Nooooo!! You timed out! D: Come back!");
- Destroy();
+ return;
}
if (m_Player == nullptr)
@@ -2013,7 +2013,6 @@ void cClientHandle::ServerTick(float a_Dt)
if (m_TicksSinceLastPacket > 600) // 30 seconds
{
SendDisconnect("Nooooo!! You timed out! D: Come back!");
- Destroy();
}
}
@@ -2114,6 +2113,64 @@ void cClientHandle::SendChat(const cCompositeChat & a_Message)
+void cClientHandle::SendChatAboveActionBar(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData)
+{
+ cWorld * World = GetPlayer()->GetWorld();
+ if (World == nullptr)
+ {
+ World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName());
+ if (World == nullptr)
+ {
+ World = cRoot::Get()->GetDefaultWorld();
+ }
+ }
+
+ AString Message = FormatMessageType(World->ShouldUseChatPrefixes(), a_ChatPrefix, a_AdditionalData);
+ m_Protocol->SendChatAboveActionBar(Message.append(a_Message));
+}
+
+
+
+
+
+void cClientHandle::SendChatAboveActionBar(const cCompositeChat & a_Message)
+{
+ m_Protocol->SendChatAboveActionBar(a_Message);
+}
+
+
+
+
+
+void cClientHandle::SendChatSystem(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData)
+{
+ cWorld * World = GetPlayer()->GetWorld();
+ if (World == nullptr)
+ {
+ World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName());
+ if (World == nullptr)
+ {
+ World = cRoot::Get()->GetDefaultWorld();
+ }
+ }
+
+ AString Message = FormatMessageType(World->ShouldUseChatPrefixes(), a_ChatPrefix, a_AdditionalData);
+ m_Protocol->SendChatSystem(Message.append(a_Message));
+}
+
+
+
+
+
+void cClientHandle::SendChatSystem(const cCompositeChat & a_Message)
+{
+ m_Protocol->SendChatSystem(a_Message);
+}
+
+
+
+
+
void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
{
ASSERT(m_Player != nullptr);
@@ -2122,15 +2179,12 @@ void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializ
bool Found = false;
{
cCSLock Lock(m_CSChunkLists);
- for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
+ auto itr = m_ChunksToSend.find(cChunkCoords{a_ChunkX, a_ChunkZ});
+ if (itr != m_ChunksToSend.end())
{
- if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkZ == a_ChunkZ))
- {
- m_ChunksToSend.erase(itr);
- Found = true;
- break;
- }
- } // for itr - m_ChunksToSend[]
+ m_ChunksToSend.erase(itr);
+ Found = true;
+ }
}
if (!Found)
{
@@ -2182,6 +2236,8 @@ void cClientHandle::SendDestroyEntity(const cEntity & a_Entity)
void cClientHandle::SendDisconnect(const AString & a_Reason)
{
+ // Destruction (Destroy()) is called when the client disconnects, not when a disconnect packet (or anything else) is sent
+ // Otherwise, the cClientHandle instance is can be unexpectedly removed from the associated player - Core/#142
if (!m_HasSentDC)
{
LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str());
@@ -2329,6 +2385,15 @@ void cClientHandle::SendHealth(void)
+void cClientHandle::SendHideTitle(void)
+{
+ m_Protocol->SendHideTitle();
+}
+
+
+
+
+
void cClientHandle::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
{
m_Protocol->SendInventorySlot(a_WindowID, a_SlotNum, a_Item);
@@ -2532,6 +2597,15 @@ void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effec
+void cClientHandle::SendResetTitle()
+{
+ m_Protocol->SendResetTitle();
+}
+
+
+
+
+
void cClientHandle::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
m_Protocol->SendRespawn(a_Dimension, a_ShouldIgnoreDimensionChecks);
@@ -2586,6 +2660,42 @@ void cClientHandle::SendDisplayObjective(const AString & a_Objective, cScoreboar
+void cClientHandle::SendSetSubTitle(const cCompositeChat & a_SubTitle)
+{
+ m_Protocol->SendSetSubTitle(a_SubTitle);
+}
+
+
+
+
+
+void cClientHandle::SendSetRawSubTitle(const AString & a_SubTitle)
+{
+ m_Protocol->SendSetRawSubTitle(a_SubTitle);
+}
+
+
+
+
+
+void cClientHandle::SendSetTitle(const cCompositeChat & a_Title)
+{
+ m_Protocol->SendSetTitle(a_Title);
+}
+
+
+
+
+
+void cClientHandle::SendSetRawTitle(const AString & a_Title)
+{
+ m_Protocol->SendSetRawTitle(a_Title);
+}
+
+
+
+
+
void cClientHandle::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
{
m_Protocol->SendSoundEffect(a_SoundName, a_X, a_Y, a_Z, a_Volume, a_Pitch);
@@ -2676,6 +2786,15 @@ void cClientHandle::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cClientHandle::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
+{
+ m_Protocol->SendTitleTimes(a_FadeInTicks, a_DisplayTicks, a_FadeOutTicks);
+}
+
+
+
+
+
void cClientHandle::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
{
m_Protocol->SendTimeUpdate(a_WorldAge, a_TimeOfDay, a_DoDaylightCycle);
@@ -2828,7 +2947,7 @@ bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkZ)
}
cCSLock Lock(m_CSChunkLists);
- return (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkZ)) != m_ChunksToSend.end());
+ return m_ChunksToSend.find(cChunkCoords(a_ChunkX, a_ChunkZ)) != m_ChunksToSend.end();
}
@@ -2844,9 +2963,9 @@ void cClientHandle::AddWantedChunk(int a_ChunkX, int a_ChunkZ)
LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, this);
cCSLock Lock(m_CSChunkLists);
- if (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkZ)) == m_ChunksToSend.end())
+ if (m_ChunksToSend.find(cChunkCoords(a_ChunkX, a_ChunkZ)) == m_ChunksToSend.end())
{
- m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
+ m_ChunksToSend.emplace(a_ChunkX, a_ChunkZ);
}
}
@@ -2859,7 +2978,6 @@ void cClientHandle::PacketBufferFull(void)
// Too much data in the incoming queue, the server is probably too busy, kick the client:
LOGERROR("Too much data in queue for client \"%s\" @ %s, kicking them.", m_Username.c_str(), m_IPString.c_str());
SendDisconnect("Server busy");
- Destroy();
}
@@ -2873,7 +2991,6 @@ void cClientHandle::PacketUnknown(UInt32 a_PacketType)
AString Reason;
Printf(Reason, "Unknown [C->S] PacketType: 0x%x", a_PacketType);
SendDisconnect(Reason);
- Destroy();
}
@@ -2884,7 +3001,6 @@ void cClientHandle::PacketError(UInt32 a_PacketType)
{
LOGERROR("Protocol error while parsing packet type 0x%02x; disconnecting client \"%s\"", a_PacketType, m_Username.c_str());
SendDisconnect("Protocol error");
- Destroy();
}
@@ -2894,13 +3010,20 @@ void cClientHandle::PacketError(UInt32 a_PacketType)
void cClientHandle::SocketClosed(void)
{
// The socket has been closed for any reason
-
+
if (!m_Username.empty()) // Ignore client pings
{
LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str());
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected");
}
-
+ if ((m_State < csDestroying) && (m_Player != nullptr))
+ {
+ cWorld * World = m_Player->GetWorld();
+ if (World != nullptr)
+ {
+ World->RemovePlayer(m_Player, true); // Must be called before cPlayer::Destroy() as otherwise cChunk tries to delete the player, and then we do it again
+ }
+ }
Destroy();
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 61f29b57c..302de5a77 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -23,7 +23,7 @@
#include <array>
-
+#include <atomic>
// fwd:
@@ -150,6 +150,10 @@ public: // tolua_export
void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes);
void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
void SendChat (const cCompositeChat & a_Message);
+ void SendChatAboveActionBar (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
+ void SendChatAboveActionBar (const cCompositeChat & a_Message);
+ void SendChatSystem (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
+ void SendChatSystem (const cCompositeChat & a_Message);
void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer);
void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player);
void SendDestroyEntity (const cEntity & a_Entity);
@@ -172,6 +176,7 @@ public: // tolua_export
void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion);
void SendGameMode (eGameMode a_GameMode);
void SendHealth (void);
+ void SendHideTitle (void);
void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale);
void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale);
@@ -192,9 +197,14 @@ public: // tolua_export
void SendPlayerSpawn (const cPlayer & a_Player);
void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp
void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
+ void SendResetTitle (void);
void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false);
void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
+ void SendSetSubTitle (const cCompositeChat & a_SubTitle);
+ void SendSetRawSubTitle (const AString & a_SubTitle);
+ void SendSetTitle (const cCompositeChat & a_Title);
+ void SendSetRawTitle (const AString & a_Title);
void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch); // tolua_export
void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data);
void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock);
@@ -205,6 +215,7 @@ public: // tolua_export
void SendTabCompletionResults (const AStringVector & a_Results);
void SendTeleportEntity (const cEntity & a_Entity);
void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ);
+ void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks);
void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle); // tolua_export
void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity);
@@ -366,10 +377,10 @@ private:
AString m_Password;
Json::Value m_Properties;
- cCriticalSection m_CSChunkLists;
- cChunkCoordsList m_LoadedChunks; // Chunks that the player belongs to
- cChunkCoordsList m_ChunksToSend; // Chunks that need to be sent to the player (queued because they weren't generated yet or there's not enough time to send them)
- cChunkCoordsList m_SentChunks; // Chunks that are currently sent to the client
+ cCriticalSection m_CSChunkLists;
+ cChunkCoordsList m_LoadedChunks; // Chunks that the player belongs to
+ std::unordered_set<cChunkCoords, cChunkCoordsHash> m_ChunksToSend; // Chunks that need to be sent to the player (queued because they weren't generated yet or there's not enough time to send them)
+ cChunkCoordsList m_SentChunks; // Chunks that are currently sent to the client
cProtocol * m_Protocol;
@@ -436,7 +447,7 @@ private:
// TODO: Add Kicking here as well
} ;
- eState m_State;
+ std::atomic<eState> m_State;
/** m_State needs to be locked in the Destroy() function so that the destruction code doesn't run twice on two different threads */
cCriticalSection m_CSDestroyingState;
diff --git a/src/CompositeChat.cpp b/src/CompositeChat.cpp
index d1eb0b852..353835039 100644
--- a/src/CompositeChat.cpp
+++ b/src/CompositeChat.cpp
@@ -6,6 +6,7 @@
#include "Globals.h"
#include "CompositeChat.h"
#include "ClientHandle.h"
+#include "SelfTests.h"
@@ -19,16 +20,14 @@ class SelfTest_CompositeChat
public:
SelfTest_CompositeChat(void)
{
- fprintf(stderr, "cCompositeChat self test...\n");
- TestParser1();
- TestParser2();
- TestParser3();
- TestParser4();
- TestParser5();
- fprintf(stderr, "cCompositeChat self test finished.\n");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestParser1), "CompositeChat parser test 1");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestParser2), "CompositeChat parser test 2");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestParser3), "CompositeChat parser test 3");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestParser4), "CompositeChat parser test 4");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestParser5), "CompositeChat parser test 5");
}
- void TestParser1(void)
+ static void TestParser1(void)
{
cCompositeChat Msg;
Msg.ParseText("Testing @2color codes and http://links parser");
@@ -44,7 +43,7 @@ public:
assert_test(Parts[3]->m_Style == "@2");
}
- void TestParser2(void)
+ static void TestParser2(void)
{
cCompositeChat Msg;
Msg.ParseText("@3Advanced stuff: @5overriding color codes and http://links.with/@4color-in-them handling");
@@ -60,7 +59,7 @@ public:
assert_test(Parts[3]->m_Style == "@5");
}
- void TestParser3(void)
+ static void TestParser3(void)
{
cCompositeChat Msg;
Msg.ParseText("http://links.starting the text");
@@ -72,7 +71,7 @@ public:
assert_test(Parts[1]->m_Style == "");
}
- void TestParser4(void)
+ static void TestParser4(void)
{
cCompositeChat Msg;
Msg.ParseText("links finishing the text: http://some.server");
@@ -84,7 +83,7 @@ public:
assert_test(Parts[1]->m_Style == "");
}
- void TestParser5(void)
+ static void TestParser5(void)
{
cCompositeChat Msg;
Msg.ParseText("http://only.links");
@@ -342,7 +341,11 @@ AString cCompositeChat::ExtractText(void) const
}
case ptUrl:
{
- Msg.append(((cUrlPart *)(*itr))->m_Url);
+ Msg.append((static_cast<cUrlPart *>(*itr))->m_Url);
+ break;
+ }
+ case ptShowAchievement:
+ {
break;
}
} // switch (PartType)
@@ -419,7 +422,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
case cCompositeChat::ptClientTranslated:
{
- const cCompositeChat::cClientTranslatedPart & p = (const cCompositeChat::cClientTranslatedPart &)**itr;
+ const cCompositeChat::cClientTranslatedPart & p = static_cast<const cCompositeChat::cClientTranslatedPart &>(**itr);
Part["translate"] = p.m_Text;
Json::Value With;
for (AStringVector::const_iterator itrW = p.m_Parameters.begin(), endW = p.m_Parameters.end(); itrW != endW; ++itr)
@@ -436,7 +439,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
case cCompositeChat::ptUrl:
{
- const cCompositeChat::cUrlPart & p = (const cCompositeChat::cUrlPart &)**itr;
+ const cCompositeChat::cUrlPart & p = static_cast<const cCompositeChat::cUrlPart &>(**itr);
Part["text"] = p.m_Text;
Json::Value Url;
Url["action"] = "open_url";
@@ -449,7 +452,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
case cCompositeChat::ptSuggestCommand:
case cCompositeChat::ptRunCommand:
{
- const cCompositeChat::cCommandPart & p = (const cCompositeChat::cCommandPart &)**itr;
+ const cCompositeChat::cCommandPart & p = static_cast<const cCompositeChat::cCommandPart &>(**itr);
Part["text"] = p.m_Text;
Json::Value Cmd;
Cmd["action"] = (p.m_PartType == cCompositeChat::ptRunCommand) ? "run_command" : "suggest_command";
@@ -461,7 +464,7 @@ AString cCompositeChat::CreateJsonString(bool a_ShouldUseChatPrefixes) const
case cCompositeChat::ptShowAchievement:
{
- const cCompositeChat::cShowAchievementPart & p = (const cCompositeChat::cShowAchievementPart &)**itr;
+ const cCompositeChat::cShowAchievementPart & p = static_cast<const cCompositeChat::cShowAchievementPart &>(**itr);
Part["translate"] = "chat.type.achievement";
Json::Value Ach;
diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp
index 472044fa3..0bb77d341 100644
--- a/src/CraftingRecipes.cpp
+++ b/src/CraftingRecipes.cpp
@@ -168,7 +168,14 @@ void cCraftingGrid::ConsumeGrid(const cCraftingGrid & a_Grid)
m_Items[ThisIdx].m_ItemCount -= NumWantedItems;
if (m_Items[ThisIdx].m_ItemCount == 0)
{
- m_Items[ThisIdx].Clear();
+ if ((m_Items[ThisIdx].m_ItemType == E_ITEM_MILK) || (m_Items[ThisIdx].m_ItemType == E_ITEM_WATER_BUCKET) || (m_Items[ThisIdx].m_ItemType == E_ITEM_LAVA_BUCKET))
+ {
+ m_Items[ThisIdx] = cItem(E_ITEM_BUCKET, m_Items[ThisIdx].m_ItemCount);
+ }
+ else
+ {
+ m_Items[ThisIdx].Clear();
+ }
}
} // for x, for y
}
@@ -373,12 +380,12 @@ void cCraftingRecipes::AddRecipeLine(int a_LineNum, const AString & a_RecipeLine
AStringVector Sides = StringSplit(RecipeLine, "=");
if (Sides.size() != 2)
{
- LOGWARNING("crafting.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);
+ LOGWARNING("crafting.txt: line %d: A single '=' was expected, got " SIZE_T_FMT, a_LineNum, Sides.size() - 1);
LOGINFO("Offending line: \"%s\"", a_RecipeLine.c_str());
return;
}
- std::unique_ptr<cCraftingRecipes::cRecipe> Recipe(new cCraftingRecipes::cRecipe);
+ std::unique_ptr<cCraftingRecipes::cRecipe> Recipe = cpp14::make_unique<cCraftingRecipes::cRecipe>();
// Parse the result:
AStringVector ResultSplit = StringSplit(Sides[0], ",");
@@ -759,7 +766,7 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::MatchRecipe(const cItem * a_Crafti
} // for y, for x
// The recipe has matched. Create a copy of the recipe and set its coords to match the crafting grid:
- std::unique_ptr<cRecipe> Recipe(new cRecipe);
+ std::unique_ptr<cRecipe> Recipe = cpp14::make_unique<cRecipe>();
Recipe->m_Result = a_Recipe->m_Result;
Recipe->m_Width = a_Recipe->m_Width;
Recipe->m_Height = a_Recipe->m_Height;
@@ -771,9 +778,12 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::MatchRecipe(const cItem * a_Crafti
continue;
}
Recipe->m_Ingredients.push_back(*itrS);
+ Recipe->m_Ingredients.back().x += a_OffsetX;
+ Recipe->m_Ingredients.back().y += a_OffsetY;
}
Recipe->m_Ingredients.insert(Recipe->m_Ingredients.end(), MatchedSlots.begin(), MatchedSlots.end());
+ // Handle the fireworks-related effects:
// We use Recipe instead of a_Recipe because we want the wildcard ingredients' slot numbers as well, which was just added previously
HandleFireworks(a_CraftingGrid, Recipe.get(), a_GridStride, a_OffsetX, a_OffsetY);
@@ -833,7 +843,7 @@ void cCraftingRecipes::HandleFireworks(const cItem * a_CraftingGrid, cCraftingRe
case E_ITEM_DYE:
{
int GridID = (itr->x + a_OffsetX) + a_GridStride * (itr->y + a_OffsetY);
- DyeColours.push_back(cFireworkItem::GetVanillaColourCodeFromDye((NIBBLETYPE)(a_CraftingGrid[GridID].m_ItemDamage & 0x0f)));
+ DyeColours.push_back(cFireworkItem::GetVanillaColourCodeFromDye(static_cast<NIBBLETYPE>(a_CraftingGrid[GridID].m_ItemDamage & 0x0f)));
break;
}
case E_ITEM_GUNPOWDER: break;
diff --git a/src/Defines.h b/src/Defines.h
index 787eacab8..f3b742e09 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -29,16 +29,16 @@ enum
-/// Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc
+/** Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc */
enum eBlockFace
{
BLOCK_FACE_NONE = -1, // Interacting with no block face - swinging the item in the air
- BLOCK_FACE_XM = 4, // Interacting with the X- face of the block
- BLOCK_FACE_XP = 5, // Interacting with the X+ face of the block
- BLOCK_FACE_YM = 0, // Interacting with the Y- face of the block
- BLOCK_FACE_YP = 1, // Interacting with the Y+ face of the block
- BLOCK_FACE_ZM = 2, // Interacting with the Z- face of the block
- BLOCK_FACE_ZP = 3, // Interacting with the Z+ face of the block
+ BLOCK_FACE_XM = 4, // Interacting with the X- face of the block
+ BLOCK_FACE_XP = 5, // Interacting with the X+ face of the block
+ BLOCK_FACE_YM = 0, // Interacting with the Y- face of the block
+ BLOCK_FACE_YP = 1, // Interacting with the Y+ face of the block
+ BLOCK_FACE_ZM = 2, // Interacting with the Z- face of the block
+ BLOCK_FACE_ZP = 3, // Interacting with the Z+ face of the block
// Synonyms using the (deprecated) world directions:
BLOCK_FACE_BOTTOM = BLOCK_FACE_YM, // Interacting with the bottom face of the block
@@ -47,6 +47,10 @@ enum eBlockFace
BLOCK_FACE_SOUTH = BLOCK_FACE_ZP, // Interacting with the southern face of the block
BLOCK_FACE_WEST = BLOCK_FACE_XM, // Interacting with the western face of the block
BLOCK_FACE_EAST = BLOCK_FACE_XP, // Interacting with the eastern face of the block
+
+ // Bounds, used for range-checking:
+ BLOCK_FACE_MIN = -1,
+ BLOCK_FACE_MAX = 5,
} ;
@@ -133,6 +137,17 @@ enum eGameMode
+enum eChatType
+{
+ ctChatBox = 0,
+ ctSystem = 1,
+ ctAboveActionBar = 2,
+} ;
+
+
+
+
+
enum eWeather
{
eWeather_Sunny = 0,
@@ -238,8 +253,17 @@ inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
case BLOCK_FACE_XP: return BLOCK_FACE_XM;
case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
- default: return a_BlockFace;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ return a_BlockFace;
+ };
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
@@ -255,8 +279,17 @@ inline eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace)
case BLOCK_FACE_XP: return BLOCK_FACE_ZM;
case BLOCK_FACE_ZM: return BLOCK_FACE_XM;
case BLOCK_FACE_ZP: return BLOCK_FACE_XP;
- default: return a_BlockFace;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ return a_BlockFace;
+ }
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
@@ -271,25 +304,45 @@ inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
case BLOCK_FACE_XP: return BLOCK_FACE_ZP;
case BLOCK_FACE_ZM: return BLOCK_FACE_XP;
case BLOCK_FACE_ZP: return BLOCK_FACE_XM;
- default: return a_BlockFace;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ return a_BlockFace;
+ };
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
+
+
+
+
inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
{
switch (a_BlockFace)
{
- case BLOCK_FACE_YP: return BLOCK_FACE_YM;
- case BLOCK_FACE_XP: return BLOCK_FACE_XM;
- case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
- case BLOCK_FACE_YM: return BLOCK_FACE_YP;
- case BLOCK_FACE_XM: return BLOCK_FACE_XP;
- case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
- default: return a_BlockFace;
+ case BLOCK_FACE_YP: return BLOCK_FACE_YM;
+ case BLOCK_FACE_XP: return BLOCK_FACE_XM;
+ case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
+ case BLOCK_FACE_YM: return BLOCK_FACE_YP;
+ case BLOCK_FACE_XM: return BLOCK_FACE_XP;
+ case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
+ case BLOCK_FACE_NONE: return a_BlockFace;
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
+
+
+
/** Returns the textual representation of the BlockFace constant. */
inline AString BlockFaceToString(eBlockFace a_BlockFace)
{
@@ -305,7 +358,7 @@ inline AString BlockFaceToString(eBlockFace a_BlockFace)
}
// clang optimisises this line away then warns that it has done so.
#if !defined(__clang__)
- return Printf("Unknown BLOCK_FACE: %d", a_BlockFace);
+ return Printf("Unknown BLOCK_FACE: %d", a_BlockFace);
#endif
}
@@ -436,7 +489,7 @@ inline void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBl
case BLOCK_FACE_ZP: a_BlockZ++; break;
case BLOCK_FACE_XP: a_BlockX++; break;
case BLOCK_FACE_XM: a_BlockX--; break;
- default:
+ case BLOCK_FACE_NONE:
{
LOGWARNING("%s: Unknown face: %d", __FUNCTION__, a_BlockFace);
ASSERT(!"AddFaceDirection(): Unknown face");
@@ -454,7 +507,7 @@ inline void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBl
case BLOCK_FACE_ZP: a_BlockZ--; break;
case BLOCK_FACE_XP: a_BlockX--; break;
case BLOCK_FACE_XM: a_BlockX++; break;
- default:
+ case BLOCK_FACE_NONE:
{
LOGWARNING("%s: Unknown inv face: %d", __FUNCTION__, a_BlockFace);
ASSERT(!"AddFaceDirection(): Unknown face");
diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp
index 5ed18de6b..17c77dd93 100644
--- a/src/Enchantments.cpp
+++ b/src/Enchantments.cpp
@@ -69,8 +69,8 @@ void cEnchantments::AddFromString(const AString & a_StringSpec)
LOG("%s: Failed to parse enchantment \"%s\", skipping.", __FUNCTION__, Split[0].c_str());
continue;
}
- int lvl = atoi(Split[1].c_str());
- if ((lvl == 0) && (Split[1] != "0"))
+ unsigned int lvl;
+ if (!StringToInteger(Split[1], lvl))
{
// Level failed to parse
LOG("%s: Failed to parse enchantment level \"%s\", skipping.", __FUNCTION__, Split[1].c_str());
@@ -108,7 +108,7 @@ AString cEnchantments::ToString(void) const
-int cEnchantments::GetLevel(int a_EnchantmentID) const
+unsigned int cEnchantments::GetLevel(int a_EnchantmentID) const
{
// Return the level for the specified enchantment; 0 if not stored
cMap::const_iterator itr = m_Enchantments.find(a_EnchantmentID);
@@ -125,7 +125,7 @@ int cEnchantments::GetLevel(int a_EnchantmentID) const
-void cEnchantments::SetLevel(int a_EnchantmentID, int a_Level)
+void cEnchantments::SetLevel(int a_EnchantmentID, unsigned int a_Level)
{
// Sets the level for the specified enchantment, adding it if not stored before or removing it if level <= 0
if (a_Level == 0)
@@ -908,7 +908,7 @@ void cEnchantments::AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantm
-void cEnchantments::AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, int a_EnchantmentLevel)
+void cEnchantments::AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, unsigned int a_EnchantmentLevel)
{
cWeightedEnchantment weightedenchantment;
weightedenchantment.m_Weight = a_Weight;
diff --git a/src/Enchantments.h b/src/Enchantments.h
index 9d3f342d4..8c08e7a93 100644
--- a/src/Enchantments.h
+++ b/src/Enchantments.h
@@ -92,10 +92,10 @@ public:
AString ToString(void) const;
/** Returns the level for the specified enchantment; 0 if not stored */
- int GetLevel(int a_EnchantmentID) const;
+ unsigned int GetLevel(int a_EnchantmentID) const;
/** Sets the level for the specified enchantment, adding it if not stored before or removing it if level <= 0 */
- void SetLevel(int a_EnchantmentID, int a_Level);
+ void SetLevel(int a_EnchantmentID, unsigned int a_Level);
/** Removes all enchantments */
void Clear(void);
@@ -115,7 +115,7 @@ public:
static void AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantments, short a_ItemType, int a_EnchantmentLevel);
/** Add a enchantment with weight to the vector */
- static void AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, int a_EnchantmentLevel);
+ static void AddEnchantmentWeightToVector(cWeightedEnchantments & a_Enchantments, int a_Weight, int a_EnchantmentID, unsigned int a_EnchantmentLevel);
/** Remove the entire enchantment (with weight) from the vector */
static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments & a_Enchantments, int a_EnchantmentID);
@@ -145,7 +145,7 @@ public:
protected:
/** Maps enchantment ID -> enchantment level */
- typedef std::map<int, int> cMap;
+ typedef std::map<int, unsigned int> cMap;
/** Currently stored enchantments */
cMap m_Enchantments;
diff --git a/src/Endianness.h b/src/Endianness.h
index a415903a5..0e8bc8e99 100644
--- a/src/Endianness.h
+++ b/src/Endianness.h
@@ -2,7 +2,7 @@
#pragma once
#undef ntohll
-#define ntohll(x) ((((UInt64)ntohl((UInt32)x)) << 32) + ntohl(x >> 32))
+#define ntohll(x) (((static_cast<UInt64>(ntohl(static_cast<UInt32>(x)))) << 32) + ntohl(x >> 32))
@@ -13,7 +13,7 @@ inline UInt64 HostToNetwork8(const void * a_Value)
{
UInt64 buf;
memcpy( &buf, a_Value, sizeof( buf));
- buf = (( ( (UInt64)htonl((UInt32)buf)) << 32) + htonl(buf >> 32));
+ buf = (( ( static_cast<UInt64>(htonl(static_cast<UInt32>(buf)))) << 32) + htonl(buf >> 32));
return buf;
}
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index 32952100c..492cf2a56 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -84,7 +84,7 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFa
int X = BlockHit.x, Y = BlockHit.y, Z = BlockHit.z;
m_HitBlockPos = Vector3i(X, Y, Z);
-
+
// Broadcast arrow hit sound
m_World->BroadcastSoundEffect("random.bowhit", (double)X, (double)Y, (double)Z, 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
@@ -108,15 +108,15 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
Damage += m_World->GetTickRandomNumber(Damage / 2 + 2);
}
- int PowerLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPower);
+ unsigned int PowerLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPower);
if (PowerLevel > 0)
{
int ExtraDamage = (int)ceil(0.25 * (PowerLevel + 1));
Damage += ExtraDamage;
}
- int KnockbackAmount = 1;
- int PunchLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ // int KnockbackAmount = 1;
+ unsigned int PunchLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPunch);
if (PunchLevel > 0)
{
Vector3d LookVector = GetLookVector();
@@ -130,8 +130,9 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
a_EntityHit.SetSpeed(FinalSpeed);
}
- a_EntityHit.TakeDamage(dtRangedAttack, this, Damage, KnockbackAmount);
-
+ // a_EntityHit.TakeDamage(dtRangedAttack, this, Damage, KnockbackAmount); // TODO fix knockback.
+ a_EntityHit.TakeDamage(dtRangedAttack, this, Damage, 0); // Until knockback is fixed.
+
if (IsOnFire() && !a_EntityHit.IsSubmerged() && !a_EntityHit.IsSwimming())
{
a_EntityHit.StartBurning(100);
diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt
index 5d10e1680..7261e85c0 100644
--- a/src/Entities/CMakeLists.txt
+++ b/src/Entities/CMakeLists.txt
@@ -60,6 +60,14 @@ SET (HDRS
ThrownSnowballEntity.h
WitherSkullEntity.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(ArrowEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=switch-enum -Wno-error=old-style-cast")
+ set_source_files_properties(EntityEffect.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
+ set_source_files_properties(Floater.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(Player.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=switch-enum -Wno-error=conversion -Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Entities ${SRCS} ${HDRS})
diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp
index 7a911d4db..b71d70bdd 100644
--- a/src/Entities/EnderCrystal.cpp
+++ b/src/Entities/EnderCrystal.cpp
@@ -22,7 +22,7 @@ cEnderCrystal::cEnderCrystal(double a_X, double a_Y, double a_Z)
void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle)
{
- a_ClientHandle.SendSpawnObject(*this, 51, 0, (Byte)GetYaw(), (Byte)GetPitch());
+ a_ClientHandle.SendSpawnObject(*this, 51, 0, static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
}
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 4a909a1fd..bb9d3c44b 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -13,6 +13,7 @@
#include "Player.h"
#include "Items/ItemHandler.h"
#include "../FastRandom.h"
+#include "../NetherPortalScanner.h"
@@ -42,6 +43,7 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
m_WorldTravellingFrom(nullptr),
m_EntityType(a_EntityType),
m_World(nullptr),
+ m_IsWorldChangeScheduled(false),
m_IsFireproof(false),
m_TicksSinceLastBurnDamage(0),
m_TicksSinceLastLavaDamage(0),
@@ -396,7 +398,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
}
- int ThornsLevel = 0;
+ unsigned int ThornsLevel = 0;
const cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
{
@@ -742,6 +744,13 @@ void cEntity::KilledBy(TakeDamageInfo & a_TDI)
return;
}
+ // If the victim is a player the hook is handled by the cPlayer class
+ if (!IsPlayer())
+ {
+ AString emptystring = AString("");
+ cRoot::Get()->GetPluginManager()->CallHookKilled(*this, a_TDI, emptystring);
+ }
+
// Drop loot:
cItems Drops;
GetDrops(Drops, a_TDI.Attacker);
@@ -1260,9 +1269,35 @@ void cEntity::DetectCacti(void)
+void cEntity::ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition, bool a_SetPortalCooldown)
+{
+ m_NewWorld = a_World;
+ m_NewWorldPosition = a_NewPosition;
+ m_IsWorldChangeScheduled = true;
+ m_WorldChangeSetPortalCooldown = a_SetPortalCooldown;
+}
+
+
+
bool cEntity::DetectPortal()
{
+ // If somebody scheduled a world change with ScheduleMoveToWorld, change worlds now.
+ if (m_IsWorldChangeScheduled)
+ {
+ m_IsWorldChangeScheduled = false;
+
+ if (m_WorldChangeSetPortalCooldown)
+ {
+ // Delay the portal check.
+ m_PortalCooldownData.m_TicksDelayed = 0;
+ m_PortalCooldownData.m_ShouldPreventTeleportation = true;
+ }
+
+ MoveToWorld(m_NewWorld, false, m_NewWorldPosition);
+ return true;
+ }
+
if (GetWorld()->GetDimension() == dimOverworld)
{
if (GetWorld()->GetLinkedNetherWorldName().empty() && GetWorld()->GetLinkedEndWorldName().empty())
@@ -1312,8 +1347,15 @@ bool cEntity::DetectPortal()
// Send a respawn packet before world is loaded / generated so the client isn't left in limbo
((cPlayer *)this)->GetClientHandle()->SendRespawn(dimOverworld);
}
-
- return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName()), false);
+
+ Vector3d TargetPos = GetPosition();
+ TargetPos.x *= 8.0;
+ TargetPos.z *= 8.0;
+
+ cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName(), dimNether, GetWorld()->GetName(), false);
+ LOGD("Jumping nether -> overworld");
+ new cNetherPortalScanner(this, TargetWorld, TargetPos, 256);
+ return true;
}
else
{
@@ -1329,8 +1371,15 @@ bool cEntity::DetectPortal()
((cPlayer *)this)->AwardAchievement(achEnterPortal);
((cPlayer *)this)->GetClientHandle()->SendRespawn(dimNether);
}
-
- return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedNetherWorldName(), dimNether, GetWorld()->GetName()), false);
+
+ Vector3d TargetPos = GetPosition();
+ TargetPos.x /= 8.0;
+ TargetPos.z /= 8.0;
+
+ cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedNetherWorldName(), dimNether, GetWorld()->GetName(), false);
+ LOGD("Jumping overworld -> nether");
+ new cNetherPortalScanner(this, TargetWorld, TargetPos, 128);
+ return true;
}
}
case E_BLOCK_END_PORTAL:
@@ -1392,7 +1441,7 @@ bool cEntity::DetectPortal()
-bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
+bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition)
{
UNUSED(a_ShouldSendRespawn);
ASSERT(a_World != nullptr);
@@ -1403,14 +1452,27 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
return false;
}
+ // Ask the plugins if the entity is allowed to changing the world
+ if (cRoot::Get()->GetPluginManager()->CallHookEntityChangingWorld(*this, *a_World))
+ {
+ // A Plugin doesn't allow the entity to changing the world
+ return false;
+ }
+
// Remove all links to the old world
SetWorldTravellingFrom(GetWorld()); // cChunk::Tick() handles entity removal
GetWorld()->BroadcastDestroyEntity(*this);
+ SetPosition(a_NewPosition);
+
// Queue add to new world
a_World->AddEntity(this);
+ cWorld * OldWorld = cRoot::Get()->GetWorld(GetWorld()->GetName()); // Required for the hook HOOK_ENTITY_CHANGED_WORLD
SetWorld(a_World);
+ // Entity changed the world, call the hook
+ cRoot::Get()->GetPluginManager()->CallHookEntityChangedWorld(*this, *OldWorld);
+
return true;
}
@@ -1427,7 +1489,7 @@ bool cEntity::MoveToWorld(const AString & a_WorldName, bool a_ShouldSendRespawn)
return false;
}
- return DoMoveToWorld(World, a_ShouldSendRespawn);
+ return DoMoveToWorld(World, a_ShouldSendRespawn, GetPosition());
}
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index fecbb9bf5..f54e130eb 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -205,8 +205,8 @@ public:
double GetSpeedZ (void) const { return m_Speed.z; }
double GetWidth (void) const { return m_Width; }
- int GetChunkX(void) const {return (int)floor(m_Pos.x / cChunkDef::Width); }
- int GetChunkZ(void) const {return (int)floor(m_Pos.z / cChunkDef::Width); }
+ int GetChunkX(void) const {return static_cast<int>(floor(m_Pos.x / cChunkDef::Width)); }
+ int GetChunkZ(void) const {return static_cast<int>(floor(m_Pos.z / cChunkDef::Width)); }
void SetHeadYaw (double a_HeadYaw);
void SetHeight (double a_Height);
@@ -350,31 +350,31 @@ public:
*/
virtual bool DetectPortal(void);
- /// Handles when the entity is in the void
+ /** Handles when the entity is in the void */
virtual void TickInVoid(cChunk & a_Chunk);
- /// Called when the entity starts burning
+ /** Called when the entity starts burning */
virtual void OnStartedBurning(void);
- /// Called when the entity finishes burning
+ /** Called when the entity finishes burning */
virtual void OnFinishedBurning(void);
// tolua_begin
- /// Sets the maximum value for the health
+ /** Sets the maximum value for the health */
void SetMaxHealth(int a_MaxHealth);
int GetMaxHealth(void) const { return m_MaxHealth; }
- /// Sets whether the entity is fireproof
+ /** 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
+ /** Puts the entity on fire for the specified amount of ticks */
void StartBurning(int a_TicksLeftBurning);
- /// Stops the entity from burning, resets all burning timers
+ /** Stops the entity from burning, resets all burning timers */
void StopBurning(void);
// tolua_end
@@ -386,21 +386,26 @@ public:
// tolua_begin
- /// Teleports to the entity specified
+ /** Teleports to the entity specified */
virtual void TeleportToEntity(cEntity & a_Entity);
- /// Teleports to the coordinates specified
+ /** Teleports to the coordinates specified */
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ);
+ /** Schedules a MoveToWorld call to occur on the next Tick of the entity */
+ void ScheduleMoveToWorld(cWorld * a_World, Vector3d a_NewPosition, bool a_SetPortalCooldown = false);
+
+ bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition) { return DoMoveToWorld(a_World, a_ShouldSendRespawn, a_NewPosition); }
+
/** Moves entity to specified world, taking a world pointer */
- bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn = true) { return DoMoveToWorld(a_World, a_ShouldSendRespawn); }
+ bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn = true) { return MoveToWorld(a_World, a_ShouldSendRespawn, GetPosition()); }
/** Moves entity to specified world, taking a world name */
bool MoveToWorld(const AString & a_WorldName, bool a_ShouldSendRespawn = true);
// tolua_end
- virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn);
+ virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition);
/** Returns if the entity is travelling away from a specified world */
bool IsWorldTravellingFrom(cWorld * a_World) const { return (m_WorldTravellingFrom == a_World); }
@@ -530,23 +535,29 @@ protected:
eEntityType m_EntityType;
cWorld * m_World;
+
+ /** State variables for ScheduleMoveToWorld. */
+ bool m_IsWorldChangeScheduled;
+ bool m_WorldChangeSetPortalCooldown;
+ cWorld * m_NewWorld;
+ Vector3d m_NewWorldPosition;
- /// Whether the entity is capable of taking fire or lava damage.
+ /** 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())
+ /** Time, in ticks, since the last damage dealt by being on fire. Valid only if on fire (IsOnFire()) */
int m_TicksSinceLastBurnDamage;
- /// Time, in ticks, since the last damage dealt by standing in lava. Reset to zero when moving out of lava.
+ /** Time, in ticks, since the last damage dealt by standing in lava. Reset to zero when moving out of lava. */
int m_TicksSinceLastLavaDamage;
- /// Time, in ticks, since the last damage dealt by standing in fire. Reset to zero when moving out of fire.
+ /** Time, in ticks, since the last damage dealt by standing in fire. Reset to zero when moving out of fire. */
int m_TicksSinceLastFireDamage;
- /// Time, in ticks, until the entity extinguishes its fire
+ /** Time, in ticks, until the entity extinguishes its fire */
int m_TicksLeftBurning;
- /// Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void.
+ /** Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void. */
int m_TicksSinceLastVoidDamage;
/** Does the actual speed-setting. The default implementation just sets the member variable value;
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index db7f6f2c8..676370508 100644
--- a/src/Entities/ExpOrb.cpp
+++ b/src/Entities/ExpOrb.cpp
@@ -56,12 +56,12 @@ void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward);
a_ClosestPlayer->DeltaExperience(m_Reward);
- m_World->BroadcastSoundEffect("random.orb", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ m_World->BroadcastSoundEffect("random.orb", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
Destroy();
}
a_Distance.Normalize();
- a_Distance *= ((float) (5.5 - Distance));
+ a_Distance *= (static_cast<float>(5.5 - Distance));
SetSpeedX( a_Distance.x);
SetSpeedY( a_Distance.y);
SetSpeedZ( a_Distance.z);
diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp
index 4a165909a..bae13ea66 100644
--- a/src/Entities/FallingBlock.cpp
+++ b/src/Entities/FallingBlock.cpp
@@ -38,7 +38,7 @@ void cFallingBlock::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
// GetWorld()->BroadcastTeleportEntity(*this); // Test position
int BlockX = POSX_TOINT;
- int BlockY = (int)(GetPosY() - 0.5);
+ int BlockY = static_cast<int>(GetPosY() - 0.5);
int BlockZ = POSZ_TOINT;
if (BlockY < 0)
diff --git a/src/Entities/FireChargeEntity.cpp b/src/Entities/FireChargeEntity.cpp
index f6c665156..10d83b8dd 100644
--- a/src/Entities/FireChargeEntity.cpp
+++ b/src/Entities/FireChargeEntity.cpp
@@ -19,11 +19,11 @@ cFireChargeEntity::cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y
-void cFireChargeEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cFireChargeEntity::Explode(Vector3i a_Block)
{
- if (m_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
+ if (m_World->GetBlock(a_Block) == E_BLOCK_AIR)
{
- m_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 1);
+ m_World->SetBlock(a_Block.x, a_Block.y, a_Block.z, E_BLOCK_FIRE, 1);
}
}
@@ -34,7 +34,7 @@ void cFireChargeEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
void cFireChargeEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
Destroy();
- Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
+ Explode(a_HitPos.Floor());
}
@@ -44,7 +44,7 @@ void cFireChargeEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_
void cFireChargeEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
Destroy();
- Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
+ Explode(a_HitPos.Floor());
// TODO: Some entities are immune to hits
a_EntityHit.StartBurning(5 * 20); // 5 seconds of burning
diff --git a/src/Entities/FireChargeEntity.h b/src/Entities/FireChargeEntity.h
index eb08f5324..25f04cb7c 100644
--- a/src/Entities/FireChargeEntity.h
+++ b/src/Entities/FireChargeEntity.h
@@ -32,7 +32,7 @@ public:
protected:
- void Explode(int a_BlockX, int a_BlockY, int a_BlockZ);
+ void Explode(Vector3i a_Block);
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
diff --git a/src/Entities/GhastFireballEntity.cpp b/src/Entities/GhastFireballEntity.cpp
index c64fb2a17..1adfd1bc0 100644
--- a/src/Entities/GhastFireballEntity.cpp
+++ b/src/Entities/GhastFireballEntity.cpp
@@ -19,9 +19,9 @@ cGhastFireballEntity::cGhastFireballEntity(cEntity * a_Creator, double a_X, doub
-void cGhastFireballEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cGhastFireballEntity::Explode(Vector3i a_Block)
{
- m_World->DoExplosionAt(1, a_BlockX, a_BlockY, a_BlockZ, true, esGhastFireball, this);
+ m_World->DoExplosionAt(1, a_Block.x, a_Block.y, a_Block.z, true, esGhastFireball, this);
}
@@ -31,7 +31,7 @@ void cGhastFireballEntity::Explode(int a_BlockX, int a_BlockY, int a_BlockZ)
void cGhastFireballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
Destroy();
- Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
+ Explode(a_HitPos.Floor());
}
@@ -41,5 +41,5 @@ void cGhastFireballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace
void cGhastFireballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
Destroy();
- Explode((int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z));
+ Explode(a_HitPos.Floor());
}
diff --git a/src/Entities/GhastFireballEntity.h b/src/Entities/GhastFireballEntity.h
index bbce89d31..dc136dfc2 100644
--- a/src/Entities/GhastFireballEntity.h
+++ b/src/Entities/GhastFireballEntity.h
@@ -32,7 +32,7 @@ public:
protected:
- void Explode(int a_BlockX, int a_BlockY, int a_BlockZ);
+ void Explode(Vector3i a_Block);
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h
index 9d783006c..003c22082 100644
--- a/src/Entities/HangingEntity.h
+++ b/src/Entities/HangingEntity.h
@@ -46,6 +46,9 @@ public:
protected:
+ Byte m_Facing;
+
+
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override
{
@@ -53,6 +56,7 @@ protected:
UNUSED(a_Chunk);
}
+
/** Converts protocol hanging item facing to eBlockFace values */
inline static eBlockFace ProtocolFaceToBlockFace(Byte a_ProtocolFace)
{
@@ -77,6 +81,7 @@ protected:
return Dir;
}
+
/** Converts eBlockFace values to protocol hanging item faces */
inline static Byte BlockFaceToProtocolFace(eBlockFace a_BlockFace)
{
@@ -89,21 +94,28 @@ protected:
case BLOCK_FACE_ZM: Dir = 2; break;
case BLOCK_FACE_XM: Dir = 1; break;
case BLOCK_FACE_XP: Dir = 3; break;
- default:
+ case BLOCK_FACE_YP:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_NONE:
{
// Uncomment when entities are initialised with their real data, instead of dummy values:
// LOGINFO("Invalid facing (%d) in a cHangingEntity, adjusting to BLOCK_FACE_XP.", a_BlockFace);
// ASSERT(!"Tried to convert a bad facing!");
Dir = cHangingEntity::BlockFaceToProtocolFace(BLOCK_FACE_XP);
+ break;
}
+ #if !defined(__clang__)
+ default:
+ {
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ }
+ #endif
}
return Dir;
}
-
- Byte m_Facing;
-
}; // tolua_export
diff --git a/src/Entities/ItemFrame.cpp b/src/Entities/ItemFrame.cpp
index 4e6e38f1f..6317eba85 100644
--- a/src/Entities/ItemFrame.cpp
+++ b/src/Entities/ItemFrame.cpp
@@ -62,7 +62,7 @@ void cItemFrame::KilledBy(TakeDamageInfo & a_TDI)
return;
}
- if ((a_TDI.Attacker != nullptr) && a_TDI.Attacker->IsPlayer() && !((cPlayer *)a_TDI.Attacker)->IsGameModeCreative())
+ if ((a_TDI.Attacker != nullptr) && a_TDI.Attacker->IsPlayer() && !static_cast<cPlayer *>(a_TDI.Attacker)->IsGameModeCreative())
{
cItems Item;
Item.push_back(m_Item);
@@ -83,7 +83,7 @@ void cItemFrame::KilledBy(TakeDamageInfo & a_TDI)
void cItemFrame::GetDrops(cItems & a_Items, cEntity * a_Killer)
{
- if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !((cPlayer *)a_Killer)->IsGameModeCreative())
+ if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !static_cast<cPlayer *>(a_Killer)->IsGameModeCreative())
{
a_Items.push_back(cItem(E_ITEM_ITEM_FRAME));
}
@@ -96,7 +96,7 @@ void cItemFrame::GetDrops(cItems & a_Items, cEntity * a_Killer)
void cItemFrame::SpawnOn(cClientHandle & a_ClientHandle)
{
super::SpawnOn(a_ClientHandle);
- a_ClientHandle.SendSpawnObject(*this, 71, GetProtocolFacing(), (Byte)GetYaw(), (Byte)GetPitch());
+ a_ClientHandle.SendSpawnObject(*this, 71, GetProtocolFacing(), static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
a_ClientHandle.SendEntityMetadata(*this);
}
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index b80759d24..7274a7a41 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -106,7 +106,7 @@ cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
{
- a_ClientHandle.SendSpawnVehicle(*this, 10, (char)m_Payload); // 10 = Minecarts
+ a_ClientHandle.SendSpawnVehicle(*this, 10, static_cast<char>(m_Payload)); // 10 = Minecarts
a_ClientHandle.SendEntityMetadata(*this);
}
@@ -725,11 +725,11 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
{
if (GetSpeedZ() > 0)
{
- BLOCKTYPE Block = m_World->GetBlock(POSX_TOINT, POSY_TOINT, (int)ceil(GetPosZ()));
+ BLOCKTYPE Block = m_World->GetBlock(POSX_TOINT, POSY_TOINT, static_cast<int>(ceil(GetPosZ())));
if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
{
// We could try to detect a block in front based purely on coordinates, but xoft made a bounding box system - why not use? :P
- cBoundingBox bbBlock(Vector3d(POSX_TOINT, POSY_TOINT, (int)ceil(GetPosZ())), 0.5, 1);
+ cBoundingBox bbBlock(Vector3d(POSX_TOINT, POSY_TOINT, static_cast<int>(ceil(GetPosZ()))), 0.5, 1);
cBoundingBox bbMinecart(Vector3d(GetPosX(), floor(GetPosY()), GetPosZ()), GetWidth() / 2, GetHeight());
if (bbBlock.DoesIntersect(bbMinecart))
@@ -762,10 +762,10 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
{
if (GetSpeedX() > 0)
{
- BLOCKTYPE Block = m_World->GetBlock((int)ceil(GetPosX()), POSY_TOINT, POSZ_TOINT);
+ BLOCKTYPE Block = m_World->GetBlock(static_cast<int>(ceil(GetPosX())), POSY_TOINT, POSZ_TOINT);
if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
{
- cBoundingBox bbBlock(Vector3d((int)ceil(GetPosX()), POSY_TOINT, POSZ_TOINT), 0.5, 1);
+ cBoundingBox bbBlock(Vector3d(static_cast<int>(ceil(GetPosX())), POSY_TOINT, POSZ_TOINT), 0.5, 1);
cBoundingBox bbMinecart(Vector3d(GetPosX(), floor(GetPosY()), GetPosZ()), GetWidth() / 2, GetHeight());
if (bbBlock.DoesIntersect(bbMinecart))
@@ -1003,7 +1003,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
bool cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
{
- if ((TDI.Attacker != nullptr) && TDI.Attacker->IsPlayer() && ((cPlayer *)TDI.Attacker)->IsGameModeCreative())
+ if ((TDI.Attacker != nullptr) && TDI.Attacker->IsPlayer() && static_cast<cPlayer *>(TDI.Attacker)->IsGameModeCreative())
{
Destroy();
TDI.FinalDamage = GetMaxHealth(); // Instant hit for creative
@@ -1051,11 +1051,6 @@ bool cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
Drops.push_back(cItem(E_ITEM_MINECART_WITH_HOPPER, 1, 0));
break;
}
- default:
- {
- ASSERT(!"Unhandled minecart type when spawning pickup!");
- return true;
- }
}
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ());
diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h
index d1736e9b9..05eaf16e9 100644
--- a/src/Entities/Minecart.h
+++ b/src/Entities/Minecart.h
@@ -135,7 +135,7 @@ protected:
virtual void Destroyed() override;
// cItemGrid::cListener overrides:
- virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum)
+ virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override
{
UNUSED(a_SlotNum);
ASSERT(a_Grid == &m_Contents);
diff --git a/src/Entities/Painting.cpp b/src/Entities/Painting.cpp
index 02a8f6ed0..d73c2a245 100644
--- a/src/Entities/Painting.cpp
+++ b/src/Entities/Painting.cpp
@@ -33,7 +33,7 @@ void cPainting::SpawnOn(cClientHandle & a_Client)
void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
{
- if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !((cPlayer *)a_Killer)->IsGameModeCreative())
+ if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !static_cast<cPlayer *>(a_Killer)->IsGameModeCreative())
{
a_Items.push_back(cItem(E_ITEM_PAINTING));
}
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index fcb686e28..2cd0f2f0e 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -75,10 +75,10 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, s
{
return;
}
- a_Duration = (int)(a_Duration * a_DistanceModifier);
+ a_Duration = static_cast<int>(a_Duration * a_DistanceModifier);
m_EntityEffects[a_EffectType] = cEntityEffect::CreateEntityEffect(a_EffectType, a_Duration, a_Intensity, a_DistanceModifier);
- m_World->BroadcastEntityEffect(*this, a_EffectType, a_Intensity, a_Duration);
+ m_World->BroadcastEntityEffect(*this, a_EffectType, a_Intensity, static_cast<short>(a_Duration));
m_EntityEffects[a_EffectType]->OnActivate(*this);
}
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp
index f2f76dbf9..e4576a8f2 100644
--- a/src/Entities/Pickup.cpp
+++ b/src/Entities/Pickup.cpp
@@ -38,7 +38,7 @@ public:
Vector3d EntityPos = a_Entity->GetPosition();
double Distance = (EntityPos - m_Position).Length();
- cItem & Item = ((cPickup *)a_Entity)->GetItem();
+ cItem & Item = static_cast<cPickup *>(a_Entity)->GetItem();
if ((Distance < 1.2) && Item.IsEqual(m_Pickup->GetItem()))
{
short CombineCount = Item.m_ItemCount;
@@ -52,7 +52,7 @@ public:
return false;
}
- m_Pickup->GetItem().AddCount((char)CombineCount);
+ m_Pickup->GetItem().AddCount(static_cast<char>(CombineCount));
Item.m_ItemCount -= CombineCount;
if (Item.m_ItemCount <= 0)
@@ -228,8 +228,9 @@ bool cPickup::CollectedBy(cPlayer & a_Dest)
m_Item.m_ItemCount -= NumAdded;
m_World->BroadcastCollectEntity(*this, a_Dest);
+
// Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;)
- m_World->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ m_World->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
if (m_Item.m_ItemCount <= 0)
{
// All of the pickup has been collected, schedule the pickup for destroying
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 607a663de..3e1e2b7ea 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -16,6 +16,7 @@
#include "../Items/ItemHandler.h"
#include "../Vector3.h"
#include "../FastRandom.h"
+#include <cmath>
#include "../WorldStorage/StatSerializer.h"
#include "../CompositeChat.h"
@@ -94,7 +95,7 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
SetMaxHealth(MAX_HEALTH);
m_Health = MAX_HEALTH;
-
+
m_LastPlayerListTime = std::chrono::steady_clock::now();
m_PlayerName = a_PlayerName;
@@ -106,7 +107,7 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
SetPosY(World->GetSpawnY());
SetPosZ(World->GetSpawnZ());
SetBedPos(Vector3i(static_cast<int>(World->GetSpawnX()), static_cast<int>(World->GetSpawnY()), static_cast<int>(World->GetSpawnZ())));
-
+
LOGD("Player \"%s\" is connecting for the first time, spawning at default world spawn {%.2f, %.2f, %.2f}",
a_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ()
);
@@ -128,7 +129,14 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
m_IsFlying = true;
}
}
-
+
+ if (m_GameMode == gmSpectator) // If player is reconnecting to the server in spectator mode
+ {
+ m_CanFly = true;
+ m_IsFlying = true;
+ m_bVisible = false;
+ }
+
cRoot::Get()->GetServer()->PlayerCreated(this);
}
@@ -145,17 +153,17 @@ cPlayer::~cPlayer(void)
}
LOGD("Deleting cPlayer \"%s\" at %p, ID %d", GetName().c_str(), this, GetUniqueID());
-
+
// Notify the server that the player is being destroyed
cRoot::Get()->GetServer()->PlayerDestroying(this);
SaveToDisk();
m_ClientHandle = nullptr;
-
+
delete m_InventoryWindow;
m_InventoryWindow = nullptr;
-
+
LOGD("Player %p deleted", this);
}
@@ -201,7 +209,7 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_ClientHandle = nullptr;
return;
}
-
+
if (!m_ClientHandle->IsPlaying())
{
// We're not yet in the game, ignore everything
@@ -210,21 +218,21 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
m_Stats.AddValue(statMinutesPlayed, 1);
-
+
if (!a_Chunk.IsValid())
{
// This may happen if the cPlayer is created before the chunks have the chance of being loaded / generated (#83)
return;
}
-
+
super::Tick(a_Dt, a_Chunk);
-
+
// Handle charging the bow:
if (m_IsChargingBow)
{
m_BowCharge += 1;
}
-
+
// Handle updating experience
if (m_bDirtyExperience)
{
@@ -236,7 +244,7 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// Apply food exhaustion from movement:
ApplyFoodExhaustionFromMovement();
-
+
if (cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this, m_LastPos, GetPosition()))
{
CanMove = false;
@@ -257,10 +265,10 @@ void cPlayer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
FinishEating();
}
-
+
HandleFood();
}
-
+
if (m_IsFishing)
{
HandleFloater();
@@ -460,7 +468,7 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
{
return;
}
-
+
m_bTouchGround = a_bTouchGround;
if (!m_bTouchGround)
@@ -509,7 +517,7 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
{
// cPlayer makes sure damage isn't applied in creative, no need to check here
TakeDamage(dtFalling, nullptr, Damage, Damage, 0);
-
+
// Fall particles
GetWorld()->BroadcastSoundParticleEffect(2006, POSX_TOINT, static_cast<int>(GetPosY()) - 1, POSZ_TOINT, Damage /* Used as particle effect speed modifier */);
}
@@ -541,7 +549,7 @@ void cPlayer::SetFoodLevel(int a_FoodLevel)
m_FoodSaturationLevel = 5.0;
return;
}
-
+
m_FoodLevel = FoodLevel;
SendHealth();
}
@@ -609,7 +617,7 @@ void cPlayer::StartEating(void)
{
// Set the timer:
m_EatingFinishTick = m_World->GetWorldAge() + EATING_TICKS;
-
+
// Send the packets:
m_World->BroadcastEntityAnimation(*this, 3);
m_World->BroadcastEntityMetadata(*this);
@@ -623,7 +631,7 @@ void cPlayer::FinishEating(void)
{
// Reset the timer:
m_EatingFinishTick = -1;
-
+
// Send the packets:
m_ClientHandle->SendEntityStatus(*this, esPlayerEatingAccepted);
m_World->BroadcastEntityMetadata(*this);
@@ -757,7 +765,7 @@ void cPlayer::SetSprintingMaxSpeed(double a_Speed)
void cPlayer::SetFlyingMaxSpeed(double a_Speed)
{
m_FlyingMaxSpeed = a_Speed;
-
+
// Update the flying speed, always:
m_ClientHandle->SendPlayerAbilities();
}
@@ -769,7 +777,7 @@ void cPlayer::SetFlyingMaxSpeed(double a_Speed)
void cPlayer::SetCrouch(bool a_IsCrouched)
{
// Set the crouch status, broadcast to all visible players
-
+
if (a_IsCrouched == m_IsCrouched)
{
// No change
@@ -790,7 +798,7 @@ void cPlayer::SetSprint(bool a_IsSprinting)
// No change
return;
}
-
+
m_IsSprinting = a_IsSprinting;
m_ClientHandle->SendPlayerMaxSpeed();
}
@@ -876,7 +884,7 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
}
}
}
-
+
if (super::DoTakeDamage(a_TDI))
{
// Any kind of damage adds food exhaustion
@@ -913,11 +921,11 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
{
Pickups.Add(cItem(E_ITEM_RED_APPLE));
}
-
m_Stats.AddValue(statItemsDropped, (StatValue)Pickups.Size());
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
SaveToDisk(); // Save it, yeah the world is a tough place !
+ cPluginManager * PluginManager = cRoot::Get()->GetPluginManager();
if ((a_TDI.Attacker == nullptr) && m_World->ShouldBroadcastDeathMessages())
{
@@ -943,7 +951,12 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
case dtExplosion: DamageText = "blew up"; break;
default: DamageText = "died, somehow; we've no idea how though"; break;
}
- GetWorld()->BroadcastChatDeath(Printf("%s %s", GetName().c_str(), DamageText.c_str()));
+ AString DeathMessage = Printf("%s %s", GetName().c_str(), DamageText.c_str());
+ PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
+ if (DeathMessage != AString(""))
+ {
+ GetWorld()->BroadcastChatDeath(DeathMessage);
+ }
}
else if (a_TDI.Attacker == nullptr) // && !m_World->ShouldBroadcastDeathMessages() by fallthrough
{
@@ -952,15 +965,23 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
else if (a_TDI.Attacker->IsPlayer())
{
cPlayer * Killer = (cPlayer *)a_TDI.Attacker;
-
- GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str()));
+ AString DeathMessage = Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str());
+ PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
+ if (DeathMessage != AString(""))
+ {
+ GetWorld()->BroadcastChatDeath(DeathMessage);
+ }
}
else
{
AString KillerClass = a_TDI.Attacker->GetClass();
KillerClass.erase(KillerClass.begin()); // Erase the 'c' of the class (e.g. "cWitch" -> "Witch")
-
- GetWorld()->BroadcastChatDeath(Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str()));
+ AString DeathMessage = Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str());
+ PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
+ if (DeathMessage != AString(""))
+ {
+ GetWorld()->BroadcastChatDeath(DeathMessage);
+ }
}
m_Stats.AddValue(statDeaths);
@@ -1005,7 +1026,7 @@ void cPlayer::Respawn(void)
m_Health = GetMaxHealth();
SetInvulnerableTicks(20);
-
+
// Reset food level:
m_FoodLevel = MAX_FOOD_LEVEL;
m_FoodSaturationLevel = 5.0;
@@ -1017,7 +1038,7 @@ void cPlayer::Respawn(void)
// ToDo: send score to client? How?
m_ClientHandle->SendRespawn(GetWorld()->GetDimension(), true);
-
+
// Extinguish the fire:
StopBurning();
@@ -1151,7 +1172,7 @@ void cPlayer::CloseWindow(bool a_CanRefuse)
m_CurrentWindow = m_InventoryWindow;
return;
}
-
+
if (m_CurrentWindow->ClosedByPlayer(*this, a_CanRefuse) || !a_CanRefuse)
{
// Close accepted, go back to inventory window (the default):
@@ -1189,21 +1210,17 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
LOGWARNING("%s: Setting invalid gamemode: %d", GetName().c_str(), a_GameMode);
return;
}
-
+
if (m_GameMode == a_GameMode)
{
// Gamemode already set
return;
}
-
+
m_GameMode = a_GameMode;
m_ClientHandle->SendGameMode(a_GameMode);
- if (!(IsGameModeCreative() || IsGameModeSpectator()))
- {
- SetFlying(false);
- SetCanFly(false);
- }
+ SetCapabilities();
m_World->BroadcastPlayerListUpdateGameMode(*this);
}
@@ -1215,6 +1232,30 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
void cPlayer::LoginSetGameMode( eGameMode a_GameMode)
{
m_GameMode = a_GameMode;
+
+ SetCapabilities();
+}
+
+
+
+
+
+void cPlayer::SetCapabilities()
+{
+ if (!IsGameModeCreative() || IsGameModeSpectator())
+ {
+ SetFlying(false);
+ SetCanFly(false);
+ }
+
+ if (IsGameModeSpectator())
+ {
+ SetVisible(false);
+ }
+ else
+ {
+ SetVisible(true);
+ }
}
@@ -1306,12 +1347,12 @@ void cPlayer::SendRotation(double a_YawDegrees, double a_PitchDegrees)
Vector3d cPlayer::GetThrowStartPos(void) const
{
Vector3d res = GetEyePosition();
-
+
// Adjust the position to be just outside the player's bounding box:
res.x += 0.16 * cos(GetPitch());
res.y += -0.1;
res.z += 0.16 * sin(GetPitch());
-
+
return res;
}
@@ -1323,9 +1364,9 @@ Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const
{
Vector3d res = GetLookVector();
res.Normalize();
-
+
// TODO: Add a slight random change (+-0.0075 in each direction)
-
+
return res * a_SpeedCoeff;
}
@@ -1370,13 +1411,13 @@ void cPlayer::MoveTo( const Vector3d & a_NewPos)
}
return;
}
-
+
// TODO: should do some checks to see if player is not moving through terrain
// TODO: Official server refuses position packets too far away from each other, kicking "hacked" clients; we should, too
Vector3d DeltaPos = a_NewPos - GetPosition();
UpdateMovementStats(DeltaPos);
-
+
SetPosition( a_NewPos);
SetStance(a_NewPos.y + 1.62);
}
@@ -1411,7 +1452,7 @@ bool cPlayer::HasPermission(const AString & a_Permission)
// Empty permission request is always granted
return true;
}
-
+
AStringVector Split = StringSplit(a_Permission, ".");
// Iterate over all restrictions; if any matches, then return failure:
@@ -1583,7 +1624,7 @@ void cPlayer::TossItems(const cItems & a_Items)
{
return;
}
-
+
m_Stats.AddValue(statItemsDropped, (StatValue)a_Items.Size());
double vX = 0, vY = 0, vZ = 0;
@@ -1593,10 +1634,7 @@ void cPlayer::TossItems(const cItems & a_Items)
}
-
-
-
-bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
+bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition)
{
ASSERT(a_World != nullptr);
@@ -1605,7 +1643,14 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
// Don't move to same world
return false;
}
-
+
+ // Ask the plugins if the player is allowed to changing the world
+ if (cRoot::Get()->GetPluginManager()->CallHookEntityChangingWorld(*this, *a_World))
+ {
+ // A Plugin doesn't allow the player to changing the world
+ return false;
+ }
+
// Send the respawn packet:
if (a_ShouldSendRespawn && (m_ClientHandle != nullptr))
{
@@ -1619,8 +1664,11 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
SetWorldTravellingFrom(GetWorld()); // cChunk handles entity removal
GetWorld()->RemovePlayer(this, false);
+ SetPosition(a_NewPosition);
+
// Queue adding player to the new world, including all the necessary adjustments to the object
a_World->AddPlayer(this);
+ cWorld * OldWorld = cRoot::Get()->GetWorld(GetWorld()->GetName()); // Required for the hook HOOK_ENTITY_CHANGED_WORLD
SetWorld(a_World); // Chunks may be streamed before cWorld::AddPlayer() sets the world to the new value
// Update the view distance.
@@ -1634,7 +1682,10 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
// Broadcast the player into the new world.
a_World->BroadcastSpawnEntity(*this);
-
+
+ // Player changed the world, call the hook
+ cRoot::Get()->GetPluginManager()->CallHookEntityChangedWorld(*this, *OldWorld);
+
return true;
}
@@ -1651,7 +1702,7 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
{
return true;
}
-
+
// Load from the offline UUID file, if allowed:
AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
const char * OfflineUsage = " (unused)";
@@ -1663,7 +1714,7 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
return true;
}
}
-
+
// Load from the old-style name-based file, if allowed:
if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData())
{
@@ -1678,7 +1729,7 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
return true;
}
}
-
+
// None of the files loaded successfully
LOG("Player data file not found for %s (%s, offline %s%s), will be reset to defaults.",
GetName().c_str(), m_UUID.c_str(), OfflineUUID.c_str(), OfflineUsage
@@ -1755,7 +1806,7 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World)
{
m_CanFly = true;
}
-
+
m_Inventory.LoadFromJson(root["inventory"]);
cEnderChestEntity::LoadFromJson(root["enderchestinventory"], m_EnderChestContents);
@@ -1774,11 +1825,11 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World)
// We use the default world name (like bukkit) because stats are shared between dimensions / worlds.
cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats);
StatSerializer.Load();
-
+
LOGD("Player %s was read from file \"%s\", spawning at {%.2f, %.2f, %.2f} in world \"%s\"",
GetName().c_str(), a_FileName.c_str(), GetPosX(), GetPosY(), GetPosZ(), a_World->GetName().c_str()
);
-
+
return true;
}
@@ -2128,20 +2179,18 @@ void cPlayer::ApplyFoodExhaustionFromMovement()
return;
}
- // Process exhaustion every two ticks as that is how frequently m_LastPos is updated
- // Otherwise, we apply exhaustion for a 'movement' every tick, one of which is an already processed value
- if (GetWorld()->GetWorldAge() % 2 != 0)
- {
- return;
- }
-
// Calculate the distance travelled, update the last pos:
- Vector3d Movement(GetPosition() - m_LastPos);
- Movement.y = 0; // Only take XZ movement into account
+ double SpeedX = m_Speed.x;
+ double SpeedZ = m_Speed.z;
+ double BaseExhaustion(sqrt((SpeedX * SpeedX) + (SpeedZ * SpeedZ)));
// Apply the exhaustion based on distance travelled:
- double BaseExhaustion = Movement.Length();
- if (IsSprinting())
+ if (IsFlying() || IsClimbing())
+ {
+ // Apply no exhaustion when flying or climbing.
+ BaseExhaustion = 0;
+ }
+ else if (IsSprinting())
{
// 0.1 pt per meter sprinted
BaseExhaustion = BaseExhaustion * 0.1;
@@ -2337,7 +2386,7 @@ AString cPlayer::GetUUIDFileName(const AString & a_UUID)
{
AString UUID = cMojangAPI::MakeUUIDDashed(a_UUID);
ASSERT(UUID.length() == 36);
-
+
AString res("players/");
res.append(UUID, 0, 2);
res.push_back('/');
@@ -2345,7 +2394,3 @@ AString cPlayer::GetUUIDFileName(const AString & a_UUID)
res.append(".json");
return res;
}
-
-
-
-
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index a0cd9b1d6..dffb61677 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -26,42 +26,42 @@ class cPlayer :
public cPawn
{
typedef cPawn super;
-
+
public:
static const int MAX_HEALTH;
-
+
static const int MAX_FOOD_LEVEL;
-
+
/** Number of ticks it takes to eat an item */
static const int EATING_TICKS;
-
+
// tolua_end
-
+
CLASS_PROTODEF(cPlayer)
-
+
cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName);
-
+
virtual ~cPlayer();
virtual void SpawnOn(cClientHandle & a_Client) override;
-
+
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &) override { UNUSED(a_Dt); }
/** Returns the curently equipped weapon; empty item if none */
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
-
+
/** Returns the currently equipped helmet; empty item if none */
virtual cItem GetEquippedHelmet(void) const override { return m_Inventory.GetEquippedHelmet(); }
-
+
/** Returns the currently equipped chestplate; empty item if none */
virtual cItem GetEquippedChestplate(void) const override { return m_Inventory.GetEquippedChestplate(); }
/** Returns the currently equipped leggings; empty item if none */
virtual cItem GetEquippedLeggings(void) const override { return m_Inventory.GetEquippedLeggings(); }
-
+
/** Returns the currently equipped boots; empty item if none */
virtual cItem GetEquippedBoots(void) const override { return m_Inventory.GetEquippedBoots(); }
@@ -104,16 +104,16 @@ public:
static int CalcLevelFromXp(int a_CurrentXp);
// tolua_end
-
+
/** Starts charging the equipped bow */
void StartChargingBow(void);
-
+
/** Finishes charging the current bow. Returns the number of ticks for which the bow has been charged */
int FinishChargingBow(void);
-
+
/** Cancels the current bow charging */
void CancelChargingBow(void);
-
+
/** Returns true if the player is currently charging the bow */
bool IsChargingBow(void) const { return m_IsChargingBow; }
@@ -128,7 +128,7 @@ public:
/** Gets the contents of the player's associated enderchest */
cItemGrid & GetEnderChestContents(void) { return m_EnderChestContents; }
-
+
inline const cItem & GetEquippedItem(void) const { return GetInventory().GetEquippedItem(); } // tolua_export
/** Returns whether the player is climbing (ladders, vines etc.) */
@@ -137,43 +137,49 @@ public:
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override;
// tolua_begin
-
+
/** Sends the "look" packet to the player, forcing them to set their rotation to the specified values.
a_YawDegrees is clipped to range [-180, +180),
a_PitchDegrees is clipped to range [-180, +180) but the client only uses [-90, +90]
*/
void SendRotation(double a_YawDegrees, double a_PitchDegrees);
-
+
/** Returns the position where projectiles thrown by this player should start, player eye position + adjustment */
Vector3d GetThrowStartPos(void) const;
-
+
/** Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff. */
Vector3d GetThrowSpeed(double a_SpeedCoeff) const;
-
+
/** Returns the current gamemode. Partly OBSOLETE, you should use IsGameModeXXX() functions wherever applicable */
eGameMode GetGameMode(void) const { return m_GameMode; }
-
+
/** Returns the current effective gamemode (inherited gamemode is resolved before returning) */
eGameMode GetEffectiveGameMode(void) const { return (m_GameMode == gmNotSet) ? m_World->GetGameMode() : m_GameMode; }
-
+
/** Sets the gamemode for the player.
The gamemode may be gmNotSet, in that case the player inherits the world's gamemode.
Updates the gamemode on the client (sends the packet)
*/
void SetGameMode(eGameMode a_GameMode);
+ // Sets the current gamemode, doesn't check validity, doesn't send update packets to client
+ void LoginSetGameMode(eGameMode a_GameMode);
+
+ // Updates player's capabilities - flying, visibility, etc. from their gamemode.
+ void SetCapabilities();
+
/** Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world */
bool IsGameModeCreative(void) const;
-
+
/** Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world */
bool IsGameModeSurvival(void) const;
-
+
/** Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world */
bool IsGameModeAdventure(void) const;
-
+
/** Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current world */
bool IsGameModeSpectator(void) const;
-
+
AString GetIP(void) const { return m_IP; } // tolua_export
/** Returns the associated team, nullptr if none */
@@ -195,11 +201,8 @@ public:
If the achievement has been already awarded to the player, this method will just increment the stat counter.
Returns the _new_ stat value. (0 = Could not award achievement) */
unsigned int AwardAchievement(const eStatistic a_Ach);
-
+
void SetIP(const AString & a_IP);
-
- // Sets the current gamemode, doesn't check validity, doesn't send update packets to client
- void LoginSetGameMode(eGameMode a_GameMode);
/** Forces the player to move in the given direction.
@deprecated Use SetSpeed instead. */
@@ -210,15 +213,15 @@ public:
cWindow * GetWindow(void) { return m_CurrentWindow; } // tolua_export
const cWindow * GetWindow(void) const { return m_CurrentWindow; }
-
+
/** Opens the specified window; closes the current one first using CloseWindow() */
void OpenWindow(cWindow * a_Window); // Exported in ManualBindings.cpp
-
+
// tolua_begin
-
+
/** Closes the current window, resets current window to m_InventoryWindow. A plugin may refuse the closing if a_CanRefuse is true */
void CloseWindow(bool a_CanRefuse = true);
-
+
/** Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow */
void CloseWindowIfID(char a_WindowID, bool a_CanRefuse = true);
@@ -232,18 +235,23 @@ public:
// tolua_begin
- void SendMessage (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtCustom); }
- void SendMessageInfo (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtInformation); }
- void SendMessageFailure (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
- void SendMessageSuccess (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtSuccess); }
- void SendMessageWarning (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtWarning); }
- void SendMessageFatal (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
- void SendMessagePrivateMsg(const AString & a_Message, const AString & a_Sender) { m_ClientHandle->SendChat(a_Message, mtPrivateMessage, a_Sender); }
- void SendMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChat(a_Message); }
+ void SendMessage (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtCustom); }
+ void SendMessageInfo (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtInformation); }
+ void SendMessageFailure (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
+ void SendMessageSuccess (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtSuccess); }
+ void SendMessageWarning (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtWarning); }
+ void SendMessageFatal (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
+ void SendMessagePrivateMsg (const AString & a_Message, const AString & a_Sender) { m_ClientHandle->SendChat(a_Message, mtPrivateMessage, a_Sender); }
+ void SendMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChat(a_Message); }
+
+ void SendSystemMessage (const AString & a_Message) { m_ClientHandle->SendChatSystem(a_Message, mtCustom); }
+ void SendAboveActionBarMessage(const AString & a_Message) { m_ClientHandle->SendChatAboveActionBar(a_Message, mtCustom); }
+ void SendSystemMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChatSystem(a_Message); }
+ void SendAboveActionBarMessage(const cCompositeChat & a_Message) { m_ClientHandle->SendChatAboveActionBar(a_Message); }
const AString & GetName(void) const { return m_PlayerName; }
void SetName(const AString & a_Name) { m_PlayerName = a_Name; }
-
+
// tolua_end
bool HasPermission(const AString & a_Permission); // tolua_export
@@ -260,7 +268,7 @@ public:
const AStringVector & GetRestrictions(void) const { return m_Restrictions; } // Exported in ManualBindings.cpp
// tolua_begin
-
+
/** Returns the full color code to use for this player, based on their rank.
The returned value either is empty, or includes the cChatColor::Delimiter. */
AString GetColor(void) const;
@@ -279,15 +287,15 @@ public:
/** Heals the player by the specified amount of HPs (positive only); sends health update */
virtual void Heal(int a_Health) override;
-
+
int GetFoodLevel (void) const { return m_FoodLevel; }
double GetFoodSaturationLevel (void) const { return m_FoodSaturationLevel; }
int GetFoodTickTimer (void) const { return m_FoodTickTimer; }
double GetFoodExhaustionLevel (void) const { return m_FoodExhaustionLevel; }
-
+
/** Returns true if the player is satiated, i. e. their foodlevel is at the max and they cannot eat anymore */
bool IsSatiated(void) const { return (m_FoodLevel >= MAX_FOOD_LEVEL); }
-
+
void SetFoodLevel (int a_FoodLevel);
void SetFoodSaturationLevel (double a_FoodSaturationLevel);
void SetFoodTickTimer (int a_FoodTickTimer);
@@ -298,10 +306,10 @@ public:
/** Adds the specified exhaustion to m_FoodExhaustion. Expects only positive values. */
void AddFoodExhaustion(double a_Exhaustion);
-
+
/** Returns true if the player is currently in the process of eating the currently equipped item */
bool IsEating(void) const { return (m_EatingFinishTick >= 0); }
-
+
/** Returns true if the player is currently flying. */
bool IsFlying(void) const { return m_IsFlying; }
@@ -329,16 +337,16 @@ public:
GetWorld()->BroadcastEntityAnimation(*this, 2);
}
}
-
+
/** Starts eating the currently equipped item. Resets the eating timer and sends the proper animation packet */
void StartEating(void);
-
+
/** Finishes eating the currently equipped item. Consumes the item, updates health and broadcasts the packets */
void FinishEating(void);
-
+
/** Aborts the current eating operation */
void AbortEating(void);
-
+
virtual void KilledBy(TakeDamageInfo & a_TDI) override;
virtual void Killed(cEntity * a_Victim) override;
@@ -350,75 +358,75 @@ public:
/** Moves the player to the specified world.
Returns true if successful, false on failure (world not found). */
- virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn) override;
+ virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition) override;
/** Saves all player data, such as inventory, to JSON */
bool SaveToDisk(void);
typedef cWorld * cWorldPtr;
-
+
/** Loads the player data from the disk file
Sets a_World to the world where the player will spawn, based on the stored world name or the default world by calling LoadFromFile()
Returns true on success, false on failure
*/
bool LoadFromDisk(cWorldPtr & a_World);
-
+
/** Loads the player data from the specified file
Sets a_World to the world where the player will spawn, based on the stored world name or the default world
Returns true on success, false on failure
*/
bool LoadFromFile(const AString & a_FileName, cWorldPtr & a_World);
-
+
const AString & GetLoadedWorldName() { return m_LoadedWorldName; }
void UseEquippedItem(int a_Amount = 1);
-
+
void SendHealth(void);
void SendExperience(void);
-
+
/** In UI windows, get the item that the player is dragging */
cItem & GetDraggingItem(void) {return m_DraggingItem; }
-
+
// In UI windows, when inventory-painting:
/** Clears the list of slots that are being inventory-painted. To be used by cWindow only */
void ClearInventoryPaintSlots(void);
-
+
/** Adds a slot to the list for inventory painting. To be used by cWindow only */
void AddInventoryPaintSlot(int a_SlotNum);
-
+
/** Returns the list of slots currently stored for inventory painting. To be used by cWindow only */
const cSlotNums & GetInventoryPaintSlots(void) const;
-
+
// tolua_begin
-
+
/** Returns the current relative maximum speed (takes current sprinting / flying state into account) */
double GetMaxSpeed(void) const;
-
+
/** Gets the normal relative maximum speed */
double GetNormalMaxSpeed(void) const { return m_NormalMaxSpeed; }
-
+
/** Gets the sprinting relative maximum speed */
double GetSprintingMaxSpeed(void) const { return m_SprintingMaxSpeed; }
-
+
/** Gets the flying relative maximum speed */
double GetFlyingMaxSpeed(void) const { return m_FlyingMaxSpeed; }
-
+
/** Sets the normal relative maximum speed. Sends the update to player, if needed. */
void SetNormalMaxSpeed(double a_Speed);
-
+
/** Sets the sprinting relative maximum speed. Sends the update to player, if needed. */
void SetSprintingMaxSpeed(double a_Speed);
-
+
/** Sets the flying relative maximum speed. Sends the update to player, if needed. */
void SetFlyingMaxSpeed(double a_Speed);
-
+
/** Sets the crouch status, broadcasts to all visible players */
void SetCrouch(bool a_IsCrouched);
-
+
/** Starts or stops sprinting, sends the max speed update to the client, if needed */
void SetSprint(bool a_IsSprinting);
-
+
/** Flags the player as flying */
void SetFlying(bool a_IsFlying);
@@ -442,17 +450,17 @@ public:
/** Sets the player's bed (home) position */
void SetBedPos(const Vector3i & a_Pos) { m_LastBedPos = a_Pos; }
-
+
// tolua_end
/** Update movement-related statistics. */
void UpdateMovementStats(const Vector3d & a_DeltaPos);
-
+
// tolua_begin
/** Returns wheter the player can fly or not. */
virtual bool CanFly(void) const { return m_CanFly; }
-
+
/** Returns the UUID (short format) that has been read from the client, or empty string if not available. */
const AString & GetUUID(void) const { return m_UUID; }
@@ -483,16 +491,16 @@ public:
bool PlaceBlocks(const sSetBlockVector & a_Blocks);
// cEntity overrides:
- virtual bool IsCrouched (void) const { return m_IsCrouched; }
- virtual bool IsSprinting(void) const { return m_IsSprinting; }
- virtual bool IsRclking (void) const { return IsEating() || IsChargingBow(); }
+ virtual bool IsCrouched (void) const override { return m_IsCrouched; }
+ virtual bool IsSprinting(void) const override { return m_IsSprinting; }
+ virtual bool IsRclking (void) const override { return IsEating() || IsChargingBow(); }
- virtual void Detach(void);
+ virtual void Detach(void) override;
/** Called by cClientHandle when the client is being destroyed.
The player removes its m_ClientHandle ownership so that the ClientHandle gets deleted. */
void RemoveClientHandle(void);
-
+
protected:
typedef std::vector<std::vector<AString> > AStringVectorVector;
@@ -535,16 +543,16 @@ protected:
// Food-related variables:
/** Represents the food bar, one point equals half a "drumstick" */
int m_FoodLevel;
-
+
/** "Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel */
double m_FoodSaturationLevel;
-
+
/** Count-up to the healing or damaging action, based on m_FoodLevel */
int m_FoodTickTimer;
-
+
/** A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel. Each action adds a little */
double m_FoodExhaustionLevel;
-
+
float m_LastJumpHeight;
float m_LastGroundHeight;
bool m_bTouchGround;
@@ -564,31 +572,31 @@ protected:
eGameMode m_GameMode;
AString m_IP;
-
+
/** The item being dragged by the cursor while in a UI window */
cItem m_DraggingItem;
std::chrono::steady_clock::time_point m_LastPlayerListTime;
cClientHandlePtr m_ClientHandle;
-
+
cSlotNums m_InventoryPaintSlots;
-
+
/** Max speed, relative to the game default.
1 means regular speed, 2 means twice as fast, 0.5 means half-speed.
Default value is 1. */
double m_NormalMaxSpeed;
-
+
/** Max speed, relative to the game default max speed, when sprinting.
1 means regular speed, 2 means twice as fast, 0.5 means half-speed.
Default value is 1.3. */
double m_SprintingMaxSpeed;
-
+
/** Max speed, relative to the game default flying max speed, when flying.
1 means regular speed, 2 means twice as fast, 0.5 means half-speed.
Default value is 1. */
double m_FlyingMaxSpeed;
-
+
bool m_IsCrouched;
bool m_IsSprinting;
bool m_IsFlying;
@@ -629,7 +637,7 @@ protected:
Will not apply food penalties if found to be true; will set to false after processing
*/
bool m_bIsTeleporting;
-
+
/** The short UUID (no dashes) of the player, as read from the ClientHandle.
If no ClientHandle is given, the UUID is initialized to empty. */
AString m_UUID;
@@ -642,14 +650,14 @@ protected:
void ResolvePermissions(void);
void ResolveGroups(void);
- virtual void Destroyed(void);
+ virtual void Destroyed(void) override;
/** Filters out damage for creative mode / friendly fire */
virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
/** Stops players from burning in creative mode */
virtual void TickBurning(cChunk & a_Chunk) override;
-
+
/** Called in each tick to handle food-related processing */
void HandleFood(void);
@@ -666,7 +674,3 @@ protected:
This can be used both for online and offline UUIDs. */
AString GetUUIDFileName(const AString & a_UUID);
} ; // tolua_export
-
-
-
-
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 05b7669cd..8e2e412dd 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -30,7 +30,7 @@
/// Converts an angle in radians into a byte representation used by the network protocol
-#define ANGLE_TO_PROTO(X) (Byte)(X * 255 / 360)
+#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
@@ -222,7 +222,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a
m_ProjectileKind(a_Kind),
m_CreatorData(
((a_Creator != nullptr) ? a_Creator->GetUniqueID() : cEntity::INVALID_ID),
- ((a_Creator != nullptr) ? (a_Creator->IsPlayer() ? ((cPlayer *)a_Creator)->GetName() : "") : ""),
+ ((a_Creator != nullptr) ? (a_Creator->IsPlayer() ? static_cast<cPlayer *>(a_Creator)->GetName() : "") : ""),
((a_Creator != nullptr) ? a_Creator->GetEquippedWeapon().m_Enchantments : cEnchantments())
),
m_IsInGround(false)
@@ -238,7 +238,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height) :
super(etProjectile, a_Pos.x, a_Pos.y, a_Pos.z, a_Width, a_Height),
m_ProjectileKind(a_Kind),
- m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? ((cPlayer *)a_Creator)->GetName() : "", a_Creator->GetEquippedWeapon().m_Enchantments),
+ m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? static_cast<cPlayer *>(a_Creator)->GetName() : "", a_Creator->GetEquippedWeapon().m_Enchantments),
m_IsInGround(false)
{
SetSpeed(a_Speed);
@@ -281,6 +281,7 @@ cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator,
return new cFireworkEntity(a_Creator, a_X, a_Y, a_Z, *a_Item);
}
+ case pkFishingFloat: break;
}
LOGWARNING("%s: Unknown projectile kind: %d", __FUNCTION__, a_Kind);
diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp
index fd1a0179b..926fd1abe 100644
--- a/src/Entities/SplashPotionEntity.cpp
+++ b/src/Entities/SplashPotionEntity.cpp
@@ -9,7 +9,7 @@
/// Converts an angle in radians into a byte representation used by the network protocol
-#define ANGLE_TO_PROTO(X) (Byte)(X * 255 / 360)
+#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
////////////////////////////////////////////////////////////////////////////////
// cSplashPotionEntityCallback:
@@ -51,7 +51,7 @@ public:
double Reduction = -0.25 * SplashDistance + 1.0;
Reduction = std::max(Reduction, 0.0);
- ((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction);
+ static_cast<cPawn *>(a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction);
return false;
}
@@ -116,7 +116,13 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
m_World->ForEachEntity(Callback);
- m_World->BroadcastSoundParticleEffect(2002, (int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z), m_PotionColor);
+ m_World->BroadcastSoundParticleEffect(
+ 2002,
+ FloorC(a_HitPos.x),
+ FloorC(a_HitPos.y),
+ FloorC(a_HitPos.z),
+ m_PotionColor
+ );
}
diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp
index f01cdc18c..12d826042 100644
--- a/src/Entities/ThrownEnderPearlEntity.cpp
+++ b/src/Entities/ThrownEnderPearlEntity.cpp
@@ -77,9 +77,9 @@ void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
class cProjectileCreatorCallbackForPlayers : public cPlayerListCallback
{
public:
- cProjectileCreatorCallbackForPlayers(cEntity * a_Attacker, Vector3i a_HitPos) :
+ cProjectileCreatorCallbackForPlayers(cEntity * a_Attacker, Vector3i a_CallbackHitPos) :
m_Attacker(a_Attacker),
- m_HitPos(a_HitPos)
+ m_HitPos(a_CallbackHitPos)
{
}
diff --git a/src/Entities/ThrownSnowballEntity.cpp b/src/Entities/ThrownSnowballEntity.cpp
index 24db1e7ee..b28205d44 100644
--- a/src/Entities/ThrownSnowballEntity.cpp
+++ b/src/Entities/ThrownSnowballEntity.cpp
@@ -32,7 +32,7 @@ void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d &
int TotalDamage = 0;
if (a_EntityHit.IsMob())
{
- eMonsterType MobType = ((cMonster &) a_EntityHit).GetMobType();
+ eMonsterType MobType = static_cast<cMonster &>(a_EntityHit).GetMobType();
if (MobType == mtBlaze)
{
TotalDamage = 3;
diff --git a/src/FastRandom.cpp b/src/FastRandom.cpp
index 737b13535..c1716f026 100644
--- a/src/FastRandom.cpp
+++ b/src/FastRandom.cpp
@@ -6,12 +6,28 @@
#include "Globals.h"
#include "FastRandom.h"
+#include <random>
+
#ifdef _WIN32
- #define thread_local __declspec(thread)
+ #define thread_local static __declspec(thread)
+#elif defined __APPLE__
+ #define thread_local static __thread
#endif
-thread_local unsigned int m_Counter = 0;
-
+static unsigned int GetRandomSeed()
+{
+ thread_local bool SeedCounterInitialized = 0;
+ thread_local unsigned int SeedCounter = 0;
+
+ if (!SeedCounterInitialized)
+ {
+ std::random_device rd;
+ std::uniform_int_distribution<unsigned int> dist;
+ SeedCounter = dist(rd);
+ SeedCounterInitialized = true;
+ }
+ return ++SeedCounter;
+}
@@ -92,7 +108,7 @@ public:
cFastRandom::cFastRandom(void) :
- m_LinearRand(m_Counter++)
+ m_LinearRand(GetRandomSeed())
{
}
@@ -136,7 +152,7 @@ int cFastRandom::GenerateRandomInteger(int a_Begin, int a_End)
// MTRand:
MTRand::MTRand() :
- m_MersenneRand(m_Counter++)
+ m_MersenneRand(GetRandomSeed())
{
}
diff --git a/src/FurnaceRecipe.cpp b/src/FurnaceRecipe.cpp
index ea952a852..a0c8560f1 100644
--- a/src/FurnaceRecipe.cpp
+++ b/src/FurnaceRecipe.cpp
@@ -77,7 +77,7 @@ void cFurnaceRecipe::ReloadRecipes(void)
size_t FirstCommentSymbol = ParsingLine.find('#');
if ((FirstCommentSymbol != AString::npos) && (FirstCommentSymbol != 0))
{
- ParsingLine.erase(ParsingLine.begin() + (const long)FirstCommentSymbol, ParsingLine.end());
+ ParsingLine.erase(ParsingLine.begin() + static_cast<const long>(FirstCommentSymbol), ParsingLine.end());
}
switch (ParsingLine[0])
@@ -115,13 +115,13 @@ void cFurnaceRecipe::AddFuelFromLine(const AString & a_Line, unsigned int a_Line
Line.erase(Line.begin()); // Remove the beginning "!"
Line.erase(std::remove_if(Line.begin(), Line.end(), isspace), Line.end());
- std::unique_ptr<cItem> Item(new cItem);
+ std::unique_ptr<cItem> Item = cpp14::make_unique<cItem>();
int BurnTime;
const AStringVector & Sides = StringSplit(Line, "=");
if (Sides.size() != 2)
{
- LOGWARNING("furnace.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);
+ LOGWARNING("furnace.txt: line %d: A single '=' was expected, got " SIZE_T_FMT, a_LineNum, Sides.size() - 1);
LOGINFO("Offending line: \"%s\"", a_Line.c_str());
return;
}
@@ -157,13 +157,13 @@ void cFurnaceRecipe::AddRecipeFromLine(const AString & a_Line, unsigned int a_Li
Line.erase(std::remove_if(Line.begin(), Line.end(), isspace), Line.end());
int CookTime = 200;
- std::unique_ptr<cItem> InputItem(new cItem());
- std::unique_ptr<cItem> OutputItem(new cItem());
+ std::unique_ptr<cItem> InputItem = cpp14::make_unique<cItem>();
+ std::unique_ptr<cItem> OutputItem = cpp14::make_unique<cItem>();
const AStringVector & Sides = StringSplit(Line, "=");
if (Sides.size() != 2)
{
- LOGWARNING("furnace.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);
+ LOGWARNING("furnace.txt: line %d: A single '=' was expected, got " SIZE_T_FMT, a_LineNum, Sides.size() - 1);
LOGINFO("Offending line: \"%s\"", a_Line.c_str());
return;
}
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index 867155ad2..ff8827511 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -49,16 +49,16 @@ void cBioGenConstant::InitializeBiomeGen(cIniFile & a_IniFile)
////////////////////////////////////////////////////////////////////////////////
// cBioGenCache:
-cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, int a_CacheSize) :
+cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize) :
m_BioGenToCache(a_BioGenToCache),
m_CacheSize(a_CacheSize),
- m_CacheOrder(new int[a_CacheSize]),
+ m_CacheOrder(new size_t[a_CacheSize]),
m_CacheData(new sCacheData[a_CacheSize]),
m_NumHits(0),
m_NumMisses(0),
m_TotalChain(0)
{
- for (int i = 0; i < m_CacheSize; i++)
+ for (size_t i = 0; i < m_CacheSize; i++)
{
m_CacheOrder[i] = i;
m_CacheData[i].m_ChunkX = 0x7fffffff;
@@ -86,11 +86,11 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
{
if (((m_NumHits + m_NumMisses) % 1024) == 10)
{
- LOGD("BioGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
- LOGD("BioGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits);
+ LOGD("BioGenCache: %u hits, %u misses, saved %.2f %%", static_cast<unsigned>(m_NumHits), static_cast<unsigned>(m_NumMisses), 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
+ LOGD("BioGenCache: Avg cache chain length: %.2f", static_cast<double>(m_TotalChain) / m_NumHits);
}
- for (int i = 0; i < m_CacheSize; i++)
+ for (size_t i = 0; i < m_CacheSize; i++)
{
if (
(m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) ||
@@ -100,10 +100,10 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
continue;
}
// Found it in the cache
- int Idx = m_CacheOrder[i];
+ size_t Idx = m_CacheOrder[i];
// Move to front:
- for (int j = i; j > 0; j--)
+ for (size_t j = i; j > 0; j--)
{
m_CacheOrder[j] = m_CacheOrder[j - 1];
}
@@ -122,8 +122,8 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
m_BioGenToCache->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
// Insert it as the first item in the MRU order:
- int Idx = m_CacheOrder[m_CacheSize - 1];
- for (int i = m_CacheSize - 1; i > 0; i--)
+ size_t Idx = m_CacheOrder[m_CacheSize - 1];
+ for (size_t i = m_CacheSize - 1; i > 0; i--)
{
m_CacheOrder[i] = m_CacheOrder[i - 1];
} // for i - m_CacheOrder[]
@@ -166,7 +166,7 @@ cBioGenMulticache::cBioGenMulticache(cBiomeGenPtr a_BioGenToCache, size_t a_SubC
void cBioGenMulticache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
{
const size_t coefficient = 3;
- const size_t cacheIdx = ((size_t)a_ChunkX + coefficient * (size_t)a_ChunkZ) % m_NumSubCaches;
+ const size_t cacheIdx = (static_cast<size_t>(a_ChunkX) + coefficient * static_cast<size_t>(a_ChunkZ)) % m_NumSubCaches;
m_Caches[cacheIdx]->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
}
@@ -226,7 +226,7 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
} // for itr - Split[]
if (!m_Biomes.empty())
{
- m_BiomesCount = (int)m_Biomes.size();
+ m_BiomesCount = static_cast<int>(m_Biomes.size());
return;
}
@@ -260,7 +260,7 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
{
m_Biomes.push_back(Biomes[i]);
}
- m_BiomesCount = (int)m_Biomes.size();
+ m_BiomesCount = static_cast<int>(m_Biomes.size());
}
@@ -278,7 +278,7 @@ void cBioGenCheckerboard::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::Biome
for (int x = 0; x < cChunkDef::Width; x++)
{
int Add = cChunkDef::Width * a_ChunkX + x;
- int BiomeIdx = (((Base + Add / m_BiomeSize) % m_BiomesCount) + m_BiomesCount) % m_BiomesCount; // Need to add and modulo twice because of negative numbers
+ size_t BiomeIdx = static_cast<size_t>((((Base + Add / m_BiomeSize) % m_BiomesCount) + m_BiomesCount) % m_BiomesCount); // Need to add and modulo twice because of negative numbers
a_BiomeMap[x + cChunkDef::Width * z] = m_Biomes[BiomeIdx];
}
}
@@ -314,7 +314,7 @@ void cBioGenVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap &
for (int x = 0; x < cChunkDef::Width; x++)
{
int VoronoiCellValue = m_Voronoi.GetValueAt(BaseX + x, AbsoluteZ) / 8;
- cChunkDef::SetBiome(a_BiomeMap, x, z, m_Biomes[VoronoiCellValue % m_BiomesCount]);
+ cChunkDef::SetBiome(a_BiomeMap, x, z, m_Biomes[static_cast<size_t>(VoronoiCellValue % m_BiomesCount)]);
} // for x
} // for z
}
@@ -363,7 +363,7 @@ void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::B
for (int x = 0; x < cChunkDef::Width; x++)
{
int VoronoiCellValue = m_Voronoi.GetValueAt(DistortX[x][z], DistortZ[x][z]) / 8;
- cChunkDef::SetBiome(a_BiomeMap, x, z, m_Biomes[VoronoiCellValue % m_BiomesCount]);
+ cChunkDef::SetBiome(a_BiomeMap, x, z, m_Biomes[static_cast<size_t>(VoronoiCellValue % m_BiomesCount)]);
} // for x
} // for z
}
@@ -385,15 +385,15 @@ void cBioGenDistortedVoronoi::InitializeBiomeGen(cIniFile & a_IniFile)
void cBioGenDistortedVoronoi::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ)
{
- double NoiseX = m_Noise.CubicNoise3D((float)a_BlockX / m_CellSize, (float)a_BlockZ / m_CellSize, 1000);
- NoiseX += 0.5 * m_Noise.CubicNoise3D(2 * (float)a_BlockX / m_CellSize, 2 * (float)a_BlockZ / m_CellSize, 2000);
- NoiseX += 0.08 * m_Noise.CubicNoise3D(16 * (float)a_BlockX / m_CellSize, 16 * (float)a_BlockZ / m_CellSize, 3000);
- double NoiseZ = m_Noise.CubicNoise3D((float)a_BlockX / m_CellSize, (float)a_BlockZ / m_CellSize, 4000);
- NoiseZ += 0.5 * m_Noise.CubicNoise3D(2 * (float)a_BlockX / m_CellSize, 2 * (float)a_BlockZ / m_CellSize, 5000);
- NoiseZ += 0.08 * m_Noise.CubicNoise3D(16 * (float)a_BlockX / m_CellSize, 16 * (float)a_BlockZ / m_CellSize, 6000);
+ double NoiseX = m_Noise.CubicNoise3D(static_cast<float>(a_BlockX / m_CellSize), static_cast<float>(a_BlockZ / m_CellSize), 1000);
+ NoiseX += 0.5 * m_Noise.CubicNoise3D(2 * static_cast<float>(a_BlockX / m_CellSize), 2 * static_cast<float>(a_BlockZ / m_CellSize), 2000);
+ NoiseX += 0.08 * m_Noise.CubicNoise3D(16 * static_cast<float>(a_BlockX / m_CellSize), 16 * static_cast<float>(a_BlockZ / m_CellSize), 3000);
+ double NoiseZ = m_Noise.CubicNoise3D(static_cast<float>(a_BlockX / m_CellSize), static_cast<float>(a_BlockZ / m_CellSize), 4000);
+ NoiseZ += 0.5 * m_Noise.CubicNoise3D(2 * static_cast<float>(a_BlockX / m_CellSize), 2 * static_cast<float>(a_BlockZ / m_CellSize), 5000);
+ NoiseZ += 0.08 * m_Noise.CubicNoise3D(16 * static_cast<float>(a_BlockX / m_CellSize), 16 * static_cast<float>(a_BlockZ / m_CellSize), 6000);
- a_DistortedX = a_BlockX + (int)(m_CellSize * 0.5 * NoiseX);
- a_DistortedZ = a_BlockZ + (int)(m_CellSize * 0.5 * NoiseZ);
+ a_DistortedX = a_BlockX + static_cast<int>(m_CellSize * 0.5 * NoiseX);
+ a_DistortedZ = a_BlockZ + static_cast<int>(m_CellSize * 0.5 * NoiseZ);
}
@@ -429,7 +429,7 @@ void cBioGenMultiStepMap::InitializeBiomeGen(cIniFile & a_IniFile)
m_MushroomIslandSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapMushroomIslandSize", m_MushroomIslandSize);
m_RiverCellSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapRiverCellSize", m_RiverCellSize);
m_RiverWidthThreshold = a_IniFile.GetValueSetF("Generator", "MultiStepMapRiverWidth", m_RiverWidthThreshold);
- m_LandBiomesSize = (float)a_IniFile.GetValueSetI("Generator", "MultiStepMapLandBiomeSize", (int)m_LandBiomesSize);
+ m_LandBiomesSize = static_cast<float>(a_IniFile.GetValueSetI("Generator", "MultiStepMapLandBiomeSize", static_cast<int>(m_LandBiomesSize)));
}
@@ -554,7 +554,7 @@ void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::Biome
{
for (int z = 0; z < cChunkDef::Width; z++)
{
- float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_RiverCellSize;
+ float NoiseCoordZ = static_cast<float>(a_ChunkZ * cChunkDef::Width + z) / m_RiverCellSize;
for (int x = 0; x < cChunkDef::Width; x++)
{
if (cChunkDef::GetBiome(a_BiomeMap, x, z) != biInvalidBiome)
@@ -563,7 +563,7 @@ void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::Biome
continue;
}
- float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_RiverCellSize;
+ float NoiseCoordX = static_cast<float>(a_ChunkX * cChunkDef::Width + x) / m_RiverCellSize;
double Noise = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ);
Noise += 0.5 * m_Noise3.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ);
@@ -597,15 +597,15 @@ void cBioGenMultiStepMap::ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, c
void cBioGenMultiStepMap::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize)
{
- double NoiseX = m_Noise3.CubicNoise2D( (float)a_BlockX / a_CellSize, (float)a_BlockZ / a_CellSize);
- NoiseX += 0.5 * m_Noise2.CubicNoise2D(2 * (float)a_BlockX / a_CellSize, 2 * (float)a_BlockZ / a_CellSize);
- NoiseX += 0.1 * m_Noise1.CubicNoise2D(16 * (float)a_BlockX / a_CellSize, 16 * (float)a_BlockZ / a_CellSize);
- double NoiseZ = m_Noise6.CubicNoise2D( (float)a_BlockX / a_CellSize, (float)a_BlockZ / a_CellSize);
- NoiseZ += 0.5 * m_Noise5.CubicNoise2D(2 * (float)a_BlockX / a_CellSize, 2 * (float)a_BlockZ / a_CellSize);
- NoiseZ += 0.1 * m_Noise4.CubicNoise2D(16 * (float)a_BlockX / a_CellSize, 16 * (float)a_BlockZ / a_CellSize);
+ double NoiseX = m_Noise3.CubicNoise2D( static_cast<float>(a_BlockX / a_CellSize), static_cast<float>(a_BlockZ / a_CellSize));
+ NoiseX += 0.5 * m_Noise2.CubicNoise2D(2 * static_cast<float>(a_BlockX / a_CellSize), 2 * static_cast<float>(a_BlockZ / a_CellSize));
+ NoiseX += 0.1 * m_Noise1.CubicNoise2D(16 * static_cast<float>(a_BlockX / a_CellSize), 16 * static_cast<float>(a_BlockZ / a_CellSize));
+ double NoiseZ = m_Noise6.CubicNoise2D( static_cast<float>(a_BlockX / a_CellSize), static_cast<float>(a_BlockZ / a_CellSize));
+ NoiseZ += 0.5 * m_Noise5.CubicNoise2D(2 * static_cast<float>(a_BlockX / a_CellSize), 2 * static_cast<float>(a_BlockZ / a_CellSize));
+ NoiseZ += 0.1 * m_Noise4.CubicNoise2D(16 * static_cast<float>(a_BlockX / a_CellSize), 16 * static_cast<float>(a_BlockZ / a_CellSize));
- a_DistortedX = a_BlockX + (int)(a_CellSize * 0.5 * NoiseX);
- a_DistortedZ = a_BlockZ + (int)(a_CellSize * 0.5 * NoiseZ);
+ a_DistortedX = a_BlockX + static_cast<int>(a_CellSize * 0.5 * NoiseX);
+ a_DistortedZ = a_BlockZ + static_cast<int>(a_CellSize * 0.5 * NoiseZ);
}
@@ -619,10 +619,10 @@ void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_Chunk
DblMap HumidityMap;
for (int z = 0; z < 17; z += 8)
{
- float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize;
+ float NoiseCoordZ = static_cast<float>(a_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize;
for (int x = 0; x < 17; x += 8)
{
- float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize;
+ float NoiseCoordX = static_cast<float>(a_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize;
double NoiseT = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ);
NoiseT += 0.5 * m_Noise2.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ);
@@ -641,8 +641,8 @@ void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_Chunk
// Re-map into integral values in [0 .. 255] range:
for (size_t idx = 0; idx < ARRAYCOUNT(a_TemperatureMap); idx++)
{
- a_TemperatureMap[idx] = std::max(0, std::min(255, (int)(128 + TemperatureMap[idx] * 128)));
- a_HumidityMap[idx] = std::max(0, std::min(255, (int)(128 + HumidityMap[idx] * 128)));
+ a_TemperatureMap[idx] = Clamp(static_cast<int>(128 + TemperatureMap[idx] * 128), 0, 255);
+ a_HumidityMap[idx] = Clamp(static_cast<int>(128 + HumidityMap[idx] * 128), 0, 255);
}
}
@@ -771,8 +771,8 @@ void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap
NoiseZ += m_AmpZ2 * m_Noise5.CubicNoise2D(BlockX * m_FreqZ2, BlockZ * m_FreqZ2);
NoiseZ += m_AmpZ3 * m_Noise6.CubicNoise2D(BlockX * m_FreqZ3, BlockZ * m_FreqZ3);
- DistortX[4 * x][4 * z] = (int)(BlockX + NoiseX);
- DistortZ[4 * x][4 * z] = (int)(BlockZ + NoiseZ);
+ DistortX[4 * x][4 * z] = static_cast<int>(BlockX + NoiseX);
+ DistortZ[4 * x][4 * z] = static_cast<int>(BlockZ + NoiseZ);
}
LinearUpscale2DArrayInPlace<cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4>(&DistortX[0][0]);
@@ -785,7 +785,7 @@ void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap
{
int SeedX, SeedZ, MinDist2;
int BiomeGroup = m_VoronoiLarge.GetValueAt(DistortX[x][z], DistortZ[x][z], SeedX, SeedZ, MinDist2) / 7;
- int BiomeIdx = m_VoronoiSmall.GetValueAt(DistortX[x][z], DistortZ[x][z], SeedX, SeedZ, MinDist2) / 11;
+ size_t BiomeIdx = static_cast<size_t>(m_VoronoiSmall.GetValueAt(DistortX[x][z], DistortZ[x][z], SeedX, SeedZ, MinDist2) / 11);
int MinDist1 = (DistortX[x][z] - SeedX) * (DistortX[x][z] - SeedX) + (DistortZ[x][z] - SeedZ) * (DistortZ[x][z] - SeedZ);
cChunkDef::SetBiome(a_BiomeMap, x, z, SelectBiome(BiomeGroup, BiomeIdx, (MinDist1 < MinDist2 / 4) ? 1 : 0));
}
@@ -796,7 +796,7 @@ void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap
-EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, int a_BiomeIdx, int a_DistLevel)
+EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int a_DistLevel)
{
// TODO: Move this into settings
struct BiomeLevels
@@ -900,7 +900,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, int a_BiomeIdx, int a_D
{ bgMesa, ARRAYCOUNT(bgMesa), },
{ bgDenseTrees, ARRAYCOUNT(bgDenseTrees), },
} ;
- size_t Group = a_BiomeGroup % ARRAYCOUNT(BiomeGroups);
+ size_t Group = static_cast<size_t>(a_BiomeGroup) % ARRAYCOUNT(BiomeGroups);
size_t Index = a_BiomeIdx % BiomeGroups[Group].Count;
return (a_DistLevel > 0) ? BiomeGroups[Group].Biomes[Index].InnerBiome : BiomeGroups[Group].Biomes[Index].OuterBiome;
}
@@ -913,18 +913,18 @@ void cBioGenTwoLevel::InitializeBiomeGen(cIniFile & a_IniFile)
{
m_VoronoiLarge.SetCellSize(a_IniFile.GetValueSetI("Generator", "TwoLevelLargeCellSize", 1024));
m_VoronoiSmall.SetCellSize(a_IniFile.GetValueSetI("Generator", "TwoLevelSmallCellSize", 128));
- m_FreqX1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Freq", 0.01);
- m_AmpX1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Amp", 80);
- m_FreqX2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Freq", 0.05);
- m_AmpX2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Amp", 20);
- m_FreqX3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Freq", 0.1),
- m_AmpX3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Amp", 8);
- m_FreqZ1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Freq", 0.01);
- m_AmpZ1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Amp", 80);
- m_FreqZ2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Freq", 0.05);
- m_AmpZ2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Amp", 20);
- m_FreqZ3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Freq", 0.1);
- m_AmpZ3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Amp", 8);
+ m_FreqX1 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Freq", 0.01));
+ m_AmpX1 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Amp", 80));
+ m_FreqX2 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Freq", 0.05));
+ m_AmpX2 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Amp", 20));
+ m_FreqX3 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Freq", 0.1)),
+ m_AmpX3 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Amp", 8));
+ m_FreqZ1 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Freq", 0.01));
+ m_AmpZ1 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Amp", 80));
+ m_FreqZ2 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Freq", 0.05));
+ m_AmpZ2 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Amp", 20));
+ m_FreqZ3 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Freq", 0.1));
+ m_AmpZ3 = static_cast<float>(a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Amp", 8));
}
@@ -1022,7 +1022,7 @@ public:
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- cChunkDef::SetBiome(a_Biomes, x, z, (EMCSBiome)vals[x + cChunkDef::Width * z]);
+ cChunkDef::SetBiome(a_Biomes, x, z, static_cast<EMCSBiome>(vals[x + cChunkDef::Width * z]));
}
}
}
@@ -1126,7 +1126,7 @@ public:
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- cChunkDef::SetBiome(a_Biomes, x, z, (EMCSBiome)vals[x + cChunkDef::Width * z]);
+ cChunkDef::SetBiome(a_Biomes, x, z, static_cast<EMCSBiome>(vals[x + cChunkDef::Width * z]));
}
}
}
diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h
index 13fb40c5f..44f1dfd2a 100644
--- a/src/Generating/BioGen.h
+++ b/src/Generating/BioGen.h
@@ -48,7 +48,7 @@ class cBioGenCache :
typedef cBiomeGen super;
public:
- cBioGenCache(cBiomeGenPtr a_BioGenToCache, int a_CacheSize);
+ cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize);
virtual ~cBioGenCache();
protected:
@@ -63,14 +63,14 @@ protected:
} ;
// To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data
- int m_CacheSize;
- int * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
+ size_t m_CacheSize;
+ size_t * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used
// Cache statistics
- int m_NumHits;
- int m_NumMisses;
- int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
+ size_t m_NumHits;
+ size_t m_NumMisses;
+ size_t m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
@@ -311,7 +311,7 @@ protected:
/// Selects biome from the specified biome group, based on the specified index.
/// Note that both params may overflow
/// a_DistLevel is either 0 or 1; zero when it is at the edge of the small Voronoi cell, 1 near the center
- EMCSBiome SelectBiome(int a_BiomeGroup, int a_BiomeIdx, int a_DistLevel);
+ EMCSBiome SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int a_DistLevel);
} ;
diff --git a/src/Generating/CMakeLists.txt b/src/Generating/CMakeLists.txt
index a28510d40..de74f8734 100644
--- a/src/Generating/CMakeLists.txt
+++ b/src/Generating/CMakeLists.txt
@@ -72,8 +72,34 @@ SET (HDRS
VillageGen.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+ set_source_files_properties(Caves.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(ChunkGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(CompoGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=old-style-cast")
+ set_source_files_properties(ComposableGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
+ set_source_files_properties(DistortedHeightmap.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(EndGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(FinishGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch")
+ set_source_files_properties(HeiGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(NetherFortGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
+ set_source_files_properties(Noise3DGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ 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(RainbowRoadsGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
+ set_source_files_properties(Ravines.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(RoughRavines.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=float-equal -Wno-error=old-style-cast")
+ set_source_files_properties(StructGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch -Wno-error=old-style-cast")
+ set_source_files_properties(ShapeGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(TestRailsGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors")
+ set_source_files_properties(TwoHeights.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(UnderwaterBaseGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=switch-enum")
+ set_source_files_properties(VillageGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=switch-enum")
+endif()
+
if(NOT MSVC)
add_library(Generating ${SRCS} ${HDRS})
- target_link_libraries(Generating OSSupport Blocks)
+ target_link_libraries(Generating OSSupport Blocks Bindings)
endif()
diff --git a/src/Generating/ChunkDesc.cpp b/src/Generating/ChunkDesc.cpp
index 4a5ac5a18..07855b1d0 100644
--- a/src/Generating/ChunkDesc.cpp
+++ b/src/Generating/ChunkDesc.cpp
@@ -134,7 +134,7 @@ EMCSBiome cChunkDesc::GetBiome(int a_RelX, int a_RelZ)
-void cChunkDesc::SetHeight(int a_RelX, int a_RelZ, int a_Height)
+void cChunkDesc::SetHeight(int a_RelX, int a_RelZ, HEIGHTTYPE a_Height)
{
cChunkDef::SetHeight(m_HeightMap, a_RelX, a_RelZ, a_Height);
}
@@ -143,7 +143,7 @@ void cChunkDesc::SetHeight(int a_RelX, int a_RelZ, int a_Height)
-int cChunkDesc::GetHeight(int a_RelX, int a_RelZ)
+HEIGHTTYPE cChunkDesc::GetHeight(int a_RelX, int a_RelZ)
{
return cChunkDef::GetHeight(m_HeightMap, a_RelX, a_RelZ);
}
@@ -158,7 +158,7 @@ void cChunkDesc::SetHeightFromShape(const Shape & a_Shape)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- for (int y = cChunkDef::Height - 1; y > 0; y--)
+ for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--)
{
if (a_Shape[y + x * 256 + z * 16 * 256] != 0)
{
@@ -612,8 +612,8 @@ void cChunkDesc::UpdateHeightmap(void)
{
for (int z = 0; z < cChunkDef::Width; z++)
{
- int Height = 0;
- for (int y = cChunkDef::Height - 1; y > 0; y--)
+ HEIGHTTYPE Height = 0;
+ for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--)
{
BLOCKTYPE BlockType = GetBlockType(x, y, z);
if (BlockType != E_BLOCK_AIR)
@@ -636,7 +636,7 @@ void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
const NIBBLETYPE * AreaMetas = m_BlockArea.GetBlockMetas();
for (size_t i = 0; i < ARRAYCOUNT(a_DestMetas); i++)
{
- a_DestMetas[i] = AreaMetas[2 * i] | (AreaMetas[2 * i + 1] << 4);
+ a_DestMetas[i] = static_cast<NIBBLETYPE>(AreaMetas[2 * i] | (AreaMetas[2 * i + 1] << 4));
}
}
diff --git a/src/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h
index 480106fb5..1033242f8 100644
--- a/src/Generating/ChunkDesc.h
+++ b/src/Generating/ChunkDesc.h
@@ -65,8 +65,8 @@ public:
// These operate on the heightmap, so they could get out of sync with the data
// Use UpdateHeightmap() to re-calculate heightmap from the block data
- void SetHeight(int a_RelX, int a_RelZ, int a_Height);
- int GetHeight(int a_RelX, int a_RelZ);
+ void SetHeight(int a_RelX, int a_RelZ, HEIGHTTYPE a_Height);
+ HEIGHTTYPE GetHeight(int a_RelX, int a_RelZ);
// tolua_end
@@ -204,10 +204,10 @@ public:
// Accessors used by cChunkGenerator::Generator descendants:
inline cChunkDef::BiomeMap & GetBiomeMap (void) { return m_BiomeMap; }
- inline cChunkDef::BlockTypes & GetBlockTypes (void) { return *((cChunkDef::BlockTypes *)m_BlockArea.GetBlockTypes()); }
+ inline cChunkDef::BlockTypes & GetBlockTypes (void) { return *(reinterpret_cast<cChunkDef::BlockTypes *>(m_BlockArea.GetBlockTypes())); }
// CANNOT, different compression!
// inline cChunkDef::BlockNibbles & GetBlockMetas (void) { return *((cChunkDef::BlockNibbles *)m_BlockArea.GetBlockMetas()); }
- inline BlockNibbleBytes & GetBlockMetasUncompressed(void) { return *((BlockNibbleBytes *)m_BlockArea.GetBlockMetas()); }
+ inline BlockNibbleBytes & GetBlockMetasUncompressed(void) { return *(reinterpret_cast<BlockNibbleBytes *>(m_BlockArea.GetBlockMetas())); }
inline cChunkDef::HeightMap & GetHeightMap (void) { return m_HeightMap; }
inline cEntityList & GetEntities (void) { return m_Entities; }
inline cBlockEntityList & GetBlockEntities (void) { return m_BlockEntities; }
diff --git a/src/Generating/CompoGenBiomal.cpp b/src/Generating/CompoGenBiomal.cpp
index 3140bd754..60f7e7520 100644
--- a/src/Generating/CompoGenBiomal.cpp
+++ b/src/Generating/CompoGenBiomal.cpp
@@ -4,6 +4,9 @@
// Implements the cCompoGenBiomal class representing the biome-aware composition generator
#include "Globals.h"
+
+#include "CompoGenBiomal.h"
+
#include "ComposableGenerator.h"
#include "../IniFile.h"
#include "../Noise/Noise.h"
@@ -192,7 +195,7 @@ public:
protected:
/** The block height at which water is generated instead of air. */
- int m_SeaLevel;
+ HEIGHTTYPE m_SeaLevel;
/** The pattern used for mesa biomes. Initialized by seed on generator creation. */
cPattern::BlockInfo m_MesaPattern[2 * cChunkDef::Height];
@@ -221,7 +224,7 @@ protected:
virtual void InitializeCompoGen(cIniFile & a_IniFile) override
{
- m_SeaLevel = a_IniFile.GetValueSetI("Generator", "SeaLevel", m_SeaLevel);
+ m_SeaLevel = static_cast<HEIGHTTYPE>(a_IniFile.GetValueSetI("Generator", "SeaLevel", m_SeaLevel));
}
@@ -231,7 +234,7 @@ protected:
{
// In a loop, choose whether to use one, two or three layers of stained clay, then choose a color and width for each layer
// Separate each group with another layer of hardened clay
- cNoise patternNoise((unsigned)a_Seed);
+ cNoise patternNoise(a_Seed);
static NIBBLETYPE allowedColors[] =
{
E_META_STAINED_CLAY_YELLOW,
@@ -265,8 +268,8 @@ protected:
rnd /= 2;
for (int lay = 0; lay < numLayers; lay++)
{
- int numBlocks = layerSizes[(rnd % ARRAYCOUNT(layerSizes))];
- NIBBLETYPE Color = allowedColors[(rnd / 4) % ARRAYCOUNT(allowedColors)];
+ int numBlocks = layerSizes[(static_cast<size_t>(rnd) % ARRAYCOUNT(layerSizes))];
+ NIBBLETYPE Color = allowedColors[static_cast<size_t>(rnd / 4) % ARRAYCOUNT(allowedColors)];
if (
((numBlocks == 3) && (numLayers == 2)) || // In two-layer mode disallow the 3-high layers:
(Color == E_META_STAINED_CLAY_WHITE)) // White stained clay can ever be only 1 block high
@@ -411,7 +414,12 @@ protected:
FillColumnPattern(a_ChunkDesc, a_RelX, a_RelZ, Pattern, a_ShapeColumn);
return;
}
- default:
+ case biInvalidBiome:
+ case biHell:
+ case biSky:
+ case biNumBiomes:
+ case biVariant:
+ case biNumVariantBiomes:
{
ASSERT(!"Unhandled biome");
return;
@@ -427,7 +435,7 @@ protected:
{
bool HasHadWater = false;
int PatternIdx = 0;
- int top = std::max(m_SeaLevel, a_ChunkDesc.GetHeight(a_RelX, a_RelZ));
+ HEIGHTTYPE top = std::max(m_SeaLevel, a_ChunkDesc.GetHeight(a_RelX, a_RelZ));
for (int y = top; y > 0; y--)
{
if (a_ShapeColumn[y] > 0)
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index 6b7643ddb..4eee8b707 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -221,11 +221,11 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
if (MultiCacheLength > 0)
{
LOGD("Enabling multicache for biomegen of length %d.", MultiCacheLength);
- m_BiomeGen = cBiomeGenPtr(new cBioGenMulticache(m_BiomeGen, CacheSize, MultiCacheLength));
+ m_BiomeGen = cBiomeGenPtr(new cBioGenMulticache(m_BiomeGen, static_cast<size_t>(CacheSize), static_cast<size_t>(MultiCacheLength)));
}
else
{
- m_BiomeGen = cBiomeGenPtr(new cBioGenCache(m_BiomeGen, CacheSize));
+ m_BiomeGen = cBiomeGenPtr(new cBioGenCache(m_BiomeGen, static_cast<size_t>(CacheSize)));
}
}
@@ -274,7 +274,7 @@ void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
}
// Create a cache of the composited heightmaps, so that finishers may use it:
- m_CompositedHeightCache = std::make_shared<cHeiGenMultiCache>(std::make_shared<cCompositedHeiGen>(m_ShapeGen, m_CompositionGen), 16, 24);
+ m_CompositedHeightCache = std::make_shared<cHeiGenMultiCache>(std::make_shared<cCompositedHeiGen>(m_BiomeGen, m_ShapeGen, m_CompositionGen), 16, 24);
// 24 subcaches of depth 16 each = 96 KiB of RAM. Acceptable, for the amount of work this saves.
}
@@ -618,7 +618,9 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
int MaxSize = a_IniFile.GetValueSetI("Generator", "VillageMaxSize", 128);
int MinDensity = a_IniFile.GetValueSetI("Generator", "VillageMinDensity", 50);
int MaxDensity = a_IniFile.GetValueSetI("Generator", "VillageMaxDensity", 80);
- m_FinishGens.push_back(std::make_shared<cVillageGen>(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, MinDensity, MaxDensity, m_BiomeGen, m_CompositedHeightCache));
+ AString PrefabList = a_IniFile.GetValueSet("Generator", "VillagePrefabs", "PlainsVillage, SandVillage");
+ auto Prefabs = StringSplitAndTrim(PrefabList, ",");
+ m_FinishGens.push_back(std::make_shared<cVillageGen>(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, MinDensity, MaxDensity, m_BiomeGen, m_CompositedHeightCache, Prefabs));
}
else if (NoCaseCompare(*itr, "Vines") == 0)
{
diff --git a/src/Generating/CompositedHeiGen.h b/src/Generating/CompositedHeiGen.h
index fa33a7861..c4e6ce77d 100644
--- a/src/Generating/CompositedHeiGen.h
+++ b/src/Generating/CompositedHeiGen.h
@@ -20,7 +20,8 @@ class cCompositedHeiGen:
public cTerrainHeightGen
{
public:
- cCompositedHeiGen(cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
+ cCompositedHeiGen(cBiomeGenPtr a_BiomeGen, cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
+ m_BiomeGen(a_BiomeGen),
m_ShapeGen(a_ShapeGen),
m_CompositionGen(a_CompositionGen)
{
@@ -28,18 +29,20 @@ public:
- // cTerrainheightGen overrides:
+ // cTerrainHeightGen overrides:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override
{
cChunkDesc::Shape shape;
m_ShapeGen->GenShape(a_ChunkX, a_ChunkZ, shape);
cChunkDesc desc(a_ChunkX, a_ChunkZ);
+ m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, desc.GetBiomeMap()); // Need to initialize biomes for the composition gen
desc.SetHeightFromShape(shape);
m_CompositionGen->ComposeTerrain(desc, shape);
memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap));
}
protected:
+ cBiomeGenPtr m_BiomeGen;
cTerrainShapeGenPtr m_ShapeGen;
cTerrainCompositionGenPtr m_CompositionGen;
};
diff --git a/src/Generating/DungeonRoomsFinisher.cpp b/src/Generating/DungeonRoomsFinisher.cpp
index c4bf8839e..c62da7492 100644
--- a/src/Generating/DungeonRoomsFinisher.cpp
+++ b/src/Generating/DungeonRoomsFinisher.cpp
@@ -194,7 +194,7 @@ protected:
{
return;
}
- a_ChunkDesc.SetBlockTypeMeta(RelX, m_FloorHeight + 1, RelZ, E_BLOCK_CHEST, (NIBBLETYPE)a_Chest.y);
+ a_ChunkDesc.SetBlockTypeMeta(RelX, m_FloorHeight + 1, RelZ, E_BLOCK_CHEST, static_cast<NIBBLETYPE>(a_Chest.y));
// Fill the chest with random loot
static const cLootProbab LootProbab[] =
@@ -217,7 +217,7 @@ protected:
{ cItem(E_ITEM_NAME_TAG), 1, 1, 10 },
} ;
- cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(RelX, m_FloorHeight + 1, RelZ);
+ cChestEntity * ChestEntity = static_cast<cChestEntity *>(a_ChunkDesc.GetBlockEntity(RelX, m_FloorHeight + 1, RelZ));
ASSERT((ChestEntity != nullptr) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
int NumSlots = 3 + ((Noise.IntNoise3DInt(a_Chest.x, a_Chest.y, a_Chest.z) / 11) % 4);
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index 00b34bddd..59af0fd63 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -69,7 +69,7 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
}
// Choose what block to use.
- NOISE_DATATYPE BlockType = m_Noise.IntNoise3D((int) ChunkX, y, (int) ChunkZ);
+ NOISE_DATATYPE BlockType = m_Noise.IntNoise3D(static_cast<int>(ChunkX), y, static_cast<int>(ChunkZ));
if (BlockType < -0.7)
{
TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM);
@@ -260,13 +260,13 @@ void cFinishGenGlowStone::TryPlaceGlowstone(cChunkDesc & a_ChunkDesc, int a_RelX
for (int j = 0; j < a_Size; j++)
{
- Vector3i Direction = AvailableDirections[m_Noise.IntNoise3DInt(CurrentPos.x, CurrentPos.y * i, CurrentPos.z) % ARRAYCOUNT(AvailableDirections)];
+ Vector3i Direction = AvailableDirections[static_cast<size_t>(m_Noise.IntNoise3DInt(CurrentPos.x, CurrentPos.y * i, CurrentPos.z)) % ARRAYCOUNT(AvailableDirections)];
int Attempts = 2; // multiply by 1 would make no difference, so multiply by 2 instead
while (Direction.Equals(PreviousDirection))
{
// To make the glowstone branches look better we want to make the direction change every time.
- Direction = AvailableDirections[m_Noise.IntNoise3DInt(CurrentPos.x, CurrentPos.y * i * Attempts, CurrentPos.z) % ARRAYCOUNT(AvailableDirections)];
+ Direction = AvailableDirections[static_cast<size_t>(m_Noise.IntNoise3DInt(CurrentPos.x, CurrentPos.y * i * Attempts, CurrentPos.z)) % ARRAYCOUNT(AvailableDirections)];
Attempts++;
}
@@ -438,7 +438,7 @@ void cFinishGenVines::GenFinish(cChunkDesc & a_ChunkDesc)
continue;
}
- NIBBLETYPE Meta = Places[m_Noise.IntNoise3DInt(xx, y, zz) % Places.size()];
+ NIBBLETYPE Meta = Places[static_cast<size_t>(m_Noise.IntNoise3DInt(xx, y, zz)) % Places.size()];
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_VINES, Meta);
}
}
@@ -507,7 +507,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
for (int z = 0; z < cChunkDef::Width; z++)
{
int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
- const float zz = (float)BlockZ;
+ const float zz = static_cast<float>(BlockZ);
for (int x = 0; x < cChunkDef::Width; x++)
{
int BlockX = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
@@ -515,7 +515,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
{
continue;
}
- int Top = a_ChunkDesc.GetHeight(x, z);
+ HEIGHTTYPE Top = a_ChunkDesc.GetHeight(x, z);
if (Top > 250)
{
// Nothing grows above Y=250
@@ -528,7 +528,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
continue;
}
- const float xx = (float)BlockX;
+ const float xx = static_cast<float>(BlockX);
float val1 = m_Noise.CubicNoise2D(xx * 0.1f, zz * 0.1f);
float val2 = m_Noise.CubicNoise2D(xx * 0.01f, zz * 0.01f);
switch (a_ChunkDesc.GetBlockType(x, Top, z))
@@ -563,7 +563,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
}
else if ((val1 > 0.5) && (val2 < -0.5))
{
- a_ChunkDesc.SetBlockTypeMeta(x, ++Top, z, E_BLOCK_PUMPKIN, (int)(val3 * 8) % 4);
+ a_ChunkDesc.SetBlockTypeMeta(x, ++Top, z, E_BLOCK_PUMPKIN, static_cast<int>(val3 * 8) % 4);
}
break;
} // case E_BLOCK_GRASS
@@ -650,9 +650,9 @@ void cFinishGenSoulsandRims::GenFinish(cChunkDesc & a_ChunkDesc)
continue;
}
- NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(xx)) / 32;
- NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(zz)) / 32;
- NOISE_DATATYPE CompBlock = m_Noise.CubicNoise3D(NoiseX, (float) (y) / 4, NoiseY);
+ NOISE_DATATYPE NoiseX = (static_cast<NOISE_DATATYPE>(xx)) / 32;
+ NOISE_DATATYPE NoiseY = (static_cast<NOISE_DATATYPE>(zz)) / 32;
+ NOISE_DATATYPE CompBlock = m_Noise.CubicNoise3D(NoiseX, static_cast<float>(y) / 4, NoiseY);
if (CompBlock < 0)
{
a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SOULSAND);
@@ -676,7 +676,7 @@ void cFinishGenSnow::GenFinish(cChunkDesc & a_ChunkDesc)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- int Height = a_ChunkDesc.GetHeight(x, z);
+ HEIGHTTYPE Height = a_ChunkDesc.GetHeight(x, z);
if (GetSnowStartHeight(a_ChunkDesc.GetBiome(x, z)) > Height)
{
// Height isn't high enough for snow to start forming.
@@ -775,7 +775,7 @@ void cFinishGenSingleTopBlock::GenFinish(cChunkDesc & a_ChunkDesc)
continue;
}
- int Height = a_ChunkDesc.GetHeight(x, z);
+ HEIGHTTYPE Height = a_ChunkDesc.GetHeight(x, z);
if (Height >= cChunkDef::Height - 1)
{
// Too high up
@@ -918,7 +918,7 @@ void cFinishGenPreSimulator::CollapseSandGravel(
}
} // switch (GetBlock)
} // for y
- cChunkDef::SetHeight(a_HeightMap, x, z, HeightY);
+ cChunkDef::SetHeight(a_HeightMap, x, z, static_cast<HEIGHTTYPE>(HeightY));
} // for x
} // for z
}
@@ -1259,7 +1259,7 @@ bool cFinishGenPassiveMobs::TrySpawnAnimals(cChunkDesc & a_ChunkDesc, int a_RelX
}
if (
(BlockUnderFeet != E_BLOCK_GRASS) &&
- ((AnimalToSpawn == mtSheep) || (AnimalToSpawn == mtChicken) || (AnimalToSpawn == mtPig))
+ ((AnimalToSpawn == mtWolf) || (AnimalToSpawn == mtRabbit) || (AnimalToSpawn == mtCow) || (AnimalToSpawn == mtSheep) || (AnimalToSpawn == mtChicken) || (AnimalToSpawn == mtPig))
)
{
return false;
@@ -1274,6 +1274,7 @@ bool cFinishGenPassiveMobs::TrySpawnAnimals(cChunkDesc & a_ChunkDesc, int a_RelX
double AnimalZ = static_cast<double>(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + a_RelZ + 0.5);
cMonster * NewMob = cMonster::NewMonsterFromType(AnimalToSpawn);
+ NewMob->SetHealth(NewMob->GetMaxHealth());
NewMob->SetPosition(AnimalX, AnimalY, AnimalZ);
a_ChunkDesc.GetEntities().push_back(NewMob);
LOGD("Spawning %s #%i at {%.02f, %.02f, %.02f}", NewMob->GetClass(), NewMob->GetUniqueID(), AnimalX, AnimalY, AnimalZ);
@@ -1374,8 +1375,12 @@ eMonsterType cFinishGenPassiveMobs::GetRandomMob(cChunkDesc & a_ChunkDesc)
return mtInvalidType;
}
- int RandMob = (m_Noise.IntNoise2DInt(chunkX - chunkZ + 2, chunkX + 5) / 7) % ListOfSpawnables.size();
auto MobIter = ListOfSpawnables.begin();
+ using diff_type =
+ std::iterator_traits<decltype(MobIter)>::difference_type;
+ diff_type RandMob = static_cast<diff_type>
+ (static_cast<size_t>(m_Noise.IntNoise2DInt(chunkX - chunkZ + 2, chunkX + 5) / 7)
+ % ListOfSpawnables.size());
std::advance(MobIter, RandMob);
return *MobIter;
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 3c08c1a39..5adc60c4f 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -64,13 +64,13 @@ cGridStructGen::cGridStructGen(
LOG("Grid Size cannot be zero, setting to 1");
m_GridSizeZ = 1;
}
- size_t NumStructuresPerQuery = (size_t)(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
+ size_t NumStructuresPerQuery = static_cast<size_t>(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
if (NumStructuresPerQuery > m_MaxCacheSize)
{
m_MaxCacheSize = NumStructuresPerQuery * 4;
LOGINFO(
"cGridStructGen: The cache size is too small (%u), increasing the cache size to %u to avoid inefficiency.",
- (unsigned)a_MaxCacheSize, (unsigned)m_MaxCacheSize
+ static_cast<unsigned>(a_MaxCacheSize), static_cast<unsigned>(m_MaxCacheSize)
);
}
}
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp
index e34ffc57c..6cfd53837 100644
--- a/src/Generating/HeiGen.cpp
+++ b/src/Generating/HeiGen.cpp
@@ -58,7 +58,7 @@ public:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override
{
int heights[cChunkDef::Width * cChunkDef::Width];
- m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, cChunkDef::Width, cChunkDef::Width, heights);
+ m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, static_cast<size_t>(cChunkDef::Width), static_cast<size_t>(cChunkDef::Width), heights);
for (size_t i = 0; i < ARRAYCOUNT(heights); i++)
{
a_HeightMap[i] = static_cast<HEIGHTTYPE>(std::max(std::min(60 + heights[i], cChunkDef::Height - 60), 40));
@@ -92,7 +92,7 @@ void cHeiGenFlat::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile)
{
- m_Height = a_IniFile.GetValueSetI("Generator", "FlatHeight", m_Height);
+ m_Height = static_cast<HEIGHTTYPE>(a_IniFile.GetValueSetI("Generator", "FlatHeight", m_Height));
}
@@ -102,16 +102,16 @@ void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile)
////////////////////////////////////////////////////////////////////////////////
// cHeiGenCache:
-cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, int a_CacheSize) :
+cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_CacheSize) :
m_HeiGenToCache(a_HeiGenToCache),
m_CacheSize(a_CacheSize),
- m_CacheOrder(new int[a_CacheSize]),
+ m_CacheOrder(new size_t[a_CacheSize]),
m_CacheData(new sCacheData[a_CacheSize]),
m_NumHits(0),
m_NumMisses(0),
m_TotalChain(0)
{
- for (int i = 0; i < m_CacheSize; i++)
+ for (size_t i = 0; i < m_CacheSize; i++)
{
m_CacheOrder[i] = i;
m_CacheData[i].m_ChunkX = 0x7fffffff;
@@ -141,11 +141,11 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
if (((m_NumHits + m_NumMisses) % 1024) == 10)
{
LOGD("HeiGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
- LOGD("HeiGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits);
+ LOGD("HeiGenCache: Avg cache chain length: %.2f", static_cast<double>(m_TotalChain) / m_NumHits);
}
//*/
- for (int i = 0; i < m_CacheSize; i++)
+ for (size_t i = 0; i < m_CacheSize; i++)
{
if (
(m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) ||
@@ -155,10 +155,10 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
continue;
}
// Found it in the cache
- int Idx = m_CacheOrder[i];
+ auto Idx = m_CacheOrder[i];
// Move to front:
- for (int j = i; j > 0; j--)
+ for (size_t j = i; j > 0; j--)
{
m_CacheOrder[j] = m_CacheOrder[j - 1];
}
@@ -177,8 +177,8 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
m_HeiGenToCache->GenHeightMap(a_ChunkX, a_ChunkZ, a_HeightMap);
// Insert it as the first item in the MRU order:
- int Idx = m_CacheOrder[m_CacheSize - 1];
- for (int i = m_CacheSize - 1; i > 0; i--)
+ auto Idx = m_CacheOrder[m_CacheSize - 1];
+ for (auto i = m_CacheSize - 1; i > 0; i--)
{
m_CacheOrder[i] = m_CacheOrder[i - 1];
} // for i - m_CacheOrder[]
@@ -194,7 +194,7 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
bool cHeiGenCache::GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height)
{
- for (int i = 0; i < m_CacheSize; i++)
+ for (size_t i = 0; i < m_CacheSize; i++)
{
if ((m_CacheData[i].m_ChunkX == a_ChunkX) && (m_CacheData[i].m_ChunkZ == a_ChunkZ))
{
@@ -300,15 +300,7 @@ void cHeiGenClassic::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightM
{
const float xx = (float)(a_ChunkX * cChunkDef::Width + x);
- int hei = 64 + (int)(GetNoise(xx * 0.05f, zz * 0.05f) * 16);
- if (hei < 10)
- {
- hei = 10;
- }
- if (hei > 250)
- {
- hei = 250;
- }
+ HEIGHTTYPE hei = static_cast<HEIGHTTYPE>(Clamp(static_cast<int>(64 + (GetNoise(xx * 0.05f, zz * 0.05f) * 16)), 10, 250));
cChunkDef::SetHeight(a_HeightMap, x, z, hei);
} // for x
} // for z
@@ -366,15 +358,7 @@ void cHeiGenMountains::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::Heigh
for (int x = 0; x < cChunkDef::Width; x++)
{
int idx = IdxZ + x;
- int hei = 100 - (int)((MountainNoise[idx] - DitchNoise[idx] + PerlinNoise[idx]) * 15);
- if (hei < 10)
- {
- hei = 10;
- }
- if (hei > 250)
- {
- hei = 250;
- }
+ HEIGHTTYPE hei = static_cast<HEIGHTTYPE>(Clamp(100 - static_cast<int>((MountainNoise[idx] - DitchNoise[idx] + PerlinNoise[idx]) * 15), 10, 250));
cChunkDef::SetHeight(a_HeightMap, x, z, hei);
} // for x
} // for z
@@ -536,7 +520,7 @@ void cHeiGenBiomal::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMa
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- cChunkDef::SetHeight(a_HeightMap, x, z, (int)Height[x + 17 * z]);
+ cChunkDef::SetHeight(a_HeightMap, x, z, static_cast<HEIGHTTYPE>(Height[x + 17 * z]));
}
}
//*/
@@ -817,7 +801,10 @@ protected:
case biTaiga: a_Min = 63; a_Max = 75; break;
case biTaigaHills: a_Min = 63; a_Max = 90; break;
case biTaigaM: a_Min = 63; a_Max = 80; break;
- default:
+ case biInvalidBiome:
+ case biNumBiomes:
+ case biVariant:
+ case biNumVariantBiomes:
{
ASSERT(!"Unknown biome");
a_Min = 10;
diff --git a/src/Generating/HeiGen.h b/src/Generating/HeiGen.h
index 62bb227c6..0dc9c814b 100644
--- a/src/Generating/HeiGen.h
+++ b/src/Generating/HeiGen.h
@@ -28,7 +28,7 @@ class cHeiGenCache :
public cTerrainHeightGen
{
public:
- cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, int a_CacheSize);
+ cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_CacheSize);
~cHeiGenCache();
// cTerrainHeightGen overrides:
@@ -49,14 +49,14 @@ protected:
cTerrainHeightGenPtr m_HeiGenToCache;
// To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data
- int m_CacheSize;
- int * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
+ size_t m_CacheSize;
+ size_t * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used
// Cache statistics
- int m_NumHits;
- int m_NumMisses;
- int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
+ size_t m_NumHits;
+ size_t m_NumMisses;
+ size_t m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
} ;
@@ -103,7 +103,7 @@ public:
protected:
- int m_Height;
+ HEIGHTTYPE m_Height;
// cTerrainHeightGen overrides:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override;
diff --git a/src/Generating/IntGen.h b/src/Generating/IntGen.h
index 9cc881639..3f94ec3d0 100644
--- a/src/Generating/IntGen.h
+++ b/src/Generating/IntGen.h
@@ -754,7 +754,7 @@ public:
int IdxZ = z * SizeX;
for (int x = 0; x < SizeX; x++)
{
- size_t val = (size_t)a_Values[x + IdxZ];
+ size_t val = static_cast<size_t>(a_Values[x + IdxZ]);
const cBiomesInGroups & Biomes = (val > bgfRare) ?
rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] :
biomesInGroups[val % ARRAYCOUNT(biomesInGroups)];
@@ -891,7 +891,7 @@ public:
}
// There's a river, change the output to a river or a frozen river, based on the original biome:
- if (IsBiomeVeryCold((EMCSBiome)a_Values[idx]))
+ if (IsBiomeVeryCold(static_cast<EMCSBiome>(a_Values[idx])))
{
a_Values[idx] = biFrozenRiver;
}
diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp
index 65588ce4b..4ba896ef6 100644
--- a/src/Generating/MineShafts.cpp
+++ b/src/Generating/MineShafts.cpp
@@ -542,7 +542,7 @@ cMineShaft * cMineShaftCorridor::CreateAndFit(
{
cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ);
BoundingBox.p2.y += 3;
- int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7;
+ int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + static_cast<int>(a_ParentSystem.m_MineShafts.size()), a_PivotZ) / 7;
int NumSegments = 2 + (rnd) % (MAX_SEGMENTS - 1); // 2 .. MAX_SEGMENTS
switch (a_Direction)
{
@@ -564,14 +564,14 @@ cMineShaft * cMineShaftCorridor::CreateAndFit(
void cMineShaftCorridor::AppendBranches(int a_RecursionLevel, cNoise & a_Noise)
{
- int rnd = a_Noise.IntNoise3DInt(m_BoundingBox.p1.x, m_BoundingBox.p1.y + a_RecursionLevel, m_BoundingBox.p1.z) / 7;
+ int Outerrnd = a_Noise.IntNoise3DInt(m_BoundingBox.p1.x, m_BoundingBox.p1.y + a_RecursionLevel, m_BoundingBox.p1.z) / 7;
// Prefer the same height, but allow for up to one block height displacement:
- int Height = m_BoundingBox.p1.y + ((rnd % 4) + ((rnd >> 3) % 3)) / 2;
+ int OuterHeight = m_BoundingBox.p1.y + ((Outerrnd % 4) + ((Outerrnd >> 3) % 3)) / 2;
switch (m_Direction)
{
case dirXM:
{
- m_ParentSystem.AppendBranch(m_BoundingBox.p1.x - 1, Height, m_BoundingBox.p1.z + 1, dirXM, a_Noise, a_RecursionLevel);
+ m_ParentSystem.AppendBranch(m_BoundingBox.p1.x - 1, OuterHeight, m_BoundingBox.p1.z + 1, dirXM, a_Noise, a_RecursionLevel);
for (int i = m_NumSegments; i >= 0; i--)
{
int rnd = a_Noise.IntNoise3DInt(m_BoundingBox.p1.x + i + 10, m_BoundingBox.p1.y + a_RecursionLevel, m_BoundingBox.p1.z) / 11;
@@ -586,7 +586,7 @@ void cMineShaftCorridor::AppendBranches(int a_RecursionLevel, cNoise & a_Noise)
case dirXP:
{
- m_ParentSystem.AppendBranch(m_BoundingBox.p2.x + 1, Height, m_BoundingBox.p1.z + 1, dirXP, a_Noise, a_RecursionLevel);
+ m_ParentSystem.AppendBranch(m_BoundingBox.p2.x + 1, OuterHeight, m_BoundingBox.p1.z + 1, dirXP, a_Noise, a_RecursionLevel);
for (int i = m_NumSegments; i >= 0; i--)
{
int rnd = a_Noise.IntNoise3DInt(m_BoundingBox.p1.x + i + 10, m_BoundingBox.p1.y + a_RecursionLevel, m_BoundingBox.p1.z) / 11;
@@ -601,7 +601,7 @@ void cMineShaftCorridor::AppendBranches(int a_RecursionLevel, cNoise & a_Noise)
case dirZM:
{
- m_ParentSystem.AppendBranch(m_BoundingBox.p1.x + 1, Height, m_BoundingBox.p1.z - 1, dirZM, a_Noise, a_RecursionLevel);
+ m_ParentSystem.AppendBranch(m_BoundingBox.p1.x + 1, OuterHeight, m_BoundingBox.p1.z - 1, dirZM, a_Noise, a_RecursionLevel);
for (int i = m_NumSegments; i >= 0; i--)
{
int rnd = a_Noise.IntNoise3DInt(m_BoundingBox.p1.x + i + 10, m_BoundingBox.p1.y + a_RecursionLevel, m_BoundingBox.p1.z) / 11;
@@ -616,7 +616,7 @@ void cMineShaftCorridor::AppendBranches(int a_RecursionLevel, cNoise & a_Noise)
case dirZP:
{
- m_ParentSystem.AppendBranch(m_BoundingBox.p1.x + 1, Height, m_BoundingBox.p2.z + 1, dirZP, a_Noise, a_RecursionLevel);
+ m_ParentSystem.AppendBranch(m_BoundingBox.p1.x + 1, OuterHeight, m_BoundingBox.p2.z + 1, dirZP, a_Noise, a_RecursionLevel);
for (int i = m_NumSegments; i >= 0; i--)
{
int rnd = a_Noise.IntNoise3DInt(m_BoundingBox.p1.x + i + 10, m_BoundingBox.p1.y + a_RecursionLevel, m_BoundingBox.p1.z) / 11;
@@ -781,13 +781,19 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
case dirZM:
case dirZP:
- default:
{
x = m_BoundingBox.p1.x - BlockX;
z = m_BoundingBox.p1.z + m_ChestPosition - BlockZ;
Meta = E_META_CHEST_FACING_XP;
break;
}
+ #if !defined(__clang__)
+ default:
+ {
+ ASSERT(!"Unknown direction");
+ return;
+ }
+ #endif
} // switch (Dir)
if (
@@ -796,7 +802,7 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
)
{
a_ChunkDesc.SetBlockTypeMeta(x, m_BoundingBox.p1.y + 1, z, E_BLOCK_CHEST, Meta);
- cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(x, m_BoundingBox.p1.y + 1, z);
+ cChestEntity * ChestEntity = static_cast<cChestEntity *>(a_ChunkDesc.GetBlockEntity(x, m_BoundingBox.p1.y + 1, z));
ASSERT((ChestEntity != nullptr) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
int NumSlots = 3 + ((Noise.IntNoise3DInt(x, m_BoundingBox.p1.y, z) / 11) % 4);
@@ -986,7 +992,7 @@ cMineShaft * cMineShaftCrossing::CreateAndFit(
)
{
cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ);
- int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7;
+ int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + static_cast<int>(a_ParentSystem.m_MineShafts.size()), a_PivotZ) / 7;
BoundingBox.p2.y += 3;
if ((rnd % 4) < 2)
{
@@ -1127,7 +1133,7 @@ cMineShaft * cMineShaftStaircase::CreateAndFit(
cNoise & a_Noise
)
{
- int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7;
+ int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + static_cast<int>(a_ParentSystem.m_MineShafts.size()), a_PivotZ) / 7;
cCuboid Box;
switch (a_Direction)
{
diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp
index f35555efd..d29ab8cd1 100644
--- a/src/Generating/NetherFortGen.cpp
+++ b/src/Generating/NetherFortGen.cpp
@@ -36,7 +36,7 @@ public:
int BlockY = 64;
// Generate pieces:
- for (int i = 0; m_Pieces.size() < (size_t)(a_MaxDepth * a_MaxDepth / 8 + a_MaxDepth); i++)
+ for (int i = 0; m_Pieces.size() < static_cast<size_t>(a_MaxDepth * a_MaxDepth / 8 + a_MaxDepth); i++)
{
cBFSPieceGenerator pg(cNetherFortGen::m_PiecePool, a_Seed + i);
pg.PlacePieces(a_OriginX, BlockY, a_OriginZ, a_MaxDepth, m_Pieces);
@@ -55,7 +55,7 @@ public:
{
for (cPlacedPieces::const_iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
{
- const cPrefab & Prefab = (const cPrefab &)((*itr)->GetPiece());
+ const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
Prefab.Draw(a_Chunk, *itr);
} // for itr - m_PlacedPieces[]
}
diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp
index 63e88c2a8..8163746f8 100644
--- a/src/Generating/Noise3DGenerator.cpp
+++ b/src/Generating/Noise3DGenerator.cpp
@@ -305,7 +305,7 @@ void cNoise3DGenerator::UpdateHeightmap(cChunkDesc & a_ChunkDesc)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- for (int y = cChunkDef::Height - 1; y > 0; y--)
+ for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--)
{
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR)
{
@@ -790,7 +790,10 @@ void cBiomalNoise3DComposable::GetBiomeParams(EMCSBiome a_Biome, NOISE_DATATYPE
case biTaiga: a_HeightAmp = 0.1f; a_MidPoint = 64; break;
case biTaigaM: a_HeightAmp = 0.1f; a_MidPoint = 70; break;
case biTaigaHills: a_HeightAmp = 0.075f; a_MidPoint = 68; break;
- default:
+ case biInvalidBiome:
+ case biNumBiomes:
+ case biVariant:
+ case biNumVariantBiomes:
{
// Make a crazy terrain so that it stands out
a_HeightAmp = 0.001f;
diff --git a/src/Generating/POCPieceGenerator.cpp b/src/Generating/POCPieceGenerator.cpp
index 6e7e74d7a..834e3887f 100644
--- a/src/Generating/POCPieceGenerator.cpp
+++ b/src/Generating/POCPieceGenerator.cpp
@@ -32,7 +32,7 @@ public:
/** Imprints the piece in the specified chunk. Assumes they intersect. */
- void ImprintInChunk(cChunkDesc & a_ChunkDesc, const Vector3i & a_Pos, int a_NumCCWRotations)
+ void ImprintInChunk(cChunkDesc & a_ChunkDesc, const Vector3i & a_Pos, int a_NumCCWRotations) const
{
int BlockX = a_ChunkDesc.GetChunkX() * cChunkDef::Width;
int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
@@ -227,7 +227,7 @@ void cPOCPieceGenerator::GenFinish(cChunkDesc & a_ChunkDesc)
continue;
}
- ((cPOCPiece &)(*itr)->GetPiece()).ImprintInChunk(a_ChunkDesc, Pos, (*itr)->GetNumCCWRotations());
+ (static_cast<const cPOCPiece &>((*itr)->GetPiece())).ImprintInChunk(a_ChunkDesc, Pos, (*itr)->GetNumCCWRotations());
} // for itr - m_Pieces[]
a_ChunkDesc.UpdateHeightmap();
}
diff --git a/src/Generating/PieceGenerator.cpp b/src/Generating/PieceGenerator.cpp
index 97aa646fc..93e7179e2 100644
--- a/src/Generating/PieceGenerator.cpp
+++ b/src/Generating/PieceGenerator.cpp
@@ -6,6 +6,7 @@
#include "Globals.h"
#include "PieceGenerator.h"
+#include "../SelfTests.h"
@@ -22,6 +23,11 @@ static class cPieceGeneratorSelfTest :
public:
cPieceGeneratorSelfTest(void)
{
+ cSelfTests::Get().Register(std::bind(&cPieceGeneratorSelfTest::Test, this), "PieceGenerator");
+ }
+
+ void Test(void)
+ {
// Prepare the internal state:
InitializePieces();
@@ -31,14 +37,14 @@ public:
Gen.PlacePieces(500, 50, 500, 3, OutPieces);
// Print out the pieces:
- printf("OutPieces.size() = " SIZE_T_FMT "\n", OutPieces.size());
+ LOG("OutPieces.size() = " SIZE_T_FMT, OutPieces.size());
size_t idx = 0;
for (cPlacedPieces::const_iterator itr = OutPieces.begin(), end = OutPieces.end(); itr != end; ++itr, ++idx)
{
const Vector3i & Coords = (*itr)->GetCoords();
cCuboid Hitbox = (*itr)->GetHitBox();
Hitbox.Sort();
- printf(SIZE_T_FMT ": {%d, %d, %d}, rot %d, hitbox {%d, %d, %d} - {%d, %d, %d} (%d * %d * %d)\n", idx,
+ LOG(SIZE_T_FMT ": {%d, %d, %d}, rot %d, hitbox {%d, %d, %d} - {%d, %d, %d} (%d * %d * %d)", idx,
Coords.x, Coords.y, Coords.z,
(*itr)->GetNumCCWRotations(),
Hitbox.p1.x, Hitbox.p1.y, Hitbox.p1.z,
@@ -46,7 +52,7 @@ public:
Hitbox.DifX() + 1, Hitbox.DifY() + 1, Hitbox.DifZ() + 1
);
} // itr - OutPieces[]
- printf("Done.\n");
+ LOG("Done.");
// Free the placed pieces properly:
Gen.FreePieces(OutPieces);
@@ -385,7 +391,7 @@ cPlacedPiece * cPieceGenerator::PlaceStartingPiece(int a_BlockX, int a_BlockY, i
else
{
// All pieces returned zero weight, but we need one to start. Choose with equal chance:
- StartingPiece = StartingPieces[rnd % StartingPieces.size()];
+ StartingPiece = StartingPieces[static_cast<size_t>(rnd) % StartingPieces.size()];
}
rnd = rnd >> 16;
@@ -394,9 +400,9 @@ cPlacedPiece * cPieceGenerator::PlaceStartingPiece(int a_BlockX, int a_BlockY, i
int NumRotations = 1;
for (size_t i = 1; i < ARRAYCOUNT(Rotations); i++)
{
- if (StartingPiece->CanRotateCCW((int)i))
+ if (StartingPiece->CanRotateCCW(static_cast<int>(i)))
{
- Rotations[NumRotations] = (int)i;
+ Rotations[NumRotations] = static_cast<int>(i);
NumRotations += 1;
}
}
@@ -561,7 +567,10 @@ void cPieceGenerator::DebugConnectorPool(const cPieceGenerator::cFreeConnectors
{
printf(" Connector pool: " SIZE_T_FMT " items\n", a_ConnectorPool.size() - a_NumProcessed);
size_t idx = 0;
- for (cPieceGenerator::cFreeConnectors::const_iterator itr = a_ConnectorPool.begin() + a_NumProcessed, end = a_ConnectorPool.end(); itr != end; ++itr, ++idx)
+
+ typedef cPieceGenerator::cFreeConnectors::difference_type difType;
+
+ for (auto itr = a_ConnectorPool.cbegin() + static_cast<difType>(a_NumProcessed), end = a_ConnectorPool.cend(); itr != end; ++itr, ++idx)
{
printf(" " SIZE_T_FMT ": {%d, %d, %d}, type %d, direction %s, depth %d\n",
idx,
@@ -672,7 +681,10 @@ void cBFSPieceGenerator::PlacePieces(int a_BlockX, int a_BlockY, int a_BlockZ, i
NumProcessed++;
if (NumProcessed > 1000)
{
- ConnectorPool.erase(ConnectorPool.begin(), ConnectorPool.begin() + NumProcessed);
+
+ typedef cPieceGenerator::cFreeConnectors::difference_type difType;
+
+ ConnectorPool.erase(ConnectorPool.begin(), ConnectorPool.begin() + static_cast<difType>(NumProcessed));
NumProcessed = 0;
}
}
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index 761986690..e5e6a1e06 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -166,6 +166,45 @@ cPrefab::cPrefab(const cBlockArea & a_Image, int a_AllowedRotations) :
+cPrefab::cPrefab(const cBlockArea & a_Image) :
+ m_Size(a_Image.GetSize()),
+ m_AllowedRotations(0),
+ m_MergeStrategy(cBlockArea::msOverwrite),
+ m_ShouldExtendFloor(false),
+ m_DefaultWeight(1),
+ m_AddWeightIfSame(0),
+ m_MoveToGround(false)
+{
+ m_HitBox.p1.Set(0, 0, 0);
+ m_HitBox.p2.Set(m_Size.x - 1, m_Size.y - 1, m_Size.z - 1);
+ m_BlockArea[0].CopyFrom(a_Image);
+}
+
+
+
+
+
+cPrefab::cPrefab(const AString & a_BlockDefinitions, const AString & a_BlockData, int a_SizeX, int a_SizeY, int a_SizeZ) :
+ m_Size(a_SizeX, a_SizeY, a_SizeZ),
+ m_AllowedRotations(0),
+ m_MergeStrategy(cBlockArea::msOverwrite),
+ m_ShouldExtendFloor(false),
+ m_DefaultWeight(1),
+ m_AddWeightIfSame(0),
+ m_MoveToGround(false)
+{
+ m_HitBox.p1.Set(0, 0, 0);
+ m_HitBox.p2.Set(m_Size.x - 1, m_Size.y - 1, m_Size.z - 1);
+ m_BlockArea[0].Create(m_Size);
+ CharMap cm;
+ ParseCharMap(cm, a_BlockDefinitions.c_str());
+ ParseBlockImage(cm, a_BlockData.c_str());
+}
+
+
+
+
+
void cPrefab::AddRotatedBlockAreas(void)
{
// 1 CCW rotation:
@@ -326,6 +365,16 @@ void cPrefab::AddConnector(int a_RelX, int a_RelY, int a_RelZ, eBlockFace a_Dire
+void cPrefab::SetAllowedRotations(int a_AllowedRotations)
+{
+ m_AllowedRotations = a_AllowedRotations;
+ AddRotatedBlockAreas();
+}
+
+
+
+
+
void cPrefab::ParseCharMap(CharMap & a_CharMapOut, const char * a_CharMapDef)
{
ASSERT(a_CharMapDef != nullptr);
@@ -348,13 +397,13 @@ void cPrefab::ParseCharMap(CharMap & a_CharMapOut, const char * a_CharMapDef)
LOGWARNING("Bad prefab CharMap definition line: \"%s\", skipping.", itr->c_str());
continue;
}
- unsigned char Src = (unsigned char)CharDef[0][0];
+ unsigned char Src = static_cast<unsigned char>(CharDef[0][0]);
ASSERT(a_CharMapOut[Src].m_BlockMeta == 16); // This letter has not been assigned yet?
- a_CharMapOut[Src].m_BlockType = (BLOCKTYPE)atoi(CharDef[1].c_str());
+ a_CharMapOut[Src].m_BlockType = static_cast<BLOCKTYPE>(atoi(CharDef[1].c_str()));
NIBBLETYPE BlockMeta = 0;
if ((NumElements >= 3) && !CharDef[2].empty())
{
- BlockMeta = (NIBBLETYPE)atoi(CharDef[2].c_str());
+ BlockMeta = static_cast<NIBBLETYPE>(atoi(CharDef[2].c_str()));
ASSERT((BlockMeta <= 15));
}
a_CharMapOut[Src].m_BlockMeta = BlockMeta;
@@ -372,7 +421,7 @@ void cPrefab::ParseBlockImage(const CharMap & a_CharMap, const char * a_BlockIma
{
for (int z = 0; z < m_Size.z; z++)
{
- const unsigned char * BlockImage = (const unsigned char *)a_BlockImage + y * m_Size.x * m_Size.z + z * m_Size.x;
+ const unsigned char * BlockImage = reinterpret_cast<const unsigned char *>(a_BlockImage + y * m_Size.x * m_Size.z + z * m_Size.x);
for (int x = 0; x < m_Size.x; x++)
{
const sBlockTypeDef & MappedValue = a_CharMap[BlockImage[x]];
@@ -424,7 +473,7 @@ void cPrefab::ParseConnectors(const char * a_ConnectorsDef)
m_Connectors.push_back(cPiece::cConnector(
atoi(Coords[0].c_str()), atoi(Coords[1].c_str()), atoi(Coords[2].c_str()), // Connector pos
atoi(Defs[0].c_str()), // Connector type
- (eBlockFace)BlockFace
+ static_cast<eBlockFace>(BlockFace)
));
} // for itr - Lines[]
}
diff --git a/src/Generating/Prefab.h b/src/Generating/Prefab.h
index eb905e78e..45af4b282 100644
--- a/src/Generating/Prefab.h
+++ b/src/Generating/Prefab.h
@@ -95,6 +95,13 @@ public:
/** Creates a prefab based on the given BlockArea and allowed rotations. */
cPrefab(const cBlockArea & a_Image, int a_AllowedRotations);
+ /** Creates a prefab based on the given BlockArea. Allowed rotations can be added later on using SetAllowedRotations(). */
+ cPrefab(const cBlockArea & a_Image);
+
+ /** Creates a prefab based on the specified block data, using the char-to-block map in a_BlockDefinitions.
+ Allowed rotations can be added later on using SetAllowedRotations(). */
+ cPrefab(const AString & a_BlockDefinitions, const AString & a_BlockData, int a_SizeX, int a_SizeY, int a_SizeZ);
+
/** Draws the prefab into the specified chunk, according to the placement stored in the PlacedPiece. */
void Draw(cChunkDesc & a_Dest, const cPlacedPiece * a_Placement) const;
@@ -124,6 +131,21 @@ public:
at the coords governed by the connectors. */
bool ShouldMoveToGround(void) const { return m_MoveToGround; }
+ /** Sets the m_AllowedRotations bitmask and fills the m_BlockArea[] with rotated versions of m_BlockArea[0]. */
+ void SetAllowedRotations(int a_AllowedRotations);
+
+ /** Parses the per-depth weight into m_DepthWeight member. */
+ void ParseDepthWeight(const char * a_DepthWeightDef);
+
+ /** Sets the merge strategy to be used when drawing the piece. */
+ void SetMergeStrategy(cBlockArea::eMergeStrategy a_MergeStrategy) { m_MergeStrategy = a_MergeStrategy; }
+
+ /** Sets the flag whether the prefab should be moved to ground level before being drawn. */
+ void SetMoveToGround(bool a_MoveToGround) { m_MoveToGround = a_MoveToGround; }
+
+ /** Sets the flag whether the lowest layer of the prefab should be repeated downwards until it hits a solid block. */
+ void SetExtendFloor(bool a_ShouldExtendFloor) { m_ShouldExtendFloor = a_ShouldExtendFloor; }
+
protected:
/** Packs complete definition of a single block, for per-letter assignment. */
struct sBlockTypeDef
@@ -201,9 +223,6 @@ protected:
/** Parses the connectors definition text into m_Connectors member. */
void ParseConnectors(const char * a_ConnectorsDef);
-
- /** Parses the per-depth weight into m_DepthWeight member. */
- void ParseDepthWeight(const char * a_DepthWeightDef);
};
diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp
index 895555ef8..e2273aed3 100644
--- a/src/Generating/PrefabPiecePool.cpp
+++ b/src/Generating/PrefabPiecePool.cpp
@@ -5,6 +5,54 @@
#include "Globals.h"
#include "PrefabPiecePool.h"
+#include "../Bindings/LuaState.h"
+#include "SelfTests.h"
+#include "WorldStorage/SchematicFileSerializer.h"
+
+
+
+
+
+// Conditionally log a warning
+#define CONDWARNING(ShouldLog, ...) \
+ if (ShouldLog) \
+ { \
+ LOGWARNING(__VA_ARGS__); \
+ }
+
+
+
+
+
+/** Returns the map of string => eMergeStrategy used when translating cubeset file merge strategies. */
+static std::map<AString, cBlockArea::eMergeStrategy> & GetMergeStrategyMap(void)
+{
+ static std::map<AString, cBlockArea::eMergeStrategy> msmap;
+ if (msmap.empty())
+ {
+ // This is the first use, initialize the map:
+ msmap["msOverwrite"] = cBlockArea::msOverwrite;
+ msmap["msFillAir"] = cBlockArea::msFillAir;
+ msmap["msImprint"] = cBlockArea::msImprint;
+ msmap["msLake"] = cBlockArea::msLake;
+ msmap["msSpongePrint"] = cBlockArea::msSpongePrint;
+ msmap["msDifference"] = cBlockArea::msDifference;
+ msmap["msSimpleCompare"] = cBlockArea::msSimpleCompare;
+ msmap["msMask"] = cBlockArea::msMask;
+ }
+ return msmap;
+}
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// cPrefabPiecePool:
+
+cPrefabPiecePool::cPrefabPiecePool(void)
+{
+}
@@ -26,6 +74,15 @@ cPrefabPiecePool::cPrefabPiecePool(
+cPrefabPiecePool::cPrefabPiecePool(const AString & a_FileName, bool a_LogWarnings)
+{
+ LoadFromFile(a_FileName, a_LogWarnings);
+}
+
+
+
+
+
cPrefabPiecePool::~cPrefabPiecePool()
{
Clear();
@@ -83,9 +140,69 @@ void cPrefabPiecePool::AddStartingPieceDefs(const cPrefab::sDef * a_StartingPiec
+bool cPrefabPiecePool::LoadFromFile(const AString & a_FileName, bool a_LogWarnings)
+{
+ // Read the first 4 KiB of the file in order to auto-detect format:
+ cFile f;
+ if (!f.Open(a_FileName, cFile::fmRead))
+ {
+ CONDWARNING(a_LogWarnings, "Cannot open file %s for reading", a_FileName.c_str());
+ return false;
+ }
+ char buf[4096];
+ auto len = f.Read(buf, sizeof(buf));
+ f.Close();
+ AString Header(buf, static_cast<size_t>(len));
+
+ if (Header.find("CubesetFormatVersion =") != AString::npos)
+ {
+ return LoadFromCubesetFile(a_FileName, a_LogWarnings);
+ }
+ CONDWARNING(a_LogWarnings, "Cannot load prefabs from file %s, unknown file format", a_FileName.c_str());
+ return false;
+}
+
+
+
+
+
+bool cPrefabPiecePool::LoadFromCubesetFile(const AString & a_FileName, bool a_LogWarnings)
+{
+ // Load the file in the Lua interpreter:
+ cLuaState Lua(Printf("LoadablePiecePool %s", a_FileName.c_str()));
+ Lua.Create();
+ if (!Lua.LoadFile(a_FileName, a_LogWarnings))
+ {
+ // Reason for failure has already been logged in LoadFile()
+ return false;
+ }
+
+ // Check the version:
+ int Version = 0;
+ if (!Lua.GetNamedGlobal("Cubeset.Metadata.CubesetFormatVersion", Version))
+ {
+ CONDWARNING(a_LogWarnings, "Cannot load cubeset %s, it doesn't contain version information.", a_FileName.c_str());
+ return false;
+ }
+
+ // Load the data, using the correct version loader:
+ if (Version == 1)
+ {
+ return LoadFromCubesetFileVer1(a_FileName, Lua, a_LogWarnings);
+ }
+
+ // Unknown version:
+ CONDWARNING(a_LogWarnings, "Cannot load cubeset %s, version (%d) not supported.", a_FileName.c_str(), Version);
+ return false;
+}
+
+
+
+
+
void cPrefabPiecePool::AddToPerConnectorMap(cPrefab * a_Prefab)
{
- cPiece::cConnectors Connectors = ((const cPiece *)a_Prefab)->GetConnectors();
+ cPiece::cConnectors Connectors = (static_cast<const cPiece *>(a_Prefab))->GetConnectors();
for (cPiece::cConnectors::const_iterator itr = Connectors.begin(), end = Connectors.end(); itr != end; ++itr)
{
m_PiecesByConnector[itr->m_Type].push_back(a_Prefab);
@@ -95,6 +212,377 @@ void cPrefabPiecePool::AddToPerConnectorMap(cPrefab * a_Prefab)
+
+bool cPrefabPiecePool::LoadFromCubesetFileVer1(const AString & a_FileName, cLuaState & a_LuaState, bool a_LogWarnings)
+{
+ // Load the metadata:
+ ApplyPoolMetadataCubesetVer1(a_FileName, a_LuaState, a_LogWarnings);
+
+ // Push the Cubeset.Pieces global value on the stack:
+ lua_getglobal(a_LuaState, "_G");
+ cLuaState::cStackValue stk(a_LuaState);
+ auto pieces = a_LuaState.WalkToValue("Cubeset.Pieces");
+ if (!pieces.IsValid() || !lua_istable(a_LuaState, -1))
+ {
+ CONDWARNING(a_LogWarnings, "The cubeset file %s doesn't contain any pieces", a_FileName.c_str());
+ return false;
+ }
+
+ // Iterate over all items in the Cubeset.Pieces value:
+ int idx = 1;
+ bool res = true;
+ while (true)
+ {
+ lua_pushinteger(a_LuaState, idx); // stk: [Pieces] [idx]
+ lua_gettable(a_LuaState, -2); // stk: [Pieces] [PieceItem]
+ if (!lua_istable(a_LuaState, -1))
+ {
+ // The PieceItem is not present, we've iterated over all items
+ lua_pop(a_LuaState, 1); // stk: [Pieces]
+ break;
+ }
+ if (!LoadCubesetPieceVer1(a_FileName, a_LuaState, idx, a_LogWarnings))
+ {
+ res = false;
+ }
+ lua_pop(a_LuaState, 1); // stk: [Pieces]
+ idx += 1;
+ }
+ return res;
+}
+
+
+
+
+
+bool cPrefabPiecePool::LoadCubesetPieceVer1(const AString & a_FileName, cLuaState & a_LuaState, int a_PieceIndex, bool a_LogWarnings)
+{
+ ASSERT(lua_istable(a_LuaState, -1));
+
+ // The piece name is optional, but useful for debugging messages:
+ AString PieceName;
+ if (!a_LuaState.GetNamedValue("OriginData.ExportName", PieceName))
+ {
+ Printf(PieceName, "Piece #%d", a_PieceIndex);
+ }
+
+ // Read the hitbox dimensions:
+ cCuboid Hitbox;
+ if (
+ !a_LuaState.GetNamedValue("Hitbox.MinX", Hitbox.p1.x) ||
+ !a_LuaState.GetNamedValue("Hitbox.MinY", Hitbox.p1.y) ||
+ !a_LuaState.GetNamedValue("Hitbox.MinZ", Hitbox.p1.z) ||
+ !a_LuaState.GetNamedValue("Hitbox.MaxX", Hitbox.p2.x) ||
+ !a_LuaState.GetNamedValue("Hitbox.MaxY", Hitbox.p2.y) ||
+ !a_LuaState.GetNamedValue("Hitbox.MaxZ", Hitbox.p2.z)
+ )
+ {
+ CONDWARNING(a_LogWarnings, "Cannot load piece %s from file %s, it's missing hitbox information", PieceName.c_str(), a_FileName.c_str());
+ return false;
+ }
+
+ // Load the prefab data:
+ auto prefab = LoadPrefabFromCubesetVer1(a_FileName, a_LuaState, PieceName, a_LogWarnings);
+ if (prefab == nullptr)
+ {
+ return false;
+ }
+
+ // Read the connectors
+ if (!ReadConnectorsCubesetVer1(a_FileName, a_LuaState, PieceName, prefab.get(), a_LogWarnings))
+ {
+ return false;
+ }
+
+ // Read the allowed rotations. It is an optional metadata value, default to 0:
+ int AllowedRotations = 0;
+ a_LuaState.GetNamedValue("Metadata.AllowedRotations", AllowedRotations);
+ prefab->SetAllowedRotations(AllowedRotations);
+
+ // Apply the relevant metadata:
+ if (!ApplyPieceMetadataCubesetVer1(a_FileName, a_LuaState, PieceName, prefab.get(), a_LogWarnings))
+ {
+ return false;
+ }
+
+ // Add the prefab into the list of pieces:
+ int IsStartingPiece = 0;
+ a_LuaState.GetNamedValue("Metadata.IsStarting", IsStartingPiece);
+ if (IsStartingPiece != 0)
+ {
+ m_StartingPieces.push_back(prefab.release());
+ }
+ else
+ {
+ auto p = prefab.release();
+ m_AllPieces.push_back(p);
+ AddToPerConnectorMap(p);
+ }
+ return true;
+}
+
+
+
+
+
+UniquePtr<cPrefab> cPrefabPiecePool::LoadPrefabFromCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ const AString & a_PieceName,
+ bool a_LogWarnings
+)
+{
+ // First try loading a referenced schematic file, if any:
+ AString SchematicFileName;
+ if (a_LuaState.GetNamedValue("SchematicFileName", SchematicFileName))
+ {
+ auto PathEnd = a_FileName.find_last_of("/\\"); // Find the last path separator
+ if (PathEnd != AString::npos)
+ {
+ SchematicFileName = a_FileName.substr(0, PathEnd) + SchematicFileName;
+ }
+ cBlockArea area;
+ if (!cSchematicFileSerializer::LoadFromSchematicFile(area, SchematicFileName))
+ {
+ CONDWARNING(a_LogWarnings, "Cannot load schematic file \"%s\" for piece %s in cubeset %s.",
+ SchematicFileName.c_str(), a_PieceName.c_str(), a_FileName.c_str()
+ );
+ return nullptr;
+ }
+ return cpp14::make_unique<cPrefab>(area);
+ } // if (SchematicFileName)
+
+ // There's no referenced schematic file, load from BlockDefinitions / BlockData.
+ // Get references to the data and the table.concat function:
+ cLuaState::cRef TableConcat, BlockDefinitions, BlockData;
+ if (
+ !a_LuaState.GetNamedGlobal("table.concat", TableConcat) ||
+ !a_LuaState.GetNamedValue("BlockDefinitions", BlockDefinitions) ||
+ !a_LuaState.GetNamedValue("BlockData", BlockData)
+ )
+ {
+ CONDWARNING(a_LogWarnings, "Cannot parse block data for piece %s in cubeset %s", a_PieceName.c_str(), a_FileName.c_str());
+ return nullptr;
+ }
+
+ // Call table.concat() on the BlockDefinitions:
+ AString BlockDefStr;
+ if (!a_LuaState.Call(TableConcat, BlockDefinitions, "\n", cLuaState::Return, BlockDefStr))
+ {
+ CONDWARNING(a_LogWarnings, "Cannot concat block definitions for piece %s in cubeset %s", a_PieceName.c_str(), a_FileName.c_str());
+ return nullptr;
+ }
+
+ // Call table.concat() on the BlockData:
+ AString BlockDataStr;
+ if (!a_LuaState.Call(TableConcat, BlockData, "", cLuaState::Return, BlockDataStr))
+ {
+ CONDWARNING(a_LogWarnings, "Cannot concat block data for piece %s in cubeset %s", a_PieceName.c_str(), a_FileName.c_str());
+ return nullptr;
+ }
+
+ // Read the size:
+ int SizeX = 0, SizeY = 0, SizeZ = 0;
+ if (
+ !a_LuaState.GetNamedValue("Size.x", SizeX) ||
+ !a_LuaState.GetNamedValue("Size.y", SizeY) ||
+ !a_LuaState.GetNamedValue("Size.z", SizeZ)
+ )
+ {
+ CONDWARNING(a_LogWarnings, "Cannot load piece %s from file %s, its size information is missing", a_PieceName.c_str(), a_FileName.c_str());
+ return nullptr;
+ }
+
+ // Check that the size matches the data length:
+ if (static_cast<size_t>(SizeX * SizeY * SizeZ) != BlockDataStr.size())
+ {
+ CONDWARNING(a_LogWarnings, "Cannot create piece %s from file %s, its size (%d) doesn't match the blockdata length (%u)",
+ a_PieceName.c_str(), a_FileName.c_str(),
+ SizeX * SizeY * SizeZ, static_cast<unsigned>(BlockDataStr.size())
+ );
+ return nullptr;
+ }
+
+ return cpp14::make_unique<cPrefab>(BlockDefStr, BlockDataStr, SizeX, SizeY, SizeZ);
+}
+
+
+
+
+
+bool cPrefabPiecePool::ReadConnectorsCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ const AString & a_PieceName,
+ cPrefab * a_Prefab,
+ bool a_LogWarnings
+)
+{
+ // Get the Connectors subtable:
+ auto conns = a_LuaState.WalkToValue("Connectors");
+ if (!conns.IsValid())
+ {
+ CONDWARNING(a_LogWarnings, "Cannot load piece %s from file %s, it has no connectors definition.", a_PieceName.c_str(), a_FileName.c_str());
+ return false;
+ }
+
+ // Iterate over all items in the Connectors table:
+ int idx = 1;
+ bool res = true;
+ while (true)
+ {
+ lua_pushinteger(a_LuaState, idx); // stk: [Connectors] [idx]
+ lua_gettable(a_LuaState, -2); // stk: [Connectors] [conn]
+ if (!lua_istable(a_LuaState, -1))
+ {
+ // The connector is not present, we've iterated over all items
+ lua_pop(a_LuaState, 1); // stk: [Connectors]
+ break;
+ }
+ int Type = 0, RelX = 0, RelY = 0, RelZ = 0;
+ eBlockFace Direction = BLOCK_FACE_NONE;
+ if (
+ !a_LuaState.GetNamedValue("Type", Type) ||
+ !a_LuaState.GetNamedValue("RelX", RelX) ||
+ !a_LuaState.GetNamedValue("RelY", RelY) ||
+ !a_LuaState.GetNamedValue("RelZ", RelZ) ||
+ !a_LuaState.GetNamedValue("Direction", Direction)
+ )
+ {
+ CONDWARNING(a_LogWarnings, "Piece %s in file %s has a malformed Connector at index %d. Skipping the connector.", a_PieceName.c_str(), a_FileName.c_str(), idx);
+ res = false;
+ continue;
+ }
+ a_Prefab->AddConnector(RelX, RelY, RelZ, Direction, Type);
+ lua_pop(a_LuaState, 1); // stk: [Connectors]
+ idx += 1;
+ }
+ return res;
+}
+
+
+
+
+
+bool cPrefabPiecePool::ApplyPieceMetadataCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ const AString & a_PieceName,
+ cPrefab * a_Prefab,
+ bool a_LogWarnings
+)
+{
+ // Push the Metadata table on top of the Lua stack:
+ auto md = a_LuaState.WalkToValue("Metadata");
+ if (!md.IsValid())
+ {
+ return false;
+ }
+
+ // Get the values:
+ int AddWeightIfSame = 0, DefaultWeight = 100, MoveToGround = 0, ShouldExpandFloor = 0;
+ AString DepthWeight, MergeStrategy;
+ a_LuaState.GetNamedValue("AddWeightIfSame", AddWeightIfSame);
+ a_LuaState.GetNamedValue("DefaultWeight", DefaultWeight);
+ a_LuaState.GetNamedValue("DepthWeight", DepthWeight);
+ a_LuaState.GetNamedValue("MergeStrategy", MergeStrategy);
+ a_LuaState.GetNamedValue("MoveToGround", MoveToGround);
+ a_LuaState.GetNamedValue("ShouldExpandFloor", ShouldExpandFloor);
+
+ // Apply the values:
+ a_Prefab->SetAddWeightIfSame(AddWeightIfSame);
+ a_Prefab->SetDefaultWeight(DefaultWeight);
+ a_Prefab->ParseDepthWeight(DepthWeight.c_str());
+ auto msmap = GetMergeStrategyMap();
+ auto strategy = msmap.find(MergeStrategy);
+ if (strategy == msmap.end())
+ {
+ CONDWARNING(a_LogWarnings, "Unknown merge strategy (\"%s\") specified for piece %s in file %s. Using msSpongePrint instead.",
+ MergeStrategy.c_str(), a_PieceName.c_str(), a_FileName.c_str()
+ );
+ a_Prefab->SetMergeStrategy(cBlockArea::msSpongePrint);
+ }
+ else
+ {
+ a_Prefab->SetMergeStrategy(strategy->second);
+ }
+ a_Prefab->SetMoveToGround(MoveToGround != 0);
+ a_Prefab->SetExtendFloor(ShouldExpandFloor != 0);
+
+ return true;
+}
+
+
+
+
+
+bool cPrefabPiecePool::ApplyPoolMetadataCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ bool a_LogWarnings
+)
+{
+ // Push the Cubeset.Metadata table on top of the Lua stack:
+ lua_getglobal(a_LuaState, "_G");
+ auto md = a_LuaState.WalkToValue("Cubeset.Metadata");
+ if (!md.IsValid())
+ {
+ CONDWARNING(a_LogWarnings, "Cannot load cubeset from file %s: Cubeset.Metadata table is missing", a_FileName.c_str());
+ return false;
+ }
+
+ // Set the metadata values to defaults:
+ m_MinDensity = 100;
+ m_MaxDensity = 100;
+ m_VillageRoadBlockType = E_BLOCK_GRAVEL;
+ m_VillageRoadBlockMeta = 0;
+ m_VillageWaterRoadBlockType = E_BLOCK_PLANKS;
+ m_VillageWaterRoadBlockMeta = 0;
+
+ // Read the metadata values:
+ a_LuaState.GetNamedValue("IntendedUse", m_IntendedUse);
+ a_LuaState.GetNamedValue("MaxDensity", m_MaxDensity);
+ a_LuaState.GetNamedValue("MinDensity", m_MinDensity);
+ a_LuaState.GetNamedValue("VillageRoadBlockType", m_VillageRoadBlockType);
+ a_LuaState.GetNamedValue("VillageRoadBlockMeta", m_VillageRoadBlockMeta);
+ a_LuaState.GetNamedValue("VillageWaterRoadBlockType", m_VillageWaterRoadBlockType);
+ a_LuaState.GetNamedValue("VillageWaterRoadBlockMeta", m_VillageWaterRoadBlockMeta);
+ AString allowedBiomes;
+ if (a_LuaState.GetNamedValue("AllowedBiomes", allowedBiomes))
+ {
+ auto biomes = StringSplitAndTrim(allowedBiomes, ",");
+ for (const auto & biome: biomes)
+ {
+ EMCSBiome b = StringToBiome(biome);
+ if (b == biInvalidBiome)
+ {
+ CONDWARNING(a_LogWarnings, "Invalid biome (\"%s\") specified in AllowedBiomes in cubeset file %s. Skipping the biome.",
+ biome.c_str(), a_FileName.c_str()
+ );
+ continue;
+ }
+ m_AllowedBiomes.insert(b);
+ }
+ }
+ else
+ {
+ // All biomes are allowed:
+ for (int b = biFirstBiome; b <= biMaxBiome; b++)
+ {
+ m_AllowedBiomes.insert(static_cast<EMCSBiome>(b));
+ }
+ for (int b = biFirstVariantBiome; b <= biMaxVariantBiome; b++)
+ {
+ m_AllowedBiomes.insert(static_cast<EMCSBiome>(b));
+ }
+ }
+ return true;
+}
+
+
+
+
+
cPieces cPrefabPiecePool::GetPiecesWithConnector(int a_ConnectorType)
{
return m_PiecesByConnector[a_ConnectorType];
@@ -122,7 +610,7 @@ cPieces cPrefabPiecePool::GetStartingPieces(void)
int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece)
{
- return ((const cPrefab &)a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
+ return (static_cast<const cPrefab &>(a_NewPiece)).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
}
@@ -131,7 +619,7 @@ int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const c
int cPrefabPiecePool::GetStartingPieceWeight(const cPiece & a_NewPiece)
{
- return ((const cPrefab &)a_NewPiece).GetDefaultWeight();
+ return (static_cast<const cPrefab &>(a_NewPiece)).GetDefaultWeight();
}
diff --git a/src/Generating/PrefabPiecePool.h b/src/Generating/PrefabPiecePool.h
index b9c1f0483..f7bf41994 100644
--- a/src/Generating/PrefabPiecePool.h
+++ b/src/Generating/PrefabPiecePool.h
@@ -9,6 +9,7 @@
#pragma once
+#include <unordered_set>
#include "PieceGenerator.h"
#include "Prefab.h"
@@ -16,6 +17,13 @@
+// fwd:
+class cLuaState;
+
+
+
+
+
class cPrefabPiecePool :
public cPiecePool
{
@@ -34,6 +42,10 @@ public:
const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs
);
+ /** Creates a pool and loads the contents of the specified file into it.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ cPrefabPiecePool(const AString & a_FileName, bool a_LogWarnings);
+
/** Destroys the pool, freeing all pieces. */
~cPrefabPiecePool();
@@ -50,6 +62,40 @@ public:
May be called multiple times with different PieceDefs, will add all such pieces. */
void AddStartingPieceDefs(const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs);
+ /** Loads the pieces from the specified file. Returns true if successful, false on error.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool LoadFromFile(const AString & a_FileName, bool a_LogWarnings);
+
+ /** Loads the pieces from the specified Cubeset file. Returns true if successful, false on error.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool LoadFromCubesetFile(const AString & a_FileName, bool a_LogWarnings);
+
+ /** Returns the number of regular (non-starting) pieces. */
+ size_t GetAllPiecesCount(void) const { return m_AllPieces.size(); }
+
+ /** Returns the number of starting pieces. */
+ size_t GetStartingPiecesCount(void) const { return m_StartingPieces.size(); }
+
+ // Metadata accessors:
+ const AString & GetIntendedUse(void) const { return m_IntendedUse; }
+ int GetMinDensity(void) const { return m_MinDensity; }
+ int GetMaxDensity(void) const { return m_MaxDensity; }
+ BLOCKTYPE GetVillageRoadBlockType (void) const { return m_VillageRoadBlockType; }
+ NIBBLETYPE GetVillageRoadBlockMeta (void) const { return m_VillageRoadBlockMeta; }
+ BLOCKTYPE GetVillageWaterRoadBlockType(void) const { return m_VillageWaterRoadBlockType; }
+ NIBBLETYPE GetVillageWaterRoadBlockMeta(void) const { return m_VillageWaterRoadBlockMeta; }
+
+ /** Returns true if a_Biome is among the accepted biomes in the m_AcceptedBiomes metadata member. */
+ bool IsBiomeAllowed(EMCSBiome a_Biome) const { return (m_AllowedBiomes.find(a_Biome) != m_AllowedBiomes.end()); }
+
+ // cPiecePool overrides:
+ virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override;
+ virtual cPieces GetStartingPieces(void) override;
+ virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) override;
+ virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) override;
+ virtual void PiecePlaced(const cPiece & a_Piece) override;
+ virtual void Reset(void) override;
+
protected:
/** The type used to map a connector type to the list of pieces with that connector */
@@ -67,17 +113,97 @@ protected:
The pieces are copies out of m_AllPieces and shouldn't be ever delete-d. */
cPiecesMap m_PiecesByConnector;
+ /** The intended use of this piece pool, as specified by the pool's metadata. */
+ AString m_IntendedUse;
+
+ /** The minimum density, as read from the metadata. */
+ int m_MinDensity;
+
+ /** The maximum density, as read from the metadata. */
+ int m_MaxDensity;
+
+ /** The block type to use for the village roads. */
+ BLOCKTYPE m_VillageRoadBlockType;
+
+ /** The block meta to use for the village roads. */
+ NIBBLETYPE m_VillageRoadBlockMeta;
+
+ /** The block type used for the village roads if the road is on water. */
+ BLOCKTYPE m_VillageWaterRoadBlockType;
+
+ /** The block meta used for the village roads if the road is on water. */
+ NIBBLETYPE m_VillageWaterRoadBlockMeta;
+
+ /** A set of allowed biomes for the pool. The pool will only be used within the specified biomes. */
+ std::unordered_set<EMCSBiome, BiomeHasher> m_AllowedBiomes;
+
/** Adds the prefab to the m_PiecesByConnector map for all its connectors. */
void AddToPerConnectorMap(cPrefab * a_Prefab);
+
+ /** Loads the pieces from the cubeset file parsed into the specified Lua state.
+ Returns true on success, false on error.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool LoadFromCubesetFileVer1(const AString & a_FileName, cLuaState & a_LuaState, bool a_LogWarnings);
+
+ /** Loads a single piece from the cubeset file parsed into the specified Lua state.
+ The piece's definition table is expected to be at the top of the Lua stack.
+ Returns true on success, false on error.
+ a_PieceIndex is the index of the piece, in the Pieces table. It is used for logging only.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool LoadCubesetPieceVer1(const AString & a_FileName, cLuaState & a_LuaState, int a_PieceIndex, bool a_LogWarnings);
+
+ /** Loads a single piece's prefab from the cubeset file parsed into the specified Lua state.
+ The piece's definition table is expected to be at the top of the Lua stack.
+ Returns the prefab on success, nullptr on failure.
+ a_PieceName is the identification of the piece, used for logging only.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ UniquePtr<cPrefab> LoadPrefabFromCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ const AString & a_PieceName,
+ bool a_LogWarnings
+ );
- // cPiecePool overrides:
- virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override;
- virtual cPieces GetStartingPieces(void) override;
- virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) override;
- virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) override;
- virtual void PiecePlaced(const cPiece & a_Piece) override;
- virtual void Reset(void) override;
+ /** Reads a single piece's connectors from the cubeset file parsed into the specified Lua state.
+ The piece's definition table is expected to be at the top of the Lua stack.
+ Returns true on success, false on failure.
+ The connectors are added into the a_Prefab object.
+ No Connectors table is considered a failure, empty Connectors table is considered a success.
+ If any of the connectors are malformed, it is considered a failure, although the rest of the connectors will still load.
+ a_PieceName is the identification of the piece, used for logging only.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool ReadConnectorsCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ const AString & a_PieceName,
+ cPrefab * a_Prefab,
+ bool a_LogWarnings
+ );
+
+ /** Reads a single piece's metadata from the cubeset file parsed into the specified Lua state.
+ The piece's definition table is expected to be at the top of the Lua stack.
+ Returns true on success, false on failure.
+ The metadata is applied into the a_Prefab object.
+ a_PieceName is the identification of the piece, used for logging only.
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool ApplyPieceMetadataCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ const AString & a_PieceName,
+ cPrefab * a_Prefab,
+ bool a_LogWarnings
+ );
+
+ /** Reads the metadata for the entire pool from the cubeset file parsed into the specified Lua state.
+ Returns true on success, false on failure.
+ The metadata is applied into "this".
+ If a_LogWarnings is true, logs a warning to console when loading fails. */
+ bool ApplyPoolMetadataCubesetVer1(
+ const AString & a_FileName,
+ cLuaState & a_LuaState,
+ bool a_LogWarnings
+ );
} ;
diff --git a/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp b/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp
deleted file mode 100644
index c08e53ef6..000000000
--- a/src/Generating/Prefabs/AlchemistVillagePrefabs.cpp
+++ /dev/null
@@ -1,3590 +0,0 @@
-
-// AlchemistVillagePrefabs.cpp
-
-// Defines the prefabs in the group AlchemistVillage
-
-// NOTE: This file has been generated automatically by GalExport!
-// Any manual changes will be overwritten by the next automatic export!
-
-#include "Globals.h"
-#include "AlchemistVillagePrefabs.h"
-
-
-
-
-
-const cPrefab::sDef g_AlchemistVillagePrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // BarWithBasement:
- // The data has been exported from the gallery Desert, area index 82, ID 598, created by STR_Warrior
- {
- // Size:
- 11, 12, 10, // SizeX = 11, SizeY = 12, SizeZ = 10
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 11, 10, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A: 65: 3\n" /* ladder */
- "B: 50: 3\n" /* torch */
- "C:171: 8\n" /* carpet */
- "D:101: 0\n" /* ironbars */
- "E: 64: 8\n" /* wooddoorblock */
- "F:128: 2\n" /* sandstonestairs */
- "G: 24: 1\n" /* sandstone */
- "H: 44: 9\n" /* step */
- "I:126: 8\n" /* woodenslab */
- "J:128: 7\n" /* sandstonestairs */
- "K: 44: 1\n" /* step */
- "L: 64: 3\n" /* wooddoorblock */
- "M:128: 6\n" /* sandstonestairs */
- "a: 24: 2\n" /* sandstone */
- "b: 1: 0\n" /* stone */
- "c: 24: 0\n" /* sandstone */
- "d: 12: 0\n" /* sand */
- "e:134: 4\n" /* 134 */
- "f: 5: 1\n" /* wood */
- "g:134: 5\n" /* 134 */
- "h: 65: 5\n" /* ladder */
- "i: 17: 3\n" /* tree */
- "j: 69:11\n" /* lever */
- "k: 4: 0\n" /* cobblestone */
- "l:134: 0\n" /* 134 */
- "m: 19: 0\n" /* sponge */
- "n:134: 1\n" /* 134 */
- "o: 50: 4\n" /* torch */
- "p: 13: 0\n" /* gravel */
- "q: 5: 0\n" /* wood */
- "r: 96: 8\n" /* trapdoor */
- "s:128: 5\n" /* sandstonestairs */
- "t:107: 2\n" /* fencegate */
- "u:128: 4\n" /* sandstonestairs */
- "v:134: 3\n" /* 134 */
- "w: 85: 0\n" /* fence */
- "x:134: 7\n" /* 134 */
- "y:107: 5\n" /* fencegate */
- "z: 64: 1\n" /* wooddoorblock */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmabbbammm"
- /* 1 */ "mcccccccccm"
- /* 2 */ "abcccccccba"
- /* 3 */ "cbcccccccbc"
- /* 4 */ "cbcccccccbc"
- /* 5 */ "cbcccccccbc"
- /* 6 */ "cbcccccccbc"
- /* 7 */ "cbcccccccbc"
- /* 8 */ "abbbbbbbbba"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmadddammm"
- /* 1 */ "mcccccccccm"
- /* 2 */ "acefg.efgca"
- /* 3 */ "ccefg.efgcc"
- /* 4 */ "ccefg.efgcc"
- /* 5 */ "cc.......cc"
- /* 6 */ "cc.......cc"
- /* 7 */ "cch......cc"
- /* 8 */ "accccccccca"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmadddammm"
- /* 1 */ "mcccccccccm"
- /* 2 */ "acfff.fffca"
- /* 3 */ "ccfff.fffcc"
- /* 4 */ "ccfif.fifcc"
- /* 5 */ "cc.j...j.cc"
- /* 6 */ "cc.......cc"
- /* 7 */ "cch......cc"
- /* 8 */ "accccccccca"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmakkkammm"
- /* 1 */ "mcccccccccm"
- /* 2 */ "aclfn.lfnca"
- /* 3 */ "cclfn.lfncc"
- /* 4 */ "cclfn.lfncc"
- /* 5 */ "cc.......cc"
- /* 6 */ "cc.......cc"
- /* 7 */ "cch..o...cc"
- /* 8 */ "accccccccca"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmapppammm"
- /* 1 */ "mmmmpppmmmm"
- /* 2 */ "acccqqqccca"
- /* 3 */ "cqqqqqqqqqc"
- /* 4 */ "cqqqqqqqqqc"
- /* 5 */ "cqqqqqqqqqc"
- /* 6 */ "cqqqqqqqqqc"
- /* 7 */ "cqrqqqqqqqc"
- /* 8 */ "aqcccccccca"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmma...ammm"
- /* 1 */ "mmm.....mmm"
- /* 2 */ "acccstuccca"
- /* 3 */ "cnv.....vvc"
- /* 4 */ "cnw.....wlc"
- /* 5 */ "c.........c"
- /* 6 */ "cgxxe.....c"
- /* 7 */ "c...y..nwlc"
- /* 8 */ "azcccccccca"
- /* 9 */ "mmAmmmmmmmm"
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmma...ammm"
- /* 1 */ "mmm.....mmm"
- /* 2 */ "accc...ccca"
- /* 3 */ "c..B...B..c"
- /* 4 */ "c.C.....C.c"
- /* 5 */ "D.........D"
- /* 6 */ "c.........c"
- /* 7 */ "c.......C.c"
- /* 8 */ "aEccDDDccca"
- /* 9 */ "mmAmmmmmmmm"
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmF...Fmmm"
- /* 1 */ "mmmG...cmmm"
- /* 2 */ "acccsHuccca"
- /* 3 */ "cIIIIIIIIIc"
- /* 4 */ "cIIIIIIIIIc"
- /* 5 */ "uIIIIIIIIIs"
- /* 6 */ "cIIIIIIIIIc"
- /* 7 */ "cIIIIIIIIIc"
- /* 8 */ "acccJJJccca"
- /* 9 */ "mmAmmmmmmmm"
-
- // Level 8
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmm.....mmm"
- /* 1 */ "mmm.....mmm"
- /* 2 */ "cKKKKcKKKKc"
- /* 3 */ "KacccccccaK"
- /* 4 */ "Kc.......cK"
- /* 5 */ "cc.......cc"
- /* 6 */ "Kc.......cK"
- /* 7 */ "KaLccccccaK"
- /* 8 */ "cK.KKcKKKKc"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 9
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ ".accDDDcca."
- /* 4 */ ".c.......c."
- /* 5 */ ".D.......D."
- /* 6 */ ".c.......c."
- /* 7 */ ".aEcDDDcca."
- /* 8 */ "..........."
- /* 9 */ "..........."
-
- // Level 10
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ ".accMMMcca."
- /* 4 */ ".cIIIIIIIc."
- /* 5 */ ".uIIIIIIIs."
- /* 6 */ ".cIIIIIIIc."
- /* 7 */ ".accJJJcca."
- /* 8 */ "..........."
- /* 9 */ "..........."
-
- // Level 11
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ ".cKKKcKKKc."
- /* 4 */ ".K.......K."
- /* 5 */ ".c.......c."
- /* 6 */ ".K.......K."
- /* 7 */ ".cKKKcKKKc."
- /* 8 */ "..........."
- /* 9 */ "...........",
-
- // Connectors:
- "-1: 5, 5, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 70,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // BarWithBasement
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // BarWithoutBasement:
- // The data has been exported from the gallery Desert, area index 81, ID 597, created by STR_Warrior
- {
- // Size:
- 11, 9, 10, // SizeX = 11, SizeY = 9, SizeZ = 10
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 8, 10, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A:126: 8\n" /* woodenslab */
- "B:128: 7\n" /* sandstonestairs */
- "C: 44: 1\n" /* step */
- "D: 64: 3\n" /* wooddoorblock */
- "E:128: 6\n" /* sandstonestairs */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f:128: 5\n" /* sandstonestairs */
- "g:107: 2\n" /* fencegate */
- "h:128: 4\n" /* sandstonestairs */
- "i:134: 1\n" /* 134 */
- "j:134: 3\n" /* 134 */
- "k: 85: 0\n" /* fence */
- "l:134: 0\n" /* 134 */
- "m: 19: 0\n" /* sponge */
- "n:134: 5\n" /* 134 */
- "o:134: 7\n" /* 134 */
- "p:134: 4\n" /* 134 */
- "q:107: 1\n" /* fencegate */
- "r: 64: 1\n" /* wooddoorblock */
- "s: 65: 3\n" /* ladder */
- "t: 50: 3\n" /* torch */
- "u:171: 8\n" /* carpet */
- "v:101: 0\n" /* ironbars */
- "w: 64: 8\n" /* wooddoorblock */
- "x:128: 2\n" /* sandstonestairs */
- "y: 24: 1\n" /* sandstone */
- "z: 44: 9\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmabbbammm"
- /* 1 */ "mmmmbbbmmmm"
- /* 2 */ "accccccccca"
- /* 3 */ "ccccccccccc"
- /* 4 */ "ccccccccccc"
- /* 5 */ "ccccccccccc"
- /* 6 */ "ccccccccccc"
- /* 7 */ "ccccccccccc"
- /* 8 */ "accccccccca"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmadddammm"
- /* 1 */ "mmmmdddmmmm"
- /* 2 */ "accceeeccca"
- /* 3 */ "ceeeeeeeeec"
- /* 4 */ "ceeeeeeeeec"
- /* 5 */ "ceeeeeeeeec"
- /* 6 */ "ceeeeeeeeec"
- /* 7 */ "ceeeeeeeeec"
- /* 8 */ "aecccccccca"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmma...ammm"
- /* 1 */ "mmm.....mmm"
- /* 2 */ "acccfghccca"
- /* 3 */ "cij.....jjc"
- /* 4 */ "cik.....klc"
- /* 5 */ "c.........c"
- /* 6 */ "cnoop.....c"
- /* 7 */ "c...q..iklc"
- /* 8 */ "arcccccccca"
- /* 9 */ "mmsmmmmmmmm"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmma...ammm"
- /* 1 */ "mmm.....mmm"
- /* 2 */ "accc...ccca"
- /* 3 */ "c..t...t..c"
- /* 4 */ "c.u.....u.c"
- /* 5 */ "v.........v"
- /* 6 */ "c.........c"
- /* 7 */ "c.......u.c"
- /* 8 */ "awccvvvccca"
- /* 9 */ "mmsmmmmmmmm"
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmx...xmmm"
- /* 1 */ "mmmy...cmmm"
- /* 2 */ "acccfzhccca"
- /* 3 */ "cAAAAAAAAAc"
- /* 4 */ "cAAAAAAAAAc"
- /* 5 */ "hAAAAAAAAAf"
- /* 6 */ "cAAAAAAAAAc"
- /* 7 */ "cAAAAAAAAAc"
- /* 8 */ "acccBBBccca"
- /* 9 */ "mmsmmmmmmmm"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmm.....mmm"
- /* 1 */ "mmm.....mmm"
- /* 2 */ "cCCCCcCCCCc"
- /* 3 */ "CacccccccaC"
- /* 4 */ "Cc.......cC"
- /* 5 */ "cc.......cc"
- /* 6 */ "Cc.......cC"
- /* 7 */ "CaDccccccaC"
- /* 8 */ "cC.CCcCCCCc"
- /* 9 */ "mmmmmmmmmmm"
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ ".accvvvcca."
- /* 4 */ ".c.......c."
- /* 5 */ ".v.......v."
- /* 6 */ ".c.......c."
- /* 7 */ ".awcvvvcca."
- /* 8 */ "..........."
- /* 9 */ "..........."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ ".accEEEcca."
- /* 4 */ ".cAAAAAAAc."
- /* 5 */ ".hAAAAAAAf."
- /* 6 */ ".cAAAAAAAc."
- /* 7 */ ".accBBBcca."
- /* 8 */ "..........."
- /* 9 */ "..........."
-
- // Level 8
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ ".cCCCcCCCc."
- /* 4 */ ".C.......C."
- /* 5 */ ".c.......c."
- /* 6 */ ".C.......C."
- /* 7 */ ".cCCCcCCCc."
- /* 8 */ "..........."
- /* 9 */ "...........",
-
- // Connectors:
- "-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 80,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // BarWithoutBasement
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // BlackSmith:
- // The data has been exported from the gallery Desert, area index 97, ID 642, created by STR_Warrior
- {
- // Size:
- 11, 6, 13, // SizeX = 11, SizeY = 6, SizeZ = 13
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 5, 13, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 12: 0\n" /* sand */
- "g: 64: 3\n" /* wooddoorblock */
- "h: 43: 0\n" /* doubleslab */
- "i: 53: 5\n" /* woodstairs */
- "j: 53: 4\n" /* woodstairs */
- "k: 10: 0\n" /* lava */
- "l: 54: 5\n" /* chest */
- "m: 19: 0\n" /* sponge */
- "n: 64: 8\n" /* wooddoorblock */
- "o: 50: 3\n" /* torch */
- "p:101: 0\n" /* ironbars */
- "q: 50: 1\n" /* torch */
- "r: 50: 2\n" /* torch */
- "s:128: 2\n" /* sandstonestairs */
- "t: 44: 9\n" /* step */
- "u:126: 8\n" /* woodenslab */
- "v:128: 4\n" /* sandstonestairs */
- "w:128: 5\n" /* sandstonestairs */
- "x:128: 7\n" /* sandstonestairs */
- "y: 44: 1\n" /* step */
- "z: 43: 1\n" /* doubleslab */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmabbba"
- /* 1 */ "mmmmmmbbbbm"
- /* 2 */ "mmmmmmaccca"
- /* 3 */ "maccccccccc"
- /* 4 */ "mcccccccccc"
- /* 5 */ "mcccccccccc"
- /* 6 */ "mcccccacccc"
- /* 7 */ "mcccccacccc"
- /* 8 */ "acccaaacccc"
- /* 9 */ "ccccccccccc"
- /* 10 */ "ccccccccccc"
- /* 11 */ "ccccccccccc"
- /* 12 */ "accccccccca"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmaddda"
- /* 1 */ "mmmmmmddddm"
- /* 2 */ "mmmmmmaceca"
- /* 3 */ "mafcfcceeec"
- /* 4 */ "mcfccfceeec"
- /* 5 */ "mcccccceeec"
- /* 6 */ "mcffaaaeeec"
- /* 7 */ "mffcaaaeeec"
- /* 8 */ "acccaaaeeec"
- /* 9 */ "ceeeeeeeeec"
- /* 10 */ "ceeeeeeeeec"
- /* 11 */ "ceeeeeeeeec"
- /* 12 */ "accccccccca"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmma...a"
- /* 1 */ "mmmmmm....."
- /* 2 */ "mmmmmmacgca"
- /* 3 */ "ma....c...c"
- /* 4 */ "m.h...c...c"
- /* 5 */ "m.....c...c"
- /* 6 */ "m...aac...c"
- /* 7 */ "mij.akc...c"
- /* 8 */ "accccca...c"
- /* 9 */ "cl........c"
- /* 10 */ "c.........c"
- /* 11 */ "c.........c"
- /* 12 */ "accccccccca"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmma...a"
- /* 1 */ "mmmmmm....."
- /* 2 */ "mmmmmmacnca"
- /* 3 */ "ma....c..oc"
- /* 4 */ "m.....p...c"
- /* 5 */ "m.....c...c"
- /* 6 */ "m...ppc...p"
- /* 7 */ "m...p.c...p"
- /* 8 */ "accccca...p"
- /* 9 */ "cq........c"
- /* 10 */ "p.........c"
- /* 11 */ "c........rc"
- /* 12 */ "acccpppccca"
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmms...s"
- /* 1 */ "mmmmmmc...c"
- /* 2 */ "mmmmmmaccca"
- /* 3 */ "mattttcuuuc"
- /* 4 */ "mtuuuuvuuuc"
- /* 5 */ "mtuuuucuuuc"
- /* 6 */ "mtuuaacuuuw"
- /* 7 */ "mtuua.cuuuw"
- /* 8 */ "acccccauuuw"
- /* 9 */ "cuuuuuuuuuc"
- /* 10 */ "vuuuuuuuuuc"
- /* 11 */ "cuuuuuuuuuc"
- /* 12 */ "acccxxxccca"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmm....."
- /* 1 */ "mmmmmm....."
- /* 2 */ "mmmmmmcyyyc"
- /* 3 */ "my.y.yy...y"
- /* 4 */ "m.....y...y"
- /* 5 */ "my....y...y"
- /* 6 */ "m...zyz...y"
- /* 7 */ "my..y.y...c"
- /* 8 */ "cyyyzyc...y"
- /* 9 */ "y.........y"
- /* 10 */ "y.........y"
- /* 11 */ "y.........y"
- /* 12 */ "cyyyycyyyyc",
-
- // Connectors:
- "-1: 8, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 50,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // BlackSmith
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LargeHouse1:
- // The data has been exported from the gallery Desert, area index 77, ID 577, created by STR_Warrior
- {
- // Size:
- 15, 14, 11, // SizeX = 15, SizeY = 14, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 14, 13, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A: 96:10\n" /* trapdoor */
- "B:128: 4\n" /* sandstonestairs */
- "C:128: 5\n" /* sandstonestairs */
- "D:128: 7\n" /* sandstonestairs */
- "E: 44: 1\n" /* step */
- "F:128: 2\n" /* sandstonestairs */
- "G:128: 0\n" /* sandstonestairs */
- "H: 87: 0\n" /* netherstone */
- "I:128: 3\n" /* sandstonestairs */
- "J: 51: 0\n" /* fire */
- "K: 44: 9\n" /* step */
- "a: 24: 2\n" /* sandstone */
- "b: 24: 0\n" /* sandstone */
- "c: 12: 0\n" /* sand */
- "d: 4: 0\n" /* cobblestone */
- "e: 5: 0\n" /* wood */
- "f: 13: 0\n" /* gravel */
- "g: 85: 0\n" /* fence */
- "h: 5: 1\n" /* wood */
- "i: 64: 2\n" /* wooddoorblock */
- "j: 64: 0\n" /* wooddoorblock */
- "k: 61: 2\n" /* furnace */
- "l:118: 0\n" /* cauldronblock */
- "m: 19: 0\n" /* sponge */
- "n:134: 4\n" /* 134 */
- "o: 65: 2\n" /* ladder */
- "p:101: 0\n" /* ironbars */
- "q: 50: 1\n" /* torch */
- "r:140: 0\n" /* flowerpotblock */
- "s: 64: 8\n" /* wooddoorblock */
- "t: 50: 3\n" /* torch */
- "u: 69:12\n" /* lever */
- "v: 50: 4\n" /* torch */
- "w:128: 6\n" /* sandstonestairs */
- "x: 44:10\n" /* step */
- "y:128: 1\n" /* sandstonestairs */
- "z: 47: 0\n" /* bookshelf */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmabbbbbbbamm"
- /* 1 */ "ccccbbbbbbbbbma"
- /* 2 */ "ccccbbbbbbbbbdd"
- /* 3 */ "ccccbbbbbbbbbdd"
- /* 4 */ "ccccbbbbbbbbbdd"
- /* 5 */ "ccccbbbbbbbbbma"
- /* 6 */ "ccccbbbbbbbbbmm"
- /* 7 */ "mmmmbbbbbbbbbmm"
- /* 8 */ "mmmmbbbbbbbbbmm"
- /* 9 */ "mmmmbbbbbbbbbmm"
- /* 10 */ "mmmmabbbbbbbamm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmabbbbbbbamm"
- /* 1 */ "ccccbeeeeeeebma"
- /* 2 */ "cccceeeeeeeebff"
- /* 3 */ "ccccbeeeeeeeeff"
- /* 4 */ "ccccbeeeeeeebff"
- /* 5 */ "ccccbeeeeeeebma"
- /* 6 */ "ccccbeeeeeeebmm"
- /* 7 */ "mmmmbeeeeeeebmm"
- /* 8 */ "mmmmbeeeeeeebmm"
- /* 9 */ "mmmmbeeeeeeebmm"
- /* 10 */ "mmmmabbbbbbbamm"
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmabbbbbbbamm"
- /* 1 */ "ggggb......hb.a"
- /* 2 */ "g...i.......b.."
- /* 3 */ "g...b.......j.."
- /* 4 */ "g...bkln..o.b.."
- /* 5 */ "g...bbbb.bbbb.a"
- /* 6 */ "ggggb.......bmm"
- /* 7 */ "mmmmb.......bmm"
- /* 8 */ "mmmmb.......bmm"
- /* 9 */ "mmmmb.......bmm"
- /* 10 */ "mmmmabbbbbbbamm"
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmabbpppbbamm"
- /* 1 */ "....bq.....rb.a"
- /* 2 */ "....s.......b.t"
- /* 3 */ "....b.......s.."
- /* 4 */ "....b.u...o.b.v"
- /* 5 */ "....bbbb.bbbb.a"
- /* 6 */ "....p..t.t..pmm"
- /* 7 */ "mmmmp.......pmm"
- /* 8 */ "mmmmp.......pmm"
- /* 9 */ "mmmmb.......bmm"
- /* 10 */ "mmmmabbpppbbamm"
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmabbwwwbbamm"
- /* 1 */ "....bxxxxxxxbby"
- /* 2 */ "....bxxxxxxxb.."
- /* 3 */ "....bxxxxxxxb.."
- /* 4 */ "....bzzzxxAxb.."
- /* 5 */ "....bbbbbbbbbby"
- /* 6 */ "....BxxxxxxxCmm"
- /* 7 */ "mmmmBxxxxxxxCmm"
- /* 8 */ "mmmmBxxxxxxxCmm"
- /* 9 */ "mmmmbxxxxxxxbmm"
- /* 10 */ "mmmmabbDDDbbamm"
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmbEEEbEEEbmm"
- /* 1 */ "....EabbbbbaE.."
- /* 2 */ "....Eb.....bE.."
- /* 3 */ "....Eb.....bE.."
- /* 4 */ "....Eb.....bE.."
- /* 5 */ "....babb.bbab.."
- /* 6 */ "....E.......Emm"
- /* 7 */ "mmmmE.......Emm"
- /* 8 */ "mmmmE.......Emm"
- /* 9 */ "mmmmE.......Emm"
- /* 10 */ "mmmmbEEEbEEEbmm"
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".....abbpbba..."
- /* 2 */ ".....p.....p..."
- /* 3 */ ".....p.....p..."
- /* 4 */ ".....p.....p..."
- /* 5 */ ".....abb.bba..."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".....abbwbba..."
- /* 2 */ ".....BxxxxxC..."
- /* 3 */ ".....BxxxxxC..."
- /* 4 */ ".....BxxxxxC..."
- /* 5 */ ".....abbbbba..."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 8
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".....bEEbEEb..."
- /* 2 */ ".....E.bbb.E..."
- /* 3 */ ".....b.bbb.b..."
- /* 4 */ ".....E.bbb.E..."
- /* 5 */ ".....bEEbEEb..."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 9
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ ".......aFa....."
- /* 3 */ ".......GHy....."
- /* 4 */ ".......aIa....."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 10
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ ".......a.a....."
- /* 3 */ "........J......"
- /* 4 */ ".......a.a....."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 11
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ ".......awa....."
- /* 3 */ ".......B.C....."
- /* 4 */ ".......aDa....."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 12
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ ".......bbb....."
- /* 3 */ ".......bKb....."
- /* 4 */ ".......bbb....."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
-
- // Level 13
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ ".......E.E....."
- /* 3 */ "..............."
- /* 4 */ ".......E.E....."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "...............",
-
- // Connectors:
- "-1: 14, 2, 3: 5\n" /* Type -1, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 60,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LargeHouse1
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LargeTower:
- // The data has been exported from the gallery Desert, area index 80, ID 596, created by STR_Warrior
- {
- // Size:
- 7, 12, 7, // SizeX = 7, SizeY = 12, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 11, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 12: 0\n" /* sand */
- "d: 5: 0\n" /* wood */
- "e: 13: 0\n" /* gravel */
- "f:128: 2\n" /* sandstonestairs */
- "g:128: 0\n" /* sandstonestairs */
- "h: 24: 2\n" /* sandstone */
- "i: 71: 3\n" /* irondoorblock */
- "j:128: 1\n" /* sandstonestairs */
- "k:128: 3\n" /* sandstonestairs */
- "l: 77: 4\n" /* stonebutton */
- "m: 19: 0\n" /* sponge */
- "n: 71: 8\n" /* irondoorblock */
- "o: 77: 3\n" /* stonebutton */
- "p:128: 6\n" /* sandstonestairs */
- "q:128: 4\n" /* sandstonestairs */
- "r:128: 5\n" /* sandstonestairs */
- "s: 50: 4\n" /* torch */
- "t:128: 7\n" /* sandstonestairs */
- "u: 85: 0\n" /* fence */
- "v: 24: 1\n" /* sandstone */
- "w: 44: 1\n" /* step */
- "x: 89: 0\n" /* lightstone */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mabbbam"
- /* 1 */ "aacdcaa"
- /* 2 */ "madddam"
- /* 3 */ "madddam"
- /* 4 */ "madddam"
- /* 5 */ "aaaaaaa"
- /* 6 */ "mammmam"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "maeeeam"
- /* 1 */ "aacdcaa"
- /* 2 */ "madddam"
- /* 3 */ "madddam"
- /* 4 */ "madddam"
- /* 5 */ "aaaaaaa"
- /* 6 */ "mammmam"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "mf...fm"
- /* 1 */ "ghaiahj"
- /* 2 */ "ma...am"
- /* 3 */ "ma...am"
- /* 4 */ "ma...am"
- /* 5 */ "ghaaahj"
- /* 6 */ "mkmmmkm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "m.l...m"
- /* 1 */ ".hanah."
- /* 2 */ ".ao..a."
- /* 3 */ ".a...a."
- /* 4 */ ".a...a."
- /* 5 */ ".haaah."
- /* 6 */ "m.....m"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..pap.."
- /* 2 */ ".q...r."
- /* 3 */ ".a...a."
- /* 4 */ ".q.s.r."
- /* 5 */ "..tat.."
- /* 6 */ "......."
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..aua.."
- /* 2 */ ".a...a."
- /* 3 */ ".u...u."
- /* 4 */ ".a...a."
- /* 5 */ "..aua.."
- /* 6 */ "......."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..aua.."
- /* 2 */ ".a...a."
- /* 3 */ ".u...u."
- /* 4 */ ".a...a."
- /* 5 */ "..aua.."
- /* 6 */ "......."
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..aua.."
- /* 2 */ ".a...a."
- /* 3 */ ".u...u."
- /* 4 */ ".a...a."
- /* 5 */ "..aua.."
- /* 6 */ "......."
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..faf.."
- /* 2 */ ".g...j."
- /* 3 */ ".a...a."
- /* 4 */ ".g...j."
- /* 5 */ "..kak.."
- /* 6 */ "......."
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".aavaa."
- /* 2 */ ".a...a."
- /* 3 */ ".v...v."
- /* 4 */ ".a...a."
- /* 5 */ ".aavaa."
- /* 6 */ "......."
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "...p..."
- /* 1 */ ".haaah."
- /* 2 */ ".awwwa."
- /* 3 */ "qawawar"
- /* 4 */ ".awwwa."
- /* 5 */ ".haaah."
- /* 6 */ "...t..."
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "...w..."
- /* 1 */ ".w...w."
- /* 2 */ "......."
- /* 3 */ "w..x..w"
- /* 4 */ "......."
- /* 5 */ ".w...w."
- /* 6 */ "...w...",
-
- // Connectors:
- "-1: 3, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LargeTower
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse:
- // The data has been exported from the gallery Desert, area index 65, ID 551, created by STR_Warrior
- {
- // Size:
- 5, 6, 7, // SizeX = 5, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 5, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 61: 2\n" /* furnace */
- "h: 65: 2\n" /* ladder */
- "i: 64: 8\n" /* wooddoorblock */
- "j:101: 0\n" /* ironbars */
- "k: 50: 4\n" /* torch */
- "l:128: 2\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:126: 8\n" /* woodenslab */
- "o:128: 4\n" /* sandstonestairs */
- "p:128: 5\n" /* sandstonestairs */
- "q:128: 7\n" /* sandstonestairs */
- "r: 44: 1\n" /* step */
- "s: 96: 2\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 01234 */
- /* 0 */ "abbba"
- /* 1 */ "mbbbm"
- /* 2 */ "accca"
- /* 3 */ "ccccc"
- /* 4 */ "ccccc"
- /* 5 */ "ccccc"
- /* 6 */ "accca"
-
- // Level 1
- /* z\x* 01234 */
- /* 0 */ "addda"
- /* 1 */ "mdddm"
- /* 2 */ "aceca"
- /* 3 */ "ceeec"
- /* 4 */ "ceeec"
- /* 5 */ "ceeec"
- /* 6 */ "accca"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "a...a"
- /* 1 */ "....."
- /* 2 */ "acfca"
- /* 3 */ "c...c"
- /* 4 */ "c...c"
- /* 5 */ "cg.hc"
- /* 6 */ "accca"
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "a...a"
- /* 1 */ "....."
- /* 2 */ "acica"
- /* 3 */ "c...c"
- /* 4 */ "j...j"
- /* 5 */ "ck.hc"
- /* 6 */ "acjca"
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "l...l"
- /* 1 */ "c...c"
- /* 2 */ "accca"
- /* 3 */ "cnnnc"
- /* 4 */ "onnnp"
- /* 5 */ "cnnhc"
- /* 6 */ "acqca"
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "crcrc"
- /* 3 */ "r...r"
- /* 4 */ "c...c"
- /* 5 */ "r..sr"
- /* 6 */ "crcrc",
-
- // Connectors:
- "-1: 2, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse2:
- // The data has been exported from the gallery Desert, area index 72, ID 562, created by STR_Warrior
- {
- // Size:
- 7, 6, 11, // SizeX = 7, SizeY = 6, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 5, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 12: 0\n" /* sand */
- "e: 13: 0\n" /* gravel */
- "f: 5: 0\n" /* wood */
- "g: 64: 3\n" /* wooddoorblock */
- "h: 65: 5\n" /* ladder */
- "i: 85: 0\n" /* fence */
- "j:101: 0\n" /* ironbars */
- "k: 64: 8\n" /* wooddoorblock */
- "l: 50: 3\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n:128: 2\n" /* sandstonestairs */
- "o:128: 6\n" /* sandstonestairs */
- "p:126: 8\n" /* woodenslab */
- "q:128: 4\n" /* sandstonestairs */
- "r:128: 5\n" /* sandstonestairs */
- "s:128: 7\n" /* sandstonestairs */
- "t: 44: 1\n" /* step */
- "u: 96: 0\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mabbbam"
- /* 1 */ "mmbbbmm"
- /* 2 */ "accccca"
- /* 3 */ "ccccccc"
- /* 4 */ "ccccccc"
- /* 5 */ "ccccccc"
- /* 6 */ "accccca"
- /* 7 */ "ddddddd"
- /* 8 */ "ddddddd"
- /* 9 */ "ddddddd"
- /* 10 */ "ddddddd"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "maeeeam"
- /* 1 */ "mmeeemm"
- /* 2 */ "acccfca"
- /* 3 */ "cfffffc"
- /* 4 */ "cfffffc"
- /* 5 */ "cfffffc"
- /* 6 */ "acfccca"
- /* 7 */ "ddddddd"
- /* 8 */ "ddddddd"
- /* 9 */ "ddddddd"
- /* 10 */ "ddddddd"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "ma...am"
- /* 1 */ "m.....m"
- /* 2 */ "acccgca"
- /* 3 */ "c.....c"
- /* 4 */ "c.....c"
- /* 5 */ "ch....c"
- /* 6 */ "ac.ccca"
- /* 7 */ "i.....i"
- /* 8 */ "i.....i"
- /* 9 */ "i.....i"
- /* 10 */ "iiiiiii"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "ma...am"
- /* 1 */ "m.....m"
- /* 2 */ "acjckca"
- /* 3 */ "c..l..c"
- /* 4 */ "j.....j"
- /* 5 */ "ch....c"
- /* 6 */ "ac.cjca"
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "mn...nm"
- /* 1 */ "mc...cm"
- /* 2 */ "acoccca"
- /* 3 */ "cpppppc"
- /* 4 */ "qpppppr"
- /* 5 */ "chppppc"
- /* 6 */ "acccsca"
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "m.....m"
- /* 1 */ "m.....m"
- /* 2 */ "cttcttc"
- /* 3 */ "t.....t"
- /* 4 */ "c.....c"
- /* 5 */ "tu....t"
- /* 6 */ "cttcttc"
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ ".......",
-
- // Connectors:
- "-1: 3, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse2
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse3:
- // The data has been exported from the gallery Desert, area index 66, ID 553, created by STR_Warrior
- {
- // Size:
- 9, 6, 7, // SizeX = 9, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 65: 2\n" /* ladder */
- "h: 64: 8\n" /* wooddoorblock */
- "i:101: 0\n" /* ironbars */
- "j: 50: 4\n" /* torch */
- "k:128: 2\n" /* sandstonestairs */
- "l:126: 8\n" /* woodenslab */
- "m: 19: 0\n" /* sponge */
- "n:128: 4\n" /* sandstonestairs */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 7\n" /* sandstonestairs */
- "q: 44: 1\n" /* step */
- "r: 96: 2\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmabbbamm"
- /* 1 */ "mmmbbbmmm"
- /* 2 */ "accccccca"
- /* 3 */ "ccccccccc"
- /* 4 */ "ccccccccc"
- /* 5 */ "ccccccccc"
- /* 6 */ "accccccca"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "mmadddamm"
- /* 1 */ "mmmdddmmm"
- /* 2 */ "accceccca"
- /* 3 */ "ceeeeeeec"
- /* 4 */ "ceeeeeeec"
- /* 5 */ "ceeeeeeec"
- /* 6 */ "accccccca"
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "mma...amm"
- /* 1 */ "mm.....mm"
- /* 2 */ "acccfccca"
- /* 3 */ "c.......c"
- /* 4 */ "c.......c"
- /* 5 */ "c......gc"
- /* 6 */ "accccccca"
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "mma...amm"
- /* 1 */ "mm.....mm"
- /* 2 */ "accchccca"
- /* 3 */ "c.......c"
- /* 4 */ "i.......i"
- /* 5 */ "c.j....gc"
- /* 6 */ "acciiicca"
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "mmk...kmm"
- /* 1 */ "mmc...cmm"
- /* 2 */ "accccccca"
- /* 3 */ "clllllllc"
- /* 4 */ "nlllllllo"
- /* 5 */ "cllllllgc"
- /* 6 */ "accpppcca"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "mm.....mm"
- /* 1 */ "mm.....mm"
- /* 2 */ "cqqqcqqqc"
- /* 3 */ "q.......q"
- /* 4 */ "c.......c"
- /* 5 */ "q......rq"
- /* 6 */ "cqqqcqqqc",
-
- // Connectors:
- "-1: 4, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse3
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse4:
- // The data has been exported from the gallery Desert, area index 70, ID 560, created by STR_Warrior
- {
- // Size:
- 5, 6, 11, // SizeX = 5, SizeY = 6, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 5, 5, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 65: 5\n" /* ladder */
- "h:134: 3\n" /* 134 */
- "i: 85: 0\n" /* fence */
- "j:134: 2\n" /* 134 */
- "k: 61: 2\n" /* furnace */
- "l:134: 6\n" /* 134 */
- "m: 19: 0\n" /* sponge */
- "n:134: 4\n" /* 134 */
- "o: 64: 8\n" /* wooddoorblock */
- "p: 50: 2\n" /* torch */
- "q:101: 0\n" /* ironbars */
- "r:171: 8\n" /* carpet */
- "s:128: 2\n" /* sandstonestairs */
- "t:126: 8\n" /* woodenslab */
- "u:128: 4\n" /* sandstonestairs */
- "v:128: 5\n" /* sandstonestairs */
- "w:128: 7\n" /* sandstonestairs */
- "x: 44: 1\n" /* step */
- "y: 96: 1\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 01234 */
- /* 0 */ "abbba"
- /* 1 */ "mbbbm"
- /* 2 */ "accca"
- /* 3 */ "ccccc"
- /* 4 */ "ccccc"
- /* 5 */ "ccccc"
- /* 6 */ "ccccc"
- /* 7 */ "ccccc"
- /* 8 */ "ccccc"
- /* 9 */ "ccccc"
- /* 10 */ "accca"
-
- // Level 1
- /* z\x* 01234 */
- /* 0 */ "addda"
- /* 1 */ "mdddm"
- /* 2 */ "aceca"
- /* 3 */ "ceeec"
- /* 4 */ "ceeec"
- /* 5 */ "ceeec"
- /* 6 */ "ceeec"
- /* 7 */ "ceeec"
- /* 8 */ "ceeec"
- /* 9 */ "ceeec"
- /* 10 */ "accca"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "a...a"
- /* 1 */ "....."
- /* 2 */ "acfca"
- /* 3 */ "cg..c"
- /* 4 */ "c...c"
- /* 5 */ "c..hc"
- /* 6 */ "c..ic"
- /* 7 */ "c..jc"
- /* 8 */ "c...c"
- /* 9 */ "cklnc"
- /* 10 */ "accca"
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "a...a"
- /* 1 */ "....."
- /* 2 */ "acoca"
- /* 3 */ "cg..c"
- /* 4 */ "c..pc"
- /* 5 */ "q...q"
- /* 6 */ "q..rq"
- /* 7 */ "q...q"
- /* 8 */ "c...c"
- /* 9 */ "c...c"
- /* 10 */ "acqca"
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "s...s"
- /* 1 */ "c...c"
- /* 2 */ "accca"
- /* 3 */ "cgttc"
- /* 4 */ "ctttc"
- /* 5 */ "utttv"
- /* 6 */ "utttv"
- /* 7 */ "utttv"
- /* 8 */ "ctttc"
- /* 9 */ "ctttc"
- /* 10 */ "acwca"
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "cxcxc"
- /* 3 */ "xy..x"
- /* 4 */ "x...x"
- /* 5 */ "x...x"
- /* 6 */ "c...c"
- /* 7 */ "x...x"
- /* 8 */ "x...x"
- /* 9 */ "x...x"
- /* 10 */ "cxcxc",
-
- // Connectors:
- "-1: 2, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse4
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse5:
- // The data has been exported from the gallery Desert, area index 68, ID 558, created by STR_Warrior
- {
- // Size:
- 9, 6, 9, // SizeX = 9, SizeY = 6, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 5, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 65: 2\n" /* ladder */
- "h: 64: 8\n" /* wooddoorblock */
- "i:101: 0\n" /* ironbars */
- "j: 50: 1\n" /* torch */
- "k: 50: 4\n" /* torch */
- "l:128: 2\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:126: 8\n" /* woodenslab */
- "o:128: 6\n" /* sandstonestairs */
- "p:128: 5\n" /* sandstonestairs */
- "q:128: 4\n" /* sandstonestairs */
- "r:128: 7\n" /* sandstonestairs */
- "s: 44: 1\n" /* step */
- "t: 96: 2\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmmabbba"
- /* 1 */ "mmmmmbbbm"
- /* 2 */ "mmmmaccca"
- /* 3 */ "mmmmccccc"
- /* 4 */ "acccacccc"
- /* 5 */ "ccccccccc"
- /* 6 */ "ccccccccc"
- /* 7 */ "ccccccccc"
- /* 8 */ "accccccca"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "mmmmaddda"
- /* 1 */ "mmmmmdddm"
- /* 2 */ "mmmmaceca"
- /* 3 */ "mmmmceeec"
- /* 4 */ "acccaeeec"
- /* 5 */ "ceeeeeeec"
- /* 6 */ "ceeeeeeec"
- /* 7 */ "ceeeeeeec"
- /* 8 */ "accccccca"
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "mmmma...a"
- /* 1 */ "mmmm....."
- /* 2 */ "mmmmacfca"
- /* 3 */ "mmmmc...c"
- /* 4 */ "accca...c"
- /* 5 */ "c.......c"
- /* 6 */ "c.......c"
- /* 7 */ "c......gc"
- /* 8 */ "accccccca"
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "mmmma...a"
- /* 1 */ "mmmm....."
- /* 2 */ "mmmmachca"
- /* 3 */ "mmmmc...c"
- /* 4 */ "acica...i"
- /* 5 */ "c.......i"
- /* 6 */ "i.......i"
- /* 7 */ "cj....kgc"
- /* 8 */ "acciiicca"
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "mmmml...l"
- /* 1 */ "mmmmc...c"
- /* 2 */ "mmmmaccca"
- /* 3 */ "mmmmcnnnc"
- /* 4 */ "acocannnp"
- /* 5 */ "cnnnnnnnp"
- /* 6 */ "qnnnnnnnp"
- /* 7 */ "cnnnnnngc"
- /* 8 */ "accrrrcca"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "mmmm....."
- /* 1 */ "mmmm....."
- /* 2 */ "mmmmcscsc"
- /* 3 */ "mmmms...s"
- /* 4 */ "csssc...c"
- /* 5 */ "s.......s"
- /* 6 */ "s.......s"
- /* 7 */ "s......ts"
- /* 8 */ "cssscsssc",
-
- // Connectors:
- "-1: 6, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse6:
- // The data has been exported from the gallery Desert, area index 69, ID 559, created by STR_Warrior
- {
- // Size:
- 9, 6, 9, // SizeX = 9, SizeY = 6, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 5, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A: 96: 2\n" /* trapdoor */
- "a: 12: 0\n" /* sand */
- "b: 24: 2\n" /* sandstone */
- "c: 4: 0\n" /* cobblestone */
- "d: 3: 0\n" /* dirt */
- "e: 24: 0\n" /* sandstone */
- "f: 13: 0\n" /* gravel */
- "g: 2: 0\n" /* grass */
- "h: 5: 0\n" /* wood */
- "i: 85: 0\n" /* fence */
- "j: 64: 3\n" /* wooddoorblock */
- "k: 38: 1\n" /* rose */
- "l: 38: 2\n" /* rose */
- "m: 19: 0\n" /* sponge */
- "n: 38: 5\n" /* rose */
- "o: 65: 2\n" /* ladder */
- "p: 64: 8\n" /* wooddoorblock */
- "q:101: 0\n" /* ironbars */
- "r: 50: 1\n" /* torch */
- "s: 50: 4\n" /* torch */
- "t:128: 2\n" /* sandstonestairs */
- "u:126: 8\n" /* woodenslab */
- "v:128: 6\n" /* sandstonestairs */
- "w:128: 5\n" /* sandstonestairs */
- "x:128: 4\n" /* sandstonestairs */
- "y:128: 7\n" /* sandstonestairs */
- "z: 44: 1\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "aaaabcccb"
- /* 1 */ "adddccccm"
- /* 2 */ "adddbeeeb"
- /* 3 */ "adddeeeee"
- /* 4 */ "beeebeeee"
- /* 5 */ "eeeeeeeee"
- /* 6 */ "eeeeeeeee"
- /* 7 */ "eeeeeeeee"
- /* 8 */ "beeeeeeeb"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "aaaabfffb"
- /* 1 */ "agggffffm"
- /* 2 */ "agggbeheb"
- /* 3 */ "agggehhhe"
- /* 4 */ "beeebhhhe"
- /* 5 */ "ehhhhhhhe"
- /* 6 */ "ehhhhhhhe"
- /* 7 */ "ehhhhhhhe"
- /* 8 */ "beeeeeeeb"
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "iiiib...b"
- /* 1 */ "i........"
- /* 2 */ "i...bejeb"
- /* 3 */ "iklne...e"
- /* 4 */ "beeeb...e"
- /* 5 */ "e.......e"
- /* 6 */ "e.......e"
- /* 7 */ "e......oe"
- /* 8 */ "beeeeeeeb"
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "....b...b"
- /* 1 */ "........."
- /* 2 */ "....bepeb"
- /* 3 */ "....e...e"
- /* 4 */ "beqeb...q"
- /* 5 */ "e.......q"
- /* 6 */ "q.......q"
- /* 7 */ "er....soe"
- /* 8 */ "beeqqqeeb"
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "....t...t"
- /* 1 */ "....e...e"
- /* 2 */ "....beeeb"
- /* 3 */ "....euuue"
- /* 4 */ "bevebuuuw"
- /* 5 */ "euuuuuuuw"
- /* 6 */ "xuuuuuuuw"
- /* 7 */ "euuuuuuoe"
- /* 8 */ "beeyyyeeb"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "........."
- /* 2 */ "....ezeze"
- /* 3 */ "....z...z"
- /* 4 */ "ezzze...e"
- /* 5 */ "z.......z"
- /* 6 */ "z.......z"
- /* 7 */ "z......Az"
- /* 8 */ "ezzzezzze",
-
- // Connectors:
- "-1: 6, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse6
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse7:
- // The data has been exported from the gallery Desert, area index 73, ID 563, created by xoft
- {
- // Size:
- 9, 6, 11, // SizeX = 9, SizeY = 6, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 5, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 65: 2\n" /* ladder */
- "h:101: 0\n" /* ironbars */
- "i: 64: 8\n" /* wooddoorblock */
- "j: 50: 1\n" /* torch */
- "k: 50: 2\n" /* torch */
- "l:128: 2\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:128: 6\n" /* sandstonestairs */
- "o:126: 8\n" /* woodenslab */
- "p:128: 4\n" /* sandstonestairs */
- "q:128: 5\n" /* sandstonestairs */
- "r:128: 7\n" /* sandstonestairs */
- "s: 44: 1\n" /* step */
- "t: 96: 2\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmmabbba"
- /* 1 */ "mmmmmbbbm"
- /* 2 */ "accccccca"
- /* 3 */ "ccccccccc"
- /* 4 */ "ccccccccc"
- /* 5 */ "ccccccccc"
- /* 6 */ "acccacccc"
- /* 7 */ "mmmmccccc"
- /* 8 */ "mmmmccccc"
- /* 9 */ "mmmmccccc"
- /* 10 */ "mmmmaccca"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "mmmmaddda"
- /* 1 */ "mmmmmdddm"
- /* 2 */ "accccceca"
- /* 3 */ "ceeeeeeec"
- /* 4 */ "ceeeeeeec"
- /* 5 */ "ceeeeeeec"
- /* 6 */ "acccaeeec"
- /* 7 */ "mmmmceeec"
- /* 8 */ "mmmmceeec"
- /* 9 */ "mmmmceeec"
- /* 10 */ "mmmmaccca"
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "mmmma...a"
- /* 1 */ "mmmm....."
- /* 2 */ "acccccfca"
- /* 3 */ "c.......c"
- /* 4 */ "c.......c"
- /* 5 */ "c.......c"
- /* 6 */ "accca...c"
- /* 7 */ "mmmmc...c"
- /* 8 */ "mmmmc...c"
- /* 9 */ "mmmmc..gc"
- /* 10 */ "mmmmaccca"
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "mmmma...a"
- /* 1 */ "mmmm....."
- /* 2 */ "achcccica"
- /* 3 */ "c.......c"
- /* 4 */ "h.......c"
- /* 5 */ "cj......h"
- /* 6 */ "achca...h"
- /* 7 */ "mmmmc...h"
- /* 8 */ "mmmmh..kc"
- /* 9 */ "mmmmc..gc"
- /* 10 */ "mmmmachca"
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "mmmml...l"
- /* 1 */ "mmmmc...c"
- /* 2 */ "acnccccca"
- /* 3 */ "coooooooc"
- /* 4 */ "poooooooc"
- /* 5 */ "coooooooq"
- /* 6 */ "acrcaoooq"
- /* 7 */ "mmmmcoooq"
- /* 8 */ "mmmmpoooc"
- /* 9 */ "mmmmcoogc"
- /* 10 */ "mmmmacrca"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "mmmm....."
- /* 1 */ "mmmm....."
- /* 2 */ "cssscscsc"
- /* 3 */ "s.......s"
- /* 4 */ "s.......s"
- /* 5 */ "s.......s"
- /* 6 */ "csssc...c"
- /* 7 */ "mmmms...s"
- /* 8 */ "mmmms...s"
- /* 9 */ "mmmms..ts"
- /* 10 */ "mmmmcsssc",
-
- // Connectors:
- "-1: 6, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleHouse8:
- // The data has been exported from the gallery Desert, area index 99, ID 739, created by STR_Warrior
- {
- // Size:
- 9, 6, 9, // SizeX = 9, SizeY = 6, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- 0, 0, -1, // MinX, MinY, MinZ
- 9, 5, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 24: 0\n" /* sandstone */
- "c: 4: 0\n" /* cobblestone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 2\n" /* wooddoorblock */
- "g: 65: 2\n" /* ladder */
- "h:101: 0\n" /* ironbars */
- "i: 64: 8\n" /* wooddoorblock */
- "j: 50: 1\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:126: 8\n" /* woodenslab */
- "m: 19: 0\n" /* sponge */
- "n:128: 5\n" /* sandstonestairs */
- "o:128: 4\n" /* sandstonestairs */
- "p:128: 7\n" /* sandstonestairs */
- "q: 44: 1\n" /* step */
- "r: 96: 2\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmmabbba"
- /* 1 */ "ccccbbbbb"
- /* 2 */ "ccccbbbbb"
- /* 3 */ "ccccbbbbb"
- /* 4 */ "abbbabbbb"
- /* 5 */ "bbbbbbbbb"
- /* 6 */ "bbbbbbbbb"
- /* 7 */ "bbbbbbbbb"
- /* 8 */ "abbbbbbba"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "mmmmabbba"
- /* 1 */ "ddddbeeeb"
- /* 2 */ "ddddeeeeb"
- /* 3 */ "ddddbeeeb"
- /* 4 */ "abbbaeeeb"
- /* 5 */ "beeeeeeeb"
- /* 6 */ "beeeeeeeb"
- /* 7 */ "beeeeeeeb"
- /* 8 */ "abbbbbbba"
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "mmmmabbba"
- /* 1 */ "....b...b"
- /* 2 */ "....f...b"
- /* 3 */ "....b...b"
- /* 4 */ "abbba...b"
- /* 5 */ "b.......b"
- /* 6 */ "b.......b"
- /* 7 */ "b......gb"
- /* 8 */ "abbbbbbba"
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "mmmmabhba"
- /* 1 */ "....b...b"
- /* 2 */ "....i...b"
- /* 3 */ "....b...h"
- /* 4 */ "abhbaj..h"
- /* 5 */ "b.......h"
- /* 6 */ "h.......b"
- /* 7 */ "b......gb"
- /* 8 */ "abbhhhbba"
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "mmmmabkba"
- /* 1 */ "....blllb"
- /* 2 */ "....blllb"
- /* 3 */ "....bllln"
- /* 4 */ "abkballln"
- /* 5 */ "bllllllln"
- /* 6 */ "olllllllb"
- /* 7 */ "bllllllgb"
- /* 8 */ "abbpppbba"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "mmmmbqbqb"
- /* 1 */ "....q...q"
- /* 2 */ "....q...q"
- /* 3 */ "....q...q"
- /* 4 */ "bqqqb...b"
- /* 5 */ "q.......q"
- /* 6 */ "b.......q"
- /* 7 */ "q......rq"
- /* 8 */ "bqqqbqqqb",
-
- // Connectors:
- "-1: 0, 2, 2: 4\n" /* Type -1, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleHouse8
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LittleTower:
- // The data has been exported from the gallery Desert, area index 79, ID 595, created by STR_Warrior
- {
- // Size:
- 5, 9, 7, // SizeX = 5, SizeY = 9, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 5, 8, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 65: 5\n" /* ladder */
- "h: 64: 8\n" /* wooddoorblock */
- "i:101: 0\n" /* ironbars */
- "j: 50: 4\n" /* torch */
- "k:128: 2\n" /* sandstonestairs */
- "l:126: 8\n" /* woodenslab */
- "m: 19: 0\n" /* sponge */
- "n:128: 4\n" /* sandstonestairs */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 7\n" /* sandstonestairs */
- "q:128: 6\n" /* sandstonestairs */
- "r: 44: 1\n" /* step */
- "s: 96: 1\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 01234 */
- /* 0 */ "abbba"
- /* 1 */ "mbbbm"
- /* 2 */ "accca"
- /* 3 */ "ccccc"
- /* 4 */ "ccccc"
- /* 5 */ "ccccc"
- /* 6 */ "accca"
-
- // Level 1
- /* z\x* 01234 */
- /* 0 */ "addda"
- /* 1 */ "mdddm"
- /* 2 */ "aceca"
- /* 3 */ "ceeec"
- /* 4 */ "ceeec"
- /* 5 */ "ceeec"
- /* 6 */ "accca"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "a...a"
- /* 1 */ "....."
- /* 2 */ "acfca"
- /* 3 */ "cg..c"
- /* 4 */ "c...c"
- /* 5 */ "c...c"
- /* 6 */ "accca"
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "a...a"
- /* 1 */ "....."
- /* 2 */ "achca"
- /* 3 */ "cg..c"
- /* 4 */ "i...i"
- /* 5 */ "c..jc"
- /* 6 */ "acica"
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "k...k"
- /* 1 */ "c...c"
- /* 2 */ "accca"
- /* 3 */ "cgllc"
- /* 4 */ "nlllo"
- /* 5 */ "clllc"
- /* 6 */ "acpca"
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "accca"
- /* 3 */ "cg..c"
- /* 4 */ "c...c"
- /* 5 */ "c...c"
- /* 6 */ "accca"
-
- // Level 6
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "acica"
- /* 3 */ "cg..c"
- /* 4 */ "i...i"
- /* 5 */ "c..jc"
- /* 6 */ "acica"
-
- // Level 7
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "acqca"
- /* 3 */ "cgllc"
- /* 4 */ "nlllo"
- /* 5 */ "clllc"
- /* 6 */ "acpca"
-
- // Level 8
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "crcrc"
- /* 3 */ "rs..r"
- /* 4 */ "c...c"
- /* 5 */ "r...r"
- /* 6 */ "crcrc",
-
- // Connectors:
- "-1: 2, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LittleTower
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MediumHouse1:
- // The data has been exported from the gallery Desert, area index 71, ID 561, created by STR_Warrior
- {
- // Size:
- 15, 9, 9, // SizeX = 15, SizeY = 9, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 15, 8, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 12: 0\n" /* sand */
- "g: 64: 3\n" /* wooddoorblock */
- "h: 85: 0\n" /* fence */
- "i: 64: 0\n" /* wooddoorblock */
- "j: 65: 5\n" /* ladder */
- "k: 64: 8\n" /* wooddoorblock */
- "l:101: 0\n" /* ironbars */
- "m: 19: 0\n" /* sponge */
- "n: 50: 4\n" /* torch */
- "o:128: 2\n" /* sandstonestairs */
- "p:126: 8\n" /* woodenslab */
- "q:128: 4\n" /* sandstonestairs */
- "r:128: 7\n" /* sandstonestairs */
- "s: 44: 1\n" /* step */
- "t: 50: 3\n" /* torch */
- "u:128: 6\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmabbbammmmmmm"
- /* 1 */ "mmmmbbbmmmmmmmm"
- /* 2 */ "acccccccccacccc"
- /* 3 */ "ccccccccccccccc"
- /* 4 */ "ccccccccccccccc"
- /* 5 */ "ccccccccccccccc"
- /* 6 */ "ccccccccccccccc"
- /* 7 */ "ccccccccccccccc"
- /* 8 */ "acccccccccacccc"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmadddammmmmmm"
- /* 1 */ "mmmmdddmmmmmmmm"
- /* 2 */ "acccceccccaffff"
- /* 3 */ "ceeeeeeeeecffff"
- /* 4 */ "ceeeeeeeeecffff"
- /* 5 */ "ceeeeeeeeeeffff"
- /* 6 */ "ceeeeeeeeecffff"
- /* 7 */ "ceeeeeeeeecffff"
- /* 8 */ "acccccccccaffff"
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmma...ammmmmmm"
- /* 1 */ "mmm.....mmmmmmm"
- /* 2 */ "accccgccccahhhh"
- /* 3 */ "c.........c...h"
- /* 4 */ "c.........c...h"
- /* 5 */ "c.........i...h"
- /* 6 */ "c.........c...h"
- /* 7 */ "c.........cj..h"
- /* 8 */ "acccccccccahhhh"
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmma...ammmmmmm"
- /* 1 */ "mmm.....mmmmmmm"
- /* 2 */ "acccckcccca...."
- /* 3 */ "c.........c...."
- /* 4 */ "l.........c...."
- /* 5 */ "l.........k...."
- /* 6 */ "l.........c...."
- /* 7 */ "c..n...n..cj..."
- /* 8 */ "accclllccca...."
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmo...ommmmmmm"
- /* 1 */ "mmmc...cmmmmmmm"
- /* 2 */ "accccccccca...."
- /* 3 */ "cpppppppppc...."
- /* 4 */ "qpppppppppc...."
- /* 5 */ "qpppppppppc...."
- /* 6 */ "qpppppppppc...."
- /* 7 */ "cpppppppppcj..."
- /* 8 */ "acccrrrccca...."
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmm.....mmmmmmm"
- /* 1 */ "mmm.....mmmmmmm"
- /* 2 */ "csssscssssc...."
- /* 3 */ "s..accca..s...."
- /* 4 */ "s..c...c..s...."
- /* 5 */ "c.........c...."
- /* 6 */ "s..c...c..s...."
- /* 7 */ "s..accca..s...."
- /* 8 */ "csssscssssc...."
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "...aclca......."
- /* 4 */ "...ct..c......."
- /* 5 */ "..............."
- /* 6 */ "...c...c......."
- /* 7 */ "...aclca......."
- /* 8 */ "..............."
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "...acuca......."
- /* 4 */ "...cpppc......."
- /* 5 */ "...cpppc......."
- /* 6 */ "...cpppc......."
- /* 7 */ "...acrca......."
- /* 8 */ "..............."
-
- // Level 8
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "...cscsc......."
- /* 4 */ "...s...s......."
- /* 5 */ "...c...c......."
- /* 6 */ "...s...s......."
- /* 7 */ "...cscsc......."
- /* 8 */ "...............",
-
- // Connectors:
- "-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 80,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // MediumHouse1
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MediumHouse2:
- // The data has been exported from the gallery Desert, area index 74, ID 573, created by STR_Warrior
- {
- // Size:
- 11, 10, 9, // SizeX = 11, SizeY = 10, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 9, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A:128: 7\n" /* sandstonestairs */
- "B: 44: 1\n" /* step */
- "C: 96: 3\n" /* trapdoor */
- "D: 96: 2\n" /* trapdoor */
- "E:128: 2\n" /* sandstonestairs */
- "F:128: 0\n" /* sandstonestairs */
- "G: 87: 0\n" /* netherstone */
- "H:128: 1\n" /* sandstonestairs */
- "I:128: 3\n" /* sandstonestairs */
- "J: 51: 0\n" /* fire */
- "K: 44: 9\n" /* step */
- "a: 24: 2\n" /* sandstone */
- "b: 24: 0\n" /* sandstone */
- "c: 4: 0\n" /* cobblestone */
- "d: 12: 0\n" /* sand */
- "e: 13: 0\n" /* gravel */
- "f: 5: 0\n" /* wood */
- "g: 65: 3\n" /* ladder */
- "h: 85: 0\n" /* fence */
- "i: 64: 3\n" /* wooddoorblock */
- "j:134: 1\n" /* 134 */
- "k:134: 2\n" /* 134 */
- "l: 61: 2\n" /* furnace */
- "m: 19: 0\n" /* sponge */
- "n:134: 6\n" /* 134 */
- "o:134: 4\n" /* 134 */
- "p: 65: 2\n" /* ladder */
- "q:101: 0\n" /* ironbars */
- "r: 50: 2\n" /* torch */
- "s: 47: 0\n" /* bookshelf */
- "t: 64: 8\n" /* wooddoorblock */
- "u: 50: 3\n" /* torch */
- "v:171: 8\n" /* carpet */
- "w:128: 6\n" /* sandstonestairs */
- "x:126: 8\n" /* woodenslab */
- "y:128: 5\n" /* sandstonestairs */
- "z:128: 4\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "abbbammmcmm"
- /* 1 */ "bbbbbdddcdm"
- /* 2 */ "bbbbbmmmcdm"
- /* 3 */ "bbbbbmmmcdm"
- /* 4 */ "bbbbabbbbba"
- /* 5 */ "bbbbbbbbbbb"
- /* 6 */ "bbbbbbbbbbb"
- /* 7 */ "bbbbbbbbbbb"
- /* 8 */ "abbbbbbbbba"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "abbbammmemm"
- /* 1 */ "bfffbdddedm"
- /* 2 */ "bfffbmmmedm"
- /* 3 */ "bfffbmmmedm"
- /* 4 */ "bfffabbbfba"
- /* 5 */ "bfffffffffb"
- /* 6 */ "bfffffffffb"
- /* 7 */ "bfffffffffb"
- /* 8 */ "abbbbbbbbba"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "abbba......"
- /* 1 */ "bg..bhhh.h."
- /* 2 */ "b...b....h."
- /* 3 */ "b...b....h."
- /* 4 */ "b...abbbiba"
- /* 5 */ "b.........b"
- /* 6 */ "bjh.......b"
- /* 7 */ "bjk.lno..pb"
- /* 8 */ "abbbbbbbbba"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "abqba......"
- /* 1 */ "bg..q......"
- /* 2 */ "b...q......"
- /* 3 */ "q..rb......"
- /* 4 */ "q...sbqbtba"
- /* 5 */ "q......u..b"
- /* 6 */ "b.v.......q"
- /* 7 */ "b........pb"
- /* 8 */ "abbbqqqbbba"
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "abwba......"
- /* 1 */ "bgxxy......"
- /* 2 */ "bxxxy......"
- /* 3 */ "zxxxb......"
- /* 4 */ "zxxxabwbbba"
- /* 5 */ "zxxxxxxxxxb"
- /* 6 */ "bxxxxxxxxxy"
- /* 7 */ "bxxxsssxxpb"
- /* 8 */ "abbbAAAbbba"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "bBBBb......"
- /* 1 */ "BC..B......"
- /* 2 */ "B...B......"
- /* 3 */ "B...B......"
- /* 4 */ "b...bBBBBBb"
- /* 5 */ "Bbbb......B"
- /* 6 */ "Bbbb......B"
- /* 7 */ "Bbbb.....DB"
- /* 8 */ "bBBBBbBBBBb"
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ ".aEa......."
- /* 6 */ ".FGH......."
- /* 7 */ ".aIa......."
- /* 8 */ "..........."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ ".a.a......."
- /* 6 */ "..J........"
- /* 7 */ ".a.a......."
- /* 8 */ "..........."
-
- // Level 8
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ ".bbb......."
- /* 6 */ ".bKb......."
- /* 7 */ ".bbb......."
- /* 8 */ "..........."
-
- // Level 9
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ ".B.B......."
- /* 6 */ "..........."
- /* 7 */ ".B.B......."
- /* 8 */ "...........",
-
- // Connectors:
- "-1: 8, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 80,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // MediumHouse2
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MediumHouse3:
- // The data has been exported from the gallery Desert, area index 76, ID 575, created by STR_Warrior
- {
- // Size:
- 12, 10, 11, // SizeX = 12, SizeY = 10, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 12, 9, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 3: 0\n" /* dirt */
- "d: 24: 0\n" /* sandstone */
- "e: 13: 0\n" /* gravel */
- "f: 2: 0\n" /* grass */
- "g: 5: 0\n" /* wood */
- "h: 85: 0\n" /* fence */
- "i: 64: 3\n" /* wooddoorblock */
- "j: 64: 2\n" /* wooddoorblock */
- "k: 65: 4\n" /* ladder */
- "l: 65: 2\n" /* ladder */
- "m: 19: 0\n" /* sponge */
- "n: 50: 1\n" /* torch */
- "o: 50: 2\n" /* torch */
- "p:101: 0\n" /* ironbars */
- "q: 64: 8\n" /* wooddoorblock */
- "r:128: 2\n" /* sandstonestairs */
- "s:128: 6\n" /* sandstonestairs */
- "t:126: 8\n" /* woodenslab */
- "u:128: 5\n" /* sandstonestairs */
- "v:128: 7\n" /* sandstonestairs */
- "w: 44: 1\n" /* step */
- "x: 96: 0\n" /* trapdoor */
- "y:126: 0\n" /* woodenslab */
- "z:128: 4\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmmammbbba"
- /* 1 */ "mmmmmmmmbbbm"
- /* 2 */ "cccccaddddda"
- /* 3 */ "cccccddddddd"
- /* 4 */ "cccccddddddd"
- /* 5 */ "cccccddddddd"
- /* 6 */ "cccddddddddd"
- /* 7 */ "mmmddddddddd"
- /* 8 */ "mmmdddddddda"
- /* 9 */ "mmmdddddmmmm"
- /* 10 */ "mmmadddammmm"
-
- // Level 1
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmmammeeea"
- /* 1 */ "mmmmmmmmeeem"
- /* 2 */ "fffffadddgda"
- /* 3 */ "fffffdgggggd"
- /* 4 */ "fffffggggggd"
- /* 5 */ "fffffdgggggd"
- /* 6 */ "fffddggggggd"
- /* 7 */ "mmmdgggggggd"
- /* 8 */ "mmmdggggddda"
- /* 9 */ "mmmdgggdmmmm"
- /* 10 */ "mmmadddammmm"
-
- // Level 2
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmma.....a"
- /* 1 */ "mmmmm......."
- /* 2 */ "hhhhhadddida"
- /* 3 */ "h....d.....d"
- /* 4 */ "h....j.....d"
- /* 5 */ "h....d.....d"
- /* 6 */ "hhhad......d"
- /* 7 */ "mmmd......kd"
- /* 8 */ "mmmd....ddda"
- /* 9 */ "mmmd..ldmmmm"
- /* 10 */ "mmmadddammmm"
-
- // Level 3
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmman...oa"
- /* 1 */ "mmmmm......."
- /* 2 */ ".....appdqda"
- /* 3 */ ".....d.....d"
- /* 4 */ ".....q.....d"
- /* 5 */ ".....d.....p"
- /* 6 */ "...hd......d"
- /* 7 */ "mmmd......kd"
- /* 8 */ "mmmd....dppa"
- /* 9 */ "mmmd..ldmmmm"
- /* 10 */ "mmmhdddhmmmm"
-
- // Level 4
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmmr.....r"
- /* 1 */ "mmmmmd.....d"
- /* 2 */ ".....assddda"
- /* 3 */ ".....dtttttd"
- /* 4 */ ".....dtttttd"
- /* 5 */ ".....dtttttu"
- /* 6 */ "...hdatttttd"
- /* 7 */ "mmmdttttttkd"
- /* 8 */ "mmmdtttadvva"
- /* 9 */ "mmmdttldmmmm"
- /* 10 */ "mmmhdddhmmmm"
-
- // Level 5
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ ".....dwwdwwd"
- /* 3 */ ".....w.....w"
- /* 4 */ ".....w.....w"
- /* 5 */ ".....w.....d"
- /* 6 */ "...hdadh...w"
- /* 7 */ "mmmd...d..xw"
- /* 8 */ "mmmd...awwwd"
- /* 9 */ "mmmd..ldmmmm"
- /* 10 */ "mmmhdddhmmmm"
-
- // Level 6
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "............"
- /* 4 */ "............"
- /* 5 */ "............"
- /* 6 */ "...hd.dh...."
- /* 7 */ "mmmd...d...."
- /* 8 */ "mmmp........"
- /* 9 */ "mmmd..ldmmmm"
- /* 10 */ "mmmhdpdhmmmm"
-
- // Level 7
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "............"
- /* 4 */ "............"
- /* 5 */ "............"
- /* 6 */ "...hd.dh...."
- /* 7 */ "mmmd...d...."
- /* 8 */ "mmmp........"
- /* 9 */ "mmmdn.ldmmmm"
- /* 10 */ "mmmhdpdhmmmm"
-
- // Level 8
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "............"
- /* 4 */ "............"
- /* 5 */ "............"
- /* 6 */ "...adsda...."
- /* 7 */ "mmmdyyyd...."
- /* 8 */ "mmmzyyyu...."
- /* 9 */ "mmmdyyldmmmm"
- /* 10 */ "mmmadvdammmm"
-
- // Level 9
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "............"
- /* 4 */ "............"
- /* 5 */ "............"
- /* 6 */ "...w.w.w...."
- /* 7 */ "mmm........."
- /* 8 */ "mmmw...w...."
- /* 9 */ "mmm.....mmmm"
- /* 10 */ "mmmw.w.wmmmm",
-
- // Connectors:
- "-1: 9, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 80,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // MediumHouse3
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // SmallHouse9:
- // The data has been exported from the gallery Desert, area index 67, ID 556, created by STR_Warrior
- {
- // Size:
- 9, 6, 11, // SizeX = 9, SizeY = 6, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 5, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 65: 2\n" /* ladder */
- "h: 64: 8\n" /* wooddoorblock */
- "i:101: 0\n" /* ironbars */
- "j: 50: 2\n" /* torch */
- "k: 50: 1\n" /* torch */
- "l:128: 2\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:126: 8\n" /* woodenslab */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 6\n" /* sandstonestairs */
- "q:128: 4\n" /* sandstonestairs */
- "r:128: 7\n" /* sandstonestairs */
- "s: 44: 1\n" /* step */
- "t: 96: 2\n" /* trapdoor */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmmabbba"
- /* 1 */ "mmmmmbbbm"
- /* 2 */ "mmmmaccca"
- /* 3 */ "mmmmccccc"
- /* 4 */ "mmmmccccc"
- /* 5 */ "mmmmccccc"
- /* 6 */ "acccacccc"
- /* 7 */ "ccccccccc"
- /* 8 */ "ccccccccc"
- /* 9 */ "ccccccccc"
- /* 10 */ "accccccca"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "mmmmaddda"
- /* 1 */ "mmmmmdddm"
- /* 2 */ "mmmmaceca"
- /* 3 */ "mmmmceeec"
- /* 4 */ "mmmmceeec"
- /* 5 */ "mmmmceeec"
- /* 6 */ "acccaeeec"
- /* 7 */ "ceeeeeeec"
- /* 8 */ "ceeeeeeec"
- /* 9 */ "ceeeeeeec"
- /* 10 */ "accccccca"
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "mmmma...a"
- /* 1 */ "mmmm....."
- /* 2 */ "mmmmacfca"
- /* 3 */ "mmmmc...c"
- /* 4 */ "mmmmc...c"
- /* 5 */ "mmmmc...c"
- /* 6 */ "accca...c"
- /* 7 */ "c.......c"
- /* 8 */ "c.......c"
- /* 9 */ "c......gc"
- /* 10 */ "accccccca"
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "mmmma...a"
- /* 1 */ "mmmm....."
- /* 2 */ "mmmmachca"
- /* 3 */ "mmmmc...c"
- /* 4 */ "mmmmc...c"
- /* 5 */ "mmmmc...i"
- /* 6 */ "acica...i"
- /* 7 */ "c.......i"
- /* 8 */ "i......jc"
- /* 9 */ "ck.....gc"
- /* 10 */ "acciiicca"
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "mmmml...l"
- /* 1 */ "mmmmc...c"
- /* 2 */ "mmmmaccca"
- /* 3 */ "mmmmcnnnc"
- /* 4 */ "mmmmcnnnc"
- /* 5 */ "mmmmcnnno"
- /* 6 */ "acpcannno"
- /* 7 */ "cnnnnnnno"
- /* 8 */ "qnnnnnnnc"
- /* 9 */ "cnnnnnngc"
- /* 10 */ "accrrrcca"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "mmmm....."
- /* 1 */ "mmmm....."
- /* 2 */ "mmmmcscsc"
- /* 3 */ "mmmms...s"
- /* 4 */ "mmmms...s"
- /* 5 */ "mmmms...s"
- /* 6 */ "csssc...c"
- /* 7 */ "s.......s"
- /* 8 */ "s.......s"
- /* 9 */ "s......ts"
- /* 10 */ "cssscsssc",
-
- // Connectors:
- "-1: 6, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // SmallHouse9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Temple:
- // The data has been exported from the gallery Desert, area index 83, ID 599, created by STR_Warrior
- {
- // Size:
- 13, 10, 9, // SizeX = 13, SizeY = 10, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 13, 9, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A: 51: 0\n" /* fire */
- "B: 44: 9\n" /* step */
- "a: 24: 2\n" /* sandstone */
- "b: 4: 0\n" /* cobblestone */
- "c: 24: 0\n" /* sandstone */
- "d: 13: 0\n" /* gravel */
- "e: 5: 0\n" /* wood */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 17: 0\n" /* tree */
- "h:128: 5\n" /* sandstonestairs */
- "i:128: 4\n" /* sandstonestairs */
- "j:128: 7\n" /* sandstonestairs */
- "k:128: 6\n" /* sandstonestairs */
- "l:118: 3\n" /* cauldronblock */
- "m: 19: 0\n" /* sponge */
- "n:155: 1\n" /* quartzblock */
- "o: 64: 8\n" /* wooddoorblock */
- "p: 50: 3\n" /* torch */
- "q:101: 0\n" /* ironbars */
- "r:140: 0\n" /* flowerpotblock */
- "s: 24: 1\n" /* sandstone */
- "t:128: 2\n" /* sandstonestairs */
- "u:126: 8\n" /* woodenslab */
- "v: 44: 1\n" /* step */
- "w:128: 0\n" /* sandstonestairs */
- "x: 87: 0\n" /* netherstone */
- "y:128: 1\n" /* sandstonestairs */
- "z:128: 3\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmmabbbammmm"
- /* 1 */ "mmmmmbbbmmmmm"
- /* 2 */ "accccccccccca"
- /* 3 */ "ccccccccccccc"
- /* 4 */ "ccccccccccccc"
- /* 5 */ "ccccccccccccc"
- /* 6 */ "ccccccccccccc"
- /* 7 */ "ccccccccccccc"
- /* 8 */ "accccccccccca"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmmadddammmm"
- /* 1 */ "mmmmmdddmmmmm"
- /* 2 */ "accccceccccca"
- /* 3 */ "ceeeeeeeeeeec"
- /* 4 */ "ceeeeeeeeeeec"
- /* 5 */ "ceeeeeeeeeeec"
- /* 6 */ "ceeeeeeeeeeec"
- /* 7 */ "ceeeeeeeeeeec"
- /* 8 */ "accccccccccca"
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmma...ammmm"
- /* 1 */ "mmmm.....mmmm"
- /* 2 */ "acccccfccccca"
- /* 3 */ "cgh.......igc"
- /* 4 */ "cj.........jc"
- /* 5 */ "c...........c"
- /* 6 */ "ck.........kc"
- /* 7 */ "cgh.linhl.igc"
- /* 8 */ "accccccccccca"
-
- // Level 3
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmma...ammmm"
- /* 1 */ "mmmm.....mmmm"
- /* 2 */ "acccccoccccca"
- /* 3 */ "cg...p.p...gc"
- /* 4 */ "c...........c"
- /* 5 */ "q...........q"
- /* 6 */ "c...........c"
- /* 7 */ "cg...rsr...gc"
- /* 8 */ "acqqqcccqqqca"
-
- // Level 4
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmmt...tmmmm"
- /* 1 */ "mmmms...cmmmm"
- /* 2 */ "accccccccccca"
- /* 3 */ "cguuuuuuuuugc"
- /* 4 */ "cuuuuuuuuuuuc"
- /* 5 */ "iuuuuuuuuuuuh"
- /* 6 */ "cuuuuuuuuuuuc"
- /* 7 */ "cguuuuuuuuugc"
- /* 8 */ "acjjjcccjjjca"
-
- // Level 5
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmm.....mmmm"
- /* 1 */ "mmmm.....mmmm"
- /* 2 */ "cvvvvvcvvvvvc"
- /* 3 */ "v...........v"
- /* 4 */ "v.ccc...ccc.v"
- /* 5 */ "c.ccc...ccc.c"
- /* 6 */ "v.ccc...ccc.v"
- /* 7 */ "v...........v"
- /* 8 */ "cvvvvvcvvvvvc"
-
- // Level 6
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "..ata...ata.."
- /* 5 */ "..wxy...wxy.."
- /* 6 */ "..aza...aza.."
- /* 7 */ "............."
- /* 8 */ "............."
-
- // Level 7
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "..a.a...a.a.."
- /* 5 */ "...A.....A..."
- /* 6 */ "..a.a...a.a.."
- /* 7 */ "............."
- /* 8 */ "............."
-
- // Level 8
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "..ccc...ccc.."
- /* 5 */ "..cBc...cBc.."
- /* 6 */ "..ccc...ccc.."
- /* 7 */ "............."
- /* 8 */ "............."
-
- // Level 9
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "..v.v...v.v.."
- /* 5 */ "............."
- /* 6 */ "..v.v...v.v.."
- /* 7 */ "............."
- /* 8 */ ".............",
-
- // Connectors:
- "-1: 6, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 50,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Temple
-}; // g_AlchemistVillagePrefabs
-
-
-
-
-
-
-const cPrefab::sDef g_AlchemistVillageStartingPrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // Well:
- // The data has been exported from the gallery Desert, area index 90, ID 631, created by STR_Warrior
- {
- // Size:
- 7, 21, 7, // SizeX = 7, SizeY = 21, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 20, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 24: 2\n" /* sandstone */
- "c: 24: 0\n" /* sandstone */
- "d: 8: 0\n" /* water */
- "e: 4: 0\n" /* cobblestone */
- "f: 13: 0\n" /* gravel */
- "g:128: 1\n" /* sandstonestairs */
- "h: 44: 1\n" /* step */
- "i:128: 0\n" /* sandstonestairs */
- "j:128: 3\n" /* sandstonestairs */
- "k:128: 2\n" /* sandstonestairs */
- "l: 44: 9\n" /* step */
- "m: 19: 0\n" /* sponge */
- "n:126: 0\n" /* woodenslab */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 12
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 13
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "mcdddcm"
- /* 3 */ "mcdddcm"
- /* 4 */ "mcdddcm"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmmmmmm"
-
- // Level 14
- /* z\x* 0123456 */
- /* 0 */ "mmeeemm"
- /* 1 */ "mbcccbm"
- /* 2 */ "ecdddce"
- /* 3 */ "ecdddce"
- /* 4 */ "ecdddce"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmeeemm"
-
- // Level 15
- /* z\x* 0123456 */
- /* 0 */ "mmfffmm"
- /* 1 */ "mbcccbm"
- /* 2 */ "fcdddcf"
- /* 3 */ "fcdddcf"
- /* 4 */ "fcdddcf"
- /* 5 */ "mbcccbm"
- /* 6 */ "mmfffmm"
-
- // Level 16
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mbghibm"
- /* 2 */ ".j...j."
- /* 3 */ ".h...h."
- /* 4 */ ".k...k."
- /* 5 */ "mbghibm"
- /* 6 */ "mm...mm"
-
- // Level 17
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mb...bm"
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ "mb...bm"
- /* 6 */ "mm...mm"
-
- // Level 18
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mblllbm"
- /* 2 */ ".l...l."
- /* 3 */ ".l...l."
- /* 4 */ ".l...l."
- /* 5 */ "mblllbm"
- /* 6 */ "mm...mm"
-
- // Level 19
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mcccccm"
- /* 2 */ ".cnnnc."
- /* 3 */ ".cnnnc."
- /* 4 */ ".cnnnc."
- /* 5 */ "mcccccm"
- /* 6 */ "mm...mm"
-
- // Level 20
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mh.h.hm"
- /* 2 */ "......."
- /* 3 */ ".h...h."
- /* 4 */ "......."
- /* 5 */ "mh.h.hm"
- /* 6 */ "mm...mm",
-
- // Connectors:
- "2: 3, 16, 6: 3\n" /* Type 2, direction Z+ */
- "2: 0, 16, 3: 4\n" /* Type 2, direction X- */
- "2: 3, 16, 0: 2\n" /* Type 2, direction Z- */
- "2: 6, 16, 3: 5\n" /* Type 2, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Well
-};
-
-
-
-
-
-// The prefab counts:
-
-const size_t g_AlchemistVillagePrefabsCount = ARRAYCOUNT(g_AlchemistVillagePrefabs);
-
-const size_t g_AlchemistVillageStartingPrefabsCount = ARRAYCOUNT(g_AlchemistVillageStartingPrefabs);
-
diff --git a/src/Generating/Prefabs/AlchemistVillagePrefabs.h b/src/Generating/Prefabs/AlchemistVillagePrefabs.h
deleted file mode 100644
index dddc5530a..000000000
--- a/src/Generating/Prefabs/AlchemistVillagePrefabs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// AlchemistVillagePrefabs.h
-
-// Declares the prefabs in the group AlchemistVillage
-
-#include "../Prefab.h"
-
-
-
-
-
-extern const cPrefab::sDef g_AlchemistVillagePrefabs[];
-extern const cPrefab::sDef g_AlchemistVillageStartingPrefabs[];
-extern const size_t g_AlchemistVillagePrefabsCount;
-extern const size_t g_AlchemistVillageStartingPrefabsCount;
diff --git a/src/Generating/Prefabs/CMakeLists.txt b/src/Generating/Prefabs/CMakeLists.txt
index 68f6491c4..1b130636f 100644
--- a/src/Generating/Prefabs/CMakeLists.txt
+++ b/src/Generating/Prefabs/CMakeLists.txt
@@ -5,26 +5,18 @@ project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../../")
SET (SRCS
- AlchemistVillagePrefabs.cpp
- JapaneseVillagePrefabs.cpp
NetherFortPrefabs.cpp
- PlainsVillagePrefabs.cpp
RainbowRoadPrefabs.cpp
- SandFlatRoofVillagePrefabs.cpp
- SandVillagePrefabs.cpp
TestRailsPrefabs.cpp
- UnderwaterBasePrefabs.cpp)
+ UnderwaterBasePrefabs.cpp
+)
SET (HDRS
- AlchemistVillagePrefabs.h
- JapaneseVillagePrefabs.h
NetherFortPrefabs.h
- PlainsVillagePrefabs.h
RainbowRoadPrefabs.h
- SandFlatRoofVillagePrefabs.h
- SandVillagePrefabs.h
TestRailsPrefabs.h
- UnderwaterBasePrefabs.h)
+ UnderwaterBasePrefabs.h
+)
if(NOT MSVC)
add_library(Generating_Prefabs ${SRCS} ${HDRS})
diff --git a/src/Generating/Prefabs/JapaneseVillagePrefabs.cpp b/src/Generating/Prefabs/JapaneseVillagePrefabs.cpp
deleted file mode 100644
index 0362c9406..000000000
--- a/src/Generating/Prefabs/JapaneseVillagePrefabs.cpp
+++ /dev/null
@@ -1,3386 +0,0 @@
-
-// JapaneseVillagePrefabs.cpp
-
-// Defines the prefabs in the group JapaneseVillage
-
-// NOTE: This file has been generated automatically by GalExport!
-// Any manual changes will be overwritten by the next automatic export!
-
-#include "Globals.h"
-#include "JapaneseVillagePrefabs.h"
-
-
-
-
-
-const cPrefab::sDef g_JapaneseVillagePrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // Arch:
- // The data has been exported from the gallery Plains, area index 144, ID 488, created by Aloe_vera
- {
- // Size:
- 11, 7, 5, // SizeX = 11, SizeY = 7, SizeZ = 5
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 6, 4, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 2: 0\n" /* grass */
- "b: 13: 0\n" /* gravel */
- "c:113: 0\n" /* netherbrickfence */
- "d: 50: 5\n" /* torch */
- "e: 44: 8\n" /* step */
- "f: 44: 0\n" /* step */
- "g: 43: 0\n" /* doubleslab */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "aaaabbbaaaa"
- /* 1 */ "aaaabbbaaaa"
- /* 2 */ "aaaabbbaaaa"
- /* 3 */ "aaaabbbaaaa"
- /* 4 */ "aaaabbbaaaa"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..c.....c.."
- /* 1 */ "..c.....c.."
- /* 2 */ "..c.....c.."
- /* 3 */ "..c.....c.."
- /* 4 */ "..c.....c.."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..c.....c.."
- /* 1 */ "..........."
- /* 2 */ "..c.....c.."
- /* 3 */ "..........."
- /* 4 */ "..c.....c.."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..d.....d.."
- /* 1 */ "..........."
- /* 2 */ "..c.....c.."
- /* 3 */ "..........."
- /* 4 */ "..d.....d.."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "...eeeee..."
- /* 1 */ "..........."
- /* 2 */ "..c.....c.."
- /* 3 */ "..........."
- /* 4 */ "...eeeee..."
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..f.....f.."
- /* 1 */ ".egfffffge."
- /* 2 */ ".egeeeeege."
- /* 3 */ ".egfffffge."
- /* 4 */ "..f.....f.."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "gf.......fg"
- /* 3 */ "..........."
- /* 4 */ "...........",
-
- // Connectors:
- "2: 5, 1, 4: 3\n" /* Type 2, direction Z+ */
- "2: 5, 1, 0: 2\n" /* Type 2, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Arch
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Farm:
- // The data has been exported from the gallery Plains, area index 166, ID 554, created by Aloe_vera
- {
- // Size:
- 11, 8, 13, // SizeX = 11, SizeY = 8, SizeZ = 13
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 10, 7, 12, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 60: 7\n" /* tilleddirt */
- "c: 8: 0\n" /* water */
- "d: 43: 0\n" /* doubleslab */
- "e: 44: 0\n" /* step */
- "f: 59: 7\n" /* crops */
- "g: 83: 0\n" /* reedblock */
- "h:113: 0\n" /* netherbrickfence */
- "i: 50: 5\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "maaaaaaaaam"
- /* 7 */ "maaaaaaaaam"
- /* 8 */ "maaaaaaaaam"
- /* 9 */ "maaaaaaaaam"
- /* 10 */ "maaaaaaaaam"
- /* 11 */ "maaaaaaaaam"
- /* 12 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "mabbbbbbbam"
- /* 3 */ "mabbbbbbbam"
- /* 4 */ "mabbbbbbbam"
- /* 5 */ "mabbbbbbbam"
- /* 6 */ "mabcccccaam"
- /* 7 */ "mabbbbbbbam"
- /* 8 */ "mabbbbbbbam"
- /* 9 */ "mabbbbbbbam"
- /* 10 */ "mabbbbbbbam"
- /* 11 */ "maaaaaaaaam"
- /* 12 */ "mmmmmmmmmmm"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".deeeeeeed."
- /* 2 */ ".efffffffe."
- /* 3 */ ".efffffffe."
- /* 4 */ ".efffffffe."
- /* 5 */ ".efgggggfe."
- /* 6 */ ".eg.....ge."
- /* 7 */ ".efgggggfe."
- /* 8 */ ".efffffffe."
- /* 9 */ ".efffffffe."
- /* 10 */ ".efffffffe."
- /* 11 */ ".deeeeeeed."
- /* 12 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".h.......h."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ "...ggggg..."
- /* 6 */ "..g.....g.."
- /* 7 */ "...ggggg..."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "..........."
- /* 11 */ ".h.......h."
- /* 12 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".h.......h."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ "...ggggg..."
- /* 6 */ "..g.....g.."
- /* 7 */ "...ggggg..."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "..........."
- /* 11 */ ".h.......h."
- /* 12 */ "..........."
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".h.......h."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ "..........."
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "..........."
- /* 11 */ ".h.......h."
- /* 12 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".h.......h."
- /* 1 */ "hhh.....hhh"
- /* 2 */ ".h.......h."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ "..........."
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ ".h.......h."
- /* 11 */ "hhh.....hhh"
- /* 12 */ ".h.......h."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".i.......i."
- /* 1 */ "i.i.....i.i"
- /* 2 */ ".i.......i."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ "..........."
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ ".i.......i."
- /* 11 */ "i.i.....i.i"
- /* 12 */ ".i.......i.",
-
- // Connectors:
- "-1: 10, 2, 6: 5\n" /* Type -1, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Farm
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Forge:
- // The data has been exported from the gallery Plains, area index 79, ID 145, created by Aloe_vera
- {
- // Size:
- 16, 11, 14, // SizeX = 16, SizeY = 11, SizeZ = 14
-
- // Hitbox (relative to bounding box):
- 0, 0, -1, // MinX, MinY, MinZ
- 16, 10, 14, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 17: 1\n" /* tree */
- "c: 67: 0\n" /* stairs */
- "d: 5: 2\n" /* wood */
- "e: 67: 2\n" /* stairs */
- "f:113: 0\n" /* netherbrickfence */
- "g:118: 2\n" /* cauldronblock */
- "h: 67: 6\n" /* stairs */
- "i: 67: 4\n" /* stairs */
- "j: 87: 0\n" /* netherstone */
- "k: 67: 7\n" /* stairs */
- "l: 54: 5\n" /* chest */
- "m: 19: 0\n" /* sponge */
- "n: 61: 2\n" /* furnace */
- "o:101: 0\n" /* ironbars */
- "p: 51: 0\n" /* fire */
- "q: 50: 4\n" /* torch */
- "r: 50: 2\n" /* torch */
- "s: 35: 0\n" /* wool */
- "t: 67: 3\n" /* stairs */
- "u: 50: 3\n" /* torch */
- "v: 44: 8\n" /* step */
- "w: 43: 0\n" /* doubleslab */
- "x: 44: 0\n" /* step */
- "y: 17: 5\n" /* tree */
- "z: 17: 9\n" /* tree */,
-
- // Block data:
- // Level 0
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "mmmmmmmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmmmmmmm"
- /* 2 */ "mmaaaaaaaaaaaamm"
- /* 3 */ "mmaaaaaaaaaaaamm"
- /* 4 */ "mmaaaaaaaaaaaamm"
- /* 5 */ "mmaaaaaaaaaaaamm"
- /* 6 */ "mmaaaaaaaaaaaamm"
- /* 7 */ "mmaaaaaaaaaaaamm"
- /* 8 */ "mmaaaaaaaaaaaamm"
- /* 9 */ "mmaaaaaaaaaaaamm"
- /* 10 */ "mmaaaaaaaaaaaamm"
- /* 11 */ "mmaaaaaaaaaaaamm"
- /* 12 */ "mmmmmmmmmmmmmmmm"
- /* 13 */ "mmmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ ".....bbbbbbbbb.."
- /* 3 */ ".....cdddddddb.."
- /* 4 */ ".....cddaaaadb.."
- /* 5 */ "..beeedaaaaadb.."
- /* 6 */ "..bddddaaaaadb.."
- /* 7 */ "..bddddaaaaadb.."
- /* 8 */ "..bddddaaaaadb.."
- /* 9 */ "..bddddaaaaadb.."
- /* 10 */ "..bddddddddddb.."
- /* 11 */ "..bbbbbbbbbbbb.."
- /* 12 */ "................"
- /* 13 */ "................"
-
- // Level 2
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ ".....bfffbfffb.."
- /* 3 */ ".............a.."
- /* 4 */ ".............a.."
- /* 5 */ "..b.....ghh..a.."
- /* 6 */ "..f.....haa..b.."
- /* 7 */ "..f.....ija..b.."
- /* 8 */ "..f.....kaa..a.."
- /* 9 */ "..f..........a.."
- /* 10 */ "..fl.........a.."
- /* 11 */ "..bffffbbffffb.."
- /* 12 */ "................"
- /* 13 */ "................"
-
- // Level 3
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ ".....bfffbfffb.."
- /* 3 */ ".............a.."
- /* 4 */ ".............a.."
- /* 5 */ "..b......nn..a.."
- /* 6 */ "..f.....oaa..b.."
- /* 7 */ "..f.....opa..b.."
- /* 8 */ "..f.....oaa..a.."
- /* 9 */ "..f..........a.."
- /* 10 */ "..f..........a.."
- /* 11 */ "..bffffbbffffb.."
- /* 12 */ "................"
- /* 13 */ "................"
-
- // Level 4
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".........q...q.."
- /* 2 */ "....rbsssbsssb.."
- /* 3 */ ".............a.."
- /* 4 */ "..q..........a.."
- /* 5 */ "..b......ce..a.."
- /* 6 */ "..s......ea..b.."
- /* 7 */ "..s......aa..b.."
- /* 8 */ "..s......ta..a.."
- /* 9 */ "..s..........a.."
- /* 10 */ "..s..........a.."
- /* 11 */ ".rbssssbbssssb.."
- /* 12 */ "..u....uu....u.."
- /* 13 */ "................"
-
- // Level 5
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ ".vwxxxxxxxxxxwv."
- /* 1 */ "vvvvvvvvvvvvvvvv"
- /* 2 */ "wvbyybyyybbyybvw"
- /* 3 */ "xvz..........zvx"
- /* 4 */ "xvz..........zvx"
- /* 5 */ "xvb..........zvx"
- /* 6 */ "xvz.......a..bvx"
- /* 7 */ "xvz......ca..bvx"
- /* 8 */ "xvz.......a..zvx"
- /* 9 */ "xvz..........zvx"
- /* 10 */ "xvz..........zvx"
- /* 11 */ "wvbyyyyyyyyyybvw"
- /* 12 */ "vvvvvvvvvvvvvvvv"
- /* 13 */ ".vwxxxxxxxxxxwv."
-
- // Level 6
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "wx............xw"
- /* 1 */ "x..............x"
- /* 2 */ "..xxxxxxxxxxxx.."
- /* 3 */ "..xwwwwwwwwwwx.."
- /* 4 */ "..xwvvvvvvvvvx.."
- /* 5 */ "..xwv.......vx.."
- /* 6 */ "..xwv.....a.vx.."
- /* 7 */ "..xwv.....a.vx.."
- /* 8 */ "..xwv.....a.vx.."
- /* 9 */ "..xwvvvvvvvvvx.."
- /* 10 */ "..xwwwwwwwwwwx.."
- /* 11 */ "..xxxxxxxxxxxx.."
- /* 12 */ "x..............x"
- /* 13 */ "wx............xw"
-
- // Level 7
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "................"
- /* 4 */ "....xxxxxxxx...."
- /* 5 */ "....xxxxxxxx...."
- /* 6 */ "....xwwwwwax...."
- /* 7 */ "....xwvvvvax...."
- /* 8 */ "....xwwwwwax...."
- /* 9 */ "....xxxxxxxx...."
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ "................"
-
- // Level 8
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "................"
- /* 4 */ "................"
- /* 5 */ "................"
- /* 6 */ "..........a....."
- /* 7 */ ".......xx.a....."
- /* 8 */ "..........a....."
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ "................"
-
- // Level 9
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "................"
- /* 4 */ "................"
- /* 5 */ "................"
- /* 6 */ "..........a....."
- /* 7 */ "..........a....."
- /* 8 */ "..........a....."
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ "................"
-
- // Level 10
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "................"
- /* 4 */ "................"
- /* 5 */ "................"
- /* 6 */ "..........a....."
- /* 7 */ "..........a....."
- /* 8 */ "..........a....."
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ "................",
-
- // Connectors:
- "-1: 0, 1, 3: 4\n" /* Type -1, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Forge
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Garden2:
- // The data has been exported from the gallery Plains, area index 147, ID 491, created by Aloe_vera
- {
- // Size:
- 16, 5, 16, // SizeX = 16, SizeY = 5, SizeZ = 16
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 15, 4, 15, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 8: 0\n" /* water */
- "c: 2: 0\n" /* grass */
- "d: 17: 1\n" /* tree */
- "e: 13: 0\n" /* gravel */
- "f: 31: 2\n" /* tallgrass */
- "g: 18: 5\n" /* leaves */
- "h: 38: 7\n" /* rose */
- "i: 17: 9\n" /* tree */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "aaaaaaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaaaaaaa"
- /* 8 */ "aaaaaaaaaaaaaaaa"
- /* 9 */ "aaaaaaaaaaaaaaaa"
- /* 10 */ "aaaaaaaaaaaaaaaa"
- /* 11 */ "aaaaaaaaaaaaaaaa"
- /* 12 */ "aaaaaaaaaaaaaaaa"
- /* 13 */ "aaaaaaaaaaaaaaaa"
- /* 14 */ "aaaaaaaaaaaaaaaa"
- /* 15 */ "aaaaaaaaaaaaaaaa"
-
- // Level 1
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "aaaaaaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaaaaaa"
- /* 6 */ "aaaabbaaaaaaaaaa"
- /* 7 */ "aaabbbaaaaaaaaaa"
- /* 8 */ "aaabbaaaaaaaaaaa"
- /* 9 */ "aaaabaaaaaaaaaaa"
- /* 10 */ "aaaaaaaaaaaaaaaa"
- /* 11 */ "aaaaaaaaaaaaaaaa"
- /* 12 */ "aaaaaaaaaaaaaaaa"
- /* 13 */ "aaaaaaaaaaaaaaaa"
- /* 14 */ "aaaaaaaaaaaaaaaa"
- /* 15 */ "aaaaaaaaaaaaaaaa"
-
- // Level 2
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "cccccccccccccccc"
- /* 1 */ "ccdccccccccdcccc"
- /* 2 */ "cccccceecccccdcc"
- /* 3 */ "ccccccceeccccccc"
- /* 4 */ "cccccccceccccccc"
- /* 5 */ "cccbbbbceccccccc"
- /* 6 */ "cccbbbbceecccccc"
- /* 7 */ "ccbbbbbcceeeeccc"
- /* 8 */ "ccbbbbbccccceecc"
- /* 9 */ "ccbbbbcccccccecc"
- /* 10 */ "ccccbcccccccceec"
- /* 11 */ "ccccccccccccccec"
- /* 12 */ "ccccccccaaacccec"
- /* 13 */ "cccccccccaccccec"
- /* 14 */ "ccccccccccccceec"
- /* 15 */ "cccccccccccceecc"
-
- // Level 3
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "......f...gg.g.."
- /* 1 */ "..gg.....gggggg."
- /* 2 */ "ffgg......ghgggg"
- /* 3 */ ".............gg."
- /* 4 */ "...........f...."
- /* 5 */ "...........h.ff."
- /* 6 */ ".............fh."
- /* 7 */ "...............f"
- /* 8 */ "................"
- /* 9 */ ".......ff.f....."
- /* 10 */ ".f.....ffggf...."
- /* 11 */ ".......gggg.f..."
- /* 12 */ ".f......iddg...."
- /* 13 */ ".....f..gdgg...."
- /* 14 */ "....ff...gg....."
- /* 15 */ "................"
-
- // Level 4
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "...........g.g.."
- /* 2 */ ".............gg."
- /* 3 */ "................"
- /* 4 */ "................"
- /* 5 */ "................"
- /* 6 */ "................"
- /* 7 */ "................"
- /* 8 */ "................"
- /* 9 */ "................"
- /* 10 */ ".........g......"
- /* 11 */ "........ggg....."
- /* 12 */ "........ggg....."
- /* 13 */ ".........g......"
- /* 14 */ "................"
- /* 15 */ "................",
-
- // Connectors:
- "-1: 12, 3, 15: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Garden2
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseMid:
- // The data has been exported from the gallery Plains, area index 62, ID 119, created by Aloe_vera
- {
- // Size:
- 10, 9, 9, // SizeX = 10, SizeY = 9, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- 0, 0, -1, // MinX, MinY, MinZ
- 10, 8, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b:135: 2\n" /* 135 */
- "c:135: 0\n" /* 135 */
- "d: 17: 9\n" /* tree */
- "e:135: 3\n" /* 135 */
- "f: 85: 0\n" /* fence */
- "g: 17: 1\n" /* tree */
- "h:171: 0\n" /* carpet */
- "i: 50: 5\n" /* torch */
- "j: 35: 0\n" /* wool */
- "k: 17: 5\n" /* tree */
- "l:124: 0\n" /* redstonelampon */
- "m: 19: 0\n" /* sponge */
- "n: 69: 9\n" /* lever */
- "o: 44: 8\n" /* step */
- "p: 43: 0\n" /* doubleslab */
- "q: 44: 0\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "maaaaaaaaa"
- /* 1 */ "maaaaaaaaa"
- /* 2 */ "aaaaaaaaaa"
- /* 3 */ "aaaaaaaaaa"
- /* 4 */ "aaaaaaaaaa"
- /* 5 */ "aaaaaaaaaa"
- /* 6 */ "aaaaaaaaaa"
- /* 7 */ "maaaaaaaaa"
- /* 8 */ "maaaaaaaaa"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".aaaaaaaaa"
- /* 1 */ ".aaaaaaaaa"
- /* 2 */ "baaaaaaaaa"
- /* 3 */ "caaaaaaaaa"
- /* 4 */ "caadaaaaaa"
- /* 5 */ "caaaaaaaaa"
- /* 6 */ "eaaaaaaaaa"
- /* 7 */ ".aaaaaaaaa"
- /* 8 */ ".aaaaaaaaa"
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".fffffffff"
- /* 1 */ ".f.......f"
- /* 2 */ ".f.ggggg.f"
- /* 3 */ "...ghhhg.f"
- /* 4 */ "....hhhg.f"
- /* 5 */ "...ghhhg.f"
- /* 6 */ ".f.ggggg.f"
- /* 7 */ ".f.......f"
- /* 8 */ ".fffffffff"
-
- // Level 3
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".....i...i"
- /* 1 */ ".........."
- /* 2 */ ".i.jjgjj.."
- /* 3 */ "...g...j.."
- /* 4 */ ".......g.i"
- /* 5 */ "...g...j.."
- /* 6 */ ".i.jjgjj.."
- /* 7 */ ".........."
- /* 8 */ ".....i...i"
-
- // Level 4
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".........."
- /* 2 */ "...jjgjj.."
- /* 3 */ "...g...j.."
- /* 4 */ "...j...g.."
- /* 5 */ "...g...j.."
- /* 6 */ "...jjgjj.."
- /* 7 */ ".........."
- /* 8 */ ".........."
-
- // Level 5
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ "...f...f.."
- /* 2 */ "..fgkgkgf."
- /* 3 */ "..fd...d.."
- /* 4 */ "...d.lng.."
- /* 5 */ "..fd...d.."
- /* 6 */ "..fgkgkgf."
- /* 7 */ "...f...f.."
- /* 8 */ ".........."
-
- // Level 6
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "...ooooo.."
- /* 1 */ "..opppppo."
- /* 2 */ ".opgjjjgpo"
- /* 3 */ ".opjgggjpo"
- /* 4 */ ".opjgggjpo"
- /* 5 */ ".opjgggjpo"
- /* 6 */ ".opgjjjgpo"
- /* 7 */ "..opppppo."
- /* 8 */ "...ooooo.."
-
- // Level 7
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".opq...qpo"
- /* 1 */ ".pq.....qp"
- /* 2 */ ".q.qqqqq.q"
- /* 3 */ "...qpppq.."
- /* 4 */ "...qpppq.."
- /* 5 */ "...qpppq.."
- /* 6 */ ".q.qqqqq.q"
- /* 7 */ ".pq.....qp"
- /* 8 */ ".opq...qpo"
-
- // Level 8
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".q.......q"
- /* 1 */ ".........."
- /* 2 */ ".........."
- /* 3 */ ".........."
- /* 4 */ ".....q...."
- /* 5 */ ".........."
- /* 6 */ ".........."
- /* 7 */ ".........."
- /* 8 */ ".q.......q",
-
- // Connectors:
- "-1: 0, 1, 4: 4\n" /* Type -1, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseMid
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseSmall:
- // The data has been exported from the gallery Plains, area index 68, ID 131, created by Aloe_vera
- {
- // Size:
- 7, 6, 7, // SizeX = 7, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b: 17: 1\n" /* tree */
- "c: 35: 0\n" /* wool */
- "d: 50: 4\n" /* torch */
- "e: 85: 0\n" /* fence */
- "f: 44: 8\n" /* step */
- "g: 43: 0\n" /* doubleslab */
- "h: 44: 0\n" /* step */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".bcc.b."
- /* 2 */ ".c...c."
- /* 3 */ ".c...c."
- /* 4 */ ".c...c."
- /* 5 */ ".bcccb."
- /* 6 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ ".....d."
- /* 1 */ ".bee.b."
- /* 2 */ ".c...c."
- /* 3 */ ".e...e."
- /* 4 */ ".c...c."
- /* 5 */ ".beeeb."
- /* 6 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ ".fffff."
- /* 1 */ "fbcccbf"
- /* 2 */ "fc...cf"
- /* 3 */ "fc...cf"
- /* 4 */ "fc...cf"
- /* 5 */ "fbcccbf"
- /* 6 */ ".fffff."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "gh...hg"
- /* 1 */ "hhhhhhh"
- /* 2 */ ".hgggh."
- /* 3 */ ".hgggh."
- /* 4 */ ".hgggh."
- /* 5 */ "hhhhhhh"
- /* 6 */ "gh...hg"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "......."
- /* 3 */ "...h..."
- /* 4 */ "......."
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "-1: 4, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseSmall
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseSmallDblWithDoor:
- // The data has been exported from the gallery Plains, area index 113, ID 265, created by Aloe_vera
- {
- // Size:
- 11, 6, 7, // SizeX = 11, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b: 17: 9\n" /* tree */
- "c: 17: 1\n" /* tree */
- "d: 35: 0\n" /* wool */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171:12\n" /* carpet */
- "g:135: 1\n" /* 135 */
- "h:126: 2\n" /* woodenslab */
- "i:135: 2\n" /* 135 */
- "j: 50: 4\n" /* torch */
- "k: 64:12\n" /* wooddoorblock */
- "l: 85: 0\n" /* fence */
- "m: 19: 0\n" /* sponge */
- "n: 44: 8\n" /* step */
- "o: 43: 0\n" /* doubleslab */
- "p: 44: 0\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaabaaaam"
- /* 3 */ "maaaabaaaam"
- /* 4 */ "maaaabaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".cdedcdddc."
- /* 2 */ ".dfff.fffd."
- /* 3 */ ".dgffdfhfd."
- /* 4 */ ".diifdfffd."
- /* 5 */ ".cdddcdddc."
- /* 6 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".j...j...j."
- /* 1 */ ".cdkdclllc."
- /* 2 */ ".d.......l."
- /* 3 */ ".l...l...l."
- /* 4 */ ".d...l...l."
- /* 5 */ ".clllclllc."
- /* 6 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".nnnnnnnnn."
- /* 1 */ "ncdddcdddcn"
- /* 2 */ "nd...d...dn"
- /* 3 */ "nd...d...dn"
- /* 4 */ "nd...d...dn"
- /* 5 */ "ncdddcdddcn"
- /* 6 */ ".nnnnnnnnn."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "op.......po"
- /* 1 */ "ppppppppppp"
- /* 2 */ ".pooooooop."
- /* 3 */ ".ponndnnop."
- /* 4 */ ".pooooooop."
- /* 5 */ "ppppppppppp"
- /* 6 */ "op.......po"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "...ppppp..."
- /* 4 */ "..........."
- /* 5 */ "..........."
- /* 6 */ "...........",
-
- // Connectors:
- "-1: 3, 1, -1: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseSmallDblWithDoor
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseSmallDouble:
- // The data has been exported from the gallery Plains, area index 72, ID 135, created by Aloe_vera
- {
- // Size:
- 11, 6, 7, // SizeX = 11, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b: 17: 1\n" /* tree */
- "c: 35: 0\n" /* wool */
- "d:171:12\n" /* carpet */
- "e:135: 1\n" /* 135 */
- "f:126: 2\n" /* woodenslab */
- "g:135: 2\n" /* 135 */
- "h: 50: 4\n" /* torch */
- "i: 85: 0\n" /* fence */
- "j: 44: 8\n" /* step */
- "k: 43: 0\n" /* doubleslab */
- "l: 44: 0\n" /* step */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".bcc.bcccb."
- /* 2 */ ".cddd.dddc."
- /* 3 */ ".ceddcdfdc."
- /* 4 */ ".cggdcdddc."
- /* 5 */ ".bcccbcccb."
- /* 6 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".h...h...h."
- /* 1 */ ".bii.biiib."
- /* 2 */ ".c.......c."
- /* 3 */ ".i...i...i."
- /* 4 */ ".c...i...c."
- /* 5 */ ".biiibiiib."
- /* 6 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".jjjjjjjjj."
- /* 1 */ "jbiiibiiibj"
- /* 2 */ "jc.......cj"
- /* 3 */ "jc...c...cj"
- /* 4 */ "jc...c...cj"
- /* 5 */ "jbcccbcccbj"
- /* 6 */ ".jjjjjjjjj."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "kl...l...lk"
- /* 1 */ "lllllllllll"
- /* 2 */ ".lkkklkkkl."
- /* 3 */ ".lkjklkkkl."
- /* 4 */ ".lkkklkkkl."
- /* 5 */ "lllllllllll"
- /* 6 */ "kl...l...lk"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "...l...l..."
- /* 4 */ "..........."
- /* 5 */ "..........."
- /* 6 */ "...........",
-
- // Connectors:
- "-1: 4, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseSmallDouble
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseSmallWithDoor:
- // The data has been exported from the gallery Plains, area index 112, ID 264, created by Aloe_vera
- {
- // Size:
- 7, 6, 7, // SizeX = 7, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b: 17: 1\n" /* tree */
- "c: 35: 0\n" /* wool */
- "d: 64: 7\n" /* wooddoorblock */
- "e: 50: 4\n" /* torch */
- "f: 64:12\n" /* wooddoorblock */
- "g: 85: 0\n" /* fence */
- "h: 44: 8\n" /* step */
- "i: 43: 0\n" /* doubleslab */
- "j: 44: 0\n" /* step */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".bcdcb."
- /* 2 */ ".c...c."
- /* 3 */ ".c...c."
- /* 4 */ ".c...c."
- /* 5 */ ".bcccb."
- /* 6 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ ".....e."
- /* 1 */ ".bcfcb."
- /* 2 */ ".g...g."
- /* 3 */ ".g...g."
- /* 4 */ ".g...g."
- /* 5 */ ".bgggb."
- /* 6 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ ".hhhhh."
- /* 1 */ "hbcccbh"
- /* 2 */ "hc...ch"
- /* 3 */ "hc...ch"
- /* 4 */ "hc...ch"
- /* 5 */ "hbcccbh"
- /* 6 */ ".hhhhh."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "ij...ji"
- /* 1 */ "jjjjjjj"
- /* 2 */ ".jiiij."
- /* 3 */ ".jiiij."
- /* 4 */ ".jiiij."
- /* 5 */ "jjjjjjj"
- /* 6 */ "ij...ji"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "......."
- /* 3 */ "...j..."
- /* 4 */ "......."
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseSmallWithDoor
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseWide:
- // The data has been exported from the gallery Plains, area index 64, ID 121, created by STR_Warrior
- {
- // Size:
- 11, 6, 11, // SizeX = 11, SizeY = 6, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 11, 5, 10, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b: 17: 1\n" /* tree */
- "c: 35: 0\n" /* wool */
- "d:171: 0\n" /* carpet */
- "e:126: 1\n" /* woodenslab */
- "f: 64: 5\n" /* wooddoorblock */
- "g: 85: 0\n" /* fence */
- "h: 50: 1\n" /* torch */
- "i: 50: 2\n" /* torch */
- "j: 64:12\n" /* wooddoorblock */
- "k:126:11\n" /* woodenslab */
- "l: 17: 5\n" /* tree */
- "m: 19: 0\n" /* sponge */
- "n:126: 3\n" /* woodenslab */
- "o:125: 3\n" /* woodendoubleslab */
- "p: 5: 3\n" /* wood */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmaaaaaaamm"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "maaaaaaaaam"
- /* 7 */ "maaaaaaaaam"
- /* 8 */ "maaaaaaaaam"
- /* 9 */ "mmaaaaaaamm"
- /* 10 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..bcbcbcb.."
- /* 2 */ ".b.d.....b."
- /* 3 */ ".cded....c."
- /* 4 */ ".bded....b."
- /* 5 */ ".c.d.....c."
- /* 6 */ ".b.......b."
- /* 7 */ ".c.......c."
- /* 8 */ ".b.......b."
- /* 9 */ "..bcbfbcb.."
- /* 10 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..bgbgbgb.."
- /* 2 */ ".b.......b."
- /* 3 */ ".g.......g."
- /* 4 */ ".bh.....ib."
- /* 5 */ ".g.......g."
- /* 6 */ ".b.......b."
- /* 7 */ ".g.......g."
- /* 8 */ ".b.......b."
- /* 9 */ "..bgbjbgb.."
- /* 10 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "...kkkkk..."
- /* 1 */ "..bcbcbcb.."
- /* 2 */ ".b.......b."
- /* 3 */ "kc.......ck"
- /* 4 */ "kb.......bk"
- /* 5 */ "kc.......ck"
- /* 6 */ "kb.......bk"
- /* 7 */ "kc.......ck"
- /* 8 */ ".b.......b."
- /* 9 */ "..bcblbcb.."
- /* 10 */ "...kkkkk..."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ ".kn.....nk."
- /* 1 */ "konnnnnnnok"
- /* 2 */ "nnnnnnnnnnn"
- /* 3 */ ".nnpppppnn."
- /* 4 */ ".nnpkkkpnn."
- /* 5 */ ".nnpkkkpnn."
- /* 6 */ ".nnpkkkpnn."
- /* 7 */ ".nnpppppnn."
- /* 8 */ "nnnnnnnnnnn"
- /* 9 */ "kknnnnnnnok"
- /* 10 */ ".kn.....nk."
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "n.........n"
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "....nnn...."
- /* 5 */ "....non...."
- /* 6 */ "....nnn...."
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "n.........n",
-
- // Connectors:
- "-1: 5, 1, 10: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseWide
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseWithGarden:
- // The data has been exported from the gallery Plains, area index 67, ID 130, created by Aloe_vera
- {
- // Size:
- 16, 9, 16, // SizeX = 16, SizeY = 9, SizeZ = 16
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 16, 8, 16, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 5: 2\n" /* wood */
- "c: 2: 0\n" /* grass */
- "d:113: 0\n" /* netherbrickfence */
- "e: 17: 1\n" /* tree */
- "f: 35: 0\n" /* wool */
- "g:126: 2\n" /* woodenslab */
- "h: 31: 2\n" /* tallgrass */
- "i:125: 2\n" /* woodendoubleslab */
- "j: 38: 3\n" /* rose */
- "k: 38: 2\n" /* rose */
- "l: 38: 1\n" /* rose */
- "m: 19: 0\n" /* sponge */
- "n: 17: 2\n" /* tree */
- "o: 50: 4\n" /* torch */
- "p: 85: 0\n" /* fence */
- "q:140: 0\n" /* flowerpotblock */
- "r: 50: 3\n" /* torch */
- "s: 44: 8\n" /* step */
- "t: 50: 1\n" /* torch */
- "u: 50: 2\n" /* torch */
- "v: 43: 0\n" /* doubleslab */
- "w: 44: 0\n" /* step */
- "x: 18:10\n" /* leaves */,
-
- // Block data:
- // Level 0
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "mmmmmmmmmaammmmm"
- /* 1 */ "aabbbbbbbbbbaaam"
- /* 2 */ "aabbbbbbbbbbaaam"
- /* 3 */ "aabbbbbbbbbbaaam"
- /* 4 */ "aabbbbbbbbbbaaam"
- /* 5 */ "aabbbbbbbbbbaaam"
- /* 6 */ "aabbbbbbbbbbaaam"
- /* 7 */ "aabbbbbbbbbbaaam"
- /* 8 */ "aabbbbbbbbbbaaam"
- /* 9 */ "aabbbbbbbbbbaaam"
- /* 10 */ "aaaaaaaaaaaaaaam"
- /* 11 */ "aaaaaaaaaaaaaaam"
- /* 12 */ "aaaaaaaaaaaaaaam"
- /* 13 */ "aaaaaaaaaaaaaaam"
- /* 14 */ "aaaaaaaaaaaaaaam"
- /* 15 */ "mmmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "mmmmmmmmmccmmmmm"
- /* 1 */ "ccbbbbbbbbbbcccm"
- /* 2 */ "ccbbbbbbbbbbcccm"
- /* 3 */ "ccbbbbbbbbbbcccm"
- /* 4 */ "ccbbbbbbbbbbcccm"
- /* 5 */ "ccbbbbbbbbbbcccm"
- /* 6 */ "ccbbbbbbbbbbcccm"
- /* 7 */ "ccbbbbbbbbbbcccm"
- /* 8 */ "ccbbbbbbbbbbcccm"
- /* 9 */ "ccbbbbbbbbbbcccm"
- /* 10 */ "cccccccccccccccm"
- /* 11 */ "cccccccccccccccm"
- /* 12 */ "cccccccccccccccm"
- /* 13 */ "cccccccccccccacm"
- /* 14 */ "cccccccccccccccm"
- /* 15 */ "mmmmmmmmmmmmmmmm"
-
- // Level 2
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "ddeffeffe..eddd."
- /* 2 */ "d.fbbgggg..f..d."
- /* 3 */ "d.fbgggggggf.hd."
- /* 4 */ "d.fbgggggggf..d."
- /* 5 */ "d.eggggggggehhd."
- /* 6 */ "d.fgiiggiigf.hd."
- /* 7 */ "d.fgiiggiigf..d."
- /* 8 */ "d.fggggggggf..d."
- /* 9 */ "d.efffeefffe.hd."
- /* 10 */ "d.............d."
- /* 11 */ "djhhk.jhh..hh.d."
- /* 12 */ "d.jlk.hj.h....d."
- /* 13 */ "d..jh.hh..h..nd."
- /* 14 */ "ddddddddddddddd."
- /* 15 */ "................"
-
- // Level 3
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "........o..o...."
- /* 1 */ "..eppeffe..e...."
- /* 2 */ "..pqq......p...."
- /* 3 */ "..pq.......p...."
- /* 4 */ "..pq.......p...."
- /* 5 */ "..e........e...."
- /* 6 */ "..p........p...."
- /* 7 */ "..p........p...."
- /* 8 */ "..p........p...."
- /* 9 */ "..epppeepppe...."
- /* 10 */ "......rr........"
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ ".............n.."
- /* 14 */ "................"
- /* 15 */ "................"
-
- // Level 4
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "..ssssssssss...."
- /* 1 */ ".seffeffeffes..."
- /* 2 */ ".sf..r.....fs..."
- /* 3 */ ".sf........fs..."
- /* 4 */ ".sf........fs..."
- /* 5 */ ".set......ues..."
- /* 6 */ ".sf........fs..."
- /* 7 */ ".sf........fs..."
- /* 8 */ ".sf........fs..."
- /* 9 */ ".sefffeefffes..."
- /* 10 */ "..ssssssssss...."
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ ".............n.."
- /* 14 */ "................"
- /* 15 */ "................"
-
- // Level 5
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ ".vw........wv..."
- /* 1 */ ".wwwwwwwwwwww..."
- /* 2 */ "..wvvvvvvvvw...."
- /* 3 */ "..wvvvvvvvvw...."
- /* 4 */ "..wvvvvvvvvw...."
- /* 5 */ "..wvvvvvvvvw...."
- /* 6 */ "..wvvvvvvvvw...."
- /* 7 */ "..wvvvvvvvvw...."
- /* 8 */ "..wvvvvvvvvw...."
- /* 9 */ ".wwwwwwwwwwww..."
- /* 10 */ ".vw........wv..."
- /* 11 */ "............xxx."
- /* 12 */ "...........xxxxx"
- /* 13 */ "...........xxnxx"
- /* 14 */ "...........xxxxx"
- /* 15 */ "............xxx."
-
- // Level 6
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "....wwwwww......"
- /* 4 */ "....wvvvvw......"
- /* 5 */ "....wvvvvw......"
- /* 6 */ "....wvvvvw......"
- /* 7 */ "....wwwwww......"
- /* 8 */ "................"
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "............xxx."
- /* 12 */ "...........xxxxx"
- /* 13 */ "...........xxnxx"
- /* 14 */ "...........xxxxx"
- /* 15 */ "............xxx."
-
- // Level 7
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "................"
- /* 4 */ "................"
- /* 5 */ "......ww........"
- /* 6 */ "................"
- /* 7 */ "................"
- /* 8 */ "................"
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ "............xxx."
- /* 13 */ "............xnx."
- /* 14 */ "............xx.."
- /* 15 */ "................"
-
- // Level 8
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "................"
- /* 4 */ "................"
- /* 5 */ "................"
- /* 6 */ "................"
- /* 7 */ "................"
- /* 8 */ "................"
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ ".............x.."
- /* 13 */ "............xxx."
- /* 14 */ ".............x.."
- /* 15 */ "................",
-
- // Connectors:
- "-1: 9, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseWithGarden
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseWithSakura1:
- // The data has been exported from the gallery Plains, area index 75, ID 141, created by Aloe_vera
- {
- // Size:
- 13, 7, 15, // SizeX = 13, SizeY = 7, SizeZ = 15
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 13, 6, 15, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 2: 0\n" /* grass */
- "c: 17: 5\n" /* tree */
- "d: 5: 2\n" /* wood */
- "e: 17: 9\n" /* tree */
- "f:113: 0\n" /* netherbrickfence */
- "g: 17: 1\n" /* tree */
- "h: 35: 0\n" /* wool */
- "i: 31: 2\n" /* tallgrass */
- "j: 54: 2\n" /* chest */
- "k: 38: 6\n" /* rose */
- "l: 38: 2\n" /* rose */
- "m: 19: 0\n" /* sponge */
- "n: 50: 4\n" /* torch */
- "o: 85: 0\n" /* fence */
- "p: 44: 8\n" /* step */
- "q: 35: 6\n" /* wool */
- "r: 43: 0\n" /* doubleslab */
- "s: 44: 0\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "aaaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaaaa"
- /* 8 */ "aaaaaaaaaaaaa"
- /* 9 */ "aaaaaaaaaaaaa"
- /* 10 */ "aaaaaaaaaaaaa"
- /* 11 */ "aaaaaaaaaaaaa"
- /* 12 */ "aaaaaaaaaaaaa"
- /* 13 */ "aaaaaaaaaaaaa"
- /* 14 */ "aaaaaaaaaaaaa"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "bbbbbbbbbbbbb"
- /* 1 */ "bbbbbbbbbbbbb"
- /* 2 */ "bbbaccdabbbbb"
- /* 3 */ "bbbedddebbbbb"
- /* 4 */ "bbbedddebbbbb"
- /* 5 */ "bbbedddebbbbb"
- /* 6 */ "bbbacccabbbbb"
- /* 7 */ "bbbbbbbbbbbbb"
- /* 8 */ "bbbbbbbbbbbbb"
- /* 9 */ "bbbbbbbbbbbbb"
- /* 10 */ "bbbbbbbbbbabb"
- /* 11 */ "bbbbbbbbbbbbb"
- /* 12 */ "bbbbbbbbbbbbb"
- /* 13 */ "bbbbbbbbbbbbb"
- /* 14 */ "bbbbbbbbbbbbb"
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "ffff...ffffff"
- /* 1 */ "f...........f"
- /* 2 */ "f..ghh.g..i.f"
- /* 3 */ "f..h...h..i.f"
- /* 4 */ "f..h...h....f"
- /* 5 */ "fi.h..jh..i.f"
- /* 6 */ "f..ghhhg....f"
- /* 7 */ "f.........i.f"
- /* 8 */ "fii.........f"
- /* 9 */ "f.k..k.i....f"
- /* 10 */ "fl.i..i...g.f"
- /* 11 */ "f.i..i.k....f"
- /* 12 */ "f.l.k.......f"
- /* 13 */ "f.....l.....f"
- /* 14 */ "fffffffffffff"
-
- // Level 3
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".......n....."
- /* 2 */ "...goo.g....."
- /* 3 */ "...h...h....."
- /* 4 */ "...o...o....."
- /* 5 */ "...h...h....."
- /* 6 */ "...gooog....."
- /* 7 */ "............."
- /* 8 */ "............."
- /* 9 */ "............."
- /* 10 */ "..........g.."
- /* 11 */ "............."
- /* 12 */ "............."
- /* 13 */ "............."
- /* 14 */ "............."
-
- // Level 4
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "...ppppp....."
- /* 2 */ "..pghhhgp...."
- /* 3 */ "..ph...hp...."
- /* 4 */ "..ph...hp...."
- /* 5 */ "..ph...hp...."
- /* 6 */ "..pghhhgp...."
- /* 7 */ "...ppppp....."
- /* 8 */ "............."
- /* 9 */ "..........q.."
- /* 10 */ ".........qgq."
- /* 11 */ "..........q.."
- /* 12 */ "............."
- /* 13 */ "............."
- /* 14 */ "............."
-
- // Level 5
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "..rs...sr...."
- /* 2 */ "..sssssss...."
- /* 3 */ "...srrrs....."
- /* 4 */ "...srrrs....."
- /* 5 */ "...srrrs....."
- /* 6 */ "..sssssss...."
- /* 7 */ "..rs...sr...."
- /* 8 */ "............."
- /* 9 */ ".........qqq."
- /* 10 */ ".........qqq."
- /* 11 */ ".........qqq."
- /* 12 */ "............."
- /* 13 */ "............."
- /* 14 */ "............."
-
- // Level 6
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ ".....s......."
- /* 5 */ "............."
- /* 6 */ "............."
- /* 7 */ "............."
- /* 8 */ "............."
- /* 9 */ "............."
- /* 10 */ "..........q.."
- /* 11 */ "............."
- /* 12 */ "............."
- /* 13 */ "............."
- /* 14 */ ".............",
-
- // Connectors:
- "-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseWithSakura1
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseWithSpa:
- // The data has been exported from the gallery Plains, area index 73, ID 139, created by Aloe_vera
- {
- // Size:
- 16, 8, 14, // SizeX = 16, SizeY = 8, SizeZ = 14
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 15, 7, 13, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b: 3: 0\n" /* dirt */
- "c: 2: 0\n" /* grass */
- "d: 8: 0\n" /* water */
- "e:135: 3\n" /* 135 */
- "f:135: 1\n" /* 135 */
- "g:113: 0\n" /* netherbrickfence */
- "h: 17: 1\n" /* tree */
- "i: 35: 0\n" /* wool */
- "j:171:12\n" /* carpet */
- "k: 64: 6\n" /* wooddoorblock */
- "l:126: 2\n" /* woodenslab */
- "m: 19: 0\n" /* sponge */
- "n:135: 2\n" /* 135 */
- "o: 64: 7\n" /* wooddoorblock */
- "p: 50: 4\n" /* torch */
- "q: 85: 0\n" /* fence */
- "r: 64:12\n" /* wooddoorblock */
- "s: 50: 3\n" /* torch */
- "t: 44: 8\n" /* step */
- "u: 43: 0\n" /* doubleslab */
- "v: 44: 0\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".aaaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaaaaa."
- /* 7 */ ".aaaaaabbbbbbbbb"
- /* 8 */ ".aaaaaabbbbbbbbb"
- /* 9 */ ".aaaaaabbbbbbbbb"
- /* 10 */ ".aaaaaabbbbbbbbb"
- /* 11 */ ".aaaaaabbbbbbbbb"
- /* 12 */ ".aaaaaabbbbbbbbb"
- /* 13 */ ".......bbbbbbbbb"
-
- // Level 1
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "mmmmmmmmmmmmmmmm"
- /* 1 */ "maaaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaccccc"
- /* 8 */ "maaaaaaacccccccc"
- /* 9 */ "maaaaaaacccccccc"
- /* 10 */ "maaaaaaacccccccc"
- /* 11 */ "maaaaaaccccccccc"
- /* 12 */ "maaaaaaccccccccc"
- /* 13 */ "mmmmmmmccccccccc"
-
- // Level 2
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".aaaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaaaa."
- /* 6 */ ".aaddaaaaaaaaaa."
- /* 7 */ ".aaddaaeeef....."
- /* 8 */ ".aaddaaf........"
- /* 9 */ ".aaddaaf........"
- /* 10 */ ".aaddaae........"
- /* 11 */ ".aaddaa........."
- /* 12 */ ".aaaaaa........."
- /* 13 */ "................"
-
- // Level 3
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".ggggghiiihiiih."
- /* 2 */ ".geee.ijjjjjjji."
- /* 3 */ ".gf...kjjjijlji."
- /* 4 */ ".gf...innjijjji."
- /* 5 */ ".g....hiiohiiih."
- /* 6 */ ".g....g........."
- /* 7 */ ".g.............."
- /* 8 */ ".g.............."
- /* 9 */ ".g.............."
- /* 10 */ ".g....g........."
- /* 11 */ ".g....g........."
- /* 12 */ ".gggggg........."
- /* 13 */ "................"
-
- // Level 4
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "......p...p...p."
- /* 1 */ ".g....hqqqhqqqh."
- /* 2 */ "......i.......i."
- /* 3 */ "......r...q...q."
- /* 4 */ "......i...q...i."
- /* 5 */ "......hqqrhqqqh."
- /* 6 */ "......g...s....."
- /* 7 */ "................"
- /* 8 */ "................"
- /* 9 */ "................"
- /* 10 */ "................"
- /* 11 */ "................"
- /* 12 */ ".g....g........."
- /* 13 */ "................"
-
- // Level 5
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ ".tttttttttttttt."
- /* 1 */ "tggggghqqqhqqqht"
- /* 2 */ "tg....i.......it"
- /* 3 */ "tg....i...i...it"
- /* 4 */ "tg....i...i...it"
- /* 5 */ "tg....hiiihiiiht"
- /* 6 */ "tg....gtttttttt."
- /* 7 */ "tg....gt........"
- /* 8 */ "tg....gt........"
- /* 9 */ "tg....gt........"
- /* 10 */ "tg....gt........"
- /* 11 */ "tg....gt........"
- /* 12 */ "tggggggt........"
- /* 13 */ ".tttttt........."
-
- // Level 6
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "uv............vu"
- /* 1 */ "vvvvvvvvvvvvvvvv"
- /* 2 */ ".vuuuuuuuuuuuuv."
- /* 3 */ ".vuuuuuutuuuuuv."
- /* 4 */ ".vuuuuuuuuuuuuv."
- /* 5 */ ".vuuuuvvvvvvvvvv"
- /* 6 */ ".vuuuuv.......vu"
- /* 7 */ ".vuuuuv........."
- /* 8 */ ".vuuuuv........."
- /* 9 */ ".vuuuuv........."
- /* 10 */ ".vuuuuv........."
- /* 11 */ ".vuuuuv........."
- /* 12 */ "vvvvvvvv........"
- /* 13 */ "uv....vu........"
-
- // Level 7
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "...vvvvvvvvvv..."
- /* 4 */ "...vv..........."
- /* 5 */ "...vv..........."
- /* 6 */ "...vv..........."
- /* 7 */ "...vv..........."
- /* 8 */ "...vv..........."
- /* 9 */ "...vv..........."
- /* 10 */ "...vv..........."
- /* 11 */ "................"
- /* 12 */ "................"
- /* 13 */ "................",
-
- // Connectors:
- "",
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseWithSpa
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MediumSakuraTree:
- // The data has been exported from the gallery Plains, area index 146, ID 490, created by STR_Warrior
- {
- // Size:
- 7, 10, 7, // SizeX = 7, SizeY = 10, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 9, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 2: 0\n" /* grass */
- "c: 31: 1\n" /* tallgrass */
- "d: 38: 7\n" /* rose */
- "e: 17: 1\n" /* tree */
- "f: 38: 0\n" /* rose */
- "g: 38: 8\n" /* rose */
- "h: 38: 5\n" /* rose */
- "i: 35: 6\n" /* wool */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "aaaaaaa"
- /* 2 */ "aaaaaaa"
- /* 3 */ "aaaaaaa"
- /* 4 */ "aaaaaaa"
- /* 5 */ "aaaaaaa"
- /* 6 */ "aaaaaaa"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "bbbbbbb"
- /* 1 */ "bbbbbbb"
- /* 2 */ "bbbbbbb"
- /* 3 */ "bbbabbb"
- /* 4 */ "bbbbbbb"
- /* 5 */ "bbbbbbb"
- /* 6 */ "bbbbbbb"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "m.c...m"
- /* 2 */ ".dccdc."
- /* 3 */ "..cefc."
- /* 4 */ ".ccfgh."
- /* 5 */ "m.ccc.m"
- /* 6 */ "mm...mm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "m.....m"
- /* 1 */ "......."
- /* 2 */ "......."
- /* 3 */ "...e..."
- /* 4 */ "......."
- /* 5 */ "......."
- /* 6 */ "m.....m"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..i...."
- /* 2 */ "......."
- /* 3 */ "...e.i."
- /* 4 */ ".i....."
- /* 5 */ "......."
- /* 6 */ "......."
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..i...."
- /* 2 */ "...i..."
- /* 3 */ "..ieii."
- /* 4 */ ".i.ii.."
- /* 5 */ "...i..."
- /* 6 */ "......."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..ii..."
- /* 2 */ "..iii.."
- /* 3 */ ".iieii."
- /* 4 */ ".iiii.."
- /* 5 */ "..iii.."
- /* 6 */ "......."
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "..iii.."
- /* 2 */ ".iiiii."
- /* 3 */ ".iieii."
- /* 4 */ ".iiiii."
- /* 5 */ "..iii.."
- /* 6 */ "......."
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "...i..."
- /* 2 */ "..iiii."
- /* 3 */ ".iiiii."
- /* 4 */ "..iii.."
- /* 5 */ "...i..."
- /* 6 */ "......."
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "...i..."
- /* 3 */ "..iii.."
- /* 4 */ "...i..."
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "-1: 3, 2, 0: 2\n" /* Type -1, direction Z- */
- "3: 6, 2, 3: 5\n" /* Type 3, direction X+ */
- "-3: 0, 2, 3: 4\n" /* Type -3, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // MediumSakuraTree
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Restaurant:
- // The data has been exported from the gallery Plains, area index 61, ID 117, created by Aloe_vera
- {
- // Size:
- 15, 10, 15, // SizeX = 15, SizeY = 10, SizeZ = 15
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 14, 9, 15, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b:135: 0\n" /* 135 */
- "c:135: 2\n" /* 135 */
- "d:135: 1\n" /* 135 */
- "e: 17: 9\n" /* tree */
- "f:135: 3\n" /* 135 */
- "g: 85: 0\n" /* fence */
- "h: 17: 1\n" /* tree */
- "i:171: 0\n" /* carpet */
- "j:171:12\n" /* carpet */
- "k:126: 1\n" /* woodenslab */
- "l: 50: 5\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 35: 0\n" /* wool */
- "o: 50: 3\n" /* torch */
- "p: 50: 1\n" /* torch */
- "q: 50: 4\n" /* torch */
- "r: 35:14\n" /* wool */
- "s: 44: 8\n" /* step */
- "t: 43: 0\n" /* doubleslab */
- "u: 44: 0\n" /* step */
- "v: 17: 5\n" /* tree */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmaaaaaaammmm"
- /* 1 */ "maaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaam"
- /* 4 */ "aaaaaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaaaaaa"
- /* 8 */ "aaaaaaaaaaaaaaa"
- /* 9 */ "aaaaaaaaaaaaaaa"
- /* 10 */ "aaaaaaaaaaaaaaa"
- /* 11 */ "maaaaaaaaaaaaam"
- /* 12 */ "maaaaaaaaaaaaam"
- /* 13 */ "maaaaaaaaaaaaam"
- /* 14 */ "mmmmaaaaaaammmm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "....bcccccd...."
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaa."
- /* 4 */ "caaaaaaaaaaaaac"
- /* 5 */ "baaaaaaaaaaaaad"
- /* 6 */ "baaaaaaaaaaaaad"
- /* 7 */ "baaaaaaaaaaeaad"
- /* 8 */ "baaaaaaaaaaaaad"
- /* 9 */ "baaaaaaaaaaaaad"
- /* 10 */ "faaaaaaaaaaaaaf"
- /* 11 */ ".aaaaaaaaaaaaa."
- /* 12 */ ".aaaaaaaaaaaaa."
- /* 13 */ ".aaaaaaaaaaaaa."
- /* 14 */ "....bfffffd...."
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".gggg.....gggg."
- /* 2 */ ".g...........g."
- /* 3 */ ".g.hhhhhhhhh.g."
- /* 4 */ ".g.hiiijiiih.g."
- /* 5 */ "...hikijikih..."
- /* 6 */ "...hiiijiiihg.."
- /* 7 */ "...hjjjjjjj...."
- /* 8 */ "...hiiijiiihg.."
- /* 9 */ "...hikijikih..."
- /* 10 */ ".g.hiiijiiih.g."
- /* 11 */ ".g.hhhhhhhhh.g."
- /* 12 */ ".g...........g."
- /* 13 */ ".gggg.....gggg."
- /* 14 */ "..............."
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".l..g.....g..l."
- /* 2 */ "..............."
- /* 3 */ "...hnnnhnnnh..."
- /* 4 */ ".g.n.......n.g."
- /* 5 */ "...n.......n..."
- /* 6 */ "...n.......hl.."
- /* 7 */ "...h..........."
- /* 8 */ "...n.......hl.."
- /* 9 */ "...n.......n..."
- /* 10 */ ".g.n.......n.g."
- /* 11 */ "...hnnnhnnnh..."
- /* 12 */ "..............."
- /* 13 */ ".l..g.....g..l."
- /* 14 */ "..............."
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "....g.....g...."
- /* 2 */ "..............."
- /* 3 */ "...hn.nhn.nh..."
- /* 4 */ ".g.n...o...n.g."
- /* 5 */ "...n.......n..."
- /* 6 */ "...n.......h..."
- /* 7 */ "...hp......e..."
- /* 8 */ "...n.......h..."
- /* 9 */ "...n.......n..."
- /* 10 */ ".g.n...q...n.g."
- /* 11 */ "...hn.nhn.nh..."
- /* 12 */ "..............."
- /* 13 */ "....g.....g...."
- /* 14 */ "..............."
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "....g.....g...."
- /* 2 */ "....ggggggg...."
- /* 3 */ "...hnnnhnnnh..."
- /* 4 */ ".ggn.......ngg."
- /* 5 */ "..gn.......ng.."
- /* 6 */ "..gn.......hg.."
- /* 7 */ "..gh..r.r..ng.."
- /* 8 */ "..gn.......hg.."
- /* 9 */ "..gn.......ng.."
- /* 10 */ ".ggn.......ngg."
- /* 11 */ "...hnnnhnnnh..."
- /* 12 */ "....ggggggg...."
- /* 13 */ "....g.....g...."
- /* 14 */ "..............."
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "...stuuuuuts..."
- /* 2 */ "..sttttttttts.."
- /* 3 */ ".sthvvvhvvvhts."
- /* 4 */ ".tte.......ett."
- /* 5 */ ".ute.......etu."
- /* 6 */ ".ute.......htu."
- /* 7 */ ".uth..g.g..etu."
- /* 8 */ ".ute.......htu."
- /* 9 */ ".ute.......etu."
- /* 10 */ ".tte.......ett."
- /* 11 */ ".sthvvvhvvvhts."
- /* 12 */ "..sttttttttts.."
- /* 13 */ "...stuuuuuts..."
- /* 14 */ "..............."
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".stu.......uts."
- /* 2 */ ".tu.........ut."
- /* 3 */ ".u.uuuuuuuuu.u."
- /* 4 */ "...utttttttu..."
- /* 5 */ "...utttttttu..."
- /* 6 */ "...utttttttu..."
- /* 7 */ "...utttttttu..."
- /* 8 */ "...utttttttu..."
- /* 9 */ "...utttttttu..."
- /* 10 */ "...utttttttu..."
- /* 11 */ ".u.uuuuuuuuu.u."
- /* 12 */ ".tu.........ut."
- /* 13 */ ".stu.......uts."
- /* 14 */ "..............."
-
- // Level 8
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".u...........u."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ ".....uuuuu....."
- /* 6 */ ".....utttu....."
- /* 7 */ ".....utttu....."
- /* 8 */ ".....utttu....."
- /* 9 */ ".....uuuuu....."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ ".u...........u."
- /* 14 */ "..............."
-
- // Level 9
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ ".......u......."
- /* 8 */ "..............."
- /* 9 */ "..............."
- /* 10 */ "..............."
- /* 11 */ "..............."
- /* 12 */ "..............."
- /* 13 */ "..............."
- /* 14 */ "...............",
-
- // Connectors:
- "-1: 14, 1, 7: 5\n" /* Type -1, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Restaurant
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // SakuraDouble:
- // The data has been exported from the gallery Plains, area index 76, ID 142, created by Aloe_vera
- {
- // Size:
- 12, 8, 6, // SizeX = 12, SizeY = 8, SizeZ = 6
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 12, 7, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 2: 0\n" /* grass */
- "c: 17: 1\n" /* tree */
- "d: 35: 6\n" /* wool */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "aaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaa"
-
- // Level 1
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "bbbbbbbbbbbb"
- /* 1 */ "bbbbbbbbbbbb"
- /* 2 */ "bbabbbbbbbbb"
- /* 3 */ "bbbbbbbbbabb"
- /* 4 */ "bbbbbbbbbbbb"
- /* 5 */ "bbbbbbbbbbbb"
-
- // Level 2
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "..c........."
- /* 3 */ ".........c.."
- /* 4 */ "............"
- /* 5 */ "............"
-
- // Level 3
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "..c........."
- /* 3 */ ".........c.."
- /* 4 */ "............"
- /* 5 */ "............"
-
- // Level 4
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "..d........."
- /* 1 */ "ddddd......."
- /* 2 */ "ddcdd...ddd."
- /* 3 */ "ddddd...dcd."
- /* 4 */ "..d.....ddd."
- /* 5 */ "............"
-
- // Level 5
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ ".ddd........"
- /* 1 */ ".ddd....ddd."
- /* 2 */ "ddddd..ddddd"
- /* 3 */ ".ddd...ddcdd"
- /* 4 */ ".ddd...ddddd"
- /* 5 */ "........ddd."
-
- // Level 6
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "..d......d.."
- /* 2 */ ".ddd....ddd."
- /* 3 */ "..d....ddddd"
- /* 4 */ "........ddd."
- /* 5 */ ".........d.."
-
- // Level 7
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ ".........d.."
- /* 4 */ "............"
- /* 5 */ "............",
-
- // Connectors:
- "-1: -1, 2, 2: 4\n" /* Type -1, direction X- */
- "3: 5, 2, 6: 3\n" /* Type 3, direction Z+ */
- "-3: 6, 2, -1: 2\n" /* Type -3, direction Z- */
- "-3: 12, 2, 2: 5\n" /* Type -3, direction X+ */
- "3: 12, 2, 2: 5\n" /* Type 3, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // SakuraDouble
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // SakuraSmall:
- // The data has been exported from the gallery Plains, area index 145, ID 489, created by Aloe_vera
- {
- // Size:
- 5, 7, 5, // SizeX = 5, SizeY = 7, SizeZ = 5
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 5, 6, 5, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 2: 0\n" /* grass */
- "c: 17: 1\n" /* tree */
- "d: 35: 6\n" /* wool */
- "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 */ "bbbbb"
- /* 1 */ "bbbbb"
- /* 2 */ "bbabb"
- /* 3 */ "bbbbb"
- /* 4 */ "bbbbb"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "..c.."
- /* 3 */ "....."
- /* 4 */ "....."
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "..c.."
- /* 3 */ "....."
- /* 4 */ "....."
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "..d.."
- /* 1 */ "ddddd"
- /* 2 */ "ddcdd"
- /* 3 */ "ddddd"
- /* 4 */ "..d.."
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ ".ddd."
- /* 1 */ ".ddd."
- /* 2 */ "ddddd"
- /* 3 */ ".ddd."
- /* 4 */ ".ddd."
-
- // Level 6
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "..d.."
- /* 2 */ ".ddd."
- /* 3 */ "..d.."
- /* 4 */ ".....",
-
- // Connectors:
- "-1: 2, 2, -1: 2\n" /* Type -1, direction Z- */
- "3: 5, 2, 2: 5\n" /* Type 3, direction X+ */
- "-3: -1, 2, 2: 4\n" /* Type -3, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // SakuraSmall
-}; // g_JapaneseVillagePrefabs
-
-
-
-
-
-
-const cPrefab::sDef g_JapaneseVillageStartingPrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // HighTemple:
- // The data has been exported from the gallery Plains, area index 70, ID 133, created by Aloe_vera
- {
- // Size:
- 11, 19, 11, // SizeX = 11, SizeY = 19, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 10, 18, 10, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 2\n" /* wood */
- "b:135: 0\n" /* 135 */
- "c:135: 2\n" /* 135 */
- "d:135: 1\n" /* 135 */
- "e: 17: 9\n" /* tree */
- "f:135: 3\n" /* 135 */
- "g: 85: 0\n" /* fence */
- "h: 17: 1\n" /* tree */
- "i:171: 0\n" /* carpet */
- "j: 50: 5\n" /* torch */
- "k: 35: 0\n" /* wool */
- "l: 17: 5\n" /* tree */
- "m: 19: 0\n" /* sponge */
- "n:124: 0\n" /* redstonelampon */
- "o: 69: 9\n" /* lever */
- "p: 44: 8\n" /* step */
- "q: 43: 0\n" /* doubleslab */
- "r: 44: 0\n" /* step */
- "s: 50: 4\n" /* torch */
- "t: 50: 1\n" /* torch */
- "u: 50: 3\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmaaaaammm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "aaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaa"
- /* 8 */ "maaaaaaaaam"
- /* 9 */ "maaaaaaaaam"
- /* 10 */ "mmmaaaaammm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "...bcccd..."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ "caaaaaaaaac"
- /* 4 */ "baaaaaaaaad"
- /* 5 */ "baaeaaaaaad"
- /* 6 */ "baaaaaaaaad"
- /* 7 */ "faaaaaaaaaf"
- /* 8 */ ".aaaaaaaaa."
- /* 9 */ ".aaaaaaaaa."
- /* 10 */ "...bfffd..."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".ggg...ggg."
- /* 2 */ ".g.......g."
- /* 3 */ ".g.hhhhh.g."
- /* 4 */ "...hiiih..."
- /* 5 */ "....iiih..."
- /* 6 */ "...hiiih..."
- /* 7 */ ".g.hhhhh.g."
- /* 8 */ ".g.......g."
- /* 9 */ ".ggg...ggg."
- /* 10 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".j.g...g.j."
- /* 2 */ "..........."
- /* 3 */ ".g.kkhkk.g."
- /* 4 */ "...h...k..."
- /* 5 */ ".......h..."
- /* 6 */ "...h...k..."
- /* 7 */ ".g.kkhkk.g."
- /* 8 */ "..........."
- /* 9 */ ".j.g...g.j."
- /* 10 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "...g...g..."
- /* 2 */ "..........."
- /* 3 */ ".g.kkhkk.g."
- /* 4 */ "...h...k..."
- /* 5 */ "...k...h..."
- /* 6 */ "...h...k..."
- /* 7 */ ".g.kkhkk.g."
- /* 8 */ "..........."
- /* 9 */ "...g...g..."
- /* 10 */ "..........."
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "...g...g..."
- /* 2 */ "...ggggg..."
- /* 3 */ ".gghlhlhgg."
- /* 4 */ "..ge...eg.."
- /* 5 */ "..ge.nohg.."
- /* 6 */ "..ge...eg.."
- /* 7 */ ".gghlhlhgg."
- /* 8 */ "...ggggg..."
- /* 9 */ "...g...g..."
- /* 10 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..pqrrrqp.."
- /* 2 */ ".pqqqqqqqp."
- /* 3 */ ".qqhkkkhqq."
- /* 4 */ ".rqkhhhkqr."
- /* 5 */ ".rqkhhhkqr."
- /* 6 */ ".rqkhhhkqr."
- /* 7 */ ".qqhkkkhqq."
- /* 8 */ ".pqqqqqqqp."
- /* 9 */ "..pqrrrqp.."
- /* 10 */ "..........."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".qr.....rq."
- /* 2 */ ".........r."
- /* 3 */ "...hhhhh..."
- /* 4 */ "...hiiih..."
- /* 5 */ "....iiih..."
- /* 6 */ "...hiiih..."
- /* 7 */ "...hhhhh..."
- /* 8 */ ".r.......r."
- /* 9 */ ".qr.....rq."
- /* 10 */ "..........."
-
- // Level 8
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "...kkhkk..."
- /* 4 */ "...h...k..."
- /* 5 */ ".......h..."
- /* 6 */ "...h...k..."
- /* 7 */ "...kkhkk..."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "..........."
-
- // Level 9
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ ".....s....."
- /* 3 */ "...kkhkk..."
- /* 4 */ "...h...k..."
- /* 5 */ "...k...ht.."
- /* 6 */ "...h...k..."
- /* 7 */ "...kkhkk..."
- /* 8 */ ".....u....."
- /* 9 */ "..........."
- /* 10 */ "..........."
-
- // Level 10
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "...ggggg..."
- /* 3 */ "..ghlhlhg.."
- /* 4 */ "..ge...eg.."
- /* 5 */ "..ge.nohg.."
- /* 6 */ "..ge...eg.."
- /* 7 */ "..ghlhlhg.."
- /* 8 */ "...ggggg..."
- /* 9 */ "..........."
- /* 10 */ "..........."
-
- // Level 11
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..prrrrrp.."
- /* 2 */ ".pqqqqqqqp."
- /* 3 */ ".qqhkkkhqq."
- /* 4 */ ".rqkhhhkqr."
- /* 5 */ ".rqkhhhkqr."
- /* 6 */ ".rqkhhhkqr."
- /* 7 */ ".qqhkkkhqr."
- /* 8 */ ".pqqqqqqqp."
- /* 9 */ "..pqrrrqp.."
- /* 10 */ "..........."
-
- // Level 12
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".qr.....rq."
- /* 2 */ ".r.......r."
- /* 3 */ "...hhhhh..."
- /* 4 */ "...hiiih..."
- /* 5 */ "....iiih..."
- /* 6 */ "...hiiih..."
- /* 7 */ "...hhhhh..."
- /* 8 */ ".r.......r."
- /* 9 */ ".qr.....rq."
- /* 10 */ "..........."
-
- // Level 13
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "...kkhkk..."
- /* 4 */ "...h...k..."
- /* 5 */ ".......h..."
- /* 6 */ "...h...k..."
- /* 7 */ "...kkhkk..."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "..........."
-
- // Level 14
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ ".....s....."
- /* 3 */ "...kkhkk..."
- /* 4 */ "...h...k..."
- /* 5 */ "...k...ht.."
- /* 6 */ "...h...k..."
- /* 7 */ "...kkhkk..."
- /* 8 */ ".....u....."
- /* 9 */ "..........."
- /* 10 */ "..........."
-
- // Level 15
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "...ggggg..."
- /* 3 */ "..ghlhlhg.."
- /* 4 */ "..ge...eg.."
- /* 5 */ "..ge.nohg.."
- /* 6 */ "..ge...eg.."
- /* 7 */ "..ghlhlhg.."
- /* 8 */ "...ggggg..."
- /* 9 */ "..........."
- /* 10 */ "..........."
-
- // Level 16
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..pqrrrqp.."
- /* 2 */ ".pqqqqqqqp."
- /* 3 */ ".qqrrrrrqq."
- /* 4 */ ".rqrrrrrqr."
- /* 5 */ ".rqrrrrrqr."
- /* 6 */ ".rqrrrrrqr."
- /* 7 */ ".qqrrrrrqq."
- /* 8 */ ".pqqqqqqqp."
- /* 9 */ "..pqrrrqp.."
- /* 10 */ "..........."
-
- // Level 17
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".qr.....rq."
- /* 2 */ ".rr.....rr."
- /* 3 */ "...rrrrr..."
- /* 4 */ "...rqqqr..."
- /* 5 */ "...rqqqr..."
- /* 6 */ "...rqqqr..."
- /* 7 */ "...rrrrr..."
- /* 8 */ ".rr.....rr."
- /* 9 */ ".qr.....rq."
- /* 10 */ "..........."
-
- // Level 18
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "..........."
- /* 4 */ "..........."
- /* 5 */ ".....r....."
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "..........."
- /* 10 */ "...........",
-
- // Connectors:
- "2: 0, 1, 5: 4\n" /* Type 2, direction X- */
- "2: 5, 1, 0: 2\n" /* Type 2, direction Z- */
- "2: 10, 1, 5: 5\n" /* Type 2, direction X+ */
- "2: 5, 1, 10: 3\n" /* Type 2, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HighTemple
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Well:
- // The data has been exported from the gallery Plains, area index 143, ID 487, created by STR_Warrior
- {
- // Size:
- 7, 14, 7, // SizeX = 7, SizeY = 14, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 13, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 4: 0\n" /* cobblestone */
- "c: 8: 0\n" /* water */
- "d: 13: 0\n" /* gravel */
- "e: 67: 1\n" /* stairs */
- "f: 67: 2\n" /* stairs */
- "g: 67: 0\n" /* stairs */
- "h: 67: 3\n" /* stairs */
- "i: 85: 0\n" /* fence */
- "j: 44: 8\n" /* step */
- "k: 44: 0\n" /* step */
- "l: 43: 0\n" /* doubleslab */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "mbcc.bm"
- /* 3 */ "mbcccbm"
- /* 4 */ "mbcccbm"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmmmmmm"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "mbcccbm"
- /* 3 */ "mbcccbm"
- /* 4 */ "mbcccbm"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmmmmmm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "mbcccbm"
- /* 3 */ "mbcccbm"
- /* 4 */ "mbcccbm"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmmmmmm"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "mbcccbm"
- /* 3 */ "mbcccbm"
- /* 4 */ "mbcccbm"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmmmmmm"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "mbcccbm"
- /* 3 */ "mbcccbm"
- /* 4 */ "mbcccbm"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmmmmmm"
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "mbcccbm"
- /* 3 */ "mbcccbm"
- /* 4 */ "mbcccbm"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmmmmmm"
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "mmbbbmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "bbcccbb"
- /* 3 */ "bbcccbb"
- /* 4 */ "bbcccbb"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmbbbmm"
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "mmdddmm"
- /* 1 */ "mbbbbbm"
- /* 2 */ "dbcccbd"
- /* 3 */ "dbcccbd"
- /* 4 */ "dbcccbd"
- /* 5 */ "mbbbbbm"
- /* 6 */ "mmdddmm"
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mbefgbm"
- /* 2 */ ".h...h."
- /* 3 */ ".g...e."
- /* 4 */ ".f...f."
- /* 5 */ "mbehgbm"
- /* 6 */ "mm...mm"
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mi...im"
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ "mi...im"
- /* 6 */ "mm...mm"
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mi...im"
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ "mi...im"
- /* 6 */ "mm...mm"
-
- // Level 12
- /* z\x* 0123456 */
- /* 0 */ "mjkkkjm"
- /* 1 */ "jlllllj"
- /* 2 */ "klllllk"
- /* 3 */ "klllllk"
- /* 4 */ "klllllk"
- /* 5 */ "jlllllj"
- /* 6 */ "mjkkkjm"
-
- // Level 13
- /* z\x* 0123456 */
- /* 0 */ "k.....k"
- /* 1 */ "......."
- /* 2 */ "..kkk.."
- /* 3 */ "..klk.."
- /* 4 */ "..kkk.."
- /* 5 */ "......."
- /* 6 */ "k.....k",
-
- // Connectors:
- "2: 0, 9, 3: 4\n" /* Type 2, direction X- */
- "2: 3, 9, 0: 2\n" /* Type 2, direction Z- */
- "2: 6, 9, 3: 5\n" /* Type 2, direction X+ */
- "2: 3, 9, 6: 3\n" /* Type 2, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Well
-};
-
-
-
-
-
-// The prefab counts:
-
-const size_t g_JapaneseVillagePrefabsCount = ARRAYCOUNT(g_JapaneseVillagePrefabs);
-
-const size_t g_JapaneseVillageStartingPrefabsCount = ARRAYCOUNT(g_JapaneseVillageStartingPrefabs);
-
diff --git a/src/Generating/Prefabs/JapaneseVillagePrefabs.h b/src/Generating/Prefabs/JapaneseVillagePrefabs.h
deleted file mode 100644
index 501b6c1cd..000000000
--- a/src/Generating/Prefabs/JapaneseVillagePrefabs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// JapaneseVillagePrefabs.h
-
-// Declares the prefabs in the group JapaneseVillage
-
-#include "../Prefab.h"
-
-
-
-
-
-extern const cPrefab::sDef g_JapaneseVillagePrefabs[];
-extern const cPrefab::sDef g_JapaneseVillageStartingPrefabs[];
-extern const size_t g_JapaneseVillagePrefabsCount;
-extern const size_t g_JapaneseVillageStartingPrefabsCount;
diff --git a/src/Generating/Prefabs/PlainsVillagePrefabs.cpp b/src/Generating/Prefabs/PlainsVillagePrefabs.cpp
deleted file mode 100644
index 4613f76e2..000000000
--- a/src/Generating/Prefabs/PlainsVillagePrefabs.cpp
+++ /dev/null
@@ -1,6118 +0,0 @@
-
-// PlainsVillagePrefabs.cpp
-
-// Defines the prefabs in the group PlainsVillage
-
-// NOTE: This file has been generated automatically by GalExport!
-// Any manual changes will be overwritten by the next automatic export!
-
-#include "Globals.h"
-#include "PlainsVillagePrefabs.h"
-
-
-
-
-
-const cPrefab::sDef g_PlainsVillagePrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // BigPlantBed:
- // The data has been exported from the gallery Plains, area index 26, ID 70, created by Taugrammaton
- {
- // Size:
- 13, 8, 12, // SizeX = 13, SizeY = 8, SizeZ = 12
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 12, 7, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 5: 0\n" /* wood */
- "c: 13: 0\n" /* gravel */
- "d: 17: 0\n" /* tree */
- "e: 60: 7\n" /* tilleddirt */
- "f: 8: 0\n" /* water */
- "g: 85: 0\n" /* fence */
- "h: 59: 7\n" /* crops */
- "i: 50: 5\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "aaaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaaaa"
- /* 8 */ "aaaaaaaaaaaaa"
- /* 9 */ "aaaaaaaaaaaaa"
- /* 10 */ "aaaaaaaaaaaaa"
- /* 11 */ "aaaaaaaaaaaaa"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "bbbbbbbbbbbbb"
- /* 1 */ "bcccccccccccb"
- /* 2 */ "bcccccccccccb"
- /* 3 */ "bcccccccccccb"
- /* 4 */ "bcccccccccccb"
- /* 5 */ "bcccccccccccb"
- /* 6 */ "bcccccccccccb"
- /* 7 */ "bcccccccccccb"
- /* 8 */ "bcccccccccccb"
- /* 9 */ "bcccccccccccb"
- /* 10 */ "bcccccccccccb"
- /* 11 */ "bbbbbbbbbbbbb"
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "ddddddddddddd"
- /* 1 */ "deefeefeefeed"
- /* 2 */ "deefeefeefeed"
- /* 3 */ "deefeefeefeed"
- /* 4 */ "deefeefeefeed"
- /* 5 */ "deefeefeefeed"
- /* 6 */ "deefeefeefeed"
- /* 7 */ "deefeefeefeed"
- /* 8 */ "deefeefeefeed"
- /* 9 */ "deefeefeefeed"
- /* 10 */ "deefeefeefeed"
- /* 11 */ "ddddddddddddd"
-
- // Level 3
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "g..g..g..g..g"
- /* 1 */ "ghh.h..hh.hhg"
- /* 2 */ "ghh..h.hh.hhg"
- /* 3 */ "ghh.h..h..hhg"
- /* 4 */ "ghh.hh.h..hhg"
- /* 5 */ "ghh.h..hh.hhg"
- /* 6 */ "ghh.hh.hh.hhg"
- /* 7 */ "ghh....h..hhg"
- /* 8 */ "ghh..h....hhg"
- /* 9 */ "ghh.....h.hhg"
- /* 10 */ "ghh.hh.h..hhg"
- /* 11 */ "g..g..g..g..g"
-
- // Level 4
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "i..i..i..i..i"
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "............."
- /* 5 */ "............."
- /* 6 */ "............."
- /* 7 */ "............."
- /* 8 */ "............."
- /* 9 */ "............."
- /* 10 */ "............."
- /* 11 */ "i..i..i..i..i"
-
- // Level 5
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "............."
- /* 5 */ "............."
- /* 6 */ "............."
- /* 7 */ "............."
- /* 8 */ "............."
- /* 9 */ "............."
- /* 10 */ "............."
- /* 11 */ "............."
-
- // Level 6
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "............."
- /* 5 */ "............."
- /* 6 */ "............."
- /* 7 */ "............."
- /* 8 */ "............."
- /* 9 */ "............."
- /* 10 */ "............."
- /* 11 */ "............."
-
- // Level 7
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "............."
- /* 4 */ "............."
- /* 5 */ "............."
- /* 6 */ "............."
- /* 7 */ "............."
- /* 8 */ "............."
- /* 9 */ "............."
- /* 10 */ "............."
- /* 11 */ ".............",
-
- // Connectors:
- "-1: 7, 1, 11: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // BigPlantBed
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // CobbleHouse10x5Library:
- // The data has been exported from the gallery Plains, area index 23, ID 66, created by xoft
- {
- // Size:
- 12, 7, 7, // SizeX = 12, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 12, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f: 53: 3\n" /* woodstairs */
- "g: 53: 1\n" /* woodstairs */
- "h: 85: 0\n" /* fence */
- "i: 53: 0\n" /* woodstairs */
- "j: 53: 2\n" /* woodstairs */
- "k:102: 0\n" /* glasspane */
- "l: 64:12\n" /* wooddoorblock */
- "m: 19: 0\n" /* sponge */
- "n: 50: 3\n" /* torch */
- "o: 72: 0\n" /* woodplate */
- "p: 50: 4\n" /* torch */
- "q: 53: 7\n" /* woodstairs */
- "r: 47: 0\n" /* bookshelf */
- "s: 50: 1\n" /* torch */
- "t: 50: 2\n" /* torch */
- "u: 53: 6\n" /* woodstairs */
- "v: 5: 0\n" /* wood */,
-
- // Block data:
- // Level 0
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmmmmaaamm"
- /* 1 */ "maaaaaaaaaam"
- /* 2 */ "maaaaaaaaaam"
- /* 3 */ "maaaaaaaaaam"
- /* 4 */ "maaaaaaaaaam"
- /* 5 */ "maaaaaaaaaam"
- /* 6 */ "mmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ ".......bcd.."
- /* 1 */ ".aaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaa."
- /* 6 */ "............"
-
- // Level 2
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".aaaaaaaeaa."
- /* 2 */ ".af.ghi...a."
- /* 3 */ ".ah.......a."
- /* 4 */ ".aj.ghighia."
- /* 5 */ ".aaaaaaaaaa."
- /* 6 */ "............"
-
- // Level 3
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".akkakkalaa."
- /* 2 */ ".k..no.n.nk."
- /* 3 */ ".ko.......k."
- /* 4 */ ".k..po.po.k."
- /* 5 */ ".akkakkakka."
- /* 6 */ "............"
-
- // Level 4
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "jjjjjjjjjjjj"
- /* 1 */ "qaaaaaaaaaaq"
- /* 2 */ ".arrrrrrrra."
- /* 3 */ ".as......ta."
- /* 4 */ ".arrrrrrrra."
- /* 5 */ "uaaaaaaaaaau"
- /* 6 */ "ffffffffffff"
-
- // Level 5
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "jjjjjjjjjjjj"
- /* 2 */ "qvvvvvvvvvvq"
- /* 3 */ ".vvvvvvvvvv."
- /* 4 */ "uvvvvvvvvvvu"
- /* 5 */ "ffffffffffff"
- /* 6 */ "............"
-
- // Level 6
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "jjjjjjjjjjjj"
- /* 3 */ "vvvvvvvvvvvv"
- /* 4 */ "ffffffffffff"
- /* 5 */ "............"
- /* 6 */ "............",
-
- // Connectors:
- "-1: 8, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // CobbleHouse10x5Library
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // DoublePlantBed:
- // The data has been exported from the gallery Plains, area index 5, ID 20, created by tonibm1999
- {
- // Size:
- 15, 8, 9, // SizeX = 15, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 14, 7, 8, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 2: 0\n" /* grass */
- "c: 17: 0\n" /* tree */
- "d: 60: 7\n" /* tilleddirt */
- "e: 8: 0\n" /* water */
- "f: 50: 5\n" /* torch */
- "g: 59: 7\n" /* crops */
- "h: 59: 3\n" /* crops */
- "i: 59: 5\n" /* crops */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "aaaaaaabaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaaaa"
- /* 4 */ "aaaaaaabaaaaaaa"
- /* 5 */ "aaaaaaabaaaaaaa"
- /* 6 */ "aaaaaaabaaaaaaa"
- /* 7 */ "aaaaaaabaaaaaaa"
- /* 8 */ "aaaaaaabaaaaaaa"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "aaaaaaamaaaaaaa"
- /* 1 */ "aaaaaaamaaaaaaa"
- /* 2 */ "aaaaaaamaaaaaaa"
- /* 3 */ "aaaaaaamaaaaaaa"
- /* 4 */ "aaaaaaamaaaaaaa"
- /* 5 */ "aaaaaaamaaaaaaa"
- /* 6 */ "aaaaaaamaaaaaaa"
- /* 7 */ "aaaaaaamaaaaaaa"
- /* 8 */ "aaaaaaamaaaaaaa"
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "ccccccc.ccccccc"
- /* 1 */ "cddeddc.cddeddc"
- /* 2 */ "cddeddc.cddeddc"
- /* 3 */ "cddeddc.cddeddc"
- /* 4 */ "cddeddc.cddeddc"
- /* 5 */ "cddeddc.cddeddc"
- /* 6 */ "cddeddc.cddeddc"
- /* 7 */ "cddeddc.cddeddc"
- /* 8 */ "ccccccc.ccccccc"
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "f.....f.f.....f"
- /* 1 */ ".gg.gg...gg.gg."
- /* 2 */ ".gg.hg...gg.gg."
- /* 3 */ ".gg.gi...gg.gg."
- /* 4 */ ".gg.gg...gg.gg."
- /* 5 */ ".gg.gg...gg.gg."
- /* 6 */ ".gg.gg...gg.gg."
- /* 7 */ ".gg.gg...gg.gg."
- /* 8 */ "f.....f.f.....f"
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "..............."
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "...............",
-
- // Connectors:
- "-1: 7, 2, 8: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // DoublePlantBed
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Forge:
- // The data has been exported from the gallery Plains, area index 51, ID 102, created by Aloe_vera
- {
- // Size:
- 12, 9, 11, // SizeX = 12, SizeY = 9, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 12, 8, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 2\n" /* wooddoorblock */
- "h: 10: 0\n" /* lava */
- "i: 54: 2\n" /* chest */
- "j: 61: 2\n" /* furnace */
- "k:102: 0\n" /* glasspane */
- "l: 64: 8\n" /* wooddoorblock */
- "m: 19: 0\n" /* sponge */
- "n:139: 0\n" /* cobblestonewall */
- "o:101: 0\n" /* ironbars */
- "p: 53: 2\n" /* woodstairs */
- "q: 53: 7\n" /* woodstairs */
- "r: 50: 2\n" /* torch */
- "s: 50: 1\n" /* torch */
- "t: 53: 6\n" /* woodstairs */
- "u: 53: 3\n" /* woodstairs */
- "v: 43: 0\n" /* doubleslab */
- "w: 44: 0\n" /* step */,
-
- // Block data:
- // Level 0
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmmaaaaamm"
- /* 1 */ "maaaaaaaaamm"
- /* 2 */ "maaaaaaaaamm"
- /* 3 */ "maaaaaaaaaaa"
- /* 4 */ "maaaaaaaaaaa"
- /* 5 */ "maaaaaaaaaaa"
- /* 6 */ "maaaaaaaaaaa"
- /* 7 */ "maaaaaaaaaaa"
- /* 8 */ "maaaaammmmmm"
- /* 9 */ "maaaaammmmmm"
- /* 10 */ "mmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ ".....bcccd.."
- /* 1 */ ".aaaaaaaad.."
- /* 2 */ ".aaaaaaaad.."
- /* 3 */ ".aaaaaaaaaaa"
- /* 4 */ ".aaaaaaaaaaa"
- /* 5 */ ".aaaaaaaaaaa"
- /* 6 */ ".aaaaaaaaaaa"
- /* 7 */ ".aaaaaaaaaaa"
- /* 8 */ ".aaaaa......"
- /* 9 */ ".aaaaa......"
- /* 10 */ "............"
-
- // Level 2
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".efffe......"
- /* 2 */ ".f...g......"
- /* 3 */ ".f...ea..aaa"
- /* 4 */ ".f...f...aha"
- /* 5 */ ".f...f...aha"
- /* 6 */ ".f...fijjaha"
- /* 7 */ ".f...eaaaaaa"
- /* 8 */ ".f...f......"
- /* 9 */ ".efffe......"
- /* 10 */ "............"
-
- // Level 3
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".ekkke......"
- /* 2 */ ".k...l......"
- /* 3 */ ".k...en..n.a"
- /* 4 */ ".k...k.....o"
- /* 5 */ ".f...k.....o"
- /* 6 */ ".k...k.....o"
- /* 7 */ ".k...eaooooa"
- /* 8 */ ".k...f......"
- /* 9 */ ".ekkke......"
- /* 10 */ "............"
-
- // Level 4
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "ppppppp....."
- /* 1 */ "qfffffq....."
- /* 2 */ ".f...f......"
- /* 3 */ ".f..rfa..aoa"
- /* 4 */ ".f...f...o.a"
- /* 5 */ ".f...f...o.a"
- /* 6 */ ".fs..f...o.a"
- /* 7 */ ".f...faaaaaa"
- /* 8 */ ".f...f......"
- /* 9 */ "tffffft....."
- /* 10 */ "uuuuuuu....."
-
- // Level 5
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "ppppppp....."
- /* 2 */ "qfffffq....."
- /* 3 */ ".f...fvvvvvv"
- /* 4 */ ".f...fvwwwwv"
- /* 5 */ ".f...fvwwwwv"
- /* 6 */ ".f...fvwwwwv"
- /* 7 */ ".f...fvvvvvv"
- /* 8 */ "tffffft....."
- /* 9 */ "uuuuuuu....."
- /* 10 */ "............"
-
- // Level 6
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "ppppppp....."
- /* 3 */ "qfffffq....."
- /* 4 */ ".f...f......"
- /* 5 */ ".f...f......"
- /* 6 */ ".f...f......"
- /* 7 */ "tffffft....."
- /* 8 */ "uuuuuuu....."
- /* 9 */ "............"
- /* 10 */ "............"
-
- // Level 7
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "ppppppp....."
- /* 4 */ "qfffffq....."
- /* 5 */ ".f...f......"
- /* 6 */ "tffffft....."
- /* 7 */ "uuuuuuu....."
- /* 8 */ "............"
- /* 9 */ "............"
- /* 10 */ "............"
-
- // Level 8
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "............"
- /* 4 */ "ppppppp....."
- /* 5 */ "fffffff....."
- /* 6 */ "uuuuuuu....."
- /* 7 */ "............"
- /* 8 */ "............"
- /* 9 */ "............"
- /* 10 */ "............",
-
- // Connectors:
- "-1: 7, 1, -1: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Forge
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // LampPost:
- // The data has been exported from the gallery Plains, area index 28, ID 73, created by STR_Warrior
- {
- // Size:
- 3, 7, 3, // SizeX = 3, SizeY = 7, SizeZ = 3
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 2, 6, 2, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 43: 0\n" /* doubleslab */
- "c:139: 0\n" /* cobblestonewall */
- "d: 50: 4\n" /* torch */
- "e: 50: 2\n" /* torch */
- "f: 50: 1\n" /* torch */
- "g: 50: 3\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 012 */
- /* 0 */ "mmm"
- /* 1 */ "mam"
- /* 2 */ "mmm"
-
- // Level 1
- /* z\x* 012 */
- /* 0 */ "..."
- /* 1 */ ".b."
- /* 2 */ "..."
-
- // Level 2
- /* z\x* 012 */
- /* 0 */ "..."
- /* 1 */ ".c."
- /* 2 */ "..."
-
- // Level 3
- /* z\x* 012 */
- /* 0 */ "..."
- /* 1 */ ".c."
- /* 2 */ "..."
-
- // Level 4
- /* z\x* 012 */
- /* 0 */ ".d."
- /* 1 */ "ebf"
- /* 2 */ ".g."
-
- // Level 5
- /* z\x* 012 */
- /* 0 */ "..."
- /* 1 */ "..."
- /* 2 */ "..."
-
- // Level 6
- /* z\x* 012 */
- /* 0 */ "..."
- /* 1 */ "..."
- /* 2 */ "...",
-
- // Connectors:
- "-1: 1, 1, 2: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // LampPost
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftCorridor:
- // The data has been exported from the gallery Plains, area index 139, ID 447, created by STR_Warrior
- {
- // Size:
- 10, 4, 3, // SizeX = 10, SizeY = 4, SizeZ = 3
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 9, 3, 2, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 85: 0\n" /* fence */
- "c: 66: 1\n" /* tracks */
- "d: 50: 2\n" /* torch */
- "e: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "aaaaaaaaaa"
- /* 1 */ "aaaaaaaaaa"
- /* 2 */ "aaaaaaaaaa"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "..b....b.."
- /* 1 */ "cccccccccc"
- /* 2 */ "..b....b.."
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "..b....b.."
- /* 1 */ ".........."
- /* 2 */ "..b....b.."
-
- // Level 3
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "..a....a.."
- /* 1 */ ".dae..dae."
- /* 2 */ "..a....a..",
-
- // Connectors:
- "-3: 0, 1, 1: 4\n" /* Type -3, direction X- */
- "3: 9, 1, 1: 5\n" /* Type 3, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 200,
-
- // MoveToGround:
- false,
- }, // MineshaftCorridor
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftCrossing:
- // The data has been exported from the gallery Plains, area index 171, ID 578, created by Aloe_vera
- {
- // Size:
- 5, 4, 5, // SizeX = 5, SizeY = 4, SizeZ = 5
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 4, 3, 4, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 66: 0\n" /* tracks */
- "c: 66: 1\n" /* tracks */
- "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 */ "m.b.m"
- /* 1 */ ".aba."
- /* 2 */ "ccccc"
- /* 3 */ ".aba."
- /* 4 */ "m.b.m"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m"
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m",
-
- // Connectors:
- "3: 4, 1, 2: 5\n" /* Type 3, direction X+ */
- "-3: 4, 1, 2: 5\n" /* Type -3, direction X+ */
- "-3: 2, 1, 4: 3\n" /* Type -3, direction Z+ */
- "3: 2, 1, 4: 3\n" /* Type 3, direction Z+ */
- "3: 0, 1, 2: 4\n" /* Type 3, direction X- */
- "-3: 0, 1, 2: 4\n" /* Type -3, direction X- */
- "3: 2, 1, 0: 2\n" /* Type 3, direction Z- */
- "-3: 2, 1, 0: 2\n" /* Type -3, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 1,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftCrossing
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftCrossing:
- // The data has been exported from the gallery Plains, area index 193, ID 657, created by Aloe_vera
- {
- // Size:
- 11, 4, 11, // SizeX = 11, SizeY = 4, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 10, 3, 10, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 66: 0\n" /* tracks */
- "c: 85: 0\n" /* fence */
- "d: 66: 1\n" /* tracks */
- "e: 50: 4\n" /* torch */
- "f: 50: 3\n" /* torch */
- "g: 50: 2\n" /* torch */
- "h: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "mmmmaaammmm"
- /* 2 */ "mmmmaaammmm"
- /* 3 */ "mmmmaaammmm"
- /* 4 */ "aaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaa"
- /* 7 */ "mmmmaaammmm"
- /* 8 */ "mmmmaaammmm"
- /* 9 */ "mmmmaaammmm"
- /* 10 */ "mmmmaaammmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm.b.mmmm"
- /* 1 */ "mmmm.b.mmmm"
- /* 2 */ "mmmmcbcmmmm"
- /* 3 */ "mmmm.b.mmmm"
- /* 4 */ "..c..b..c.."
- /* 5 */ "ddddddddddd"
- /* 6 */ "..c..b..c.."
- /* 7 */ "mmmm.b.mmmm"
- /* 8 */ "mmmmcbcmmmm"
- /* 9 */ "mmmm.b.mmmm"
- /* 10 */ "mmmm.b.mmmm"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm...mmmm"
- /* 1 */ "mmmm...mmmm"
- /* 2 */ "mmmmc.cmmmm"
- /* 3 */ "mmmm...mmmm"
- /* 4 */ "..c.....c.."
- /* 5 */ "..........."
- /* 6 */ "..c.....c.."
- /* 7 */ "mmmm...mmmm"
- /* 8 */ "mmmmc.cmmmm"
- /* 9 */ "mmmm...mmmm"
- /* 10 */ "mmmm...mmmm"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm...mmmm"
- /* 1 */ "mmmm.e.mmmm"
- /* 2 */ "mmmmaaammmm"
- /* 3 */ "mmmm.f.mmmm"
- /* 4 */ "..a.....a.."
- /* 5 */ ".gah...gah."
- /* 6 */ "..a.....a.."
- /* 7 */ "mmmm.e.mmmm"
- /* 8 */ "mmmmaaammmm"
- /* 9 */ "mmmm.f.mmmm"
- /* 10 */ "mmmm...mmmm",
-
- // Connectors:
- "3: 5, 1, 0: 2\n" /* Type 3, direction Z- */
- "-3: 5, 1, 0: 2\n" /* Type -3, direction Z- */
- "3: 0, 1, 5: 4\n" /* Type 3, direction X- */
- "-3: 0, 1, 5: 4\n" /* Type -3, direction X- */
- "3: 5, 1, 10: 3\n" /* Type 3, direction Z+ */
- "-3: 5, 1, 10: 3\n" /* Type -3, direction Z+ */
- "3: 10, 1, 5: 5\n" /* Type 3, direction X+ */
- "-3: 10, 1, 5: 5\n" /* Type -3, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 10,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftCrossing
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftDoubleCrossing:
- // The data has been exported from the gallery Plains, area index 172, ID 579, created by Aloe_vera
- {
- // Size:
- 5, 8, 5, // SizeX = 5, SizeY = 8, SizeZ = 5
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 4, 7, 4, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 66: 0\n" /* tracks */
- "c: 66: 1\n" /* tracks */
- "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 */ "m.b.m"
- /* 1 */ ".aba."
- /* 2 */ "ccccc"
- /* 3 */ ".aba."
- /* 4 */ "m.b.m"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m"
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m"
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "aaaaa"
- /* 1 */ "aa.aa"
- /* 2 */ "a...a"
- /* 3 */ "aa.aa"
- /* 4 */ "aaaaa"
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m"
-
- // Level 6
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m"
-
- // Level 7
- /* z\x* 01234 */
- /* 0 */ "m...m"
- /* 1 */ ".a.a."
- /* 2 */ "....."
- /* 3 */ ".a.a."
- /* 4 */ "m...m",
-
- // Connectors:
- "-3: 4, 5, 2: 5\n" /* Type -3, direction X+ */
- "3: 4, 5, 2: 5\n" /* Type 3, direction X+ */
- "-3: 2, 1, 4: 3\n" /* Type -3, direction Z+ */
- "3: 2, 1, 4: 3\n" /* Type 3, direction Z+ */
- "-3: 0, 1, 2: 4\n" /* Type -3, direction X- */
- "3: 0, 1, 2: 4\n" /* Type 3, direction X- */
- "-3: 2, 1, 0: 2\n" /* Type -3, direction Z- */
- "3: 2, 1, 0: 2\n" /* Type 3, direction Z- */
- "-3: 4, 1, 2: 5\n" /* Type -3, direction X+ */
- "3: 4, 1, 2: 5\n" /* Type 3, direction X+ */
- "-3: 2, 5, 4: 3\n" /* Type -3, direction Z+ */
- "3: 2, 5, 4: 3\n" /* Type 3, direction Z+ */
- "-3: 0, 5, 2: 4\n" /* Type -3, direction X- */
- "3: 0, 5, 2: 4\n" /* Type 3, direction X- */
- "-3: 2, 5, 0: 2\n" /* Type -3, direction Z- */
- "3: 2, 5, 0: 2\n" /* Type 3, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 1,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftDoubleCrossing
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftSpiral:
- // The data has been exported from the gallery Plains, area index 198, ID 662, created by Aloe_vera
- {
- // Size:
- 7, 12, 7, // SizeX = 7, SizeY = 12, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 11, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 85: 0\n" /* fence */
- "c: 66: 4\n" /* tracks */
- "d: 66: 0\n" /* tracks */
- "e: 66: 6\n" /* tracks */
- "f: 66: 2\n" /* tracks */
- "g: 50: 1\n" /* torch */
- "h: 50: 3\n" /* torch */
- "i: 66: 1\n" /* tracks */
- "j: 66: 7\n" /* tracks */
- "k: 66: 5\n" /* tracks */
- "l: 50: 2\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 66: 3\n" /* tracks */
- "o: 66: 8\n" /* tracks */
- "p: 50: 4\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmmmmm"
- /* 2 */ "mmmmmmm"
- /* 3 */ "aaabmmm"
- /* 4 */ "aaammmm"
- /* 5 */ "aaammmm"
- /* 6 */ "aaammmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmmmmm"
- /* 2 */ "aaammmm"
- /* 3 */ "aaabmmm"
- /* 4 */ ".c.mmmm"
- /* 5 */ ".d.mmmm"
- /* 6 */ ".d.mmmm"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "aaaammm"
- /* 1 */ "aaaammm"
- /* 2 */ "aaaammm"
- /* 3 */ ".c.bmmm"
- /* 4 */ "...mmmm"
- /* 5 */ "...mmmm"
- /* 6 */ "...mmmm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "b..aamm"
- /* 1 */ ".efaamm"
- /* 2 */ ".d.aamm"
- /* 3 */ "...bmmm"
- /* 4 */ "...mmmm"
- /* 5 */ "...mmmm"
- /* 6 */ "...mmmm"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "b...aaa"
- /* 1 */ "...faaa"
- /* 2 */ "....aaa"
- /* 3 */ "...baaa"
- /* 4 */ "...mmmm"
- /* 5 */ "mmmmmmm"
- /* 6 */ "mmmmmmm"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "ag....b"
- /* 1 */ "h...ij."
- /* 2 */ ".....k."
- /* 3 */ "...baaa"
- /* 4 */ "mmmmaaa"
- /* 5 */ "mmmmmmm"
- /* 6 */ "mmmmmmm"
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "mm....b"
- /* 1 */ "mm....."
- /* 2 */ "mm....."
- /* 3 */ "mmmb.k."
- /* 4 */ "mmmaaaa"
- /* 5 */ "mmmaaaa"
- /* 6 */ "mmmaaaa"
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "mmm..la"
- /* 1 */ "mmm...h"
- /* 2 */ "mmm...."
- /* 3 */ "mmmb..."
- /* 4 */ "mmaa.d."
- /* 5 */ "mmaano."
- /* 6 */ "mmaa..b"
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmmmmm"
- /* 2 */ "mmmm..."
- /* 3 */ "mmmb..."
- /* 4 */ "aaa...."
- /* 5 */ "aaan..."
- /* 6 */ "aaa...b"
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmmmmm"
- /* 2 */ "mmmmmmm"
- /* 3 */ "mmmb..."
- /* 4 */ "......."
- /* 5 */ "iii...p"
- /* 6 */ ".....la"
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmmmmm"
- /* 2 */ "mmmmmmm"
- /* 3 */ "mmmbmmm"
- /* 4 */ ".....mm"
- /* 5 */ ".....mm"
- /* 6 */ ".....mm"
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmmmmm"
- /* 2 */ "mmmmmmm"
- /* 3 */ "mmmbmmm"
- /* 4 */ "....mmm"
- /* 5 */ "....mmm"
- /* 6 */ "....mmm",
-
- // Connectors:
- "3: 1, 1, 6: 3\n" /* Type 3, direction Z+ */
- "-3: 1, 1, 6: 3\n" /* Type -3, direction Z+ */
- "3: 0, 9, 5: 4\n" /* Type 3, direction X- */
- "-3: 0, 9, 5: 4\n" /* Type -3, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftSpiral
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftStairs:
- // The data has been exported from the gallery Plains, area index 195, ID 659, created by Aloe_vera
- {
- // Size:
- 7, 8, 3, // SizeX = 7, SizeY = 8, SizeZ = 3
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 7, 2, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 66: 1\n" /* tracks */
- "c: 66: 2\n" /* tracks */
- "d: 85: 0\n" /* fence */
- "e: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "aaammmm"
- /* 1 */ "aaammmm"
- /* 2 */ "aaammmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "..aammm"
- /* 1 */ "bcaammm"
- /* 2 */ "..aammm"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "...aamm"
- /* 1 */ "..caamm"
- /* 2 */ "...aamm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "...daam"
- /* 1 */ "...caam"
- /* 2 */ "...daam"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "m..d.aa"
- /* 1 */ "m...caa"
- /* 2 */ "m..d.aa"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "mm.d..."
- /* 1 */ "mm...bb"
- /* 2 */ "mm.d..."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "mmmd..."
- /* 1 */ "mmm...."
- /* 2 */ "mmmd..."
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "mmma..."
- /* 1 */ "mmmae.."
- /* 2 */ "mmma...",
-
- // Connectors:
- "3: 0, 1, 1: 4\n" /* Type 3, direction X- */
- "-3: 0, 1, 1: 4\n" /* Type -3, direction X- */
- "3: 6, 5, 1: 5\n" /* Type 3, direction X+ */
- "-3: 6, 5, 1: 5\n" /* Type -3, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftStairs
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftStairsCrossing:
- // The data has been exported from the gallery Plains, area index 199, ID 663, created by Aloe_vera
- {
- // Size:
- 11, 12, 12, // SizeX = 11, SizeY = 12, SizeZ = 12
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 10, 11, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 66: 0\n" /* tracks */
- "c: 66: 5\n" /* tracks */
- "d: 85: 0\n" /* fence */
- "e: 66: 1\n" /* tracks */
- "f: 50: 3\n" /* torch */
- "g: 50: 2\n" /* torch */
- "h: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "mmmmaaammmm"
- /* 2 */ "mmmmaaammmm"
- /* 3 */ "mmmmmmmmmmm"
- /* 4 */ "mmmmmmmmmmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmmmmmmmmm"
- /* 9 */ "mmmmmmmmmmm"
- /* 10 */ "mmmmmmmmmmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm.b.mmmm"
- /* 1 */ "mmmm.c.mmmm"
- /* 2 */ "mmmmaaammmm"
- /* 3 */ "mmmmaaammmm"
- /* 4 */ "mmmmmmmmmmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmmmmmmmmm"
- /* 9 */ "mmmmmmmmmmm"
- /* 10 */ "mmmmmmmmmmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm...mmmm"
- /* 1 */ "mmmm...mmmm"
- /* 2 */ "mmmm.c.mmmm"
- /* 3 */ "mmmmaaammmm"
- /* 4 */ "mmmmaaammmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmmmmmmmmm"
- /* 9 */ "mmmmmmmmmmm"
- /* 10 */ "mmmmmmmmmmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm...mmmm"
- /* 1 */ "mmmm...mmmm"
- /* 2 */ "mmmm...mmmm"
- /* 3 */ "mmmmdcdmmmm"
- /* 4 */ "mmmmaaammmm"
- /* 5 */ "mmmmaaammmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmmmmmmmmm"
- /* 9 */ "mmmmmmmmmmm"
- /* 10 */ "mmmmmmmmmmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmm...mmmm"
- /* 2 */ "mmmm...mmmm"
- /* 3 */ "mmmmd.dmmmm"
- /* 4 */ "mmmm.c.mmmm"
- /* 5 */ "aaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaa"
- /* 8 */ "mmmmaaammmm"
- /* 9 */ "mmmmmmmmmmm"
- /* 10 */ "mmmmmmmmmmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmm...mmmm"
- /* 3 */ "mmmmd.dmmmm"
- /* 4 */ "mmmm...mmmm"
- /* 5 */ "..d..b..d.."
- /* 6 */ "eeeeeeeeeee"
- /* 7 */ "..d..c..d.."
- /* 8 */ "mmmmaaammmm"
- /* 9 */ "mmmmaaammmm"
- /* 10 */ "mmmmmmmmmmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmmmmmmmmm"
- /* 3 */ "mmmmd.dmmmm"
- /* 4 */ "mmmm...mmmm"
- /* 5 */ "..d.....d.."
- /* 6 */ "..........."
- /* 7 */ "..d.....d.."
- /* 8 */ "mmmm.c.mmmm"
- /* 9 */ "mmmmaaammmm"
- /* 10 */ "mmmmaaammmm"
- /* 11 */ "mmmmmmmmmmm"
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmmmmmmmmm"
- /* 3 */ "mmmmaaammmm"
- /* 4 */ "mmmm.f.mmmm"
- /* 5 */ "..a.....a.."
- /* 6 */ ".gah...gah."
- /* 7 */ "..a.....a.."
- /* 8 */ "mmmm...mmmm"
- /* 9 */ "mmmmdcdmmmm"
- /* 10 */ "mmmmaaammmm"
- /* 11 */ "mmmmaaammmm"
-
- // Level 8
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmmmmmmmmm"
- /* 3 */ "mmmmmmmmmmm"
- /* 4 */ "mmmmmmmmmmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmm...mmmm"
- /* 8 */ "mmmm...mmmm"
- /* 9 */ "mmmmd.dmmmm"
- /* 10 */ "mmmm.c.mmmm"
- /* 11 */ "mmmmaaammmm"
-
- // Level 9
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmmmmmmmmm"
- /* 3 */ "mmmmmmmmmmm"
- /* 4 */ "mmmmmmmmmmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmm...mmmm"
- /* 9 */ "mmmmd.dmmmm"
- /* 10 */ "mmmm...mmmm"
- /* 11 */ "mmmm.b.mmmm"
-
- // Level 10
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmmmmmmmmm"
- /* 3 */ "mmmmmmmmmmm"
- /* 4 */ "mmmmmmmmmmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmmmmmmmmm"
- /* 9 */ "mmmmd.dmmmm"
- /* 10 */ "mmmm...mmmm"
- /* 11 */ "mmmm...mmmm"
-
- // Level 11
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmmmmmmmm"
- /* 1 */ "mmmmmmmmmmm"
- /* 2 */ "mmmmmmmmmmm"
- /* 3 */ "mmmmmmmmmmm"
- /* 4 */ "mmmmmmmmmmm"
- /* 5 */ "mmmmmmmmmmm"
- /* 6 */ "mmmmmmmmmmm"
- /* 7 */ "mmmmmmmmmmm"
- /* 8 */ "mmmmmmmmmmm"
- /* 9 */ "mmmmaaammmm"
- /* 10 */ "mmmm.f.mmmm"
- /* 11 */ "mmmm...mmmm",
-
- // Connectors:
- "3: 0, 5, 6: 4\n" /* Type 3, direction X- */
- "-3: 0, 5, 6: 4\n" /* Type -3, direction X- */
- "3: 10, 5, 6: 5\n" /* Type 3, direction X+ */
- "-3: 10, 5, 6: 5\n" /* Type -3, direction X+ */
- "3: 5, 9, 11: 3\n" /* Type 3, direction Z+ */
- "-3: 5, 9, 11: 3\n" /* Type -3, direction Z+ */
- "3: 5, 1, 1: 2\n" /* Type 3, direction Z- */
- "-3: 5, 1, 1: 2\n" /* Type -3, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 30,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftStairsCrossing
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftTee:
- // The data has been exported from the gallery Plains, area index 194, ID 658, created by Aloe_vera
- {
- // Size:
- 11, 4, 7, // SizeX = 11, SizeY = 4, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 10, 3, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 66: 0\n" /* tracks */
- "c: 85: 0\n" /* fence */
- "d: 66: 1\n" /* tracks */
- "e: 50: 4\n" /* torch */
- "f: 50: 3\n" /* torch */
- "g: 50: 2\n" /* torch */
- "h: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "mmmmaaammmm"
- /* 2 */ "mmmmaaammmm"
- /* 3 */ "mmmmaaammmm"
- /* 4 */ "aaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaa"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm.b.mmmm"
- /* 1 */ "mmmm.b.mmmm"
- /* 2 */ "mmmmcbcmmmm"
- /* 3 */ "mmmm.b.mmmm"
- /* 4 */ "..c..b..c.."
- /* 5 */ "ddddddddddd"
- /* 6 */ "..c.....c.."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm...mmmm"
- /* 1 */ "mmmm...mmmm"
- /* 2 */ "mmmmc.cmmmm"
- /* 3 */ "mmmm...mmmm"
- /* 4 */ "..c.....c.."
- /* 5 */ "..........."
- /* 6 */ "..c.....c.."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmm...mmmm"
- /* 1 */ "mmmm.e.mmmm"
- /* 2 */ "mmmmaaammmm"
- /* 3 */ "mmmm.f.mmmm"
- /* 4 */ "..a.....a.."
- /* 5 */ ".gah...gah."
- /* 6 */ "..a.....a..",
-
- // Connectors:
- "3: 0, 1, 5: 4\n" /* Type 3, direction X- */
- "-3: 0, 1, 5: 4\n" /* Type -3, direction X- */
- "3: 5, 1, 0: 2\n" /* Type 3, direction Z- */
- "-3: 5, 1, 0: 2\n" /* Type -3, direction Z- */
- "3: 10, 1, 5: 5\n" /* Type 3, direction X+ */
- "-3: 10, 1, 5: 5\n" /* Type -3, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 20,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftTee
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineshaftsCorridor5:
- // The data has been exported from the gallery Plains, area index 200, ID 664, created by Aloe_vera
- {
- // Size:
- 11, 4, 3, // SizeX = 11, SizeY = 4, SizeZ = 3
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 10, 3, 2, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 85: 0\n" /* fence */
- "c: 66: 1\n" /* tracks */
- "d: 50: 2\n" /* torch */
- "e: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "aaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaa"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..b.....b.."
- /* 1 */ "ccccccccccc"
- /* 2 */ "..b.....b.."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..b.....b.."
- /* 1 */ "..........."
- /* 2 */ "..b.....b.."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..a.....a.."
- /* 1 */ ".dae...dae."
- /* 2 */ "..a.....a..",
-
- // Connectors:
- "3: 10, 1, 1: 5\n" /* Type 3, direction X+ */
- "-3: 10, 1, 1: 5\n" /* Type -3, direction X+ */
- "-3: 0, 1, 1: 4\n" /* Type -3, direction X- */
- "3: 0, 1, 1: 4\n" /* Type 3, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- false,
- }, // MineshaftsCorridor5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Scarecrow:
- // The data has been exported from the gallery Plains, area index 150, ID 494, created by STR_Warrior
- {
- // Size:
- 1, 6, 3, // SizeX = 1, SizeY = 6, SizeZ = 3
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 0, 5, 2, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a:139: 0\n" /* cobblestonewall */
- "b: 85: 0\n" /* fence */
- "c:126: 4\n" /* woodenslab */
- "d: 86: 1\n" /* pumpkin */
- "e:139: 1\n" /* cobblestonewall */
- "f:163: 4\n" /* acaciawoodenstairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0 */
- /* 0 */ "."
- /* 1 */ "a"
- /* 2 */ "."
-
- // Level 1
- /* z\x* 0 */
- /* 0 */ "."
- /* 1 */ "b"
- /* 2 */ "."
-
- // Level 2
- /* z\x* 0 */
- /* 0 */ "c"
- /* 1 */ "d"
- /* 2 */ "c"
-
- // Level 3
- /* z\x* 0 */
- /* 0 */ "."
- /* 1 */ "e"
- /* 2 */ "."
-
- // Level 4
- /* z\x* 0 */
- /* 0 */ "f"
- /* 1 */ "d"
- /* 2 */ "f"
-
- // Level 5
- /* z\x* 0 */
- /* 0 */ "."
- /* 1 */ "f"
- /* 2 */ ".",
-
- // Connectors:
- "-1: -1, 0, 1: 4\n" /* Type -1, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 10,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Scarecrow
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // SinglePlantBed:
- // The data has been exported from the gallery Plains, area index 17, ID 60, created by Aloe_vera
- {
- // Size:
- 10, 7, 7, // SizeX = 10, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 9, 6, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 17: 0\n" /* tree */
- "c: 60: 7\n" /* tilleddirt */
- "d: 8: 0\n" /* water */
- "e: 59: 7\n" /* crops */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "aaaaaaaaaa"
- /* 1 */ "aaaaaaaaaa"
- /* 2 */ "aaaaaaaaaa"
- /* 3 */ "aaaaaaaaaa"
- /* 4 */ "aaaaaaaaaa"
- /* 5 */ "aaaaaaaaaa"
- /* 6 */ "aaaaaaaaaa"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "bbbbbbbbbb"
- /* 1 */ "bccccccccb"
- /* 2 */ "bccccccccb"
- /* 3 */ "bddddddddb"
- /* 4 */ "bccccccccb"
- /* 5 */ "bccccccccb"
- /* 6 */ "bbbbbbbbbb"
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".eeeeeeee."
- /* 2 */ ".eeeeeeee."
- /* 3 */ ".........."
- /* 4 */ ".eeeeeeee."
- /* 5 */ ".eeeeeeee."
- /* 6 */ ".........."
-
- // Level 3
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".........."
- /* 2 */ ".........."
- /* 3 */ ".........."
- /* 4 */ ".........."
- /* 5 */ ".........."
- /* 6 */ ".........."
-
- // Level 4
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".........."
- /* 2 */ ".........."
- /* 3 */ ".........."
- /* 4 */ ".........."
- /* 5 */ ".........."
- /* 6 */ ".........."
-
- // Level 5
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".........."
- /* 2 */ ".........."
- /* 3 */ ".........."
- /* 4 */ ".........."
- /* 5 */ ".........."
- /* 6 */ ".........."
-
- // Level 6
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".........."
- /* 2 */ ".........."
- /* 3 */ ".........."
- /* 4 */ ".........."
- /* 5 */ ".........."
- /* 6 */ "..........",
-
- // Connectors:
- "-1: 9, 1, 3: 5\n" /* Type -1, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // SinglePlantBed
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenChurchMid:
- // The data has been exported from the gallery Plains, area index 58, ID 109, created by Aloe_vera
- {
- // Size:
- 7, 15, 13, // SizeX = 7, SizeY = 15, SizeZ = 13
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 7, 14, 13, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A: 85: 0\n" /* fence */
- "B:126: 8\n" /* woodenslab */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h: 65: 3\n" /* ladder */
- "i: 53: 3\n" /* woodstairs */
- "j: 53: 7\n" /* woodstairs */
- "k: 64:12\n" /* wooddoorblock */
- "l:102: 0\n" /* glasspane */
- "m: 19: 0\n" /* sponge */
- "n: 50: 1\n" /* torch */
- "o: 50: 2\n" /* torch */
- "p:171:14\n" /* carpet */
- "q: 50: 3\n" /* torch */
- "r: 53: 2\n" /* woodstairs */
- "s: 53: 0\n" /* woodstairs */
- "t: 53: 1\n" /* woodstairs */
- "u: 53: 5\n" /* woodstairs */
- "v: 53: 4\n" /* woodstairs */
- "w: 17: 4\n" /* tree */
- "x: 17: 8\n" /* tree */
- "y: 54: 2\n" /* chest */
- "z: 50: 4\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmaaamm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "maaaaam"
- /* 7 */ "maaaaam"
- /* 8 */ "maaaaam"
- /* 9 */ "maaaaam"
- /* 10 */ "maaaaam"
- /* 11 */ "maaaaam"
- /* 12 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "..bcd.."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aaaaa."
- /* 3 */ ".aaaaa."
- /* 4 */ ".aaaaa."
- /* 5 */ ".aaaaa."
- /* 6 */ ".aaaaa."
- /* 7 */ ".aaaaa."
- /* 8 */ ".aaaaa."
- /* 9 */ ".aaaaa."
- /* 10 */ ".aaaaa."
- /* 11 */ ".aaaaa."
- /* 12 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".efgfe."
- /* 2 */ ".f..hf."
- /* 3 */ ".f...f."
- /* 4 */ ".f...f."
- /* 5 */ ".ei.ie."
- /* 6 */ ".f...f."
- /* 7 */ ".fi.if."
- /* 8 */ ".f...f."
- /* 9 */ ".f.j.f."
- /* 10 */ ".f...f."
- /* 11 */ ".efffe."
- /* 12 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".efkfe."
- /* 2 */ ".l..hl."
- /* 3 */ ".l...l."
- /* 4 */ ".l...l."
- /* 5 */ ".e...e."
- /* 6 */ ".l...l."
- /* 7 */ ".l...l."
- /* 8 */ ".fn.of."
- /* 9 */ ".l.p.l."
- /* 10 */ ".l...l."
- /* 11 */ ".ellle."
- /* 12 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".efffe."
- /* 2 */ ".f.qhf."
- /* 3 */ ".f...f."
- /* 4 */ ".f...f."
- /* 5 */ "re...er"
- /* 6 */ "sf...ft"
- /* 7 */ "sf...ft"
- /* 8 */ "sf...ft"
- /* 9 */ "sf...ft"
- /* 10 */ "sf...ft"
- /* 11 */ "sefffet"
- /* 12 */ "su...vt"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".ewwwe."
- /* 2 */ ".xffhx."
- /* 3 */ ".xfffx."
- /* 4 */ ".xfffx."
- /* 5 */ ".ewwwe."
- /* 6 */ ".sf.ft."
- /* 7 */ ".sf.ft."
- /* 8 */ ".sf.ft."
- /* 9 */ ".sf.ft."
- /* 10 */ ".sf.ft."
- /* 11 */ ".sffft."
- /* 12 */ ".su.vt."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".eflfe."
- /* 2 */ ".f..hf."
- /* 3 */ ".f...f."
- /* 4 */ ".f.y.f."
- /* 5 */ ".efffe."
- /* 6 */ "..sft.."
- /* 7 */ "..sft.."
- /* 8 */ "..sft.."
- /* 9 */ "..sft.."
- /* 10 */ "..sft.."
- /* 11 */ "..sft.."
- /* 12 */ "..sft.."
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".eflfe."
- /* 2 */ ".f..hf."
- /* 3 */ ".l...l."
- /* 4 */ ".f...f."
- /* 5 */ ".efffe."
- /* 6 */ "......."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".eflfe."
- /* 2 */ ".f..hf."
- /* 3 */ ".f...f."
- /* 4 */ ".f.z.f."
- /* 5 */ ".efffe."
- /* 6 */ "......."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".ewwwe."
- /* 2 */ ".xffhx."
- /* 3 */ ".xfffx."
- /* 4 */ ".xfffx."
- /* 5 */ ".ewwwe."
- /* 6 */ "......."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".eAAAe."
- /* 2 */ ".A...A."
- /* 3 */ ".A...A."
- /* 4 */ ".A...A."
- /* 5 */ ".eAAAe."
- /* 6 */ "......."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".e...e."
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ ".e...e."
- /* 6 */ "......."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 12
- /* z\x* 0123456 */
- /* 0 */ "su...vt"
- /* 1 */ "sefffet"
- /* 2 */ "sfBBBft"
- /* 3 */ "sfBBBft"
- /* 4 */ "sfBBBft"
- /* 5 */ "sefffet"
- /* 6 */ "su...vt"
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 13
- /* z\x* 0123456 */
- /* 0 */ ".su.vt."
- /* 1 */ ".sffft."
- /* 2 */ ".sffft."
- /* 3 */ ".sffft."
- /* 4 */ ".sffft."
- /* 5 */ ".sffft."
- /* 6 */ ".su.vt."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ "......."
-
- // Level 14
- /* z\x* 0123456 */
- /* 0 */ "..sft.."
- /* 1 */ "..sft.."
- /* 2 */ "..sft.."
- /* 3 */ "..sft.."
- /* 4 */ "..sft.."
- /* 5 */ "..sft.."
- /* 6 */ "..sft.."
- /* 7 */ "......."
- /* 8 */ "......."
- /* 9 */ "......."
- /* 10 */ "......."
- /* 11 */ "......."
- /* 12 */ ".......",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 20,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenChurchMid
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenGranary:
- // The data has been exported from the gallery Plains, area index 54, ID 105, created by Aloe_vera
- {
- // Size:
- 7, 7, 9, // SizeX = 7, SizeY = 7, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 7, 6, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b:170: 0\n" /* haybale */
- "c: 67: 0\n" /* stairs */
- "d: 67: 2\n" /* stairs */
- "e: 67: 1\n" /* stairs */
- "f: 17: 0\n" /* tree */
- "g: 5: 0\n" /* wood */
- "h:170: 4\n" /* haybale */
- "i:170: 8\n" /* haybale */
- "j: 54: 2\n" /* chest */
- "k: 50: 4\n" /* torch */
- "l: 53: 0\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 53: 5\n" /* woodstairs */
- "o: 53: 4\n" /* woodstairs */
- "p: 53: 1\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "maaaaam"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "maaaaam"
- /* 7 */ "maaaaam"
- /* 8 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "bcddde."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aaaaa."
- /* 3 */ ".aaaaa."
- /* 4 */ ".aaaaa."
- /* 5 */ ".aaaaa."
- /* 6 */ ".aaaaa."
- /* 7 */ ".aaaaa."
- /* 8 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".f..bf."
- /* 2 */ ".g...g."
- /* 3 */ ".gb.hg."
- /* 4 */ ".fihif."
- /* 5 */ ".gbbbg."
- /* 6 */ ".gijbg."
- /* 7 */ ".fgfgf."
- /* 8 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ ".k...k."
- /* 1 */ ".f...f."
- /* 2 */ ".g...g."
- /* 3 */ ".g...g."
- /* 4 */ ".fh..f."
- /* 5 */ ".ghibg."
- /* 6 */ ".ghiig."
- /* 7 */ ".fgfgf."
- /* 8 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "ln...op"
- /* 1 */ "lgggggp"
- /* 2 */ "lg...gp"
- /* 3 */ "lg...gp"
- /* 4 */ "lg...gp"
- /* 5 */ "lgbb.gp"
- /* 6 */ "lgibigp"
- /* 7 */ "lgggggp"
- /* 8 */ "ln...op"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ ".ln.op."
- /* 1 */ ".lgggp."
- /* 2 */ ".lg.gp."
- /* 3 */ ".lg.gp."
- /* 4 */ ".lg.gp."
- /* 5 */ ".lg.gp."
- /* 6 */ ".lg.gp."
- /* 7 */ ".lgggp."
- /* 8 */ ".ln.op."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "..lgp.."
- /* 1 */ "..lgp.."
- /* 2 */ "..lgp.."
- /* 3 */ "..lgp.."
- /* 4 */ "..lgp.."
- /* 5 */ "..lgp.."
- /* 6 */ "..lgp.."
- /* 7 */ "..lgp.."
- /* 8 */ "..lgp..",
-
- // Connectors:
- "-1: 3, 1, -1: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 20,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenGranary
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse10x7Library:
- // The data has been exported from the gallery Plains, area index 47, ID 98, created by Aloe_vera
- {
- // Size:
- 12, 8, 9, // SizeX = 12, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 12, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h: 64: 5\n" /* wooddoorblock */
- "i: 53: 3\n" /* woodstairs */
- "j: 85: 0\n" /* fence */
- "k: 53: 2\n" /* woodstairs */
- "l: 53: 1\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 53: 0\n" /* woodstairs */
- "o:102: 0\n" /* glasspane */
- "p: 64:12\n" /* wooddoorblock */
- "q: 50: 3\n" /* torch */
- "r: 72: 0\n" /* woodplate */
- "s: 53: 7\n" /* woodstairs */
- "t: 47: 0\n" /* bookshelf */
- "u: 50: 1\n" /* torch */
- "v: 50: 2\n" /* torch */
- "w: 53: 6\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "mmmmaaaammmm"
- /* 1 */ "maaaaaaaaaam"
- /* 2 */ "maaaaaaaaaam"
- /* 3 */ "maaaaaaaaaam"
- /* 4 */ "maaaaaaaaaam"
- /* 5 */ "maaaaaaaaaam"
- /* 6 */ "maaaaaaaaaam"
- /* 7 */ "maaaaaaaaaam"
- /* 8 */ "mmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "....bccd...."
- /* 1 */ ".aaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaa."
- /* 8 */ "............"
-
- // Level 2
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".efffghfffe."
- /* 2 */ ".f........f."
- /* 3 */ ".fi......if."
- /* 4 */ ".fj......jf."
- /* 5 */ ".fk......kf."
- /* 6 */ ".f.ljnljn.f."
- /* 7 */ ".effffffffe."
- /* 8 */ "............"
-
- // Level 3
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".eoofppfooe."
- /* 2 */ ".o..q..q..o."
- /* 3 */ ".o........o."
- /* 4 */ ".fr......rf."
- /* 5 */ ".o........o."
- /* 6 */ ".o..r..r..o."
- /* 7 */ ".eoofoofooe."
- /* 8 */ "............"
-
- // Level 4
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "kkkkkkkkkkkk"
- /* 1 */ "sffffffffffs"
- /* 2 */ ".fttttttttf."
- /* 3 */ ".f........f."
- /* 4 */ ".fu......vf."
- /* 5 */ ".f........f."
- /* 6 */ ".fttttttttf."
- /* 7 */ "wffffffffffw"
- /* 8 */ "iiiiiiiiiiii"
-
- // Level 5
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "kkkkkkkkkkkk"
- /* 2 */ "sffffffffffs"
- /* 3 */ ".fttttttttf."
- /* 4 */ ".f........f."
- /* 5 */ ".fttttttttf."
- /* 6 */ "wffffffffffw"
- /* 7 */ "iiiiiiiiiiii"
- /* 8 */ "............"
-
- // Level 6
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "kkkkkkkkkkkk"
- /* 3 */ "sffffffffffs"
- /* 4 */ ".f........f."
- /* 5 */ "wffffffffffw"
- /* 6 */ "iiiiiiiiiiii"
- /* 7 */ "............"
- /* 8 */ "............"
-
- // Level 7
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ "............"
- /* 2 */ "............"
- /* 3 */ "kkkkkkkkkkkk"
- /* 4 */ "ffffffffffff"
- /* 5 */ "iiiiiiiiiiii"
- /* 6 */ "............"
- /* 7 */ "............"
- /* 8 */ "............",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse10x7Library
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse5x5:
- // The data has been exported from the gallery Plains, area index 49, ID 100, created by Aloe_vera
- {
- // Size:
- 7, 7, 7, // SizeX = 7, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 7, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 3\n" /* wooddoorblock */
- "h: 64: 8\n" /* wooddoorblock */
- "i:102: 0\n" /* glasspane */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 7\n" /* woodstairs */
- "l: 50: 3\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 53: 6\n" /* woodstairs */
- "o: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmaaamm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "..bcd.."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aaaaa."
- /* 3 */ ".aaaaa."
- /* 4 */ ".aaaaa."
- /* 5 */ ".aaaaa."
- /* 6 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".efgfe."
- /* 2 */ ".f...f."
- /* 3 */ ".f...f."
- /* 4 */ ".f...f."
- /* 5 */ ".efffe."
- /* 6 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".efhfe."
- /* 2 */ ".i...i."
- /* 3 */ ".i...i."
- /* 4 */ ".i...i."
- /* 5 */ ".eiiie."
- /* 6 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "jjjjjjj"
- /* 1 */ "kfffffk"
- /* 2 */ ".fl.lf."
- /* 3 */ ".f...f."
- /* 4 */ ".f...f."
- /* 5 */ "nfffffn"
- /* 6 */ "ooooooo"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "jjjjjjj"
- /* 2 */ "kfffffk"
- /* 3 */ ".f...f."
- /* 4 */ "nfffffn"
- /* 5 */ "ooooooo"
- /* 6 */ "......."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "jjjjjjj"
- /* 3 */ "fffffff"
- /* 4 */ "ooooooo"
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse5x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse7x5:
- // The data has been exported from the gallery Plains, area index 40, ID 91, created by xoft
- {
- // Size:
- 9, 7, 7, // SizeX = 9, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 9, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64:12\n" /* wooddoorblock */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 7\n" /* woodstairs */
- "l: 50: 3\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 53: 6\n" /* woodstairs */
- "o: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmaaammm"
- /* 1 */ "maaaaaaam"
- /* 2 */ "maaaaaaam"
- /* 3 */ "maaaaaaam"
- /* 4 */ "maaaaaaam"
- /* 5 */ "maaaaaaam"
- /* 6 */ "mmmmmmmmm"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "...bcd..."
- /* 1 */ ".aaaaaaa."
- /* 2 */ ".aaaaaaa."
- /* 3 */ ".aaaaaaa."
- /* 4 */ ".aaaaaaa."
- /* 5 */ ".aaaaaaa."
- /* 6 */ "........."
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".effgffe."
- /* 2 */ ".f.....f."
- /* 3 */ ".f.....f."
- /* 4 */ ".f.....f."
- /* 5 */ ".efffffe."
- /* 6 */ "........."
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".ehfifhe."
- /* 2 */ ".h.....h."
- /* 3 */ ".h.....h."
- /* 4 */ ".h.....h."
- /* 5 */ ".ehhfhhe."
- /* 6 */ "........."
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "jjjjjjjjj"
- /* 1 */ "kefffffek"
- /* 2 */ ".f.l.l.f."
- /* 3 */ ".f.....f."
- /* 4 */ ".f.....f."
- /* 5 */ "nefffffen"
- /* 6 */ "ooooooooo"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "jjjjjjjjj"
- /* 2 */ "kfffffffk"
- /* 3 */ ".f.....f."
- /* 4 */ "nfffffffn"
- /* 5 */ "ooooooooo"
- /* 6 */ "........."
-
- // Level 6
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "........."
- /* 2 */ "jjjjjjjjj"
- /* 3 */ "fffffffff"
- /* 4 */ "ooooooooo"
- /* 5 */ "........."
- /* 6 */ ".........",
-
- // Connectors:
- "-1: 4, 1, -1: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse7x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse9x5:
- // The data has been exported from the gallery Plains, area index 41, ID 92, created by xoft
- {
- // Size:
- 11, 7, 7, // SizeX = 11, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 11, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 3\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64: 8\n" /* wooddoorblock */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 7\n" /* woodstairs */
- "l: 50: 3\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 53: 6\n" /* woodstairs */
- "o: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".efffgfffe."
- /* 2 */ ".f.......f."
- /* 3 */ ".f.......f."
- /* 4 */ ".f.......f."
- /* 5 */ ".efffffffe."
- /* 6 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".ehhfifhhe."
- /* 2 */ ".h.......h."
- /* 3 */ ".h.......h."
- /* 4 */ ".h.......h."
- /* 5 */ ".ehhhfhhhe."
- /* 6 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "jjjjjjjjjjj"
- /* 1 */ "kfffffffffk"
- /* 2 */ ".f..l.l.ff."
- /* 3 */ ".f......ff."
- /* 4 */ ".f......ff."
- /* 5 */ "nfffffffffn"
- /* 6 */ "ooooooooooo"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "jjjjjjjjjjj"
- /* 2 */ "kfffffffffk"
- /* 3 */ ".fffffffff."
- /* 4 */ "nfffffffffn"
- /* 5 */ "ooooooooooo"
- /* 6 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "jjjjjjjjjjj"
- /* 3 */ "fffffffffff"
- /* 4 */ "ooooooooooo"
- /* 5 */ "..........."
- /* 6 */ "...........",
-
- // Connectors:
- "-1: 5, 1, -1: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse9x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse9x5Fence:
- // The data has been exported from the gallery Plains, area index 9, ID 26, created by Aloe_vera
- {
- // Size:
- 10, 7, 11, // SizeX = 10, SizeY = 7, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- 0, -1, -1, // MinX, MinY, MinZ
- 10, 6, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 3: 0\n" /* dirt */
- "c: 5: 0\n" /* wood */
- "d: 2: 0\n" /* grass */
- "e: 67: 2\n" /* stairs */
- "f: 43: 0\n" /* doubleslab */
- "g: 67: 0\n" /* stairs */
- "h: 67: 3\n" /* stairs */
- "i: 17: 0\n" /* tree */
- "j: 53: 1\n" /* woodstairs */
- "k: 85: 0\n" /* fence */
- "l: 53: 0\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 64: 2\n" /* wooddoorblock */
- "o: 64: 4\n" /* wooddoorblock */
- "p:102: 0\n" /* glasspane */
- "q: 72: 0\n" /* woodplate */
- "r: 64: 8\n" /* wooddoorblock */
- "s: 64:12\n" /* wooddoorblock */
- "t: 53: 5\n" /* woodstairs */
- "u: 53: 4\n" /* woodstairs */
- "v: 50: 1\n" /* torch */
- "w: 50: 2\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "mmmmmmmmmm"
- /* 1 */ "maaaaammmm"
- /* 2 */ "maaaaammmm"
- /* 3 */ "maaaaabbbb"
- /* 4 */ "aaaaaabbbb"
- /* 5 */ "aaaaaabbbb"
- /* 6 */ "aaaaaabbbb"
- /* 7 */ "maaaaabbbb"
- /* 8 */ "maaaaabbbb"
- /* 9 */ "maaaaammmm"
- /* 10 */ "mmmmmmmmmm"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "......mmmm"
- /* 1 */ ".aaaaammmm"
- /* 2 */ ".acccammmm"
- /* 3 */ ".acccadddd"
- /* 4 */ "eafffadddd"
- /* 5 */ "gaffffdddd"
- /* 6 */ "hafffadddd"
- /* 7 */ ".afffadddd"
- /* 8 */ ".afffadddd"
- /* 9 */ ".aaaaammmm"
- /* 10 */ "......mmmm"
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "......mmmm"
- /* 1 */ ".icccimmmm"
- /* 2 */ ".cjklcmmmm"
- /* 3 */ ".c...ckkkk"
- /* 4 */ ".c...c...k"
- /* 5 */ ".n...o...k"
- /* 6 */ ".c...c...k"
- /* 7 */ ".cff.c...k"
- /* 8 */ ".c...ckkkk"
- /* 9 */ ".icccimmmm"
- /* 10 */ "......mmmm"
-
- // Level 3
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "......mmmm"
- /* 1 */ ".ipppimmmm"
- /* 2 */ ".p.q.pmmmm"
- /* 3 */ ".p...p...."
- /* 4 */ ".c...c...."
- /* 5 */ ".r...s...."
- /* 6 */ ".c...c...."
- /* 7 */ ".p...p...."
- /* 8 */ ".p...p...."
- /* 9 */ ".ipppimmmm"
- /* 10 */ "......mmmm"
-
- // Level 4
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "lt...ujmmm"
- /* 1 */ "licccijmmm"
- /* 2 */ "lc...cjmmm"
- /* 3 */ "lc...cj..."
- /* 4 */ "lcv.wcj..."
- /* 5 */ "lc...cj..."
- /* 6 */ "lcv.wcj..."
- /* 7 */ "lc...cj..."
- /* 8 */ "lc...cj..."
- /* 9 */ "licccijmmm"
- /* 10 */ "lt...ujmmm"
-
- // Level 5
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".lt.uj.mmm"
- /* 1 */ ".lcccj.mmm"
- /* 2 */ ".lc.cj.mmm"
- /* 3 */ ".lc.cj...."
- /* 4 */ ".lc.cj...."
- /* 5 */ ".lc.cj...."
- /* 6 */ ".lc.cj...."
- /* 7 */ ".lc.cj...."
- /* 8 */ ".lc.cj...."
- /* 9 */ ".lcccj.mmm"
- /* 10 */ ".lt.uj.mmm"
-
- // Level 6
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "..lcj..mmm"
- /* 1 */ "..lcj..mmm"
- /* 2 */ "..lcj..mmm"
- /* 3 */ "..lcj....."
- /* 4 */ "..lcj....."
- /* 5 */ "..lcj....."
- /* 6 */ "..lcj....."
- /* 7 */ "..lcj....."
- /* 8 */ "..lcj....."
- /* 9 */ "..lcj..mmm"
- /* 10 */ "..lcj..mmm",
-
- // Connectors:
- "-1: 0, 1, 5: 4\n" /* Type -1, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse9x5Fence
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse9x5Library:
- // The data has been exported from the gallery Plains, area index 46, ID 97, created by Aloe_vera
- {
- // Size:
- 11, 7, 7, // SizeX = 11, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 11, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h: 53: 3\n" /* woodstairs */
- "i: 85: 0\n" /* fence */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 1\n" /* woodstairs */
- "l: 53: 0\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n:102: 0\n" /* glasspane */
- "o: 64:12\n" /* wooddoorblock */
- "p: 50: 3\n" /* torch */
- "q: 72: 0\n" /* woodplate */
- "r: 53: 7\n" /* woodstairs */
- "s: 47: 0\n" /* bookshelf */
- "t: 50: 1\n" /* torch */
- "u: 50: 2\n" /* torch */
- "v: 53: 6\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".efffgfffe."
- /* 2 */ ".fh.....hf."
- /* 3 */ ".fi.....if."
- /* 4 */ ".fj.kil.jf."
- /* 5 */ ".efffffffe."
- /* 6 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".ennfofnne."
- /* 2 */ ".n..p.p..n."
- /* 3 */ ".nq.....qn."
- /* 4 */ ".n...q...n."
- /* 5 */ ".ennnfnnne."
- /* 6 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "jjjjjjjjjjj"
- /* 1 */ "rfffffffffr"
- /* 2 */ ".fsssssssf."
- /* 3 */ ".ft.....uf."
- /* 4 */ ".fsssssssf."
- /* 5 */ "vfffffffffv"
- /* 6 */ "hhhhhhhhhhh"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "jjjjjjjjjjj"
- /* 2 */ "rfffffffffr"
- /* 3 */ ".f.......f."
- /* 4 */ "vfffffffffv"
- /* 5 */ "hhhhhhhhhhh"
- /* 6 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "jjjjjjjjjjj"
- /* 3 */ "fffffffffff"
- /* 4 */ "hhhhhhhhhhh"
- /* 5 */ "..........."
- /* 6 */ "...........",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse9x5Library
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse9x7:
- // The data has been exported from the gallery Plains, area index 52, ID 103, created by Aloe_vera
- {
- // Size:
- 11, 8, 9, // SizeX = 11, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 11, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64:12\n" /* wooddoorblock */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 7\n" /* woodstairs */
- "l: 50: 3\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 50: 4\n" /* torch */
- "o: 53: 6\n" /* woodstairs */
- "p: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "maaaaaaaaam"
- /* 7 */ "maaaaaaaaam"
- /* 8 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ ".aaaaaaaaa."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".efffgfffe."
- /* 2 */ ".f.......f."
- /* 3 */ ".f.......f."
- /* 4 */ ".f.......f."
- /* 5 */ ".f.......f."
- /* 6 */ ".f.......f."
- /* 7 */ ".efffffffe."
- /* 8 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".ehhfifhhe."
- /* 2 */ ".h.......h."
- /* 3 */ ".h.......h."
- /* 4 */ ".f.......f."
- /* 5 */ ".h.......h."
- /* 6 */ ".h.......h."
- /* 7 */ ".ehhhfhhhe."
- /* 8 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "jjjjjjjjjjj"
- /* 1 */ "kfffffffffk"
- /* 2 */ ".f..l.l..f."
- /* 3 */ ".f.......f."
- /* 4 */ ".f.......f."
- /* 5 */ ".f.......f."
- /* 6 */ ".f...n...f."
- /* 7 */ "offfffffffo"
- /* 8 */ "ppppppppppp"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "jjjjjjjjjjj"
- /* 2 */ "kfffffffffk"
- /* 3 */ ".f.......f."
- /* 4 */ ".f.......f."
- /* 5 */ ".f.......f."
- /* 6 */ "offfffffffo"
- /* 7 */ "ppppppppppp"
- /* 8 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "jjjjjjjjjjj"
- /* 3 */ "kfffffffffk"
- /* 4 */ ".f.......f."
- /* 5 */ "offfffffffo"
- /* 6 */ "ppppppppppp"
- /* 7 */ "..........."
- /* 8 */ "..........."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "jjjjjjjjjjj"
- /* 4 */ "fffffffffff"
- /* 5 */ "ppppppppppp"
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "...........",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse9x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse9x7Butcher:
- // The data has been exported from the gallery Plains, area index 48, ID 99, created by Aloe_vera
- {
- // Size:
- 11, 9, 13, // SizeX = 11, SizeY = 9, SizeZ = 13
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 8, 13, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 3: 0\n" /* dirt */
- "b: 2: 0\n" /* grass */
- "c: 4: 0\n" /* cobblestone */
- "d: 67: 0\n" /* stairs */
- "e: 67: 2\n" /* stairs */
- "f: 67: 1\n" /* stairs */
- "g: 43: 0\n" /* doubleslab */
- "h: 17: 0\n" /* tree */
- "i: 5: 0\n" /* wood */
- "j: 64: 7\n" /* wooddoorblock */
- "k: 53: 3\n" /* woodstairs */
- "l: 85: 0\n" /* fence */
- "m: 19: 0\n" /* sponge */
- "n: 53: 2\n" /* woodstairs */
- "o:102: 0\n" /* glasspane */
- "p: 64:12\n" /* wooddoorblock */
- "q: 72: 0\n" /* woodplate */
- "r: 53: 7\n" /* woodstairs */
- "s: 50: 1\n" /* torch */
- "t: 50: 2\n" /* torch */
- "u: 53: 6\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "aaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaab"
- /* 5 */ "baaaaaaaaab"
- /* 6 */ "aaaaaaaaaaa"
- /* 7 */ "baaaaaaaaaa"
- /* 8 */ "baaaaaaaaaa"
- /* 9 */ "baaaaaaaaab"
- /* 10 */ "aaaaaaaaaaa"
- /* 11 */ "aaaaaaaaaba"
- /* 12 */ "aaaaaaaaaba"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmcccmmmm"
- /* 1 */ "mcccccccccm"
- /* 2 */ "mcccccccccm"
- /* 3 */ "mcccccccccm"
- /* 4 */ "mcccccccccm"
- /* 5 */ "mcccccccccm"
- /* 6 */ "mcccccccccm"
- /* 7 */ "mcccccccccm"
- /* 8 */ "mmaaaaaaamm"
- /* 9 */ "mmaaaaaaamm"
- /* 10 */ "mmaaaaaaamm"
- /* 11 */ "mmaaaaaaamm"
- /* 12 */ "mmaaaaaaamm"
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....def...."
- /* 1 */ ".ccccccccc."
- /* 2 */ ".cggggcccc."
- /* 3 */ ".cggggcccc."
- /* 4 */ ".cggggcccc."
- /* 5 */ ".cggggcccc."
- /* 6 */ ".cggggcccc."
- /* 7 */ ".ccccccccc."
- /* 8 */ "..bbbbbbb.."
- /* 9 */ "mmbbbbbbbmm"
- /* 10 */ "mmbbbbbbbmm"
- /* 11 */ "mmbbbbbbbmm"
- /* 12 */ "mmbbbbbbbmm"
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".hiiijiiih."
- /* 2 */ ".i.g....ki."
- /* 3 */ ".i.g....li."
- /* 4 */ ".i.g....ni."
- /* 5 */ ".i.......i."
- /* 6 */ ".i.......i."
- /* 7 */ ".hiiijiiih."
- /* 8 */ "..l.....l.."
- /* 9 */ "mml.....lmm"
- /* 10 */ "mml.....lmm"
- /* 11 */ "mml.....lmm"
- /* 12 */ "mmlllllllmm"
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".hooipiooh."
- /* 2 */ ".o.......o."
- /* 3 */ ".o......qo."
- /* 4 */ ".i.......i."
- /* 5 */ ".o.......o."
- /* 6 */ ".o.......o."
- /* 7 */ ".hooipiooh."
- /* 8 */ "..........."
- /* 9 */ "mm.......mm"
- /* 10 */ "mm.......mm"
- /* 11 */ "mm.......mm"
- /* 12 */ "mm.......mm"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "nnnnnnnnnnn"
- /* 1 */ "riiiiiiiiir"
- /* 2 */ ".i.......i."
- /* 3 */ ".i.......i."
- /* 4 */ ".is.....ti."
- /* 5 */ ".i.......i."
- /* 6 */ ".i.......i."
- /* 7 */ "uiiiiiiiiiu"
- /* 8 */ "kkkkkkkkkkk"
- /* 9 */ "mm.......mm"
- /* 10 */ "mm.......mm"
- /* 11 */ "mm.......mm"
- /* 12 */ "mm.......mm"
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "nnnnnnnnnnn"
- /* 2 */ "riiiiiiiiir"
- /* 3 */ ".i.......i."
- /* 4 */ ".i.......i."
- /* 5 */ ".i.......i."
- /* 6 */ "uiiiiiiiiiu"
- /* 7 */ "kkkkkkkkkkk"
- /* 8 */ "..........."
- /* 9 */ "mm.......mm"
- /* 10 */ "mm.......mm"
- /* 11 */ "mm.......mm"
- /* 12 */ "mm.......mm"
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "nnnnnnnnnnn"
- /* 3 */ "riiiiiiiiir"
- /* 4 */ ".i.......i."
- /* 5 */ "uiiiiiiiiiu"
- /* 6 */ "kkkkkkkkkkk"
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "mm.......mm"
- /* 10 */ "mm.......mm"
- /* 11 */ "mm.......mm"
- /* 12 */ "mm.......mm"
-
- // Level 8
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "nnnnnnnnnnn"
- /* 4 */ "iiiiiiiiiii"
- /* 5 */ "kkkkkkkkkkk"
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "..........."
- /* 9 */ "mm.......mm"
- /* 10 */ "mm.......mm"
- /* 11 */ "mm.......mm"
- /* 12 */ "mm.......mm",
-
- // Connectors:
- "-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse9x7Butcher
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouse9x7DoubleDoor:
- // The data has been exported from the gallery Plains, area index 38, ID 87, created by Aloe_vera
- {
- // Size:
- 11, 8, 9, // SizeX = 11, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 11, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 67: 3\n" /* stairs */
- "f: 17: 0\n" /* tree */
- "g: 5: 0\n" /* wood */
- "h: 64: 7\n" /* wooddoorblock */
- "i:102: 0\n" /* glasspane */
- "j: 64:12\n" /* wooddoorblock */
- "k: 53: 2\n" /* woodstairs */
- "l: 53: 7\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 17: 4\n" /* tree */
- "o: 17: 8\n" /* tree */
- "p: 50: 3\n" /* torch */
- "q: 50: 4\n" /* torch */
- "r: 53: 6\n" /* woodstairs */
- "s: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "maaaaaaaaam"
- /* 7 */ "maaaaaaaaam"
- /* 8 */ "mmmmaaammmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ ".aaaaaaaaa."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "....bed...."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".fggfhfggf."
- /* 2 */ ".g.......g."
- /* 3 */ ".g.......g."
- /* 4 */ ".f.......f."
- /* 5 */ ".g.......g."
- /* 6 */ ".g.......g."
- /* 7 */ ".fggfhfggf."
- /* 8 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".fiifjfiif."
- /* 2 */ ".i.......i."
- /* 3 */ ".i.......i."
- /* 4 */ ".f.......f."
- /* 5 */ ".i.......i."
- /* 6 */ ".i.......i."
- /* 7 */ ".fiifjfiif."
- /* 8 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "kkkkkkkkkkk"
- /* 1 */ "lfnnnnnnnfl"
- /* 2 */ ".o..p.p..o."
- /* 3 */ ".o.......o."
- /* 4 */ ".o.......o."
- /* 5 */ ".o.......o."
- /* 6 */ ".o..q.q..o."
- /* 7 */ "rfnnnnnnnfr"
- /* 8 */ "sssssssssss"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "kkkkkkkkkkk"
- /* 2 */ "lgggggggggl"
- /* 3 */ ".g.......g."
- /* 4 */ ".g.......g."
- /* 5 */ ".g.......g."
- /* 6 */ "rgggggggggr"
- /* 7 */ "sssssssssss"
- /* 8 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "kkkkkkkkkkk"
- /* 3 */ "lgggggggggl"
- /* 4 */ ".g.......g."
- /* 5 */ "rgggggggggr"
- /* 6 */ "sssssssssss"
- /* 7 */ "..........."
- /* 8 */ "..........."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "kkkkkkkkkkk"
- /* 4 */ "ggggggggggg"
- /* 5 */ "sssssssssss"
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "...........",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouse9x7DoubleDoor
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouseL13x14:
- // The data has been exported from the gallery Plains, area index 39, ID 90, created by STR_Warrior
- {
- // Size:
- 15, 9, 16, // SizeX = 15, SizeY = 9, SizeZ = 16
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 15, 8, 16, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "A: 53: 7\n" /* woodstairs */
- "B: 53: 4\n" /* woodstairs */
- "C: 53: 5\n" /* woodstairs */
- "D: 53: 6\n" /* woodstairs */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 43: 0\n" /* doubleslab */
- "f: 17: 0\n" /* tree */
- "g: 5: 0\n" /* wood */
- "h: 64: 7\n" /* wooddoorblock */
- "i: 96: 8\n" /* trapdoor */
- "j: 61: 2\n" /* furnace */
- "k: 53: 3\n" /* woodstairs */
- "l: 85: 0\n" /* fence */
- "m: 19: 0\n" /* sponge */
- "n: 53: 2\n" /* woodstairs */
- "o: 53: 1\n" /* woodstairs */
- "p: 53: 0\n" /* woodstairs */
- "q: 47: 0\n" /* bookshelf */
- "r:102: 0\n" /* glasspane */
- "s: 64:12\n" /* wooddoorblock */
- "t: 72: 0\n" /* woodplate */
- "u: 17: 4\n" /* tree */
- "v: 17: 8\n" /* tree */
- "w: 50: 3\n" /* torch */
- "x: 50: 1\n" /* torch */
- "y: 50: 4\n" /* torch */
- "z: 50: 2\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmmmaaammmmmm"
- /* 1 */ "maaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaaam"
- /* 8 */ "mmmmmmmmaaaaaam"
- /* 9 */ "mmmmmmmmaaaaaam"
- /* 10 */ "mmmmmmmmaaaaaam"
- /* 11 */ "mmmmmmmmaaaaaam"
- /* 12 */ "mmmmmmmmaaaaaam"
- /* 13 */ "mmmmmmmmaaaaaam"
- /* 14 */ "mmmmmmmmaaaaaam"
- /* 15 */ "mmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "......bcd......"
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".aeeeeaaaaaaaa."
- /* 3 */ ".aeeeeaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaaaa."
- /* 8 */ "........aaaaaa."
- /* 9 */ "mmmmmmm.aaaaaa."
- /* 10 */ "mmmmmmm.aaaaaa."
- /* 11 */ "mmmmmmm.aaaaaa."
- /* 12 */ "mmmmmmm.aaaaaa."
- /* 13 */ "mmmmmmm.aaaaaa."
- /* 14 */ "mmmmmmm.aaaaaa."
- /* 15 */ "mmmmmmm........"
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".fggggfhfggggf."
- /* 2 */ ".g...i.......g."
- /* 3 */ ".gjeee......kg."
- /* 4 */ ".f..........lg."
- /* 5 */ ".g..........ng."
- /* 6 */ ".g.olp..ol...g."
- /* 7 */ ".fggggggfn...f."
- /* 8 */ "........g....g."
- /* 9 */ "mmmmmmm.gk...g."
- /* 10 */ "mmmmmmm.gl..kg."
- /* 11 */ "mmmmmmm.gn..lg."
- /* 12 */ "mmmmmmm.g...ng."
- /* 13 */ "mmmmmmm.gq..qg."
- /* 14 */ "mmmmmmm.fggggf."
- /* 15 */ "mmmmmmm........"
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".fgrrgfsfgrrgf."
- /* 2 */ ".g...........g."
- /* 3 */ ".g...........r."
- /* 4 */ ".f..........tr."
- /* 5 */ ".g...........r."
- /* 6 */ ".g..t....t...g."
- /* 7 */ ".fgrrrrgf....f."
- /* 8 */ "........g....g."
- /* 9 */ "mmmmmmm.r....r."
- /* 10 */ "mmmmmmm.rt...r."
- /* 11 */ "mmmmmmm.r...tr."
- /* 12 */ "mmmmmmm.r....r."
- /* 13 */ "mmmmmmm.gq..qg."
- /* 14 */ "mmmmmmm.fgrrgf."
- /* 15 */ "mmmmmmm........"
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".fuuuuuuuuuuuf."
- /* 2 */ ".v....w.w....v."
- /* 3 */ ".v...........v."
- /* 4 */ ".vx..........v."
- /* 5 */ ".v...........v."
- /* 6 */ ".v......y....v."
- /* 7 */ ".fuuuuuufx..zv."
- /* 8 */ "........v....v."
- /* 9 */ "mmmmmmm.v....v."
- /* 10 */ "mmmmmmm.v....v."
- /* 11 */ "mmmmmmm.v....v."
- /* 12 */ "mmmmmmm.v....v."
- /* 13 */ "mmmmmmm.v.yy.v."
- /* 14 */ "mmmmmmm.fuuuuf."
- /* 15 */ "mmmmmmm........"
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "nnnnnnnnnnnnnno"
- /* 1 */ "pgggggggggggggo"
- /* 2 */ "pgAAAAAAAAAABgo"
- /* 3 */ "pgC.........Bgo"
- /* 4 */ "pgC.........Bgo"
- /* 5 */ "pgC.........Bgo"
- /* 6 */ "pgCDDDDDDD..Bgo"
- /* 7 */ "pggggggggC..Bgo"
- /* 8 */ "pkkkkkkpgC..Bgo"
- /* 9 */ "mmmmmmmpgC..Bgo"
- /* 10 */ "mmmmmmmpgC..Bgo"
- /* 11 */ "mmmmmmmpgC..Bgo"
- /* 12 */ "mmmmmmmpgC..Bgo"
- /* 13 */ "mmmmmmmpgCDDBgo"
- /* 14 */ "mmmmmmmpggggggo"
- /* 15 */ "mmmmmmmpkkkkkkk"
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".pnnnnnnnnnnno."
- /* 2 */ ".pgggggggggggo."
- /* 3 */ ".pgggggggggggo."
- /* 4 */ ".pgggggggggggo."
- /* 5 */ ".pgggggggggggo."
- /* 6 */ ".pgggggggggggo."
- /* 7 */ ".pkkkkkkkggggo."
- /* 8 */ "........pggggo."
- /* 9 */ "mmmmmmm.pggggo."
- /* 10 */ "mmmmmmm.pggggo."
- /* 11 */ "mmmmmmm.pggggo."
- /* 12 */ "mmmmmmm.pggggo."
- /* 13 */ "mmmmmmm.pggggo."
- /* 14 */ "mmmmmmm.kkkkko."
- /* 15 */ "mmmmmmm........"
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..nnnnnnnnnnn.."
- /* 3 */ "..pgggggggggo.."
- /* 4 */ "..pgggggggggo.."
- /* 5 */ "..pgggggggggo.."
- /* 6 */ "..kkkkkkkkggo.."
- /* 7 */ ".........pggo.."
- /* 8 */ ".........pggo.."
- /* 9 */ "mmmmmmm..pggo.."
- /* 10 */ "mmmmmmm..pggo.."
- /* 11 */ "mmmmmmm..pggo.."
- /* 12 */ "mmmmmmm..pggo.."
- /* 13 */ "mmmmmmm..kkko.."
- /* 14 */ "mmmmmmm........"
- /* 15 */ "mmmmmmm........"
-
- // Level 8
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "...pnnnnnnno..."
- /* 4 */ "...pgggggggo..."
- /* 5 */ "...pkkkkkkpo..."
- /* 6 */ "..........po..."
- /* 7 */ "..........po..."
- /* 8 */ "..........po..."
- /* 9 */ "mmmmmmm...po..."
- /* 10 */ "mmmmmmm...po..."
- /* 11 */ "mmmmmmm...po..."
- /* 12 */ "mmmmmmm...pk..."
- /* 13 */ "mmmmmmm........"
- /* 14 */ "mmmmmmm........"
- /* 15 */ "mmmmmmm........",
-
- // Connectors:
- "-1: 7, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouseL13x14
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouseL14x14:
- // The data has been exported from the gallery Plains, area index 0, ID 4, created by Aloe_vera
- {
- // Size:
- 16, 8, 16, // SizeX = 16, SizeY = 8, SizeZ = 16
-
- // Hitbox (relative to bounding box):
- -1, 1, 0, // MinX, MinY, MinZ
- 16, 7, 16, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 5: 0\n" /* wood */
- "f: 67: 3\n" /* stairs */
- "g: 17: 0\n" /* tree */
- "h: 64: 7\n" /* wooddoorblock */
- "i: 64: 5\n" /* wooddoorblock */
- "j:102: 0\n" /* glasspane */
- "k: 64:12\n" /* wooddoorblock */
- "l: 53: 2\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 53: 1\n" /* woodstairs */
- "o: 53: 7\n" /* woodstairs */
- "p: 53: 6\n" /* woodstairs */
- "q: 53: 3\n" /* woodstairs */
- "r: 53: 0\n" /* woodstairs */
- "s: 53: 5\n" /* woodstairs */
- "t: 53: 4\n" /* woodstairs */
- "u: 50: 3\n" /* torch */
- "v: 50: 2\n" /* torch */
- "w: 50: 4\n" /* torch */
- "x: 50: 1\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "mmmmmmmmaaammmmm"
- /* 1 */ "maaaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaaaam"
- /* 8 */ "mmmmmaaaaaaaaaam"
- /* 9 */ "mmmmmmmmaaaaaaam"
- /* 10 */ "mmmmmmmmaaaaaaam"
- /* 11 */ "mmmmmmmmaaaaaaam"
- /* 12 */ "mmmmmmmmaaaaaaam"
- /* 13 */ "mmmmmmmmaaaaaaam"
- /* 14 */ "mmmmmmmmaaaaaaam"
- /* 15 */ "mmmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "........bcd....."
- /* 1 */ ".aaaaaaaaaaaaaa."
- /* 2 */ ".aeeeeeeeeeeeea."
- /* 3 */ ".aeeeeeeeeeeeea."
- /* 4 */ ".aeeeeeeeeeeeea."
- /* 5 */ ".aeeeeeeeeeeeea."
- /* 6 */ ".aeeeeeeeeeeeea."
- /* 7 */ ".aaaaaaaaeeeeea."
- /* 8 */ ".....bfdaeeeeea."
- /* 9 */ "mmmm....aeeeeea."
- /* 10 */ "mmmmmmm.aeeeeea."
- /* 11 */ "mmmmmmm.aeeeeea."
- /* 12 */ "mmmmmmm.aeeeeea."
- /* 13 */ "mmmmmmm.aeeeeea."
- /* 14 */ "mmmmmmm.aaaaaaa."
- /* 15 */ "mmmmmmm........."
-
- // Level 2
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".geeeeeeghgeeeg."
- /* 2 */ ".e............e."
- /* 3 */ ".e............e."
- /* 4 */ ".e............e."
- /* 5 */ ".e............e."
- /* 6 */ ".e............e."
- /* 7 */ ".geeeeieg.....e."
- /* 8 */ "........e.....e."
- /* 9 */ "mmmm....e.....e."
- /* 10 */ "mmmmmmm.e.....e."
- /* 11 */ "mmmmmmm.e.....e."
- /* 12 */ "mmmmmmm.e.....e."
- /* 13 */ "mmmmmmm.e.....e."
- /* 14 */ "mmmmmmm.geeeeeg."
- /* 15 */ "mmmmmmm........."
-
- // Level 3
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".gejjejjgkgjjeg."
- /* 2 */ ".j............e."
- /* 3 */ ".j............j."
- /* 4 */ ".j............j."
- /* 5 */ ".j............e."
- /* 6 */ ".j............j."
- /* 7 */ ".gejjekeg.....j."
- /* 8 */ "........e.....e."
- /* 9 */ "mmmm....j.....j."
- /* 10 */ "mmmmmmm.j.....j."
- /* 11 */ "mmmmmmm.e.....e."
- /* 12 */ "mmmmmmm.j.....j."
- /* 13 */ "mmmmmmm.j.....j."
- /* 14 */ "mmmmmmm.gjjjjjg."
- /* 15 */ "mmmmmmm........."
-
- // Level 4
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "llllllllllllllln"
- /* 1 */ "ogeeeeeegegeeegn"
- /* 2 */ ".e............en"
- /* 3 */ ".e............en"
- /* 4 */ ".e............en"
- /* 5 */ ".e............en"
- /* 6 */ ".e............en"
- /* 7 */ "pgeeeeeeg.....en"
- /* 8 */ "qqqqqqqre.....en"
- /* 9 */ "mmmm...re.....en"
- /* 10 */ "mmmmmmmre.....en"
- /* 11 */ "mmmmmmmre.....en"
- /* 12 */ "mmmmmmmre.....en"
- /* 13 */ "mmmmmmmre.....en"
- /* 14 */ "mmmmmmmrgeeeeegn"
- /* 15 */ "mmmmmmmrs.....tn"
-
- // Level 5
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "lllllllllllllll."
- /* 2 */ "oeeeeeeeeeeeeen."
- /* 3 */ ".e.........u.en."
- /* 4 */ ".e..........ven."
- /* 5 */ ".e......w....en."
- /* 6 */ "peeeeeeeee...en."
- /* 7 */ "qqqqqqqqrex..en."
- /* 8 */ "........re...en."
- /* 9 */ "mmmm....re...en."
- /* 10 */ "mmmmmmm.re...en."
- /* 11 */ "mmmmmmm.re...en."
- /* 12 */ "mmmmmmm.re...en."
- /* 13 */ "mmmmmmm.re...en."
- /* 14 */ "mmmmmmm.reeeeen."
- /* 15 */ "mmmmmmm.rs...tn."
-
- // Level 6
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "llllllllllllln.."
- /* 3 */ "oeeeeeeeeeeeen.."
- /* 4 */ ".ex.........en.."
- /* 5 */ "peeeeeeeeee.en.."
- /* 6 */ "qqqqqqqqqre.en.."
- /* 7 */ ".........re.en.."
- /* 8 */ ".........re.en.."
- /* 9 */ "mmmm.....re.en.."
- /* 10 */ "mmmmmmm..re.en.."
- /* 11 */ "mmmmmmm..re.en.."
- /* 12 */ "mmmmmmm..re.en.."
- /* 13 */ "mmmmmmm..rewen.."
- /* 14 */ "mmmmmmm..reeen.."
- /* 15 */ "mmmmmmm..rs.tn.."
-
- // Level 7
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "lllllllllllll..."
- /* 4 */ "eeeeeeeeeeeen..."
- /* 5 */ "qqqqqqqqqqren..."
- /* 6 */ "..........ren..."
- /* 7 */ "..........ren..."
- /* 8 */ "..........ren..."
- /* 9 */ "mmmm......ren..."
- /* 10 */ "mmmmmmm...ren..."
- /* 11 */ "mmmmmmm...ren..."
- /* 12 */ "mmmmmmm...ren..."
- /* 13 */ "mmmmmmm...ren..."
- /* 14 */ "mmmmmmm...ren..."
- /* 15 */ "mmmmmmm...ren...",
-
- // Connectors:
- "-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouseL14x14
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouseL9x9:
- // The data has been exported from the gallery Plains, area index 42, ID 93, created by xoft
- {
- // Size:
- 11, 7, 11, // SizeX = 11, SizeY = 7, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 11, 6, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64:12\n" /* wooddoorblock */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 7\n" /* woodstairs */
- "l: 53: 1\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 50: 3\n" /* torch */
- "o: 50: 4\n" /* torch */
- "p: 53: 6\n" /* woodstairs */
- "q: 50: 1\n" /* torch */
- "r: 50: 2\n" /* torch */
- "s: 53: 3\n" /* woodstairs */
- "t: 53: 0\n" /* woodstairs */
- "u: 53: 5\n" /* woodstairs */
- "v: 53: 4\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "mmmmmaaaaam"
- /* 7 */ "mmmmmaaaaam"
- /* 8 */ "mmmmmaaaaam"
- /* 9 */ "mmmmmaaaaam"
- /* 10 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ ".....aaaaa."
- /* 7 */ "mmmm.aaaaa."
- /* 8 */ "mmmm.aaaaa."
- /* 9 */ "mmmm.aaaaa."
- /* 10 */ "mmmm......."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".efffgfffe."
- /* 2 */ ".f.......f."
- /* 3 */ ".f.......f."
- /* 4 */ ".f.......f."
- /* 5 */ ".efffe...f."
- /* 6 */ ".....f...f."
- /* 7 */ "mmmm.f...f."
- /* 8 */ "mmmm.f...f."
- /* 9 */ "mmmm.efffe."
- /* 10 */ "mmmm......."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".ehhfifhhe."
- /* 2 */ ".h.......h."
- /* 3 */ ".h.......h."
- /* 4 */ ".h.......h."
- /* 5 */ ".ehhhe...f."
- /* 6 */ ".....h...h."
- /* 7 */ "mmmm.h...h."
- /* 8 */ "mmmm.h...h."
- /* 9 */ "mmmm.ehhhe."
- /* 10 */ "mmmm......."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "jjjjjjjjjjj"
- /* 1 */ "kfffffffffl"
- /* 2 */ ".f..n.n..fl"
- /* 3 */ ".f.......fl"
- /* 4 */ ".f...o...fl"
- /* 5 */ "pfffffq.rfl"
- /* 6 */ "sssssf...fl"
- /* 7 */ "mmmmtf...fl"
- /* 8 */ "mmmmtf...fl"
- /* 9 */ "mmmmtfffffl"
- /* 10 */ "mmmmtu...vl"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "jjjjjjjjjl."
- /* 2 */ "kffffffffl."
- /* 3 */ ".f......fl."
- /* 4 */ "pffffff.fl."
- /* 5 */ "ssssssf.fl."
- /* 6 */ ".....tf.fl."
- /* 7 */ "mmmm.tf.fl."
- /* 8 */ "mmmm.tf.fl."
- /* 9 */ "mmmm.tfffl."
- /* 10 */ "mmmm.tu.vl."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "jjjjjjjjj.."
- /* 3 */ "ffffffffl.."
- /* 4 */ "sssssstfl.."
- /* 5 */ "......tfl.."
- /* 6 */ "......tfl.."
- /* 7 */ "mmmm..tfl.."
- /* 8 */ "mmmm..tfl.."
- /* 9 */ "mmmm..tfl.."
- /* 10 */ "mmmm..tfl..",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouseL9x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenHouseU13x9:
- // The data has been exported from the gallery Plains, area index 43, ID 94, created by xoft
- {
- // Size:
- 15, 7, 11, // SizeX = 15, SizeY = 7, SizeZ = 11
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 15, 6, 11, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 64: 7\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64:12\n" /* wooddoorblock */
- "j: 53: 2\n" /* woodstairs */
- "k: 53: 0\n" /* woodstairs */
- "l: 53: 1\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 50: 3\n" /* torch */
- "o: 50: 4\n" /* torch */
- "p: 50: 2\n" /* torch */
- "q: 50: 1\n" /* torch */
- "r: 53: 3\n" /* woodstairs */
- "s: 53: 5\n" /* woodstairs */
- "t: 53: 4\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmmmaaammmmmm"
- /* 1 */ "maaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaam"
- /* 6 */ "maaaaammmaaaaam"
- /* 7 */ "maaaaammmaaaaam"
- /* 8 */ "maaaaammmaaaaam"
- /* 9 */ "maaaaammmaaaaam"
- /* 10 */ "mmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "......bcd......"
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaaa."
- /* 6 */ ".aaaaa...aaaaa."
- /* 7 */ ".aaaaa...aaaaa."
- /* 8 */ ".aaaaa...aaaaa."
- /* 9 */ ".aaaaa...aaaaa."
- /* 10 */ "..............."
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".efffffgfffffe."
- /* 2 */ ".f...........f."
- /* 3 */ ".f...........f."
- /* 4 */ ".f...........f."
- /* 5 */ ".f...efffe...f."
- /* 6 */ ".f...f...f...f."
- /* 7 */ ".f...f...f...f."
- /* 8 */ ".f...f...f...f."
- /* 9 */ ".efffe...efffe."
- /* 10 */ "..............."
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".ehhhhfifhhhhe."
- /* 2 */ ".h...........h."
- /* 3 */ ".h...........h."
- /* 4 */ ".h...........h."
- /* 5 */ ".f...ehhhe...f."
- /* 6 */ ".h...h...h...h."
- /* 7 */ ".h...h...h...h."
- /* 8 */ ".h...h...h...h."
- /* 9 */ ".ehhhe...ehhhe."
- /* 10 */ "..............."
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "jjjjjjjjjjjjjjj"
- /* 1 */ "kfffffffffffffl"
- /* 2 */ "kf....n.n....fl"
- /* 3 */ "kf...........fl"
- /* 4 */ "kf...o...o...fl"
- /* 5 */ "kf..pfffffq..fl"
- /* 6 */ "kf...frrrf...fl"
- /* 7 */ "kf...fl.kf...fl"
- /* 8 */ "kf...fl.kf...fl"
- /* 9 */ "kfffffl.kfffffl"
- /* 10 */ "ks...tl.ks...tl"
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".jjjjjjjjjjjjl."
- /* 2 */ ".kfffffffffffl."
- /* 3 */ ".kfffffffffffl."
- /* 4 */ ".kfffffffffffl."
- /* 5 */ ".kffflrrrrfffl."
- /* 6 */ ".kfffl...kfffl."
- /* 7 */ ".kfffl...kfffl."
- /* 8 */ ".kfffl...kfffl."
- /* 9 */ ".kfffl...kfffl."
- /* 10 */ ".ks.tl...ks.tl."
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..kjjjjjjjjjj.."
- /* 3 */ "..kfffffffffl.."
- /* 4 */ "..kflrrrrrkfl.."
- /* 5 */ "..kfl.....kfl.."
- /* 6 */ "..kfl.....kfl.."
- /* 7 */ "..kfl.....kfl.."
- /* 8 */ "..kfl.....kfl.."
- /* 9 */ "..kfl.....kfl.."
- /* 10 */ "..kfl.....kfl..",
-
- // Connectors:
- "-1: 7, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenHouseU13x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenMill5x5:
- // The data has been exported from the gallery Plains, area index 60, ID 111, created by Aloe_vera
- {
- // Size:
- 9, 17, 13, // SizeX = 9, SizeY = 17, SizeZ = 13
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 8, 16, 12, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 2\n" /* stairs */
- "c: 67: 1\n" /* stairs */
- "d: 67: 3\n" /* stairs */
- "e: 17: 0\n" /* tree */
- "f: 5: 0\n" /* wood */
- "g: 54: 4\n" /* chest */
- "h:154: 4\n" /* hopper */
- "i: 64: 4\n" /* wooddoorblock */
- "j:102: 0\n" /* glasspane */
- "k: 85: 0\n" /* fence */
- "l: 64:12\n" /* wooddoorblock */
- "m: 19: 0\n" /* sponge */
- "n: 50: 2\n" /* torch */
- "o: 35: 0\n" /* wool */
- "p: 17: 4\n" /* tree */
- "q: 17: 8\n" /* tree */
- "r: 53: 2\n" /* woodstairs */
- "s: 53: 7\n" /* woodstairs */
- "t: 53: 6\n" /* woodstairs */
- "u: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmmmm"
- /* 1 */ "mmmmmmmmm"
- /* 2 */ "mmmmmmmmm"
- /* 3 */ "mmmmmmmmm"
- /* 4 */ "maaaaammm"
- /* 5 */ "maaaaaamm"
- /* 6 */ "maaaaaamm"
- /* 7 */ "maaaaaamm"
- /* 8 */ "maaaaammm"
- /* 9 */ "mmmmmmmmm"
- /* 10 */ "mmmmmmmmm"
- /* 11 */ "mmmmmmmmm"
- /* 12 */ "mmmmmmmmm"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".aaaaa..."
- /* 5 */ ".aaaaab.."
- /* 6 */ ".aaaaac.."
- /* 7 */ ".aaaaad.."
- /* 8 */ ".aaaaa..."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".efffe..."
- /* 5 */ ".f...f..."
- /* 6 */ ".fgh.i..."
- /* 7 */ ".f...f..."
- /* 8 */ ".efffe..."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".ejjje..."
- /* 5 */ ".j...f..."
- /* 6 */ ".j.k.l..."
- /* 7 */ ".j...f..."
- /* 8 */ ".ejjje..."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".efffe..."
- /* 5 */ ".f..nf..."
- /* 6 */ ".f.k.f..."
- /* 7 */ ".f..nf..k"
- /* 8 */ ".efffe..o"
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".epppe..."
- /* 5 */ ".q...q..."
- /* 6 */ ".q.k.q..."
- /* 7 */ ".q...q..k"
- /* 8 */ ".epppe..o"
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 6
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".efffe..."
- /* 5 */ ".f...f..."
- /* 6 */ ".f.k.f..k"
- /* 7 */ ".f...f..o"
- /* 8 */ ".efffe..o"
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 7
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ ".ejjje..."
- /* 5 */ ".j...j..."
- /* 6 */ ".j.k.j..k"
- /* 7 */ ".j...j..o"
- /* 8 */ ".ejjje..."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 8
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.o"
- /* 1 */ "mmmmmmm.o"
- /* 2 */ "mmmmmmm.o"
- /* 3 */ "........."
- /* 4 */ ".efffe..."
- /* 5 */ ".f...f..k"
- /* 6 */ ".f.k.f..o"
- /* 7 */ ".f...f..o"
- /* 8 */ ".efffe..."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 9
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.k"
- /* 1 */ "mmmmmmm.k"
- /* 2 */ "mmmmmmm.o"
- /* 3 */ "........o"
- /* 4 */ ".epppe..o"
- /* 5 */ ".q...q..k"
- /* 6 */ ".q.k.q..o"
- /* 7 */ ".q...q..k"
- /* 8 */ ".epppe..k"
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 10
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.k"
- /* 3 */ "rrrrrrr.k"
- /* 4 */ "sfffffs.o"
- /* 5 */ ".f...f..o"
- /* 6 */ ".f.kppppp"
- /* 7 */ ".f...f..o"
- /* 8 */ "tffffft.o"
- /* 9 */ "uuuuuuu.k"
- /* 10 */ "mmmmmmm.k"
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 11
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ "rrrrrrr.k"
- /* 5 */ "sfffffs.k"
- /* 6 */ ".f...f..o"
- /* 7 */ "tffffft.k"
- /* 8 */ "uuuuuuu.o"
- /* 9 */ "........o"
- /* 10 */ "mmmmmmm.o"
- /* 11 */ "mmmmmmm.k"
- /* 12 */ "mmmmmmm.k"
-
- // Level 12
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ "........."
- /* 5 */ "rrrrrrr.o"
- /* 6 */ "fffffff.o"
- /* 7 */ "uuuuuuu.k"
- /* 8 */ "........."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.o"
- /* 11 */ "mmmmmmm.o"
- /* 12 */ "mmmmmmm.o"
-
- // Level 13
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ "........."
- /* 5 */ "........o"
- /* 6 */ "........k"
- /* 7 */ "........."
- /* 8 */ "........."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 14
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ "........o"
- /* 5 */ "........o"
- /* 6 */ "........k"
- /* 7 */ "........."
- /* 8 */ "........."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 15
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ "........o"
- /* 5 */ "........k"
- /* 6 */ "........."
- /* 7 */ "........."
- /* 8 */ "........."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm.."
-
- // Level 16
- /* z\x* 012345678 */
- /* 0 */ "mmmmmmm.."
- /* 1 */ "mmmmmmm.."
- /* 2 */ "mmmmmmm.."
- /* 3 */ "........."
- /* 4 */ "........o"
- /* 5 */ "........k"
- /* 6 */ "........."
- /* 7 */ "........."
- /* 8 */ "........."
- /* 9 */ "........."
- /* 10 */ "mmmmmmm.."
- /* 11 */ "mmmmmmm.."
- /* 12 */ "mmmmmmm..",
-
- // Connectors:
- "-1: 8, 1, 6: 5\n" /* Type -1, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenMill5x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // WoodenStables:
- // The data has been exported from the gallery Plains, area index 55, ID 106, created by Aloe_vera
- {
- // Size:
- 15, 9, 9, // SizeX = 15, SizeY = 9, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, -1, 0, // MinX, MinY, MinZ
- 15, 8, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 4: 0\n" /* cobblestone */
- "b: 67: 0\n" /* stairs */
- "c: 67: 2\n" /* stairs */
- "d: 67: 1\n" /* stairs */
- "e: 3: 0\n" /* dirt */
- "f: 17: 0\n" /* tree */
- "g:107: 0\n" /* fencegate */
- "h:107: 4\n" /* fencegate */
- "i: 5: 0\n" /* wood */
- "j:107: 6\n" /* fencegate */
- "k: 85: 0\n" /* fence */
- "l:170: 0\n" /* haybale */
- "m: 19: 0\n" /* sponge */
- "n:170: 4\n" /* haybale */
- "o:170: 8\n" /* haybale */
- "p: 50: 1\n" /* torch */
- "q: 50: 2\n" /* torch */
- "r: 53: 2\n" /* woodstairs */
- "s: 53: 7\n" /* woodstairs */
- "t: 53: 6\n" /* woodstairs */
- "u: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "maaaaaaaaaaaaam"
- /* 1 */ "maaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaaam"
- /* 8 */ "mmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ ".bcccccccccccd."
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".aeeeeeeeeeeea."
- /* 3 */ ".aeeeeeeeeeeea."
- /* 4 */ ".aeeeeeeeeeeea."
- /* 5 */ ".aeeeeeeeeeeea."
- /* 6 */ ".aeeeeeeeeeeea."
- /* 7 */ ".aaaaaaaaaaaaa."
- /* 8 */ "..............."
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".fghgighgigjgf."
- /* 2 */ ".k...k...k...k."
- /* 3 */ ".k...k...k...k."
- /* 4 */ ".k...k...k...k."
- /* 5 */ ".k...k...k...k."
- /* 6 */ ".kl..k..nko..k."
- /* 7 */ ".fkkkikkkikkkf."
- /* 8 */ "..............."
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".f...i...i...f."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ ".f...i...i...f."
- /* 8 */ "..............."
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".fp.qip.qip.qf."
- /* 2 */ "..............."
- /* 3 */ "..............."
- /* 4 */ "..............."
- /* 5 */ "..............."
- /* 6 */ "..............."
- /* 7 */ ".f...i...i...f."
- /* 8 */ "..............."
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "rrrrrrrrrrrrrrr"
- /* 1 */ "siiiiiiiiiiiiis"
- /* 2 */ ".i...........i."
- /* 3 */ ".i...........i."
- /* 4 */ ".i...........i."
- /* 5 */ ".i...........i."
- /* 6 */ ".i...........i."
- /* 7 */ "tiiiiiiiiiiiiit"
- /* 8 */ "uuuuuuuuuuuuuuu"
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "rrrrrrrrrrrrrrr"
- /* 2 */ "siiiiiiiiiiiiis"
- /* 3 */ ".i...........i."
- /* 4 */ ".i...........i."
- /* 5 */ ".i...........i."
- /* 6 */ "tiiiiiiiiiiiiit"
- /* 7 */ "uuuuuuuuuuuuuuu"
- /* 8 */ "..............."
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "rrrrrrrrrrrrrrr"
- /* 3 */ "siiiiiiiiiiiiis"
- /* 4 */ ".i...........i."
- /* 5 */ "tiiiiiiiiiiiiit"
- /* 6 */ "uuuuuuuuuuuuuuu"
- /* 7 */ "..............."
- /* 8 */ "..............."
-
- // Level 8
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "rrrrrrrrrrrrrrr"
- /* 4 */ "iiiiiiiiiiiiiii"
- /* 5 */ "uuuuuuuuuuuuuuu"
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "...............",
-
- // Connectors:
- "-1: 7, 1, -1: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // WoodenStables
-}; // g_PlainsVillagePrefabs
-
-
-
-
-
-
-const cPrefab::sDef g_PlainsVillageStartingPrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // CobbleWell4x4:
- // The data has been exported from the gallery Plains, area index 1, ID 5, created by Aloe_vera
- {
- // Size:
- 4, 13, 4, // SizeX = 4, SizeY = 13, SizeZ = 4
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 3, 12, 3, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 4: 0\n" /* cobblestone */
- "c: 8: 0\n" /* water */
- "d: 85: 0\n" /* fence */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123 */
- /* 0 */ "aaaa"
- /* 1 */ "aaaa"
- /* 2 */ "aaaa"
- /* 3 */ "aaaa"
-
- // Level 1
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 2
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 3
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 4
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 5
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 6
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 7
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 8
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 9
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "b..b"
- /* 2 */ "b..b"
- /* 3 */ "bbbb"
-
- // Level 10
- /* z\x* 0123 */
- /* 0 */ "d..d"
- /* 1 */ "...."
- /* 2 */ "...."
- /* 3 */ "d..d"
-
- // Level 11
- /* z\x* 0123 */
- /* 0 */ "d..d"
- /* 1 */ "...."
- /* 2 */ "...."
- /* 3 */ "d..d"
-
- // Level 12
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bbbb"
- /* 2 */ "bbbb"
- /* 3 */ "bbbb",
-
- // Connectors:
- "2: 1, 9, 3: 3\n" /* Type 2, direction Z+ */
- "2: 2, 9, 0: 2\n" /* Type 2, direction Z- */
- "2: 0, 9, 1: 4\n" /* Type 2, direction X- */
- "2: 3, 9, 2: 5\n" /* Type 2, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // CobbleWell4x4
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MineEntrance:
- // The data has been exported from the gallery Plains, area index 138, ID 446, created by STR_Warrior
- {
- // Size:
- 7, 38, 7, // SizeX = 7, SizeY = 38, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 37, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 5: 0\n" /* wood */
- "b: 77: 2\n" /* stonebutton */
- "c: 66: 6\n" /* tracks */
- "d: 27: 1\n" /* poweredrail */
- "e: 66: 5\n" /* tracks */
- "f: 66: 9\n" /* tracks */
- "g: 66: 2\n" /* tracks */
- "h: 50: 4\n" /* torch */
- "i: 66: 4\n" /* tracks */
- "j: 66: 8\n" /* tracks */
- "k: 66: 3\n" /* tracks */
- "l: 66: 7\n" /* tracks */
- "m: 19: 0\n" /* sponge */
- "n: 50: 2\n" /* torch */
- "o: 4: 0\n" /* cobblestone */
- "p: 2: 0\n" /* grass */
- "q: 13: 0\n" /* gravel */
- "r: 53: 2\n" /* woodstairs */
- "s: 77: 1\n" /* stonebutton */
- "t: 27: 0\n" /* poweredrail */
- "u: 53: 7\n" /* woodstairs */
- "v: 53: 6\n" /* woodstairs */
- "w: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "maaaaam"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mm.abam"
- /* 2 */ "mmcddam"
- /* 3 */ "mae..am"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "mm...mm"
- /* 1 */ "mm.a.mm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "mm.h.mm"
- /* 1 */ "mm.a.mm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 12
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 13
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 14
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 15
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 16
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 17
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 18
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 19
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 20
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 21
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 22
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 23
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 24
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 25
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 26
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm...mm"
- /* 3 */ "ma..aam"
- /* 4 */ "mmfgamm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 27
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mm.aamm"
- /* 3 */ "ma..iam"
- /* 4 */ "mm..jmm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 28
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmaklmm"
- /* 3 */ "maa..am"
- /* 4 */ "mm...mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 29
- /* z\x* 0123456 */
- /* 0 */ "mmmmmmm"
- /* 1 */ "mmmammm"
- /* 2 */ "mmc..mm"
- /* 3 */ "mae.nam"
- /* 4 */ "mmaa.mm"
- /* 5 */ "mmmammm"
- /* 6 */ "mmmmmmm"
-
- // Level 30
- /* z\x* 0123456 */
- /* 0 */ "mmooomm"
- /* 1 */ "mmmammm"
- /* 2 */ "om...mo"
- /* 3 */ "oa..aao"
- /* 4 */ "omfgamo"
- /* 5 */ "mmmammm"
- /* 6 */ "mmooomm"
-
- // Level 31
- /* z\x* 0123456 */
- /* 0 */ "ppqqqpp"
- /* 1 */ "paaaaap"
- /* 2 */ "qa.aaaq"
- /* 3 */ "qa..iaq"
- /* 4 */ "qa..jaq"
- /* 5 */ "paaaaap"
- /* 6 */ "ppqqqpp"
-
- // Level 32
- /* z\x* 0123456 */
- /* 0 */ "...r..."
- /* 1 */ ".astba."
- /* 2 */ "...fl.."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ ".a...a."
- /* 6 */ "......."
-
- // Level 33
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".a...a."
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ ".a...a."
- /* 6 */ "......."
-
- // Level 34
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".a...a."
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ ".a...a."
- /* 6 */ "......."
-
- // Level 35
- /* z\x* 0123456 */
- /* 0 */ "rrrrrrr"
- /* 1 */ "uaaaaau"
- /* 2 */ ".a...a."
- /* 3 */ ".a...a."
- /* 4 */ ".a...a."
- /* 5 */ "vaaaaav"
- /* 6 */ "wwwwwww"
-
- // Level 36
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "rrrrrrr"
- /* 2 */ "uaaaaau"
- /* 3 */ ".aaaaa."
- /* 4 */ "vaaaaav"
- /* 5 */ "wwwwwww"
- /* 6 */ "......."
-
- // Level 37
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "rrrrrrr"
- /* 3 */ "aaaaaaa"
- /* 4 */ "wwwwwww"
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "2: 6, 32, 3: 5\n" /* Type 2, direction X+ */
- "2: 3, 32, 6: 3\n" /* Type 2, direction Z+ */
- "2: 0, 32, 3: 4\n" /* Type 2, direction X- */
- "2: 3, 32, 0: 2\n" /* Type 2, direction Z- */
- "3: 3, 1, 0: 2\n" /* Type 3, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- false,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // MineEntrance
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // RoofedWell:
- // The data has been exported from the gallery Plains, area index 119, ID 271, created by STR_Warrior
- {
- // Size:
- 7, 15, 7, // SizeX = 7, SizeY = 15, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 14, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 4: 0\n" /* cobblestone */
- "c: 8: 0\n" /* water */
- "d: 3: 0\n" /* dirt */
- "e: 2: 0\n" /* grass */
- "f: 13: 0\n" /* gravel */
- "g:118: 3\n" /* cauldronblock */
- "h: 85: 0\n" /* fence */
- "i: 53: 2\n" /* woodstairs */
- "j: 53: 7\n" /* woodstairs */
- "k: 5: 0\n" /* wood */
- "l: 53: 4\n" /* woodstairs */
- "m: 19: 0\n" /* sponge */
- "n: 53: 5\n" /* woodstairs */
- "o: 53: 6\n" /* woodstairs */
- "p: 53: 3\n" /* woodstairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "aaaaaaa"
- /* 2 */ "aaaaaaa"
- /* 3 */ "aaaaaaa"
- /* 4 */ "aaaaaaa"
- /* 5 */ "aaaaaaa"
- /* 6 */ "aaaaaaa"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "ddddddd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "dbcccbd"
- /* 3 */ "dbcccbd"
- /* 4 */ "dbcccbd"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddddddd"
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "ddddddd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "dbcccbd"
- /* 3 */ "dbcccbd"
- /* 4 */ "dbcccbd"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddddddd"
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "ddddddd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "dbcccbd"
- /* 3 */ "dbcccbd"
- /* 4 */ "dbcccbd"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddddddd"
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "eefffee"
- /* 1 */ "ebbbbbe"
- /* 2 */ "fbcccbf"
- /* 3 */ "fbcccbf"
- /* 4 */ "fbcccbf"
- /* 5 */ "ebbbbbe"
- /* 6 */ "eefffee"
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".bbbbb."
- /* 2 */ ".b...b."
- /* 3 */ ".b.g.b."
- /* 4 */ ".b...b."
- /* 5 */ ".bbbbb."
- /* 6 */ "......."
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".h...h."
- /* 2 */ "......."
- /* 3 */ "...h..."
- /* 4 */ "......."
- /* 5 */ ".h...h."
- /* 6 */ "......."
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".h...h."
- /* 2 */ "......."
- /* 3 */ "...h..."
- /* 4 */ "......."
- /* 5 */ ".h...h."
- /* 6 */ "......."
-
- // Level 12
- /* z\x* 0123456 */
- /* 0 */ "iiiiiii"
- /* 1 */ "jkjjjkj"
- /* 2 */ ".l...n."
- /* 3 */ ".l.h.n."
- /* 4 */ ".l...n."
- /* 5 */ "okoooko"
- /* 6 */ "ppppppp"
-
- // Level 13
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "iiiiiii"
- /* 2 */ "jkjjjkj"
- /* 3 */ ".k.h.k."
- /* 4 */ "okoooko"
- /* 5 */ "ppppppp"
- /* 6 */ "......."
-
- // Level 14
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "iiiiiii"
- /* 3 */ "kkkkkkk"
- /* 4 */ "ppppppp"
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "2: 0, 9, 3: 4\n" /* Type 2, direction X- */
- "2: 3, 9, 6: 3\n" /* Type 2, direction Z+ */
- "2: 6, 9, 3: 5\n" /* Type 2, direction X+ */
- "2: 3, 9, 0: 2\n" /* Type 2, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // RoofedWell
-};
-
-
-
-
-
-// The prefab counts:
-
-const size_t g_PlainsVillagePrefabsCount = ARRAYCOUNT(g_PlainsVillagePrefabs);
-
-const size_t g_PlainsVillageStartingPrefabsCount = ARRAYCOUNT(g_PlainsVillageStartingPrefabs);
-
diff --git a/src/Generating/Prefabs/PlainsVillagePrefabs.h b/src/Generating/Prefabs/PlainsVillagePrefabs.h
deleted file mode 100644
index 087783b1e..000000000
--- a/src/Generating/Prefabs/PlainsVillagePrefabs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// PlainsVillagePrefabs.h
-
-// Declares the prefabs in the group PlainsVillage
-
-#include "../Prefab.h"
-
-
-
-
-
-extern const cPrefab::sDef g_PlainsVillagePrefabs[];
-extern const cPrefab::sDef g_PlainsVillageStartingPrefabs[];
-extern const size_t g_PlainsVillagePrefabsCount;
-extern const size_t g_PlainsVillageStartingPrefabsCount;
diff --git a/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp b/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
deleted file mode 100644
index 3328ee210..000000000
--- a/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
+++ /dev/null
@@ -1,1669 +0,0 @@
-
-// SandFlatRoofVillagePrefabs.cpp
-
-// Defines the prefabs in the group SandFlatRoofVillage
-
-// NOTE: This file has been generated automatically by GalExport!
-// Any manual changes will be overwritten by the next automatic export!
-
-#include "Globals.h"
-#include "SandFlatRoofVillagePrefabs.h"
-
-
-
-
-
-const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // Forge:
- // The data has been exported from the gallery Desert, area index 32, ID 173, created by Aloe_vera
- {
- // Size:
- 12, 6, 10, // SizeX = 12, SizeY = 6, SizeZ = 10
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 12, 5, 10, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e:128: 3\n" /* sandstonestairs */
- "f:171:15\n" /* carpet */
- "g: 64: 6\n" /* wooddoorblock */
- "h:171: 0\n" /* carpet */
- "i:171:14\n" /* carpet */
- "j: 61: 2\n" /* furnace */
- "k: 10: 0\n" /* lava */
- "l: 54: 2\n" /* chest */
- "m: 19: 0\n" /* sponge */
- "n: 24: 2\n" /* sandstone */
- "o: 64:12\n" /* wooddoorblock */
- "p: 50: 1\n" /* torch */
- "q:101: 0\n" /* ironbars */
- "r:128: 4\n" /* sandstonestairs */
- "s:128: 6\n" /* sandstonestairs */
- "t:128: 5\n" /* sandstonestairs */
- "u:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "aaaaaaammmmm"
- /* 1 */ "aaaaaaaaaaam"
- /* 2 */ "aaaaaaaaaaam"
- /* 3 */ "aaaaaaaaaaam"
- /* 4 */ "aaaaaaaaaaam"
- /* 5 */ "aaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaam"
- /* 7 */ "maaaaaaaaaam"
- /* 8 */ "maaaaaaaaaam"
- /* 9 */ "mmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "bcccccd....."
- /* 1 */ "baaaaaaaaaa."
- /* 2 */ "baaaaaaaaaa."
- /* 3 */ "baaaaaaaaaa."
- /* 4 */ "baaaaaaaaaa."
- /* 5 */ "eaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaa."
- /* 8 */ ".aaaaaaaaaa."
- /* 9 */ "............"
-
- // Level 2
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".a....aaaaa."
- /* 2 */ "......afffa."
- /* 3 */ "......ghfha."
- /* 4 */ "......aiiia."
- /* 5 */ ".a....ahfha."
- /* 6 */ ".ajaajafffa."
- /* 7 */ ".aakkaal..a."
- /* 8 */ ".aaaaaaaaaa."
- /* 9 */ "............"
-
- // Level 3
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".n....nn.nn."
- /* 2 */ "......n...n."
- /* 3 */ "......o...n."
- /* 4 */ "......n....."
- /* 5 */ ".n....n...n."
- /* 6 */ ".n....n...n."
- /* 7 */ ".n....n...n."
- /* 8 */ ".nnn.nnn.nn."
- /* 9 */ "............"
-
- // Level 4
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".a....aaaaa."
- /* 2 */ "......a...a."
- /* 3 */ "......a...a."
- /* 4 */ "......ap..a."
- /* 5 */ ".a....a...a."
- /* 6 */ ".aqqqqa...a."
- /* 7 */ ".a....a...a."
- /* 8 */ ".aaaaaaaaaa."
- /* 9 */ "............"
-
- // Level 5
- /* z\x* 11 */
- /* * 012345678901 */
- /* 0 */ "rsssssssssss"
- /* 1 */ "raaaaaaaaaat"
- /* 2 */ "raaaaaaaaaat"
- /* 3 */ "raaaaaaaaaat"
- /* 4 */ "raaaaaaaaaat"
- /* 5 */ "raaaaaaaaaat"
- /* 6 */ "raaaaaaaaaat"
- /* 7 */ "raaaaaaaaaat"
- /* 8 */ "raaaaaaaaaat"
- /* 9 */ "uuuuuuuuuuut",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Forge
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House11x7:
- // The data has been exported from the gallery Desert, area index 31, ID 172, created by Aloe_vera
- {
- // Size:
- 13, 6, 9, // SizeX = 13, SizeY = 6, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 13, 5, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171: 0\n" /* carpet */
- "g:171:15\n" /* carpet */
- "h:171:14\n" /* carpet */
- "i: 24: 2\n" /* sandstone */
- "j: 64:12\n" /* wooddoorblock */
- "k: 50: 3\n" /* torch */
- "l: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 50: 2\n" /* torch */
- "o: 50: 4\n" /* torch */
- "p:128: 4\n" /* sandstonestairs */
- "q:128: 6\n" /* sandstonestairs */
- "r:128: 5\n" /* sandstonestairs */
- "s:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmaaammmmmmmm"
- /* 1 */ "maaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaam"
- /* 8 */ "mmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "..bcd........"
- /* 1 */ ".aaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaa."
- /* 8 */ "............."
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".aaeaaaaaaaa."
- /* 2 */ ".affgggggffa."
- /* 3 */ ".afghhhhhgfa."
- /* 4 */ ".afghfffhgfa."
- /* 5 */ ".afghhhhhgfa."
- /* 6 */ ".affgggggffa."
- /* 7 */ ".aaaaaaaaaaa."
- /* 8 */ "............."
-
- // Level 3
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".iiji.iii.ii."
- /* 2 */ ".i.........i."
- /* 3 */ ".i.........i."
- /* 4 */ "............."
- /* 5 */ ".i.........i."
- /* 6 */ ".i.........i."
- /* 7 */ ".ii.ii.ii.ii."
- /* 8 */ "............."
-
- // Level 4
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".aaaaaaaaaaa."
- /* 2 */ ".a..k..k...a."
- /* 3 */ ".a.........a."
- /* 4 */ ".al.......na."
- /* 5 */ ".a.........a."
- /* 6 */ ".a....o....a."
- /* 7 */ ".aaaaaaaaaaa."
- /* 8 */ "............."
-
- // Level 5
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "pqqqqqqqqqqqq"
- /* 1 */ "paaaaaaaaaaar"
- /* 2 */ "paaaaaaaaaaar"
- /* 3 */ "paaaaaaaaaaar"
- /* 4 */ "paaaaaaaaaaar"
- /* 5 */ "paaaaaaaaaaar"
- /* 6 */ "paaaaaaaaaaar"
- /* 7 */ "paaaaaaaaaaar"
- /* 8 */ "ssssssssssssr",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House11x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House5x4:
- // The data has been exported from the gallery Desert, area index 25, ID 166, created by Aloe_vera
- {
- // Size:
- 7, 6, 6, // SizeX = 7, SizeY = 6, SizeZ = 6
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 5, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171: 0\n" /* carpet */
- "g:171:14\n" /* carpet */
- "h: 24: 2\n" /* sandstone */
- "i: 64:12\n" /* wooddoorblock */
- "j: 50: 3\n" /* torch */
- "k:128: 4\n" /* sandstonestairs */
- "l:128: 6\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:128: 5\n" /* sandstonestairs */
- "o:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmaaamm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "..bcd.."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aaaaa."
- /* 3 */ ".aaaaa."
- /* 4 */ ".aaaaa."
- /* 5 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".aaeaa."
- /* 2 */ ".afgfa."
- /* 3 */ ".afgfa."
- /* 4 */ ".aaaaa."
- /* 5 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".hhihh."
- /* 2 */ ".h...h."
- /* 3 */ ".h...h."
- /* 4 */ ".hh.hh."
- /* 5 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aj.ja."
- /* 3 */ ".a...a."
- /* 4 */ ".aaaaa."
- /* 5 */ "......."
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "kllllln"
- /* 1 */ "kaaaaan"
- /* 2 */ "kaaaaan"
- /* 3 */ "kaaaaan"
- /* 4 */ "kaaaaan"
- /* 5 */ "oooooon",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House5x4
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House5x5:
- // The data has been exported from the gallery Desert, area index 26, ID 167, created by Aloe_vera
- {
- // Size:
- 7, 6, 7, // SizeX = 7, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171: 0\n" /* carpet */
- "g:171:15\n" /* carpet */
- "h:171:14\n" /* carpet */
- "i: 24: 2\n" /* sandstone */
- "j: 64:12\n" /* wooddoorblock */
- "k: 50: 3\n" /* torch */
- "l:128: 4\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:128: 6\n" /* sandstonestairs */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmaaamm"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "..bcd.."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aaaaa."
- /* 3 */ ".aaaaa."
- /* 4 */ ".aaaaa."
- /* 5 */ ".aaaaa."
- /* 6 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".aaeaa."
- /* 2 */ ".afffa."
- /* 3 */ ".aghga."
- /* 4 */ ".afffa."
- /* 5 */ ".aaaaa."
- /* 6 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".iijii."
- /* 2 */ ".i...i."
- /* 3 */ "......."
- /* 4 */ ".i...i."
- /* 5 */ ".ii.ii."
- /* 6 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".aaaaa."
- /* 2 */ ".ak.ka."
- /* 3 */ ".a...a."
- /* 4 */ ".a...a."
- /* 5 */ ".aaaaa."
- /* 6 */ "......."
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "lnnnnno"
- /* 1 */ "laaaaao"
- /* 2 */ "laaaaao"
- /* 3 */ "laaaaao"
- /* 4 */ "laaaaao"
- /* 5 */ "laaaaao"
- /* 6 */ "ppppppo",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House5x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House7x5:
- // The data has been exported from the gallery Desert, area index 27, ID 168, created by Aloe_vera
- {
- // Size:
- 9, 6, 7, // SizeX = 9, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171:14\n" /* carpet */
- "g:171: 0\n" /* carpet */
- "h:171:15\n" /* carpet */
- "i: 24: 2\n" /* sandstone */
- "j: 64:12\n" /* wooddoorblock */
- "k: 50: 3\n" /* torch */
- "l:128: 4\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:128: 6\n" /* sandstonestairs */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmaaammmm"
- /* 1 */ "maaaaaaam"
- /* 2 */ "maaaaaaam"
- /* 3 */ "maaaaaaam"
- /* 4 */ "maaaaaaam"
- /* 5 */ "maaaaaaam"
- /* 6 */ "mmmmmmmmm"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "..bcd...."
- /* 1 */ ".aaaaaaa."
- /* 2 */ ".aaaaaaa."
- /* 3 */ ".aaaaaaa."
- /* 4 */ ".aaaaaaa."
- /* 5 */ ".aaaaaaa."
- /* 6 */ "........."
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".aaeaaaa."
- /* 2 */ ".afffffa."
- /* 3 */ ".aghhhga."
- /* 4 */ ".afffffa."
- /* 5 */ ".aaaaaaa."
- /* 6 */ "........."
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".iiji.ii."
- /* 2 */ ".i.....i."
- /* 3 */ "........."
- /* 4 */ ".i.....i."
- /* 5 */ ".iii.iii."
- /* 6 */ "........."
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".aaaaaaa."
- /* 2 */ ".ak.k..a."
- /* 3 */ ".a.....a."
- /* 4 */ ".a.....a."
- /* 5 */ ".aaaaaaa."
- /* 6 */ "........."
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "lnnnnnnnn"
- /* 1 */ "laaaaaaao"
- /* 2 */ "laaaaaaao"
- /* 3 */ "laaaaaaao"
- /* 4 */ "laaaaaaao"
- /* 5 */ "laaaaaaao"
- /* 6 */ "ppppppppo",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House7x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House8x5:
- // The data has been exported from the gallery Desert, area index 28, ID 169, created by Aloe_vera
- {
- // Size:
- 10, 6, 7, // SizeX = 10, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 10, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171: 0\n" /* carpet */
- "g:171:14\n" /* carpet */
- "h:171:15\n" /* carpet */
- "i: 24: 2\n" /* sandstone */
- "j: 64:12\n" /* wooddoorblock */
- "k: 50: 3\n" /* torch */
- "l:128: 4\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:128: 6\n" /* sandstonestairs */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "mmaaammmmm"
- /* 1 */ "maaaaaaaam"
- /* 2 */ "maaaaaaaam"
- /* 3 */ "maaaaaaaam"
- /* 4 */ "maaaaaaaam"
- /* 5 */ "maaaaaaaam"
- /* 6 */ "mmmmmmmmmm"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "..bcd....."
- /* 1 */ ".aaaaaaaa."
- /* 2 */ ".aaaaaaaa."
- /* 3 */ ".aaaaaaaa."
- /* 4 */ ".aaaaaaaa."
- /* 5 */ ".aaaaaaaa."
- /* 6 */ ".........."
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".aaeaaaaa."
- /* 2 */ ".afghhgfa."
- /* 3 */ ".afhffhfa."
- /* 4 */ ".afghhgfa."
- /* 5 */ ".aaaaaaaa."
- /* 6 */ ".........."
-
- // Level 3
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".iijii.ii."
- /* 2 */ ".i......i."
- /* 3 */ ".........."
- /* 4 */ ".i......i."
- /* 5 */ ".ii.ii.ii."
- /* 6 */ ".........."
-
- // Level 4
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".aaaaaaaa."
- /* 2 */ ".ak.k...a."
- /* 3 */ ".a......a."
- /* 4 */ ".a......a."
- /* 5 */ ".aaaaaaaa."
- /* 6 */ ".........."
-
- // Level 5
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "lnnnnnnnnn"
- /* 1 */ "laaaaaaaao"
- /* 2 */ "laaaaaaaao"
- /* 3 */ "laaaaaaaao"
- /* 4 */ "laaaaaaaao"
- /* 5 */ "laaaaaaaao"
- /* 6 */ "pppppppppo",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House8x5
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House8x7:
- // The data has been exported from the gallery Desert, area index 29, ID 170, created by Aloe_vera
- {
- // Size:
- 10, 6, 9, // SizeX = 10, SizeY = 6, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 10, 5, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171: 0\n" /* carpet */
- "g:171:14\n" /* carpet */
- "h:171:15\n" /* carpet */
- "i: 24: 2\n" /* sandstone */
- "j: 64:12\n" /* wooddoorblock */
- "k: 50: 3\n" /* torch */
- "l: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 50: 2\n" /* torch */
- "o:128: 4\n" /* sandstonestairs */
- "p:128: 6\n" /* sandstonestairs */
- "q:128: 5\n" /* sandstonestairs */
- "r:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "mmaaammmmm"
- /* 1 */ "maaaaaaaam"
- /* 2 */ "maaaaaaaam"
- /* 3 */ "maaaaaaaam"
- /* 4 */ "maaaaaaaam"
- /* 5 */ "maaaaaaaam"
- /* 6 */ "maaaaaaaam"
- /* 7 */ "maaaaaaaam"
- /* 8 */ "mmmmmmmmmm"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "..bcd....."
- /* 1 */ ".aaaaaaaa."
- /* 2 */ ".aaaaaaaa."
- /* 3 */ ".aaaaaaaa."
- /* 4 */ ".aaaaaaaa."
- /* 5 */ ".aaaaaaaa."
- /* 6 */ ".aaaaaaaa."
- /* 7 */ ".aaaaaaaa."
- /* 8 */ ".........."
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".aaeaaaaa."
- /* 2 */ ".afghhgfa."
- /* 3 */ ".afhffhfa."
- /* 4 */ ".afhgghfa."
- /* 5 */ ".afhffhfa."
- /* 6 */ ".afghhgfa."
- /* 7 */ ".aaaaaaaa."
- /* 8 */ ".........."
-
- // Level 3
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".iijii.ii."
- /* 2 */ ".i......i."
- /* 3 */ ".i......i."
- /* 4 */ ".........."
- /* 5 */ ".i......i."
- /* 6 */ ".i......i."
- /* 7 */ ".ii.ii.ii."
- /* 8 */ ".........."
-
- // Level 4
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".aaaaaaaa."
- /* 2 */ ".a..k...a."
- /* 3 */ ".a......a."
- /* 4 */ ".al....na."
- /* 5 */ ".a......a."
- /* 6 */ ".a......a."
- /* 7 */ ".aaaaaaaa."
- /* 8 */ ".........."
-
- // Level 5
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "oppppppppp"
- /* 1 */ "oaaaaaaaaq"
- /* 2 */ "oaaaaaaaaq"
- /* 3 */ "oaaaaaaaaq"
- /* 4 */ "oaaaaaaaaq"
- /* 5 */ "oaaaaaaaaq"
- /* 6 */ "oaaaaaaaaq"
- /* 7 */ "oaaaaaaaaq"
- /* 8 */ "rrrrrrrrrq",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House8x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House9x7:
- // The data has been exported from the gallery Desert, area index 30, ID 171, created by Aloe_vera
- {
- // Size:
- 11, 6, 9, // SizeX = 11, SizeY = 6, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 5, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:171: 0\n" /* carpet */
- "g:171:15\n" /* carpet */
- "h:171:14\n" /* carpet */
- "i: 24: 2\n" /* sandstone */
- "j: 64:12\n" /* wooddoorblock */
- "k: 50: 3\n" /* torch */
- "l: 50: 1\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 50: 2\n" /* torch */
- "o: 50: 4\n" /* torch */
- "p:128: 4\n" /* sandstonestairs */
- "q:128: 6\n" /* sandstonestairs */
- "r:128: 5\n" /* sandstonestairs */
- "s:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmaaammmmmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "maaaaaaaaam"
- /* 7 */ "maaaaaaaaam"
- /* 8 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..bcd......"
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ ".aaaaaaaaa."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".aaeaaaaaa."
- /* 2 */ ".affgggffa."
- /* 3 */ ".afghhhgfa."
- /* 4 */ ".afghfhgfa."
- /* 5 */ ".afghhhgfa."
- /* 6 */ ".affgggffa."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".iijii.iii."
- /* 2 */ ".i.......i."
- /* 3 */ ".i.......i."
- /* 4 */ "..........."
- /* 5 */ ".i.......i."
- /* 6 */ ".i.......i."
- /* 7 */ ".ii.iii.ii."
- /* 8 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".a..k....a."
- /* 3 */ ".a.......a."
- /* 4 */ ".al.....na."
- /* 5 */ ".a.......a."
- /* 6 */ ".a...o...a."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "..........."
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "pqqqqqqqqqq"
- /* 1 */ "paaaaaaaaar"
- /* 2 */ "paaaaaaaaar"
- /* 3 */ "paaaaaaaaar"
- /* 4 */ "paaaaaaaaar"
- /* 5 */ "paaaaaaaaar"
- /* 6 */ "paaaaaaaaar"
- /* 7 */ "paaaaaaaaar"
- /* 8 */ "ssssssssssr",
-
- // Connectors:
- "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House9x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseL13x12:
- // The data has been exported from the gallery Desert, area index 53, ID 345, created by jakibaki
- {
- // Size:
- 15, 6, 14, // SizeX = 15, SizeY = 6, SizeZ = 14
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 15, 5, 14, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 43: 1\n" /* doubleslab */
- "f: 64: 7\n" /* wooddoorblock */
- "g:171: 0\n" /* carpet */
- "h:171:15\n" /* carpet */
- "i:171:14\n" /* carpet */
- "j: 58: 0\n" /* workbench */
- "k: 24: 2\n" /* sandstone */
- "l: 64:12\n" /* wooddoorblock */
- "m: 19: 0\n" /* sponge */
- "n: 50: 3\n" /* torch */
- "o: 50: 1\n" /* torch */
- "p: 50: 2\n" /* torch */
- "q: 50: 4\n" /* torch */
- "r:128: 6\n" /* sandstonestairs */
- "s:128: 5\n" /* sandstonestairs */
- "t:128: 4\n" /* sandstonestairs */
- "u:128: 7\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmaaammmmmmmmm"
- /* 1 */ "maaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaaam"
- /* 8 */ "mmmmmmmaaaaaaam"
- /* 9 */ "mmmmmmmaaaaaaam"
- /* 10 */ "mmmmmmmaaaaaaam"
- /* 11 */ "mmmmmmmaaaaaaam"
- /* 12 */ "mmmmmmmaaaaaaam"
- /* 13 */ "mmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "...bcd........."
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaea."
- /* 6 */ ".aaaaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaaaa."
- /* 8 */ ".......aeaaaaa."
- /* 9 */ "mmmmmm.aaaaaaa."
- /* 10 */ "mmmmmm.aaaaaaa."
- /* 11 */ "mmmmmm.aaaaaaa."
- /* 12 */ "mmmmmm.aaaaaaa."
- /* 13 */ "..............."
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".aaafaaaaaaaaa."
- /* 2 */ ".agghhhhhhhhga."
- /* 3 */ ".aghiiiiiiiiha."
- /* 4 */ ".aghiggggggiha."
- /* 5 */ ".aghiiiiiigiha."
- /* 6 */ ".agghhhhhigiha."
- /* 7 */ ".aaaaaaahigiha."
- /* 8 */ ".......ahigiha."
- /* 9 */ "mmmmmm.ahiiiha."
- /* 10 */ "mmmmmm.aghhhga."
- /* 11 */ "mmmmmm.aggggja."
- /* 12 */ "mmmmmm.aaaaaaa."
- /* 13 */ "..............."
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".kkklkkkk.kkkk."
- /* 2 */ ".k...........k."
- /* 3 */ ".k...........k."
- /* 4 */ "..............."
- /* 5 */ ".k...........k."
- /* 6 */ ".k...........k."
- /* 7 */ ".kkk.kkk.....k."
- /* 8 */ ".......k.....k."
- /* 9 */ "mmmmmm.k......."
- /* 10 */ "mmmmmm.......k."
- /* 11 */ "mmmmmm.k.....k."
- /* 12 */ "mmmmmm.kkk.kkk."
- /* 13 */ "..............."
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".a......n....a."
- /* 3 */ ".a...........a."
- /* 4 */ ".ao..........a."
- /* 5 */ ".a...........a."
- /* 6 */ ".a..........pa."
- /* 7 */ ".aaaaaaa.....a."
- /* 8 */ ".......a.....a."
- /* 9 */ "mmmmmm.a.....a."
- /* 10 */ "mmmmmm.a.....a."
- /* 11 */ "mmmmmm.a..q..a."
- /* 12 */ "mmmmmm.aaaaaaa."
- /* 13 */ "..............."
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "rrrrrrrrrrrrrrs"
- /* 1 */ "taaaaaaaaaaaaas"
- /* 2 */ "taaaaaaaaaaaaas"
- /* 3 */ "taaaaaaaaaaaaas"
- /* 4 */ "taaaaaaaaaaaaas"
- /* 5 */ "taaaaaaaaaaaaas"
- /* 6 */ "taaaaaaaaaaaaas"
- /* 7 */ "taaaaaaaaaaaaas"
- /* 8 */ "tuuuuutaaaaaaas"
- /* 9 */ "mmmmmmtaaaaaaas"
- /* 10 */ "mmmmmmtaaaaaaas"
- /* 11 */ "mmmmmmtaaaaaaas"
- /* 12 */ "mmmmmmtaaaaaaas"
- /* 13 */ "......tuuuuuuuu",
-
- // Connectors:
- "-1: 4, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseL13x12
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // MarketStall:
- // The data has been exported from the gallery Desert, area index 34, ID 175, created by Aloe_vera
- {
- // Size:
- 7, 6, 7, // SizeX = 7, SizeY = 6, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 5, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 12: 0\n" /* sand */
- "b: 85: 0\n" /* fence */
- "c:171:14\n" /* carpet */
- "d:171:15\n" /* carpet */
- "e:171: 0\n" /* carpet */
- "f: 35:14\n" /* wool */
- "g: 35: 0\n" /* wool */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "aaaaaaa"
- /* 2 */ "aaaaaaa"
- /* 3 */ "aaaaaaa"
- /* 4 */ "aaaaaaa"
- /* 5 */ "aaaaaaa"
- /* 6 */ "aaaaaaa"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "b.....b"
- /* 1 */ "cddeddc"
- /* 2 */ "cdeeedc"
- /* 3 */ "cdeeedc"
- /* 4 */ "cddeddc"
- /* 5 */ "b.....b"
- /* 6 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "b.....b"
- /* 1 */ "......."
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ "b.....b"
- /* 6 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "b.....b"
- /* 1 */ "......."
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ "b.....b"
- /* 6 */ "fgfgfgf"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "fgfgfgf"
- /* 1 */ "......."
- /* 2 */ "......."
- /* 3 */ "......."
- /* 4 */ "......."
- /* 5 */ "fgfgfgf"
- /* 6 */ "......."
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "fgfgfgf"
- /* 2 */ "fgfgfgf"
- /* 3 */ "fgfgfgf"
- /* 4 */ "fgfgfgf"
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "-1: 2, 0, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 5,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // MarketStall
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Marketplace:
- // The data has been exported from the gallery Desert, area index 38, ID 261, created by Aloe_vera
- {
- // Size:
- 14, 4, 16, // SizeX = 14, SizeY = 4, SizeZ = 16
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 14, 3, 16, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b: 12: 0\n" /* sand */
- "c: 24: 2\n" /* sandstone */
- "d: 12: 2\n" /* sand */
- "e: 85: 0\n" /* fence */
- "f: 5: 0\n" /* wood */
- "g:128: 2\n" /* sandstonestairs */
- "h:128: 0\n" /* sandstonestairs */
- "i: 8: 0\n" /* water */
- "j:128: 1\n" /* sandstonestairs */
- "k:128: 3\n" /* sandstonestairs */
- "l: 35: 0\n" /* wool */
- "m: 19: 0\n" /* sponge */
- "n: 35:14\n" /* wool */,
-
- // Block data:
- // Level 0
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "aaaabbbaaabbbb"
- /* 1 */ "aaaabbaabbabbb"
- /* 2 */ "aababbabcabbbb"
- /* 3 */ "aaaaabaaaaabbb"
- /* 4 */ "bbbbbbbbbbbbbb"
- /* 5 */ "bbbbbbbbbbaabb"
- /* 6 */ "bbbbccccbbabab"
- /* 7 */ "ccbbccccbbaaab"
- /* 8 */ "ccbbccccbbabbb"
- /* 9 */ "dcbbccccbbabaa"
- /* 10 */ "ccbbbbbbbbaaba"
- /* 11 */ "ccbbbbbbbbabaa"
- /* 12 */ "bbbbbbbbbbabaa"
- /* 13 */ "bbbaababbbaaba"
- /* 14 */ "bbbcaaaabbabbb"
- /* 15 */ "bbbcccabbbabbb"
-
- // Level 1
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "e...e.e...e..."
- /* 1 */ ".............."
- /* 2 */ ".............."
- /* 3 */ "fffff.fffff..."
- /* 4 */ ".............."
- /* 5 */ "..........f..e"
- /* 6 */ "....gggg..f..."
- /* 7 */ ".f..hiij..f..."
- /* 8 */ ".f..hiij..f..."
- /* 9 */ ".f..kkkk..f..e"
- /* 10 */ ".f............"
- /* 11 */ ".f........f..e"
- /* 12 */ "...fffff..f..."
- /* 13 */ "..........f..."
- /* 14 */ "..........f..."
- /* 15 */ "...e...e..f..e"
-
- // Level 2
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "lnlnl.lnlnl..."
- /* 1 */ ".............."
- /* 2 */ ".............."
- /* 3 */ "e...e.e...e..."
- /* 4 */ ".............."
- /* 5 */ "..........e..l"
- /* 6 */ ".............n"
- /* 7 */ ".e...........l"
- /* 8 */ ".............n"
- /* 9 */ "..........e..l"
- /* 10 */ ".............."
- /* 11 */ ".e........e..l"
- /* 12 */ "...e...e.....n"
- /* 13 */ ".............l"
- /* 14 */ ".............n"
- /* 15 */ "...lnlnl..e..l"
-
- // Level 3
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ "lnlnl.lnlnl..."
- /* 2 */ "lnlnl.lnlnl..."
- /* 3 */ "lnlnl.lnlnl..."
- /* 4 */ ".............."
- /* 5 */ "..........lll."
- /* 6 */ "..........nnn."
- /* 7 */ "ll........lll."
- /* 8 */ "nn........nnn."
- /* 9 */ "ll........lll."
- /* 10 */ "nn............"
- /* 11 */ "ll........lll."
- /* 12 */ "...lnlnl..nnn."
- /* 13 */ "...lnlnl..lll."
- /* 14 */ "...lnlnl..nnn."
- /* 15 */ "..........lll.",
-
- // Connectors:
- "-1: 5, 0, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 20,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Marketplace
-}; // g_SandFlatRoofVillagePrefabs
-
-
-
-
-
-
-const cPrefab::sDef g_SandFlatRoofVillageStartingPrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // Well:
- // The data has been exported from the gallery Desert, area index 44, ID 275, created by Aloe_vera
- {
- // Size:
- 5, 16, 5, // SizeX = 5, SizeY = 16, SizeZ = 5
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 4, 15, 4, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 24: 0\n" /* sandstone */
- "c: 8: 0\n" /* water */
- "d:128: 2\n" /* sandstonestairs */
- "e:128: 0\n" /* sandstonestairs */
- "f:128: 1\n" /* sandstonestairs */
- "g:128: 3\n" /* sandstonestairs */
- "h:128: 6\n" /* sandstonestairs */
- "i:128: 4\n" /* sandstonestairs */
- "j:128: 5\n" /* sandstonestairs */
- "k:128: 7\n" /* sandstonestairs */
- "l: 44: 1\n" /* step */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 01234 */
- /* 0 */ "aaaaa"
- /* 1 */ "abbba"
- /* 2 */ "abbba"
- /* 3 */ "abbba"
- /* 4 */ "aaaaa"
-
- // Level 1
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 6
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 7
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcccb"
- /* 2 */ "bcccb"
- /* 3 */ "bcccb"
- /* 4 */ "bbbbb"
-
- // Level 8
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcbcb"
- /* 2 */ "bbcbb"
- /* 3 */ "bcbcb"
- /* 4 */ "bbbbb"
-
- // Level 9
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcbcb"
- /* 2 */ "bbbbb"
- /* 3 */ "bcbcb"
- /* 4 */ "bbbbb"
-
- // Level 10
- /* z\x* 01234 */
- /* 0 */ "bbbbb"
- /* 1 */ "bcbcb"
- /* 2 */ "bbbbb"
- /* 3 */ "bcbcb"
- /* 4 */ "bbbbb"
-
- // Level 11
- /* z\x* 01234 */
- /* 0 */ "ddddd"
- /* 1 */ "ecccf"
- /* 2 */ "ecbcf"
- /* 3 */ "ecccf"
- /* 4 */ "ggggf"
-
- // Level 12
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "..b.."
- /* 3 */ "....."
- /* 4 */ "....."
-
- // Level 13
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ "....."
- /* 2 */ "..b.."
- /* 3 */ "....."
- /* 4 */ "....."
-
- // Level 14
- /* z\x* 01234 */
- /* 0 */ "....."
- /* 1 */ ".hhh."
- /* 2 */ ".ibj."
- /* 3 */ ".kkj."
- /* 4 */ "....."
-
- // Level 15
- /* z\x* 01234 */
- /* 0 */ "lllll"
- /* 1 */ "lllll"
- /* 2 */ "lllll"
- /* 3 */ "lllll"
- /* 4 */ "lllll",
-
- // Connectors:
- "2: 4, 11, 2: 5\n" /* Type 2, direction X+ */
- "2: 2, 11, 4: 3\n" /* Type 2, direction Z+ */
- "2: 0, 11, 2: 4\n" /* Type 2, direction X- */
- "2: 2, 11, 0: 2\n" /* Type 2, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Well
-};
-
-
-
-
-
-// The prefab counts:
-
-const size_t g_SandFlatRoofVillagePrefabsCount = ARRAYCOUNT(g_SandFlatRoofVillagePrefabs);
-
-const size_t g_SandFlatRoofVillageStartingPrefabsCount = ARRAYCOUNT(g_SandFlatRoofVillageStartingPrefabs);
-
diff --git a/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.h b/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.h
deleted file mode 100644
index ea06de5b5..000000000
--- a/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// SandFlatRoofVillagePrefabs.h
-
-// Declares the prefabs in the group SandFlatRoofVillage
-
-#include "../Prefab.h"
-
-
-
-
-
-extern const cPrefab::sDef g_SandFlatRoofVillagePrefabs[];
-extern const cPrefab::sDef g_SandFlatRoofVillageStartingPrefabs[];
-extern const size_t g_SandFlatRoofVillagePrefabsCount;
-extern const size_t g_SandFlatRoofVillageStartingPrefabsCount;
diff --git a/src/Generating/Prefabs/SandVillagePrefabs.cpp b/src/Generating/Prefabs/SandVillagePrefabs.cpp
deleted file mode 100644
index c63f8161b..000000000
--- a/src/Generating/Prefabs/SandVillagePrefabs.cpp
+++ /dev/null
@@ -1,2307 +0,0 @@
-
-// SandVillagePrefabs.cpp
-
-// Defines the prefabs in the group SandVillage
-
-// NOTE: This file has been generated automatically by GalExport!
-// Any manual changes will be overwritten by the next automatic export!
-
-#include "Globals.h"
-#include "SandVillagePrefabs.h"
-
-
-
-
-
-const cPrefab::sDef g_SandVillagePrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // DoubleField:
- // The data has been exported from the gallery Desert, area index 5, ID 75, created by tonibm1999
- {
- // Size:
- 13, 3, 9, // SizeX = 13, SizeY = 3, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 13, 2, 8, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b: 60: 7\n" /* tilleddirt */
- "c: 8: 0\n" /* water */
- "d: 50: 5\n" /* torch */
- "e: 59: 7\n" /* crops */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "aaaaaaaaaaaaa"
- /* 1 */ "aaaaaaaaaaaaa"
- /* 2 */ "aaaaaaaaaaaaa"
- /* 3 */ "aaaaaaaaaaaaa"
- /* 4 */ "aaaaaaaaaaaaa"
- /* 5 */ "aaaaaaaaaaaaa"
- /* 6 */ "aaaaaaaaaaaaa"
- /* 7 */ "aaaaaaaaaaaaa"
- /* 8 */ "aaaaaaaaaaaaa"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "aaaaaaaaaaaaa"
- /* 1 */ "abbcbbabbcbba"
- /* 2 */ "abbcbbabbcbba"
- /* 3 */ "abbcbbabbcbba"
- /* 4 */ "abbcbbabbcbba"
- /* 5 */ "abbcbbabbcbba"
- /* 6 */ "abbcbbabbcbba"
- /* 7 */ "abbcbbabbcbba"
- /* 8 */ "aaaaaaaaaaaaa"
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "d.....d.....d"
- /* 1 */ ".ee.ee.ee.ee."
- /* 2 */ ".ee.ee.ee.ee."
- /* 3 */ ".ee.ee.ee.ee."
- /* 4 */ ".ee.ee.ee.ee."
- /* 5 */ ".ee.ee.ee.ee."
- /* 6 */ ".ee.ee.ee.ee."
- /* 7 */ ".ee.ee.ee.ee."
- /* 8 */ "d.....d.....d",
-
- // Connectors:
- "-1: 6, 1, 8: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // DoubleField
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House11x7:
- // The data has been exported from the gallery Desert, area index 6, ID 81, created by Aloe_vera
- {
- // Size:
- 11, 7, 7, // SizeX = 11, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n: 50: 1\n" /* torch */
- "o: 50: 2\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".aaaaeaaaa."
- /* 2 */ ".a.......a."
- /* 3 */ ".a.......a."
- /* 4 */ ".a.......a."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".affagaffa."
- /* 2 */ ".f.......f."
- /* 3 */ ".f.......f."
- /* 4 */ ".f.......f."
- /* 5 */ ".affafaffa."
- /* 6 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "ccccccccccc"
- /* 1 */ "haaaaaaaaah"
- /* 2 */ ".a..i.i..a."
- /* 3 */ ".a.......a."
- /* 4 */ ".a..j.j..a."
- /* 5 */ "kaaaaaaaaak"
- /* 6 */ "lllllllllll"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "ccccccccccc"
- /* 2 */ "haaaaaaaaah"
- /* 3 */ ".an.....oa."
- /* 4 */ "kaaaaaaaaak"
- /* 5 */ "lllllllllll"
- /* 6 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "ccccccccccc"
- /* 3 */ "aaaaaaaaaaa"
- /* 4 */ "lllllllllll"
- /* 5 */ "..........."
- /* 6 */ "...........",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House11x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House11x9:
- // The data has been exported from the gallery Desert, area index 11, ID 115, created by xoft
- {
- // Size:
- 11, 8, 9, // SizeX = 11, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 11, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "mmmmaaammmm"
- /* 1 */ "maaaaaaaaam"
- /* 2 */ "maaaaaaaaam"
- /* 3 */ "maaaaaaaaam"
- /* 4 */ "maaaaaaaaam"
- /* 5 */ "maaaaaaaaam"
- /* 6 */ "maaaaaaaaam"
- /* 7 */ "maaaaaaaaam"
- /* 8 */ "mmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "....bcd...."
- /* 1 */ ".aaaaaaaaa."
- /* 2 */ ".aaaaaaaaa."
- /* 3 */ ".aaaaaaaaa."
- /* 4 */ ".aaaaaaaaa."
- /* 5 */ ".aaaaaaaaa."
- /* 6 */ ".aaaaaaaaa."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "..........."
-
- // Level 2
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".aaaaeaaaa."
- /* 2 */ ".a.......a."
- /* 3 */ ".a.......a."
- /* 4 */ ".a.......a."
- /* 5 */ ".a.......a."
- /* 6 */ ".a.......a."
- /* 7 */ ".aaaaaaaaa."
- /* 8 */ "..........."
-
- // Level 3
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".affagaffa."
- /* 2 */ ".f.......f."
- /* 3 */ ".f.......f."
- /* 4 */ ".a.......a."
- /* 5 */ ".f.......f."
- /* 6 */ ".f.......f."
- /* 7 */ ".afffafffa."
- /* 8 */ "..........."
-
- // Level 4
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "ccccccccccc"
- /* 1 */ "haaaaaaaaah"
- /* 2 */ ".a..i.i..a."
- /* 3 */ ".a.......a."
- /* 4 */ ".a.......a."
- /* 5 */ ".a.......a."
- /* 6 */ ".a...j...a."
- /* 7 */ "kaaaaaaaaak"
- /* 8 */ "lllllllllll"
-
- // Level 5
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "ccccccccccc"
- /* 2 */ "haaaaaaaaah"
- /* 3 */ ".a.......a."
- /* 4 */ ".a.......a."
- /* 5 */ ".a.......a."
- /* 6 */ "kaaaaaaaaak"
- /* 7 */ "lllllllllll"
- /* 8 */ "..........."
-
- // Level 6
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "ccccccccccc"
- /* 3 */ "haaaaaaaaah"
- /* 4 */ ".a.......a."
- /* 5 */ "kaaaaaaaaak"
- /* 6 */ "lllllllllll"
- /* 7 */ "..........."
- /* 8 */ "..........."
-
- // Level 7
- /* z\x* 1 */
- /* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ "..........."
- /* 2 */ "..........."
- /* 3 */ "ccccccccccc"
- /* 4 */ "aaaaaaaaaaa"
- /* 5 */ "lllllllllll"
- /* 6 */ "..........."
- /* 7 */ "..........."
- /* 8 */ "...........",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House11x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House13x7:
- // The data has been exported from the gallery Desert, area index 15, ID 125, created by Aloe_vera
- {
- // Size:
- 13, 7, 7, // SizeX = 13, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 13, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmmmaaammmmm"
- /* 1 */ "maaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaam"
- /* 6 */ "mmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ ".....bcd....."
- /* 1 */ ".aaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaa."
- /* 6 */ "............."
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".aaaaaeaaaaa."
- /* 2 */ ".a.........a."
- /* 3 */ ".a.........a."
- /* 4 */ ".a.........a."
- /* 5 */ ".aaaaaaaaaaa."
- /* 6 */ "............."
-
- // Level 3
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".afffagafffa."
- /* 2 */ ".f.........f."
- /* 3 */ ".f.........f."
- /* 4 */ ".f.........f."
- /* 5 */ ".affafffaffa."
- /* 6 */ "............."
-
- // Level 4
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "ccccccccccccc"
- /* 1 */ "haaaaaaaaaaah"
- /* 2 */ ".a...i.i...a."
- /* 3 */ ".a.........a."
- /* 4 */ ".a..j...j..a."
- /* 5 */ "kaaaaaaaaaaak"
- /* 6 */ "lllllllllllll"
-
- // Level 5
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "ccccccccccccc"
- /* 2 */ "haaaaaaaaaaah"
- /* 3 */ ".a.........a."
- /* 4 */ "kaaaaaaaaaaak"
- /* 5 */ "lllllllllllll"
- /* 6 */ "............."
-
- // Level 6
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "ccccccccccccc"
- /* 3 */ "aaaaaaaaaaaaa"
- /* 4 */ "lllllllllllll"
- /* 5 */ "............."
- /* 6 */ ".............",
-
- // Connectors:
- "-1: 6, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House13x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House13x9:
- // The data has been exported from the gallery Desert, area index 12, ID 116, created by xoft
- {
- // Size:
- 13, 8, 9, // SizeX = 13, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 13, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "mmmmmaaammmmm"
- /* 1 */ "maaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaam"
- /* 8 */ "mmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ ".....bcd....."
- /* 1 */ ".aaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaa."
- /* 8 */ "............."
-
- // Level 2
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".aaaaaeaaaaa."
- /* 2 */ ".a.........a."
- /* 3 */ ".a.........a."
- /* 4 */ ".a.........a."
- /* 5 */ ".a.........a."
- /* 6 */ ".a.........a."
- /* 7 */ ".aaaaaaaaaaa."
- /* 8 */ "............."
-
- // Level 3
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".afffagafffa."
- /* 2 */ ".f.........f."
- /* 3 */ ".f.........f."
- /* 4 */ ".a.........a."
- /* 5 */ ".f.........f."
- /* 6 */ ".f.........f."
- /* 7 */ ".affaffafffa."
- /* 8 */ "............."
-
- // Level 4
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "ccccccccccccc"
- /* 1 */ "haaaaaaaaaaah"
- /* 2 */ ".a...i.i...a."
- /* 3 */ ".a.........a."
- /* 4 */ ".a.........a."
- /* 5 */ ".a.........a."
- /* 6 */ ".a..j..j...a."
- /* 7 */ "kaaaaaaaaaaak"
- /* 8 */ "lllllllllllll"
-
- // Level 5
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "ccccccccccccc"
- /* 2 */ "haaaaaaaaaaah"
- /* 3 */ ".a.........a."
- /* 4 */ ".a.........a."
- /* 5 */ ".a.........a."
- /* 6 */ "kaaaaaaaaaaak"
- /* 7 */ "lllllllllllll"
- /* 8 */ "............."
-
- // Level 6
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "ccccccccccccc"
- /* 3 */ "haaaaaaaaaaah"
- /* 4 */ ".a.........a."
- /* 5 */ "kaaaaaaaaaaak"
- /* 6 */ "lllllllllllll"
- /* 7 */ "............."
- /* 8 */ "............."
-
- // Level 7
- /* z\x* 111 */
- /* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ "............."
- /* 2 */ "............."
- /* 3 */ "ccccccccccccc"
- /* 4 */ "aaaaaaaaaaaaa"
- /* 5 */ "lllllllllllll"
- /* 6 */ "............."
- /* 7 */ "............."
- /* 8 */ ".............",
-
- // Connectors:
- "-1: 6, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House13x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House15x9:
- // The data has been exported from the gallery Desert, area index 13, ID 118, created by xoft
- {
- // Size:
- 15, 8, 9, // SizeX = 15, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 15, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "mmmmmaaammmmmmm"
- /* 1 */ "maaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaaam"
- /* 8 */ "mmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ ".....bcd......."
- /* 1 */ ".aaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaaaa."
- /* 8 */ "..............."
-
- // Level 2
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".aaaaaeaaaaaaa."
- /* 2 */ ".a...........a."
- /* 3 */ ".a...........a."
- /* 4 */ ".a...........a."
- /* 5 */ ".a...........a."
- /* 6 */ ".a...........a."
- /* 7 */ ".aaaaaaaaaaaaa."
- /* 8 */ "..............."
-
- // Level 3
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ ".afffagaffaffa."
- /* 2 */ ".f...........f."
- /* 3 */ ".f...........f."
- /* 4 */ ".a...........a."
- /* 5 */ ".f...........f."
- /* 6 */ ".f...........f."
- /* 7 */ ".affaffaffaffa."
- /* 8 */ "..............."
-
- // Level 4
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "ccccccccccccccc"
- /* 1 */ "haaaaaaaaaaaaah"
- /* 2 */ ".a...i.i..i..a."
- /* 3 */ ".a...........a."
- /* 4 */ ".a...........a."
- /* 5 */ ".a...........a."
- /* 6 */ ".a..j..j..j..a."
- /* 7 */ "kaaaaaaaaaaaaak"
- /* 8 */ "lllllllllllllll"
-
- // Level 5
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "ccccccccccccccc"
- /* 2 */ "haaaaaaaaaaaaah"
- /* 3 */ ".a...........a."
- /* 4 */ ".a...........a."
- /* 5 */ ".a...........a."
- /* 6 */ "kaaaaaaaaaaaaak"
- /* 7 */ "lllllllllllllll"
- /* 8 */ "..............."
-
- // Level 6
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "ccccccccccccccc"
- /* 3 */ "haaaaaaaaaaaaah"
- /* 4 */ ".a...........a."
- /* 5 */ "kaaaaaaaaaaaaak"
- /* 6 */ "lllllllllllllll"
- /* 7 */ "..............."
- /* 8 */ "..............."
-
- // Level 7
- /* z\x* 11111 */
- /* * 012345678901234 */
- /* 0 */ "..............."
- /* 1 */ "..............."
- /* 2 */ "..............."
- /* 3 */ "ccccccccccccccc"
- /* 4 */ "aaaaaaaaaaaaaaa"
- /* 5 */ "lllllllllllllll"
- /* 6 */ "..............."
- /* 7 */ "..............."
- /* 8 */ "...............",
-
- // Connectors:
- "-1: 6, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House15x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House16x9:
- // The data has been exported from the gallery Desert, area index 16, ID 126, created by Aloe_vera
- {
- // Size:
- 16, 8, 9, // SizeX = 16, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 16, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "mmmmmmmmaaammmmm"
- /* 1 */ "maaaaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaaaam"
- /* 8 */ "mmmmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "........bcd....."
- /* 1 */ ".aaaaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaaaaa."
- /* 8 */ "................"
-
- // Level 2
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".aaaaaaaaeaaaaa."
- /* 2 */ ".a............a."
- /* 3 */ ".a............a."
- /* 4 */ ".a............a."
- /* 5 */ ".a............a."
- /* 6 */ ".a............a."
- /* 7 */ ".aaaaaaaaaaaaaa."
- /* 8 */ "................"
-
- // Level 3
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ ".affafffagafffa."
- /* 2 */ ".f............f."
- /* 3 */ ".f............f."
- /* 4 */ ".a............a."
- /* 5 */ ".f............f."
- /* 6 */ ".f............f."
- /* 7 */ ".affaffafffaffa."
- /* 8 */ "................"
-
- // Level 4
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "cccccccccccccccc"
- /* 1 */ "haaaaaaaaaaaaaah"
- /* 2 */ ".a..i...i.i...a."
- /* 3 */ ".a............a."
- /* 4 */ ".a............a."
- /* 5 */ ".a............a."
- /* 6 */ ".a..j..j...j..a."
- /* 7 */ "kaaaaaaaaaaaaaak"
- /* 8 */ "llllllllllllllll"
-
- // Level 5
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "cccccccccccccccc"
- /* 2 */ "haaaaaaaaaaaaaah"
- /* 3 */ ".a............a."
- /* 4 */ ".a............a."
- /* 5 */ ".a............a."
- /* 6 */ "kaaaaaaaaaaaaaak"
- /* 7 */ "llllllllllllllll"
- /* 8 */ "................"
-
- // Level 6
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "cccccccccccccccc"
- /* 3 */ "haaaaaaaaaaaaaah"
- /* 4 */ ".a............a."
- /* 5 */ "kaaaaaaaaaaaaaak"
- /* 6 */ "llllllllllllllll"
- /* 7 */ "................"
- /* 8 */ "................"
-
- // Level 7
- /* z\x* 111111 */
- /* * 0123456789012345 */
- /* 0 */ "................"
- /* 1 */ "................"
- /* 2 */ "................"
- /* 3 */ "cccccccccccccccc"
- /* 4 */ "aaaaaaaaaaaaaaaa"
- /* 5 */ "llllllllllllllll"
- /* 6 */ "................"
- /* 7 */ "................"
- /* 8 */ "................",
-
- // Connectors:
- "-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House16x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House7x7:
- // The data has been exported from the gallery Desert, area index 8, ID 112, created by Aloe_vera
- {
- // Size:
- 7, 7, 7, // SizeX = 7, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 7, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j:128: 6\n" /* sandstonestairs */
- "k:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "mmmaaam"
- /* 1 */ "maaaaam"
- /* 2 */ "maaaaam"
- /* 3 */ "maaaaam"
- /* 4 */ "maaaaam"
- /* 5 */ "maaaaam"
- /* 6 */ "mmmmmmm"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "...bcd."
- /* 1 */ ".aaaaa."
- /* 2 */ ".aaaaa."
- /* 3 */ ".aaaaa."
- /* 4 */ ".aaaaa."
- /* 5 */ ".aaaaa."
- /* 6 */ "......."
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".aaaea."
- /* 2 */ ".a...a."
- /* 3 */ ".a...a."
- /* 4 */ ".a...a."
- /* 5 */ ".aaaaa."
- /* 6 */ "......."
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".afaga."
- /* 2 */ ".f...f."
- /* 3 */ ".f...f."
- /* 4 */ ".f...f."
- /* 5 */ ".afffa."
- /* 6 */ "......."
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "ccccccc"
- /* 1 */ "haaaaah"
- /* 2 */ ".a.i.a."
- /* 3 */ ".a...a."
- /* 4 */ ".a...a."
- /* 5 */ "jaaaaaj"
- /* 6 */ "kkkkkkk"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "ccccccc"
- /* 2 */ "haaaaah"
- /* 3 */ ".a...a."
- /* 4 */ "jaaaaaj"
- /* 5 */ "kkkkkkk"
- /* 6 */ "......."
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "ccccccc"
- /* 3 */ "aaaaaaa"
- /* 4 */ "kkkkkkk"
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "-1: 4, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House7x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House9x7:
- // The data has been exported from the gallery Desert, area index 9, ID 113, created by xoft
- {
- // Size:
- 9, 7, 7, // SizeX = 9, SizeY = 7, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 6, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmaaammm"
- /* 1 */ "maaaaaaam"
- /* 2 */ "maaaaaaam"
- /* 3 */ "maaaaaaam"
- /* 4 */ "maaaaaaam"
- /* 5 */ "maaaaaaam"
- /* 6 */ "mmmmmmmmm"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "...bcd..."
- /* 1 */ ".aaaaaaa."
- /* 2 */ ".aaaaaaa."
- /* 3 */ ".aaaaaaa."
- /* 4 */ ".aaaaaaa."
- /* 5 */ ".aaaaaaa."
- /* 6 */ "........."
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".aaaeaaa."
- /* 2 */ ".a.....a."
- /* 3 */ ".a.....a."
- /* 4 */ ".a.....a."
- /* 5 */ ".aaaaaaa."
- /* 6 */ "........."
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".afagafa."
- /* 2 */ ".f.....f."
- /* 3 */ ".f.....f."
- /* 4 */ ".f.....f."
- /* 5 */ ".affaffa."
- /* 6 */ "........."
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "ccccccccc"
- /* 1 */ "haaaaaaah"
- /* 2 */ ".a.i.i.a."
- /* 3 */ ".a.....a."
- /* 4 */ ".a..j..a."
- /* 5 */ "kaaaaaaak"
- /* 6 */ "lllllllll"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "ccccccccc"
- /* 2 */ "haaaaaaah"
- /* 3 */ ".a.....a."
- /* 4 */ "kaaaaaaak"
- /* 5 */ "lllllllll"
- /* 6 */ "........."
-
- // Level 6
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "........."
- /* 2 */ "ccccccccc"
- /* 3 */ "aaaaaaaaa"
- /* 4 */ "lllllllll"
- /* 5 */ "........."
- /* 6 */ ".........",
-
- // Connectors:
- "-1: 4, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House9x7
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // House9x9:
- // The data has been exported from the gallery Desert, area index 10, ID 114, created by xoft
- {
- // Size:
- 9, 8, 9, // SizeX = 9, SizeY = 8, SizeZ = 9
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 9, 7, 9, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e: 64: 7\n" /* wooddoorblock */
- "f:102: 0\n" /* glasspane */
- "g: 64:12\n" /* wooddoorblock */
- "h:128: 7\n" /* sandstonestairs */
- "i: 50: 3\n" /* torch */
- "j: 50: 4\n" /* torch */
- "k:128: 6\n" /* sandstonestairs */
- "l:128: 3\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 012345678 */
- /* 0 */ "mmmaaammm"
- /* 1 */ "maaaaaaam"
- /* 2 */ "maaaaaaam"
- /* 3 */ "maaaaaaam"
- /* 4 */ "maaaaaaam"
- /* 5 */ "maaaaaaam"
- /* 6 */ "maaaaaaam"
- /* 7 */ "maaaaaaam"
- /* 8 */ "mmmmmmmmm"
-
- // Level 1
- /* z\x* 012345678 */
- /* 0 */ "...bcd..."
- /* 1 */ ".aaaaaaa."
- /* 2 */ ".aaaaaaa."
- /* 3 */ ".aaaaaaa."
- /* 4 */ ".aaaaaaa."
- /* 5 */ ".aaaaaaa."
- /* 6 */ ".aaaaaaa."
- /* 7 */ ".aaaaaaa."
- /* 8 */ "........."
-
- // Level 2
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".aaaeaaa."
- /* 2 */ ".a.....a."
- /* 3 */ ".a.....a."
- /* 4 */ ".a.....a."
- /* 5 */ ".a.....a."
- /* 6 */ ".a.....a."
- /* 7 */ ".aaaaaaa."
- /* 8 */ "........."
-
- // Level 3
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".afagafa."
- /* 2 */ ".f.....f."
- /* 3 */ ".f.....f."
- /* 4 */ ".a.....a."
- /* 5 */ ".f.....f."
- /* 6 */ ".f.....f."
- /* 7 */ ".affaffa."
- /* 8 */ "........."
-
- // Level 4
- /* z\x* 012345678 */
- /* 0 */ "ccccccccc"
- /* 1 */ "haaaaaaah"
- /* 2 */ ".a.i.i.a."
- /* 3 */ ".a.....a."
- /* 4 */ ".a.....a."
- /* 5 */ ".a.....a."
- /* 6 */ ".a..j..a."
- /* 7 */ "kaaaaaaak"
- /* 8 */ "lllllllll"
-
- // Level 5
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "ccccccccc"
- /* 2 */ "haaaaaaah"
- /* 3 */ ".a.....a."
- /* 4 */ ".a.....a."
- /* 5 */ ".a.....a."
- /* 6 */ "kaaaaaaak"
- /* 7 */ "lllllllll"
- /* 8 */ "........."
-
- // Level 6
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "........."
- /* 2 */ "ccccccccc"
- /* 3 */ "haaaaaaah"
- /* 4 */ ".a.....a."
- /* 5 */ "kaaaaaaak"
- /* 6 */ "lllllllll"
- /* 7 */ "........."
- /* 8 */ "........."
-
- // Level 7
- /* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ "........."
- /* 2 */ "........."
- /* 3 */ "ccccccccc"
- /* 4 */ "aaaaaaaaa"
- /* 5 */ "lllllllll"
- /* 6 */ "........."
- /* 7 */ "........."
- /* 8 */ ".........",
-
- // Connectors:
- "-1: 4, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // House9x9
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseL14x12:
- // The data has been exported from the gallery Desert, area index 14, ID 124, created by Aloe_vera
- {
- // Size:
- 14, 8, 12, // SizeX = 14, SizeY = 8, SizeZ = 12
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 14, 7, 12, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e:128: 3\n" /* sandstonestairs */
- "f: 64: 3\n" /* wooddoorblock */
- "g: 64: 1\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64: 8\n" /* wooddoorblock */
- "j:128: 7\n" /* sandstonestairs */
- "k: 50: 3\n" /* torch */
- "l: 50: 2\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n: 50: 4\n" /* torch */
- "o:128: 6\n" /* sandstonestairs */
- "p: 50: 1\n" /* torch */
- "q:128: 5\n" /* sandstonestairs */
- "r:128: 4\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "mmmmaaammmmmmm"
- /* 1 */ "maaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaam"
- /* 6 */ "maaaaaaaaaaaam"
- /* 7 */ "maaaaaaaaaaaam"
- /* 8 */ "mmmmaaaaaaaaam"
- /* 9 */ "mmmmmmaaaaaaam"
- /* 10 */ "mmmmmmaaaaaaam"
- /* 11 */ "mmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "....bcd......."
- /* 1 */ ".aaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaa."
- /* 6 */ ".aaaaaaaaaaaa."
- /* 7 */ ".aaaaaaaaaaaa."
- /* 8 */ "....beaaaaaaa."
- /* 9 */ "mmmmm.aaaaaaa."
- /* 10 */ "mmmmm.aaaaaaa."
- /* 11 */ "mmmmm........."
-
- // Level 2
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".aaaafaaaaaaa."
- /* 2 */ ".a..........a."
- /* 3 */ ".a..........a."
- /* 4 */ ".a..........a."
- /* 5 */ ".a..........a."
- /* 6 */ ".a..........a."
- /* 7 */ ".aaaaga.....a."
- /* 8 */ "......a.....a."
- /* 9 */ "mmmmm.a.....a."
- /* 10 */ "mmmmm.aaaaaaa."
- /* 11 */ "mmmmm........."
-
- // Level 3
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".ahhaiahhahha."
- /* 2 */ ".h..........h."
- /* 3 */ ".h..........h."
- /* 4 */ ".a..........a."
- /* 5 */ ".h..........h."
- /* 6 */ ".h..........h."
- /* 7 */ ".ahhaia.....a."
- /* 8 */ "......h.....h."
- /* 9 */ "mmmmm.h.....h."
- /* 10 */ "mmmmm.ahhahha."
- /* 11 */ "mmmmm........."
-
- // Level 4
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "cccccccccccccc"
- /* 1 */ "jaaaaaaaaaaaad"
- /* 2 */ ".a..k.k.....ad"
- /* 3 */ ".a..........ad"
- /* 4 */ ".a.........lad"
- /* 5 */ ".a..........ad"
- /* 6 */ ".a..n.n.....ad"
- /* 7 */ "oaaaaaap...lad"
- /* 8 */ "eeeeeba.....ad"
- /* 9 */ "mmmmmba.....ad"
- /* 10 */ "mmmmmbaaaaaaad"
- /* 11 */ "mmmmmbq.....rd"
-
- // Level 5
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ "ccccccccccccd."
- /* 2 */ "jaaaaaaaaaaad."
- /* 3 */ ".a.........ad."
- /* 4 */ ".a.........ad."
- /* 5 */ ".a.........ad."
- /* 6 */ "oaaaaaaa...ad."
- /* 7 */ "eeeeeeba...ad."
- /* 8 */ "......ba...ad."
- /* 9 */ "mmmmm.ba...ad."
- /* 10 */ "mmmmm.baaaaad."
- /* 11 */ "mmmmm.bq...rd."
-
- // Level 6
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".............."
- /* 2 */ "cccccccccccc.."
- /* 3 */ "jaaaaaaaaaad.."
- /* 4 */ ".a........ad.."
- /* 5 */ "oaaaaaaaa.ad.."
- /* 6 */ "eeeeeeeea.ad.."
- /* 7 */ ".......ba.ad.."
- /* 8 */ ".......ba.ad.."
- /* 9 */ "mmmmm..ba.ad.."
- /* 10 */ "mmmmm..baaad.."
- /* 11 */ "mmmmm..bq.rd.."
-
- // Level 7
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".............."
- /* 2 */ ".............."
- /* 3 */ "ccccccccccc..."
- /* 4 */ "aaaaaaaaaad..."
- /* 5 */ "eeeeeeeebad..."
- /* 6 */ "........bad..."
- /* 7 */ "........bad..."
- /* 8 */ "........bad..."
- /* 9 */ "mmmmm...bad..."
- /* 10 */ "mmmmm...bad..."
- /* 11 */ "mmmmm...bad...",
-
- // Connectors:
- "-1: 5, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseL14x12
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // HouseL14x12:
- // The data has been exported from the gallery Desert, area index 7, ID 82, created by Aloe_vera
- {
- // Size:
- 14, 7, 12, // SizeX = 14, SizeY = 7, SizeZ = 12
-
- // Hitbox (relative to bounding box):
- -1, 0, 0, // MinX, MinY, MinZ
- 14, 6, 12, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 0\n" /* sandstonestairs */
- "c:128: 2\n" /* sandstonestairs */
- "d:128: 1\n" /* sandstonestairs */
- "e:128: 3\n" /* sandstonestairs */
- "f: 64: 7\n" /* wooddoorblock */
- "g: 64: 5\n" /* wooddoorblock */
- "h:102: 0\n" /* glasspane */
- "i: 64:12\n" /* wooddoorblock */
- "j:128: 7\n" /* sandstonestairs */
- "k: 50: 3\n" /* torch */
- "l: 50: 4\n" /* torch */
- "m: 19: 0\n" /* sponge */
- "n:128: 6\n" /* sandstonestairs */
- "o:128: 5\n" /* sandstonestairs */
- "p:128: 4\n" /* sandstonestairs */
- "q: 50: 1\n" /* torch */,
-
- // Block data:
- // Level 0
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "mmmmmmmaaammmm"
- /* 1 */ "maaaaaaaaaaaam"
- /* 2 */ "maaaaaaaaaaaam"
- /* 3 */ "maaaaaaaaaaaam"
- /* 4 */ "maaaaaaaaaaaam"
- /* 5 */ "maaaaaaaaaaaam"
- /* 6 */ "mmmmaaamaaaaam"
- /* 7 */ "mmmmmmmmaaaaam"
- /* 8 */ "mmmmmmmmaaaaam"
- /* 9 */ "mmmmmmmmaaaaam"
- /* 10 */ "mmmmmmmmaaaaam"
- /* 11 */ "mmmmmmmmmmmmmm"
-
- // Level 1
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".......bcd...."
- /* 1 */ ".aaaaaaaaaaaa."
- /* 2 */ ".aaaaaaaaaaaa."
- /* 3 */ ".aaaaaaaaaaaa."
- /* 4 */ ".aaaaaaaaaaaa."
- /* 5 */ ".aaaaaaaaaaaa."
- /* 6 */ "....bed.aaaaa."
- /* 7 */ "........aaaaa."
- /* 8 */ "........aaaaa."
- /* 9 */ "........aaaaa."
- /* 10 */ "........aaaaa."
- /* 11 */ ".............."
-
- // Level 2
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".aaaaaaafaaaa."
- /* 2 */ ".a..........a."
- /* 3 */ ".a..........a."
- /* 4 */ ".a..........a."
- /* 5 */ ".aaaagaaa...a."
- /* 6 */ "........a...a."
- /* 7 */ "........a...a."
- /* 8 */ "........a...a."
- /* 9 */ "........a...a."
- /* 10 */ "........aaaaa."
- /* 11 */ ".............."
-
- // Level 3
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".ahhahhaiahha."
- /* 2 */ ".h..........h."
- /* 3 */ ".h..........h."
- /* 4 */ ".h..........a."
- /* 5 */ ".ahhaiahh...h."
- /* 6 */ "........h...h."
- /* 7 */ "........a...a."
- /* 8 */ "........h...h."
- /* 9 */ "........h...h."
- /* 10 */ "........ahhha."
- /* 11 */ ".............."
-
- // Level 4
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ "cccccccccccccc"
- /* 1 */ "jaaaaaaaaaaaad"
- /* 2 */ ".a.....k.k..ad"
- /* 3 */ ".a..........ad"
- /* 4 */ ".a..l.l.....ad"
- /* 5 */ "naaaaaaaa...ad"
- /* 6 */ "eeeeeeeba...ad"
- /* 7 */ ".......ba...ad"
- /* 8 */ ".......ba...ad"
- /* 9 */ ".......ba...ad"
- /* 10 */ ".......baaaaad"
- /* 11 */ ".......bo...pd"
-
- // Level 5
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ "ccccccccccccc."
- /* 2 */ "jaaaaaaaaaaad."
- /* 3 */ ".aq........ad."
- /* 4 */ "naaaaaaaaa.ad."
- /* 5 */ "eeeeeeeeba.ad."
- /* 6 */ "........ba.ad."
- /* 7 */ "........ba.ad."
- /* 8 */ "........ba.ad."
- /* 9 */ "........balad."
- /* 10 */ "........baaad."
- /* 11 */ "........bo.pd."
-
- // Level 6
- /* z\x* 1111 */
- /* * 01234567890123 */
- /* 0 */ ".............."
- /* 1 */ ".............."
- /* 2 */ "cccccccccccc.."
- /* 3 */ "aaaaaaaaaaad.."
- /* 4 */ "eeeeeeeeebad.."
- /* 5 */ ".........bad.."
- /* 6 */ ".........bad.."
- /* 7 */ ".........bad.."
- /* 8 */ ".........bad.."
- /* 9 */ ".........bad.."
- /* 10 */ ".........bad.."
- /* 11 */ ".........bad..",
-
- // Connectors:
- "-1: 8, 1, 0: 2\n" /* Type -1, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // HouseL14x12
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // SingleField:
- // The data has been exported from the gallery Desert, area index 17, ID 127, created by Aloe_vera
- {
- // Size:
- 10, 3, 7, // SizeX = 10, SizeY = 3, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, -1, // MinX, MinY, MinZ
- 10, 2, 7, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b: 60: 7\n" /* tilleddirt */
- "c: 8: 0\n" /* water */
- "d: 50: 5\n" /* torch */
- "e: 59: 7\n" /* crops */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "aaaaaaaaaa"
- /* 1 */ "aaaaaaaaaa"
- /* 2 */ "aaaaaaaaaa"
- /* 3 */ "aaaaaaaaaa"
- /* 4 */ "aaaaaaaaaa"
- /* 5 */ "aaaaaaaaaa"
- /* 6 */ "aaaaaaaaaa"
-
- // Level 1
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "aaaaaaaaaa"
- /* 1 */ "abbbbbbbba"
- /* 2 */ "abbbbbbbba"
- /* 3 */ "acccccccca"
- /* 4 */ "abbbbbbbba"
- /* 5 */ "abbbbbbbba"
- /* 6 */ "aaaaaaaaaa"
-
- // Level 2
- /* z\x* */
- /* * 0123456789 */
- /* 0 */ "d........d"
- /* 1 */ ".eeeeeeee."
- /* 2 */ ".eeeeeeee."
- /* 3 */ ".........."
- /* 4 */ ".eeeeeeee."
- /* 5 */ ".eeeeeeee."
- /* 6 */ "d........d",
-
- // Connectors:
- "-1: 0, 1, 3: 4\n" /* Type -1, direction X- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // SingleField
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // SmallHut:
- // The data has been exported from the gallery Desert, area index 4, ID 68, created by tonibm1999
- {
- // Size:
- 5, 6, 6, // SizeX = 5, SizeY = 6, SizeZ = 6
-
- // Hitbox (relative to bounding box):
- -1, 0, -1, // MinX, MinY, MinZ
- 5, 5, 5, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 24: 0\n" /* sandstone */
- "b:128: 3\n" /* sandstonestairs */
- "c: 24: 2\n" /* sandstone */
- "d: 50: 5\n" /* torch */
- "e: 26:10\n" /* bedblock */
- "f: 26: 2\n" /* bedblock */
- "g: 64: 5\n" /* wooddoorblock */
- "h: 64:12\n" /* wooddoorblock */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 01234 */
- /* 0 */ "aaaaa"
- /* 1 */ "aaaaa"
- /* 2 */ "aaaaa"
- /* 3 */ "aaaaa"
- /* 4 */ "aaaaa"
- /* 5 */ "mmamm"
-
- // Level 1
- /* z\x* 01234 */
- /* 0 */ "aaaaa"
- /* 1 */ "aaaaa"
- /* 2 */ "aaaaa"
- /* 3 */ "aaaaa"
- /* 4 */ "aaaaa"
- /* 5 */ "..b.."
-
- // Level 2
- /* z\x* 01234 */
- /* 0 */ "accca"
- /* 1 */ "cdedc"
- /* 2 */ "c.f.c"
- /* 3 */ "c...c"
- /* 4 */ "acgca"
- /* 5 */ "....."
-
- // Level 3
- /* z\x* 01234 */
- /* 0 */ "ac.ca"
- /* 1 */ "c...c"
- /* 2 */ "....."
- /* 3 */ "c...c"
- /* 4 */ "achca"
- /* 5 */ "....."
-
- // Level 4
- /* z\x* 01234 */
- /* 0 */ "accca"
- /* 1 */ "c...c"
- /* 2 */ "c...c"
- /* 3 */ "c...c"
- /* 4 */ "accca"
- /* 5 */ "....."
-
- // Level 5
- /* z\x* 01234 */
- /* 0 */ ".aaa."
- /* 1 */ "aaaaa"
- /* 2 */ "aaaaa"
- /* 3 */ "aaaaa"
- /* 4 */ ".aaa."
- /* 5 */ ".....",
-
- // Connectors:
- "-1: 2, 1, 5: 3\n" /* Type -1, direction Z+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // SmallHut
-}; // g_SandVillagePrefabs
-
-
-
-
-
-
-const cPrefab::sDef g_SandVillageStartingPrefabs[] =
-{
- ////////////////////////////////////////////////////////////////////////////////
- // RoofedWell:
- // The data has been exported from the gallery Desert, area index 43, ID 274, created by Aloe_vera
- {
- // Size:
- 7, 14, 7, // SizeX = 7, SizeY = 14, SizeZ = 7
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 6, 13, 6, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 24: 0\n" /* sandstone */
- "c: 8: 0\n" /* water */
- "d: 12: 0\n" /* sand */
- "e: 4: 0\n" /* cobblestone */
- "f: 13: 0\n" /* gravel */
- "g:118: 3\n" /* cauldronblock */
- "h: 85: 0\n" /* fence */
- "i:128: 2\n" /* sandstonestairs */
- "j:128: 7\n" /* sandstonestairs */
- "k:128: 4\n" /* sandstonestairs */
- "l:128: 5\n" /* sandstonestairs */
- "m: 19: 0\n" /* sponge */
- "n:128: 6\n" /* sandstonestairs */
- "o:128: 3\n" /* sandstonestairs */,
-
- // Block data:
- // Level 0
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "aaaaaaa"
- /* 2 */ "aaaaaaa"
- /* 3 */ "aaaaaaa"
- /* 4 */ "aaaaaaa"
- /* 5 */ "aaaaaaa"
- /* 6 */ "aaaaaaa"
-
- // Level 1
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 2
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 3
- /* z\x* 0123456 */
- /* 0 */ "aaaaaaa"
- /* 1 */ "abbbbba"
- /* 2 */ "abcccba"
- /* 3 */ "abcccba"
- /* 4 */ "abcccba"
- /* 5 */ "abbbbba"
- /* 6 */ "aaaaaaa"
-
- // Level 4
- /* z\x* 0123456 */
- /* 0 */ "ddddddd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "dbcccbd"
- /* 3 */ "dbcccbd"
- /* 4 */ "dbcccbd"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddddddd"
-
- // Level 5
- /* z\x* 0123456 */
- /* 0 */ "ddddddd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "dbcccbd"
- /* 3 */ "dbcccbd"
- /* 4 */ "dbcccbd"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddddddd"
-
- // Level 6
- /* z\x* 0123456 */
- /* 0 */ "ddeeedd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "ebcccbe"
- /* 3 */ "ebcccbe"
- /* 4 */ "ebcccbe"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddeeedd"
-
- // Level 7
- /* z\x* 0123456 */
- /* 0 */ "ddfffdd"
- /* 1 */ "dbbbbbd"
- /* 2 */ "fbcccbf"
- /* 3 */ "fbcccbf"
- /* 4 */ "fbcccbf"
- /* 5 */ "dbbbbbd"
- /* 6 */ "ddfffdd"
-
- // Level 8
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".bbbbb."
- /* 2 */ ".b...b."
- /* 3 */ ".b.g.b."
- /* 4 */ ".b...b."
- /* 5 */ ".bbbbb."
- /* 6 */ "......."
-
- // Level 9
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".h...h."
- /* 2 */ "......."
- /* 3 */ "...h..."
- /* 4 */ "......."
- /* 5 */ ".h...h."
- /* 6 */ "......."
-
- // Level 10
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".h...h."
- /* 2 */ "......."
- /* 3 */ "...h..."
- /* 4 */ "......."
- /* 5 */ ".h...h."
- /* 6 */ "......."
-
- // Level 11
- /* z\x* 0123456 */
- /* 0 */ "iiiiiii"
- /* 1 */ "jbjjjbj"
- /* 2 */ ".k...l."
- /* 3 */ ".k.h.l."
- /* 4 */ ".k...l."
- /* 5 */ "nbnnnbn"
- /* 6 */ "ooooooo"
-
- // Level 12
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "iiiiiii"
- /* 2 */ "jb...bj"
- /* 3 */ ".b.h.b."
- /* 4 */ "nb...bn"
- /* 5 */ "ooooooo"
- /* 6 */ "......."
-
- // Level 13
- /* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ "......."
- /* 2 */ "iiiiiii"
- /* 3 */ "bbbbbbb"
- /* 4 */ "ooooooo"
- /* 5 */ "......."
- /* 6 */ ".......",
-
- // Connectors:
- "2: 6, 8, 3: 5\n" /* Type 2, direction X+ */
- "2: 3, 8, 6: 3\n" /* Type 2, direction Z+ */
- "2: 0, 8, 3: 4\n" /* Type 2, direction X- */
- "2: 3, 8, 0: 2\n" /* Type 2, direction Z- */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // RoofedWell
-
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Well:
- // The data has been exported from the gallery Desert, area index 0, ID 1, created by Aloe_vera
- {
- // Size:
- 4, 13, 4, // SizeX = 4, SizeY = 13, SizeZ = 4
-
- // Hitbox (relative to bounding box):
- 0, 0, 0, // MinX, MinY, MinZ
- 3, 12, 3, // MaxX, MaxY, MaxZ
-
- // Block definitions:
- ".: 0: 0\n" /* air */
- "a: 1: 0\n" /* stone */
- "b: 24: 0\n" /* sandstone */
- "c: 8: 0\n" /* water */
- "d: 85: 0\n" /* fence */
- "m: 19: 0\n" /* sponge */,
-
- // Block data:
- // Level 0
- /* z\x* 0123 */
- /* 0 */ "aaaa"
- /* 1 */ "aaaa"
- /* 2 */ "aaaa"
- /* 3 */ "aaaa"
-
- // Level 1
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 2
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 3
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 4
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 5
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 6
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 7
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bccb"
- /* 2 */ "bccb"
- /* 3 */ "bbbb"
-
- // Level 8
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "b..b"
- /* 2 */ "b..b"
- /* 3 */ "bbbb"
-
- // Level 9
- /* z\x* 0123 */
- /* 0 */ "d..d"
- /* 1 */ "...."
- /* 2 */ "...."
- /* 3 */ "d..d"
-
- // Level 10
- /* z\x* 0123 */
- /* 0 */ "d..d"
- /* 1 */ "...."
- /* 2 */ "...."
- /* 3 */ "d..d"
-
- // Level 11
- /* z\x* 0123 */
- /* 0 */ "d..d"
- /* 1 */ "...."
- /* 2 */ "...."
- /* 3 */ "d..d"
-
- // Level 12
- /* z\x* 0123 */
- /* 0 */ "bbbb"
- /* 1 */ "bbbb"
- /* 2 */ "bbbb"
- /* 3 */ "bbbb",
-
- // Connectors:
- "2: 2, 8, 0: 2\n" /* Type 2, direction Z- */
- "2: 0, 8, 1: 4\n" /* Type 2, direction X- */
- "2: 1, 8, 3: 3\n" /* Type 2, direction Z+ */
- "2: 3, 8, 2: 5\n" /* Type 2, direction X+ */,
-
- // AllowedRotations:
- 7, /* 1, 2, 3 CCW rotation allowed */
-
- // Merge strategy:
- cBlockArea::msSpongePrint,
-
- // ShouldExtendFloor:
- true,
-
- // DefaultWeight:
- 100,
-
- // DepthWeight:
- "",
-
- // AddWeightIfSame:
- 0,
-
- // MoveToGround:
- true,
- }, // Well
-};
-
-
-
-
-
-// The prefab counts:
-
-const size_t g_SandVillagePrefabsCount = ARRAYCOUNT(g_SandVillagePrefabs);
-
-const size_t g_SandVillageStartingPrefabsCount = ARRAYCOUNT(g_SandVillageStartingPrefabs);
-
diff --git a/src/Generating/Prefabs/SandVillagePrefabs.h b/src/Generating/Prefabs/SandVillagePrefabs.h
deleted file mode 100644
index 7b00db56f..000000000
--- a/src/Generating/Prefabs/SandVillagePrefabs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// SandVillagePrefabs.h
-
-// Declares the prefabs in the group SandVillage
-
-#include "../Prefab.h"
-
-
-
-
-
-extern const cPrefab::sDef g_SandVillagePrefabs[];
-extern const cPrefab::sDef g_SandVillageStartingPrefabs[];
-extern const size_t g_SandVillagePrefabsCount;
-extern const size_t g_SandVillageStartingPrefabsCount;
diff --git a/src/Generating/Prefabs/UnderwaterBasePrefabs.cpp b/src/Generating/Prefabs/UnderwaterBasePrefabs.cpp
index 1655f50b9..112531641 100644
--- a/src/Generating/Prefabs/UnderwaterBasePrefabs.cpp
+++ b/src/Generating/Prefabs/UnderwaterBasePrefabs.cpp
@@ -32,9 +32,9 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
"b: 20: 0\n" /* glass */
"c: 5: 5\n" /* wood */
"d: 8: 0\n" /* water */
- "e: 64: 4\n" /* wooddoorblock */
- "f: 64:12\n" /* wooddoorblock */
- "g: 64:13\n" /* wooddoorblock */
+ "e: 64: 0\n" /* wooddoorblock */
+ "f: 64: 8\n" /* wooddoorblock */
+ "g: 64: 9\n" /* wooddoorblock */
"m: 19: 0\n" /* sponge */,
// Block data:
@@ -280,18 +280,16 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
".: 0: 0\n" /* air */
"a: 5: 5\n" /* wood */
"b: 5: 0\n" /* wood */
- "c: 64: 5\n" /* wooddoorblock */
- "d: 64: 2\n" /* wooddoorblock */
- "e: 64: 4\n" /* wooddoorblock */
- "f: 64: 1\n" /* wooddoorblock */
- "g: 20: 0\n" /* glass */
- "h: 64:12\n" /* wooddoorblock */
- "i: 76: 3\n" /* redstonetorchon */
- "j: 64: 8\n" /* wooddoorblock */
- "k: 76: 4\n" /* redstonetorchon */
- "l: 76: 2\n" /* redstonetorchon */
- "m: 19: 0\n" /* sponge */
- "n: 76: 1\n" /* redstonetorchon */,
+ "c: 64: 2\n" /* wooddoorblock */
+ "d: 64: 1\n" /* wooddoorblock */
+ "e: 20: 0\n" /* glass */
+ "f: 64: 9\n" /* wooddoorblock */
+ "g: 76: 3\n" /* redstonetorchon */
+ "h: 64: 8\n" /* wooddoorblock */
+ "i: 76: 4\n" /* redstonetorchon */
+ "j: 76: 2\n" /* redstonetorchon */
+ "k: 76: 1\n" /* redstonetorchon */
+ "m: 19: 0\n" /* sponge */,
// Block data:
// Level 0
@@ -313,28 +311,28 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
/* * 0123456789 */
/* 0 */ "abbbbbmmmm"
/* 1 */ "c.....bbmm"
- /* 2 */ "d.......bm"
+ /* 2 */ "c.......bm"
/* 3 */ "abb.....bm"
/* 4 */ "mmmbb....b"
/* 5 */ "mmmmmb...b"
/* 6 */ "mmmmmb...b"
/* 7 */ "mmmmmmb..b"
/* 8 */ "mmmmmmb..b"
- /* 9 */ "mmmmmmaefa"
+ /* 9 */ "mmmmmmadda"
// Level 2
/* z\x* */
/* * 0123456789 */
- /* 0 */ "abggbbmmmm"
- /* 1 */ "h...i.bbmm"
- /* 2 */ "j.......bm"
- /* 3 */ "abbk....bm"
+ /* 0 */ "abeebbmmmm"
+ /* 1 */ "f...g.bbmm"
+ /* 2 */ "h.......bm"
+ /* 3 */ "abbi....bm"
/* 4 */ "mmmbb....b"
- /* 5 */ "mmmmmb..lb"
- /* 6 */ "mmmmmbn..g"
- /* 7 */ "mmmmmmb..g"
+ /* 5 */ "mmmmmb..jb"
+ /* 6 */ "mmmmmbk..e"
+ /* 7 */ "mmmmmmb..e"
/* 8 */ "mmmmmmb..b"
- /* 9 */ "mmmmmmahja"
+ /* 9 */ "mmmmmmafha"
// Level 3
/* z\x* */
@@ -396,20 +394,17 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
"a: 5: 5\n" /* wood */
"b: 5: 0\n" /* wood */
"c: 64: 3\n" /* wooddoorblock */
- "d: 64: 6\n" /* wooddoorblock */
- "e: 64: 5\n" /* wooddoorblock */
- "f: 64: 0\n" /* wooddoorblock */
- "g: 64: 2\n" /* wooddoorblock */
- "h: 64: 1\n" /* wooddoorblock */
- "i: 64: 8\n" /* wooddoorblock */
- "j: 64:12\n" /* wooddoorblock */
- "k: 20: 0\n" /* glass */
- "l: 76: 1\n" /* redstonetorchon */
+ "d: 64: 2\n" /* wooddoorblock */
+ "e: 64: 0\n" /* wooddoorblock */
+ "f: 64: 1\n" /* wooddoorblock */
+ "g: 64: 8\n" /* wooddoorblock */
+ "h: 64: 9\n" /* wooddoorblock */
+ "i: 20: 0\n" /* glass */
+ "j: 76: 1\n" /* redstonetorchon */
+ "k: 76: 2\n" /* redstonetorchon */
+ "l: 76: 3\n" /* redstonetorchon */
"m: 19: 0\n" /* sponge */
- "n: 76: 2\n" /* redstonetorchon */
- "o: 76: 3\n" /* redstonetorchon */
- "p: 76: 4\n" /* redstonetorchon */
- "q: 64: 9\n" /* wooddoorblock */,
+ "n: 76: 4\n" /* redstonetorchon */,
// Block data:
// Level 0
@@ -435,42 +430,42 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
// Level 1
/* z\x* 111111 */
/* * 0123456789012345 */
- /* 0 */ "mmmmmmacdammmmmm"
+ /* 0 */ "mmmmmmaccammmmmm"
/* 1 */ "mmmmmmb..bmmmmmm"
/* 2 */ "mmmmmmb..bmmmmmm"
/* 3 */ "mmmmmmb..bmmmmmm"
/* 4 */ "mmmmmmb..bmmmmmm"
/* 5 */ "mmmmmmb..bmmmmmm"
/* 6 */ "abbbbbb..bbbbbba"
- /* 7 */ "e..............f"
- /* 8 */ "g..............f"
+ /* 7 */ "d..............e"
+ /* 8 */ "d..............e"
/* 9 */ "abbbbbb..bbbbbba"
/* 10 */ "mmmmmmb..bmmmmmm"
/* 11 */ "mmmmmmb..bmmmmmm"
/* 12 */ "mmmmmmb..bmmmmmm"
/* 13 */ "mmmmmmb..bmmmmmm"
/* 14 */ "mmmmmmb..bmmmmmm"
- /* 15 */ "mmmmmmahhammmmmm"
+ /* 15 */ "mmmmmmaffammmmmm"
// Level 2
/* z\x* 111111 */
/* * 0123456789012345 */
- /* 0 */ "mmmmmmaijammmmmm"
+ /* 0 */ "mmmmmmaghammmmmm"
/* 1 */ "mmmmmmb..bmmmmmm"
- /* 2 */ "mmmmmmk..kmmmmmm"
- /* 3 */ "mmmmmmk..kmmmmmm"
- /* 4 */ "mmmmmmblnbmmmmmm"
+ /* 2 */ "mmmmmmi..immmmmm"
+ /* 3 */ "mmmmmmi..immmmmm"
+ /* 4 */ "mmmmmmbjkbmmmmmm"
/* 5 */ "mmmmmmb..bmmmmmm"
- /* 6 */ "abkkbbb..bbbkkba"
- /* 7 */ "j...o......o...i"
- /* 8 */ "i...p......p...q"
- /* 9 */ "abkkbbb..bbbkkba"
+ /* 6 */ "abiibbb..bbbiiba"
+ /* 7 */ "h...l......l...g"
+ /* 8 */ "g...n......n...h"
+ /* 9 */ "abiibbb..bbbiiba"
/* 10 */ "mmmmmmb..bmmmmmm"
- /* 11 */ "mmmmmmblnbmmmmmm"
- /* 12 */ "mmmmmmk..kmmmmmm"
- /* 13 */ "mmmmmmk..kmmmmmm"
+ /* 11 */ "mmmmmmbjkbmmmmmm"
+ /* 12 */ "mmmmmmi..immmmmm"
+ /* 13 */ "mmmmmmi..immmmmm"
/* 14 */ "mmmmmmb..bmmmmmm"
- /* 15 */ "mmmmmmaqiammmmmm"
+ /* 15 */ "mmmmmmahgammmmmm"
// Level 3
/* z\x* 111111 */
@@ -549,8 +544,6 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
"h: 64: 8\n" /* wooddoorblock */
"i: 76: 4\n" /* redstonetorchon */
"j: 64: 0\n" /* wooddoorblock */
- "k: 64: 7\n" /* wooddoorblock */
- "l: 64:12\n" /* wooddoorblock */
"m: 19: 0\n" /* sponge */,
// Block data:
@@ -607,7 +600,7 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
/* * 0123456789012345 */
/* 0 */ "mmmmmmmbbbbbbbba"
/* 1 */ "mmmmmmmb.......j"
- /* 2 */ "mmmmmmmb.......k"
+ /* 2 */ "mmmmmmmb.......j"
/* 3 */ "mmmmmmmbbbbbbbba"
// Level 7
@@ -615,7 +608,7 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmbbbeebba"
/* 1 */ "mmmmmmmmb.g....h"
- /* 2 */ "mmmmmmmmb.i....l"
+ /* 2 */ "mmmmmmmmb.i....f"
/* 3 */ "mmmmmmmmbbbeebba"
// Level 8
@@ -672,19 +665,16 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
"a: 5: 5\n" /* wood */
"b: 5: 0\n" /* wood */
"c: 64: 3\n" /* wooddoorblock */
- "d: 64: 6\n" /* wooddoorblock */
- "e: 64: 5\n" /* wooddoorblock */
- "f: 64: 0\n" /* wooddoorblock */
- "g: 64: 2\n" /* wooddoorblock */
- "h: 64: 8\n" /* wooddoorblock */
- "i: 64:12\n" /* wooddoorblock */
- "j: 20: 0\n" /* glass */
- "k: 76: 1\n" /* redstonetorchon */
- "l: 76: 2\n" /* redstonetorchon */
- "m: 19: 0\n" /* sponge */
- "n: 76: 3\n" /* redstonetorchon */
- "o: 76: 4\n" /* redstonetorchon */
- "p: 64: 9\n" /* wooddoorblock */,
+ "d: 64: 2\n" /* wooddoorblock */
+ "e: 64: 0\n" /* wooddoorblock */
+ "f: 64: 8\n" /* wooddoorblock */
+ "g: 64: 9\n" /* wooddoorblock */
+ "h: 20: 0\n" /* glass */
+ "i: 76: 1\n" /* redstonetorchon */
+ "j: 76: 2\n" /* redstonetorchon */
+ "k: 76: 3\n" /* redstonetorchon */
+ "l: 76: 4\n" /* redstonetorchon */
+ "m: 19: 0\n" /* sponge */,
// Block data:
// Level 0
@@ -704,30 +694,30 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
// Level 1
/* z\x* 111111 */
/* * 0123456789012345 */
- /* 0 */ "mmmmmmacdammmmmm"
+ /* 0 */ "mmmmmmaccammmmmm"
/* 1 */ "mmmmmmb..bmmmmmm"
/* 2 */ "mmmmmmb..bmmmmmm"
/* 3 */ "mmmmmmb..bmmmmmm"
/* 4 */ "mmmmmmb..bmmmmmm"
/* 5 */ "mmmmmmb..bmmmmmm"
/* 6 */ "abbbbbb..bbbbbba"
- /* 7 */ "e..............f"
- /* 8 */ "g..............f"
+ /* 7 */ "d..............e"
+ /* 8 */ "d..............e"
/* 9 */ "abbbbbbbbbbbbbba"
// Level 2
/* z\x* 111111 */
/* * 0123456789012345 */
- /* 0 */ "mmmmmmahiammmmmm"
+ /* 0 */ "mmmmmmafgammmmmm"
/* 1 */ "mmmmmmb..bmmmmmm"
- /* 2 */ "mmmmmmj..jmmmmmm"
- /* 3 */ "mmmmmmj..jmmmmmm"
- /* 4 */ "mmmmmmbklbmmmmmm"
+ /* 2 */ "mmmmmmh..hmmmmmm"
+ /* 3 */ "mmmmmmh..hmmmmmm"
+ /* 4 */ "mmmmmmbijbmmmmmm"
/* 5 */ "mmmmmmb..bmmmmmm"
- /* 6 */ "abjjbbb..bbbjjba"
- /* 7 */ "i...n......n...h"
- /* 8 */ "h...o......o...p"
- /* 9 */ "abjjbbbjjbbbjjba"
+ /* 6 */ "abhhbbb..bbbhhba"
+ /* 7 */ "g...k......k...f"
+ /* 8 */ "f...l......l...g"
+ /* 9 */ "abhhbbbhhbbbhhba"
// Level 3
/* z\x* 111111 */
@@ -974,14 +964,12 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
"a: 5: 0\n" /* wood */
"b: 5: 5\n" /* wood */
"c: 20: 0\n" /* glass */
- "d: 64: 5\n" /* wooddoorblock */
+ "d: 64: 2\n" /* wooddoorblock */
"e: 64: 0\n" /* wooddoorblock */
- "f: 64: 2\n" /* wooddoorblock */
- "g: 76: 3\n" /* redstonetorchon */
- "h: 64:12\n" /* wooddoorblock */
- "i: 64: 8\n" /* wooddoorblock */
- "j: 64: 9\n" /* wooddoorblock */
- "k: 76: 4\n" /* redstonetorchon */
+ "f: 76: 3\n" /* redstonetorchon */
+ "g: 64: 9\n" /* wooddoorblock */
+ "h: 64: 8\n" /* wooddoorblock */
+ "i: 76: 4\n" /* redstonetorchon */
"m: 19: 0\n" /* sponge */,
// Block data:
@@ -1001,7 +989,7 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
/* 0 */ "mmaccccccccccamm"
/* 1 */ "ba............ab"
/* 2 */ "d..............e"
- /* 3 */ "f..............e"
+ /* 3 */ "d..............e"
/* 4 */ "ba............ab"
/* 5 */ "mmaccccccccccamm"
@@ -1009,10 +997,10 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmaccccccccccamm"
- /* 1 */ "bag..........gab"
- /* 2 */ "h..............i"
- /* 3 */ "i..............j"
- /* 4 */ "bak..........kab"
+ /* 1 */ "baf..........fab"
+ /* 2 */ "g..............h"
+ /* 3 */ "h..............g"
+ /* 4 */ "bai..........iab"
/* 5 */ "mmaccccccccccamm"
// Level 3
@@ -1673,7 +1661,8 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
"j: 76: 4\n" /* redstonetorchon */
"k: 64: 1\n" /* wooddoorblock */
"l: 64: 8\n" /* wooddoorblock */
- "m: 19: 0\n" /* sponge */,
+ "m: 19: 0\n" /* sponge */
+ "n: 64: 9\n" /* wooddoorblock */,
// Block data:
// Level 0
@@ -1721,7 +1710,7 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
// Level 2
/* z\x* 1111 */
/* * 01234567890123 */
- /* 0 */ "mmmmallammmmmm"
+ /* 0 */ "mmmmalnammmmmm"
/* 1 */ "mmmmb..bmmmmmm"
/* 2 */ "mmmmc..cmmmmmm"
/* 3 */ "mmmcc..ccmmmmm"
@@ -1729,14 +1718,14 @@ const cPrefab::sDef g_UnderwaterBasePrefabs[] =
/* 5 */ "mcc......ccmmm"
/* 6 */ "mc........ccba"
/* 7 */ "c............l"
- /* 8 */ "c............l"
+ /* 8 */ "c............n"
/* 9 */ "mc........ccba"
/* 10 */ "mcc......ccmmm"
/* 11 */ "mmcc....ccmmmm"
/* 12 */ "mmmcc..ccmmmmm"
/* 13 */ "mmmmc..cmmmmmm"
/* 14 */ "mmmmb..bmmmmmm"
- /* 15 */ "mmmmallammmmmm"
+ /* 15 */ "mmmmanlammmmmm"
/* 16 */ "dddddddddddddd"
// Level 3
diff --git a/src/Generating/ProtIntGen.h b/src/Generating/ProtIntGen.h
index 9e471e8bb..c0c7102d2 100644
--- a/src/Generating/ProtIntGen.h
+++ b/src/Generating/ProtIntGen.h
@@ -47,7 +47,7 @@ public:
virtual ~cProtIntGen() {}
/** Generates the array of specified size into a_Values, based on given min coords. */
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) = 0;
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) = 0;
};
@@ -109,14 +109,14 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int BaseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int BaseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
- a_Values[x + a_SizeX * z] = (super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7) % m_Range;
+ a_Values[x + a_SizeX * z] = (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
}
} // for z
}
@@ -146,22 +146,22 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int BaseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int BaseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int rnd = (super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7);
+ int rnd = (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7);
a_Values[x + a_SizeX * z] = ((rnd % 100) < m_Threshold) ? ((rnd / 101) % bgLandOceanMax + 1) : 0;
}
}
// If the centerpoint of the world is within the area, set it to bgTemperate, always:
- if ((a_MinX <= 0) && (a_MinZ <= 0) && (a_MinX + a_SizeX > 0) && (a_MinZ + a_SizeZ > 0))
+ if ((a_MinX <= 0) && (a_MinZ <= 0) && (a_MinX + static_cast<int>(a_SizeX) > 0) && (a_MinZ + static_cast<int>(a_SizeZ) > 0))
{
- a_Values[-a_MinX - a_MinZ * a_SizeX] = bgTemperate;
+ a_Values[static_cast<size_t>(-a_MinX) - static_cast<size_t>(a_MinZ) * a_SizeX] = bgTemperate;
}
}
@@ -189,13 +189,13 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Get the coords for the lower generator:
int lowerMinX = a_MinX >> 1;
int lowerMinZ = a_MinZ >> 1;
- int lowerSizeX = a_SizeX / 2 + 2;
- int lowerSizeZ = a_SizeZ / 2 + 2;
+ size_t lowerSizeX = a_SizeX / 2 + 2;
+ size_t lowerSizeZ = a_SizeZ / 2 + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
ASSERT(lowerSizeX > 0);
ASSERT(lowerSizeZ > 0);
@@ -203,22 +203,22 @@ public:
// Generate the underlying data with half the resolution:
int lowerData[m_BufferSize];
m_UnderlyingGen->GetInts(lowerMinX, lowerMinZ, lowerSizeX, lowerSizeZ, lowerData);
- const int lowStepX = (lowerSizeX - 1) * 2;
+ const size_t lowStepX = (lowerSizeX - 1) * 2;
int cache[m_BufferSize];
// Discreet-interpolate the values into twice the size:
- for (int z = 0; z < lowerSizeZ - 1; ++z)
+ for (size_t z = 0; z < lowerSizeZ - 1; ++z)
{
- int idx = (z * 2) * lowStepX;
+ size_t idx = (z * 2) * lowStepX;
int PrevZ0 = lowerData[z * lowerSizeX];
int PrevZ1 = lowerData[(z + 1) * lowerSizeX];
- for (int x = 0; x < lowerSizeX - 1; ++x)
+ for (size_t x = 0; x < lowerSizeX - 1; ++x)
{
int ValX1Z0 = lowerData[x + 1 + z * lowerSizeX];
int ValX1Z1 = lowerData[x + 1 + (z + 1) * lowerSizeX];
- int RndX = (x + lowerMinX) * 2;
- int RndZ = (z + lowerMinZ) * 2;
+ int RndX = (static_cast<int>(x) + lowerMinX) * 2;
+ int RndZ = (static_cast<int>(z) + lowerMinZ) * 2;
cache[idx] = PrevZ0;
cache[idx + lowStepX] = super::chooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
cache[idx + 1] = super::chooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
@@ -230,7 +230,7 @@ public:
}
// Copy from Cache into a_Values; take into account the even / odd offsets in a_Min:
- for (int z = 0; z < a_SizeZ; ++z)
+ for (size_t z = 0; z < a_SizeZ; ++z)
{
memcpy(a_Values + z * a_SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), a_SizeX * sizeof(int));
}
@@ -259,21 +259,21 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerData[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
// Smooth - for each square check if the surroundings are the same, if so, expand them diagonally.
// Also get rid of single-pixel irregularities (A-B-A):
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int NoiseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int NoiseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
int val = lowerData[x + 1 + (z + 1) * lowerSizeX];
int above = lowerData[x + 1 + z * lowerSizeX];
@@ -283,7 +283,7 @@ public:
if ((left == right) && (above == below))
{
- if (((super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ) / 7) % 2) == 0)
+ if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 2) == 0)
{
val = left;
}
@@ -331,21 +331,21 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 1;
- int lowerSizeZ = a_SizeZ + 1;
+ size_t lowerSizeX = a_SizeX + 1;
+ size_t lowerSizeZ = a_SizeZ + 1;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerData[m_BufferSize];
m_Underlying->GetInts(a_MinX, a_MinZ, lowerSizeX, lowerSizeZ, lowerData);
// Average - add all 4 "neighbors" and divide by 4:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idxLower = x + lowerSizeX * z;
+ size_t idxLower = x + lowerSizeX * z;
a_Values[x + a_SizeX * z] = (
lowerData[idxLower] + lowerData[idxLower + 1] +
lowerData[idxLower + lowerSizeX] + lowerData[idxLower + lowerSizeX + 1]
@@ -375,24 +375,24 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 4;
- int lowerSizeZ = a_SizeZ + 4;
+ size_t lowerSizeX = a_SizeX + 4;
+ size_t lowerSizeZ = a_SizeZ + 4;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerData[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
// Calculate the weighted average of all 16 "neighbors":
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idxLower1 = x + lowerSizeX * z;
- int idxLower2 = idxLower1 + lowerSizeX;
- int idxLower3 = idxLower1 + 2 * lowerSizeX;
- int idxLower4 = idxLower1 + 3 * lowerSizeX;
+ size_t idxLower1 = x + lowerSizeX * z;
+ size_t idxLower2 = idxLower1 + lowerSizeX;
+ size_t idxLower3 = idxLower1 + 2 * lowerSizeX;
+ size_t idxLower4 = idxLower1 + 3 * lowerSizeX;
a_Values[x + a_SizeX * z] = (
1 * lowerData[idxLower1] + 2 * lowerData[idxLower1 + 1] + 2 * lowerData[idxLower1 + 2] + 1 * lowerData[idxLower1 + 3] +
2 * lowerData[idxLower2] + 32 * lowerData[idxLower2 + 1] + 32 * lowerData[idxLower2 + 2] + 2 * lowerData[idxLower2 + 3] +
@@ -425,23 +425,23 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 3;
- int lowerSizeZ = a_SizeZ + 3;
+ size_t lowerSizeX = a_SizeX + 3;
+ size_t lowerSizeZ = a_SizeZ + 3;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerData[m_BufferSize];
m_Underlying->GetInts(a_MinX, a_MinZ, lowerSizeX, lowerSizeZ, lowerData);
// Calculate the weighted average the neighbors:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idxLower1 = x + lowerSizeX * z;
- int idxLower2 = idxLower1 + lowerSizeX;
- int idxLower3 = idxLower1 + 2 * lowerSizeX;
+ size_t idxLower1 = x + lowerSizeX * z;
+ size_t idxLower2 = idxLower1 + lowerSizeX;
+ size_t idxLower3 = idxLower1 + 2 * lowerSizeX;
a_Values[x + a_SizeX * z] = (
WeightDiagonal * lowerData[idxLower1] + WeightCardinal * lowerData[idxLower1 + 1] + WeightDiagonal * lowerData[idxLower1 + 2] +
WeightCardinal * lowerData[idxLower2] + WeightCenter * lowerData[idxLower2 + 1] + WeightCardinal * lowerData[idxLower2 + 2] +
@@ -476,20 +476,20 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
// Replace random values:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int BaseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int BaseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
- if (((super::m_Noise.IntNoise2DInt(BaseZ, a_MinX + x) / 13) % 101) < m_ChancePct)
+ if (((super::m_Noise.IntNoise2DInt(BaseZ, a_MinX + static_cast<int>(x)) / 13) % 101) < m_ChancePct)
{
- a_Values[x + a_SizeX * z] = m_Min + (super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7) % m_Range;
+ a_Values[x + a_SizeX * z] = m_Min + (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
}
} // for x
} // for z
@@ -522,18 +522,18 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
// Add the random values:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int NoiseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int NoiseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int noiseVal = ((super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ) / 7) % m_Range) - m_HalfRange;
+ int noiseVal = ((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % m_Range) - m_HalfRange;
a_Values[x + z * a_SizeX] += noiseVal;
}
}
@@ -564,23 +564,23 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerData[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
// Average random values:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int NoiseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int NoiseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idxLower = x + 1 + lowerSizeX * (z + 1);
- if (((super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ) / 7) % 100) > m_AvgChancePct)
+ size_t idxLower = x + 1 + lowerSizeX * (z + 1);
+ if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
{
// Average the 4 neighbors:
a_Values[x + z * a_SizeX] = (
@@ -621,28 +621,28 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerData[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
// Average random values:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int NoiseZ = a_MinZ + z;
- for (int x = 0; x < a_SizeX; x++)
+ int NoiseZ = a_MinZ + static_cast<int>(z);
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idxLower = x + 1 + lowerSizeX * (z + 1);
- if (((super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ) / 7) % 100) > m_AvgChancePct)
+ size_t idxLower = x + 1 + lowerSizeX * (z + 1);
+ if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
{
// Chose a value in between the min and max neighbor:
int min = std::min(std::min(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::min(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
int max = std::max(std::max(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::max(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
- a_Values[x + z * a_SizeX] = min + ((super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ + 10) / 7) % (max - min + 1));
+ a_Values[x + z * a_SizeX] = min + ((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ + 10) / 7) % (max - min + 1));
}
else
{
@@ -675,7 +675,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Map for biome -> its beach:
static const int ToBeach[] =
@@ -723,16 +723,16 @@ public:
};
// Generate the underlying values:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerValues[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
// Add beaches between ocean and biomes:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
int above = lowerValues[x + 1 + z * lowerSizeX];
@@ -779,16 +779,16 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
if (a_Values[x + z * a_SizeX] == bgOcean)
{
- int rnd = super::m_Noise.IntNoise2DInt(a_MinX + x, a_MinZ + z) / 7;
+ int rnd = super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), a_MinZ + static_cast<int>(z)) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[x + z * a_SizeX] = (rnd / 1003) % bgLandOceanMax;
@@ -822,19 +822,19 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values)
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values)
{
// Generate the underlying biome groups:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerValues[m_BufferSize];
m_Underlying->GetInts(a_MinX, a_MinZ, lowerSizeX, lowerSizeZ, lowerValues);
// Change the biomes on incompatible edges into an edge biome:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
int Above = lowerValues[x + 1 + z * lowerSizeX];
@@ -920,7 +920,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Define the per-biome-group biomes:
static const int oceanBiomes[] =
@@ -998,16 +998,16 @@ public:
// Overwrite each biome group with a random biome from that group:
// Take care of the bgfRare flag
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int IdxZ = z * a_SizeX;
- for (int x = 0; x < a_SizeX; x++)
+ size_t IdxZ = z * a_SizeX;
+ for (size_t x = 0; x < a_SizeX; x++)
{
int val = a_Values[x + IdxZ];
const cBiomesInGroups & Biomes = (val > bgfRare) ?
rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] :
- biomesInGroups[val % ARRAYCOUNT(biomesInGroups)];
- int rnd = (super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7);
+ biomesInGroups[static_cast<size_t>(val) % ARRAYCOUNT(biomesInGroups)];
+ int rnd = (super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7);
a_Values[x + IdxZ] = Biomes.Biomes[rnd % Biomes.Count];
}
}
@@ -1050,21 +1050,21 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
// Replace some of the values:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int idxZ = z * a_SizeX;
- for (int x = 0; x < a_SizeX; x++)
+ size_t idxZ = z * a_SizeX;
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idx = x + idxZ;
+ size_t idx = x + idxZ;
if (a_Values[idx] == m_From)
{
- int rnd = super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
+ int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[idx] = m_To;
@@ -1109,7 +1109,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying data:
ASSERT(a_SizeX * a_SizeZ <= m_BufferSize);
@@ -1118,12 +1118,12 @@ public:
m_Rivers->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, riverData);
// Mix the values:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int idxZ = z * a_SizeX;
- for (int x = 0; x < a_SizeX; x++)
+ size_t idxZ = z * a_SizeX;
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int idx = x + idxZ;
+ size_t idx = x + idxZ;
if (IsBiomeOcean(a_Values[idx]))
{
// Oceans are kept without any changes
@@ -1136,7 +1136,7 @@ public:
}
// There's a river, change the output to a river or a frozen river, based on the original biome:
- if (IsBiomeVeryCold((EMCSBiome)a_Values[idx]))
+ if (IsBiomeVeryCold(static_cast<EMCSBiome>(a_Values[idx])))
{
a_Values[idx] = biFrozenRiver;
}
@@ -1173,19 +1173,19 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying data:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerValues[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
// Detect the edges:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
int Above = lowerValues[x + 1 + z * lowerSizeX];
int Below = lowerValues[x + 1 + (z + 2) * lowerSizeX];
@@ -1231,19 +1231,19 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying data:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerValues[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
// Add the mushroom islands:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
if (!IsBiomeOcean(val))
@@ -1278,7 +1278,7 @@ public:
// If at least 3 ocean neighbors and the chance is right, change:
if (
(NumOceanNeighbors >= 3) &&
- ((super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7) % 1000 < m_Chance)
+ ((super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7) % 1000 < m_Chance)
)
{
a_Values[x + z * a_SizeX] = m_ToValue;
@@ -1321,17 +1321,17 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying data:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
// Change random pixels to bgOcean:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int rnd = super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
+ int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[x + z * a_SizeX] = m_ToValue;
@@ -1370,20 +1370,20 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying data:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
// Change some of the biome groups into rare biome groups:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
- int rnd = super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
+ int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
- int idx = x + a_SizeX * z;
+ size_t idx = x + a_SizeX * z;
a_Values[idx] = a_Values[idx] | bgfRare;
}
}
@@ -1418,7 +1418,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the base biomes and the alterations:
m_BaseBiomes->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@@ -1426,8 +1426,8 @@ public:
m_Alterations->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, alterations);
// Change the biomes into their alternate versions:
- int len = a_SizeX * a_SizeZ;
- for (int idx = 0; idx < len; ++idx)
+ size_t len = a_SizeX * a_SizeZ;
+ for (size_t idx = 0; idx < len; ++idx)
{
if (alterations[idx] == 0)
{
@@ -1482,19 +1482,19 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying biomes:
- int lowerSizeX = a_SizeX + 2;
- int lowerSizeZ = a_SizeZ + 2;
+ size_t lowerSizeX = a_SizeX + 2;
+ size_t lowerSizeZ = a_SizeZ + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
int lowerValues[m_BufferSize];
m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
// Convert incompatible edges into neutral biomes:
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
int biome = lowerValues[x + 1 + (z + 1) * lowerSizeX];
int above = lowerValues[x + 1 + z * lowerSizeX];
@@ -1642,7 +1642,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, int a_SizeX, int a_SizeZ, int * a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{
// Generate the underlying biomes and the alterations:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@@ -1650,8 +1650,8 @@ public:
m_Alteration->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, alterations);
// Wherever alterations are nonzero, change into alternate biome, if available:
- int len = a_SizeX * a_SizeZ;
- for (int idx = 0; idx < len; ++idx)
+ size_t len = a_SizeX * a_SizeZ;
+ for (size_t idx = 0; idx < len; ++idx)
{
if (alterations[idx] == 0)
{
diff --git a/src/Generating/RainbowRoadsGen.cpp b/src/Generating/RainbowRoadsGen.cpp
index fd4a81692..03400556a 100644
--- a/src/Generating/RainbowRoadsGen.cpp
+++ b/src/Generating/RainbowRoadsGen.cpp
@@ -76,7 +76,7 @@ protected:
{
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
{
- cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
+ const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
Prefab.Draw(a_Chunk, *itr);
} // for itr - m_PlacedPieces[]
}
diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp
index 9f8f69139..8c6316273 100644
--- a/src/Generating/Ravines.cpp
+++ b/src/Generating/Ravines.cpp
@@ -135,17 +135,17 @@ void cStructGenRavines::cRavine::GenerateBaseDefPoints(int a_BlockX, int a_Block
// Get the base angle in which the ravine "axis" goes:
float Angle = (float)(((float)((a_Noise.IntNoise3DInt(20 * a_BlockX, 70 * a_BlockZ, 6000) / 9) % 16384)) / 16384.0 * M_PI);
- float xc = sin(Angle);
- float zc = cos(Angle);
+ float xc = sinf(Angle);
+ float zc = cosf(Angle);
// Calculate the definition points and radii:
int MaxRadius = (int)(sqrt(12.0 + ((a_Noise.IntNoise2DInt(61 * a_BlockX, 97 * a_BlockZ) / 13) % a_Size) / 16));
int Top = 32 + ((a_Noise.IntNoise2DInt(13 * a_BlockX, 17 * a_BlockZ) / 23) % 32);
int Bottom = 5 + ((a_Noise.IntNoise2DInt(17 * a_BlockX, 29 * a_BlockZ) / 13) % 32);
int Mid = (Top + Bottom) / 2;
- int PointX = CenterX - (int)(xc * a_Size / 2);
- int PointZ = CenterZ - (int)(zc * a_Size / 2);
- m_Points.push_back(cRavDefPoint(PointX, PointZ, 0, (Mid + Top) / 2, (Mid + Bottom) / 2));
+ int DefinitionPointX = CenterX - (int)(xc * a_Size / 2);
+ int DefinitionPointZ = CenterZ - (int)(zc * a_Size / 2);
+ m_Points.push_back(cRavDefPoint(DefinitionPointX, DefinitionPointZ, 0, (Mid + Top) / 2, (Mid + Bottom) / 2));
for (int i = 1; i < NUM_RAVINE_POINTS - 1; i++)
{
int LineX = CenterX + (int)(xc * a_Size * (i - NUM_RAVINE_POINTS / 2) / NUM_RAVINE_POINTS);
@@ -160,9 +160,9 @@ void cStructGenRavines::cRavine::GenerateBaseDefPoints(int a_BlockX, int a_Block
int ThisBottom = Bottom + ((a_Noise.IntNoise3DInt(19 * a_BlockX, 7 * a_BlockZ, i * 31) / 13) % 8) - 4;
m_Points.push_back(cRavDefPoint(PointX, PointZ, Radius, ThisTop, ThisBottom));
} // for i - m_Points[]
- PointX = CenterX + (int)(xc * a_Size / 2);
- PointZ = CenterZ + (int)(zc * a_Size / 2);
- m_Points.push_back(cRavDefPoint(PointX, PointZ, 0, Mid, Mid));
+ DefinitionPointX = CenterX + (int)(xc * a_Size / 2);
+ DefinitionPointZ = CenterZ + (int)(zc * a_Size / 2);
+ m_Points.push_back(cRavDefPoint(DefinitionPointX, DefinitionPointZ, 0, Mid, Mid));
}
diff --git a/src/Generating/RoughRavines.cpp b/src/Generating/RoughRavines.cpp
index 2ee3704b3..c0397ee26 100644
--- a/src/Generating/RoughRavines.cpp
+++ b/src/Generating/RoughRavines.cpp
@@ -21,7 +21,7 @@ class cRoughRavine :
public:
cRoughRavine(
- int a_Seed, int a_Size,
+ int a_Seed, size_t a_Size,
float a_CenterWidth, float a_Roughness,
float a_FloorHeightEdge1, float a_FloorHeightEdge2, float a_FloorHeightCenter,
float a_CeilingHeightEdge1, float a_CeilingHeightEdge2, float a_CeilingHeightCenter,
@@ -33,14 +33,14 @@ public:
m_Roughness(a_Roughness)
{
// Create the basic structure - 2 lines meeting at the centerpoint:
- int Max = 2 * a_Size;
- int Half = a_Size; // m_DefPoints[Half] will be the centerpoint
+ size_t Max = 2 * a_Size;
+ size_t Half = a_Size; // m_DefPoints[Half] will be the centerpoint
m_DefPoints.resize(Max + 1);
int rnd = m_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) / 7;
float Len = (float)a_Size;
float Angle = (float)rnd; // Angle is in radians, will be wrapped in the "sin" and "cos" operations
- float OfsX = sin(Angle) * Len;
- float OfsZ = cos(Angle) * Len;
+ float OfsX = sinf(Angle) * Len;
+ float OfsZ = cosf(Angle) * Len;
m_DefPoints[0].Set (a_OriginX - OfsX, a_OriginZ - OfsZ, 1, a_CeilingHeightEdge1, a_FloorHeightEdge1);
m_DefPoints[Half].Set((float)a_OriginX, (float)a_OriginZ, a_CenterWidth, a_CeilingHeightCenter, a_FloorHeightCenter);
m_DefPoints[Max].Set (a_OriginX + OfsX, a_OriginZ + OfsZ, 1, a_CeilingHeightEdge2, a_FloorHeightEdge2);
@@ -90,7 +90,7 @@ protected:
/** Recursively subdivides the line between the points of the specified index.
Sets the midpoint to the center of the line plus or minus a random offset, then calls itself for each half
of the new line. */
- void SubdivideLine(int a_Idx1, int a_Idx2)
+ void SubdivideLine(size_t a_Idx1, size_t a_Idx2)
{
// Calculate the midpoint:
const sRavineDefPoint & p1 = m_DefPoints[a_Idx1];
@@ -114,7 +114,7 @@ protected:
MidX -= dz * m_Roughness;
MidZ += dx * m_Roughness;
}
- int MidIdx = (a_Idx1 + a_Idx2) / 2;
+ size_t MidIdx = (a_Idx1 + a_Idx2) / 2;
m_DefPoints[MidIdx].Set(MidX, MidZ, MidR, MidT, MidB);
// Recurse the two halves, if they are worth recursing:
@@ -275,7 +275,7 @@ cRoughRavines::cRoughRavines(
cGridStructGen::cStructurePtr cRoughRavines::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
// Pick a random value for each of the ravine's parameters:
- int Size = m_MinSize + (m_Noise.IntNoise2DInt(a_GridX, a_GridZ) / 7) % (m_MaxSize - m_MinSize); // Random int from m_MinSize to m_MaxSize
+ size_t Size = static_cast<size_t>(m_MinSize + (m_Noise.IntNoise2DInt(a_GridX, a_GridZ) / 7) % (m_MaxSize - m_MinSize)); // Random int from m_MinSize to m_MaxSize
float CenterWidth = m_Noise.IntNoise2DInRange(a_GridX + 10, a_GridZ, m_MinCenterWidth, m_MaxCenterWidth);
float Roughness = m_Noise.IntNoise2DInRange(a_GridX + 20, a_GridZ, m_MinRoughness, m_MaxRoughness);
float FloorHeightEdge1 = m_Noise.IntNoise2DInRange(a_GridX + 30, a_GridZ, m_MinFloorHeightEdge, m_MaxFloorHeightEdge);
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index 7572cdcbf..fd911e7dc 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -72,7 +72,7 @@ void cStructGenTrees::GenFinish(cChunkDesc & a_ChunkDesc)
{
for (int z = 0; z < cChunkDef::Width; z++)
{
- for (int y = cChunkDef::Height - 1; y >= 0; y--)
+ for (HEIGHTTYPE y = cChunkDef::Height - 1; y >= 0; y--)
{
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR)
{
@@ -304,14 +304,14 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore
for (int i = 0; i < a_NumNests; i++)
{
- int rnd = m_Noise.IntNoise3DInt(a_ChunkX + i, a_Seq, a_ChunkZ + 64 * i) / 8;
- int BaseX = rnd % cChunkDef::Width;
- rnd /= cChunkDef::Width;
- int BaseZ = rnd % cChunkDef::Width;
- rnd /= cChunkDef::Width;
- int BaseY = rnd % a_MaxHeight;
- rnd /= a_MaxHeight;
- int NestSize = a_NestSize + (rnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger
+ int Nestrnd = m_Noise.IntNoise3DInt(a_ChunkX + i, a_Seq, a_ChunkZ + 64 * i) / 8;
+ int BaseX = Nestrnd % cChunkDef::Width;
+ Nestrnd /= cChunkDef::Width;
+ int BaseZ = Nestrnd % cChunkDef::Width;
+ Nestrnd /= cChunkDef::Width;
+ int BaseY = Nestrnd % a_MaxHeight;
+ Nestrnd /= a_MaxHeight;
+ int NestSize = a_NestSize + (Nestrnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger
int Num = 0;
while (Num < NestSize)
{
@@ -436,14 +436,14 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, int a_MaxLakeH
BLOCKTYPE * BlockTypes = a_Lake.GetBlockTypes();
for (int i = 0; i < NumBubbles; i++)
{
- int Rnd = m_Noise.IntNoise3DInt(a_ChunkX, i, a_ChunkZ) / 13;
- const int BubbleR = 2 + (Rnd & 0x03); // 2 .. 5
+ int BubbleRnd = m_Noise.IntNoise3DInt(a_ChunkX, i, a_ChunkZ) / 13;
+ const int BubbleR = 2 + (BubbleRnd & 0x03); // 2 .. 5
const int Range = 16 - 2 * BubbleR;
- const int BubbleX = BubbleR + (Rnd % Range);
+ const int BubbleX = BubbleR + (BubbleRnd % Range);
Rnd >>= 4;
- const int BubbleY = 4 + (Rnd & 0x01); // 4 .. 5
+ const int BubbleY = 4 + (BubbleRnd & 0x01); // 4 .. 5
Rnd >>= 1;
- const int BubbleZ = BubbleR + (Rnd % Range);
+ const int BubbleZ = BubbleR + (BubbleRnd % Range);
const int HalfR = BubbleR / 2; // 1 .. 2
const int RSquared = BubbleR * BubbleR;
for (int y = -HalfR; y <= HalfR; y++)
diff --git a/src/Generating/TestRailsGen.cpp b/src/Generating/TestRailsGen.cpp
index 8256b55a0..72317eb67 100644
--- a/src/Generating/TestRailsGen.cpp
+++ b/src/Generating/TestRailsGen.cpp
@@ -76,7 +76,7 @@ protected:
{
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
{
- cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
+ const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
Prefab.Draw(a_Chunk, *itr);
} // for itr - m_PlacedPieces[]
}
diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp
index 72fe5f819..5da8fc44a 100644
--- a/src/Generating/Trees.cpp
+++ b/src/Generating/Trees.cpp
@@ -6,6 +6,7 @@
#include "Globals.h"
#include "Trees.h"
#include "../BlockID.h"
+#include "../World.h"
@@ -130,7 +131,7 @@ inline void PushSomeColumns(int a_BlockX, int a_Height, int a_BlockZ, int a_Colu
{
int x = a_BlockX + a_Coords[i].x;
int z = a_BlockZ + a_Coords[i].z;
- if (a_Noise.IntNoise3DInt(x + 64 * a_Seq, a_Height + (int)i, z + 64 * a_Seq) <= a_Chance)
+ if (a_Noise.IntNoise3DInt(x + 64 * a_Seq, a_Height + static_cast<int>(i), z + 64 * a_Seq) <= a_Chance)
{
for (int j = 0; j < a_ColumnHeight; j++)
{
@@ -200,7 +201,8 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
}
else
{
- GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
+ bool IsLarge = a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY + 32 * a_Seq, a_BlockZ) < 0x60000000;
+ GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks, IsLarge);
}
return;
}
@@ -321,12 +323,12 @@ void GetSmallAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a
int Random = a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) >> 3;
- int Heights[] = {1, 2, 2, 3} ;
- int Height = 1 + Heights[Random & 3];
+ HEIGHTTYPE Heights[] = {1, 2, 2, 3} ;
+ HEIGHTTYPE Height = 1 + Heights[Random & 3];
Random >>= 2;
// Pre-alloc so that we don't realloc too often later:
- a_LogBlocks.reserve(Height + 5);
+ a_LogBlocks.reserve(static_cast<size_t>(Height + 5));
a_OtherBlocks.reserve(ARRAYCOUNT(BigO2) * 2 + ARRAYCOUNT(BigO1) + ARRAYCOUNT(Corners) * 3 + 3 + 5);
// Trunk:
@@ -396,8 +398,8 @@ void GetLargeAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a
for (int i = 4; i < Height; i++)
{
// Get a direction for the trunk to go to.
- Vector3d BranchStartDirection = AvailableDirections[a_Noise.IntNoise3DInt(a_BlockX, a_BlockY + i, a_BlockZ) % ARRAYCOUNT(AvailableDirections)];
- Vector3d BranchDirection = AvailableDirections[a_Noise.IntNoise3DInt(a_BlockX, a_BlockY / i, a_BlockZ) % ARRAYCOUNT(AvailableDirections)] / 3;
+ Vector3d BranchStartDirection = AvailableDirections[static_cast<size_t>(a_Noise.IntNoise3DInt(a_BlockX, a_BlockY + i, a_BlockZ)) % ARRAYCOUNT(AvailableDirections)];
+ Vector3d BranchDirection = AvailableDirections[static_cast<size_t>(a_Noise.IntNoise3DInt(a_BlockX, a_BlockY / i, a_BlockZ)) % ARRAYCOUNT(AvailableDirections)] / 3;
int BranchLength = 2 + a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY * a_Seq, a_BlockZ * a_Seq) % 3;
GetLargeAppleTreeBranch(a_BlockX, a_BlockY + i, a_BlockZ, BranchLength, BranchStartDirection, BranchDirection, a_BlockY + Height, a_Noise, a_LogBlocks);
@@ -476,10 +478,10 @@ NIBBLETYPE GetLogMetaFromDirection(NIBBLETYPE a_BlockMeta, Vector3d a_Direction)
void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
{
- int Height = 5 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
+ HEIGHTTYPE Height = 5 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
// Prealloc, so that we don't realloc too often later:
- a_LogBlocks.reserve(Height);
+ a_LogBlocks.reserve(static_cast<size_t>(Height));
a_OtherBlocks.reserve(80);
// The entire trunk, out of logs:
@@ -650,10 +652,10 @@ void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
{
- int Height = 9 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
+ HEIGHTTYPE Height = 9 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
// Prealloc, so that we don't realloc too often later:
- a_LogBlocks.reserve(Height);
+ a_LogBlocks.reserve(static_cast<size_t>(Height));
a_OtherBlocks.reserve(80);
// The entire trunk, out of logs:
@@ -713,12 +715,12 @@ void GetSpruceTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi
// (each of the mod8 remainders has a very different chance of occurrence) - that's why we divide by 8
int MyRandom = a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY + 32 * a_Seq, a_BlockZ) / 8;
- static const int sHeights[] = {1, 2, 2, 3};
- int Height = sHeights[MyRandom & 3];
+ static const HEIGHTTYPE sHeights[] = {1, 2, 2, 3};
+ HEIGHTTYPE Height = sHeights[MyRandom & 3];
MyRandom >>= 2;
// Prealloc, so that we don't realloc too often later:
- a_LogBlocks.reserve(Height);
+ a_LogBlocks.reserve(static_cast<size_t>(Height));
a_OtherBlocks.reserve(180);
// Clear trunk blocks:
@@ -816,8 +818,8 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise
}
// Pre-allocate the vector:
- a_LogBlocks.reserve(TrunkHeight);
- a_OtherBlocks.reserve(NumLeavesLayers * 25);
+ a_LogBlocks.reserve(static_cast<size_t>(TrunkHeight));
+ a_OtherBlocks.reserve(static_cast<size_t>(NumLeavesLayers * 25));
// The entire trunk, out of logs:
for (int i = TrunkHeight; i >= 0; --i)
@@ -843,7 +845,7 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise
{
break;
}
- ASSERT((size_t)LayerSize < ARRAYCOUNT(BigOs));
+ ASSERT(static_cast<size_t>(LayerSize) < ARRAYCOUNT(BigOs));
PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigOs[LayerSize].Coords, BigOs[LayerSize].Count, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER);
h--;
}
@@ -866,8 +868,8 @@ void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois
int Height = 3 + (a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY, a_BlockZ + 32 * a_Seq) / 8) % 3;
- a_LogBlocks.reserve(Height);
- a_OtherBlocks.reserve(2 * ARRAYCOUNT(BigO2) + 2 * ARRAYCOUNT(BigO3) + Height * ARRAYCOUNT(Vines) + 20);
+ a_LogBlocks.reserve(static_cast<size_t>(Height));
+ a_OtherBlocks.reserve(2 * ARRAYCOUNT(BigO2) + 2 * ARRAYCOUNT(BigO3) + static_cast<size_t>(Height) * ARRAYCOUNT(Vines) + 20);
for (int i = 0; i < Height; i++)
{
@@ -920,9 +922,9 @@ void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois
-void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
+void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks, bool a_Large)
{
- if (a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY + 32 * a_Seq, a_BlockZ) < 0x60000000)
+ if (!a_Large)
{
GetSmallJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
}
@@ -952,8 +954,8 @@ void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise &
int Height = 24 + (a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY, a_BlockZ + 32 * a_Seq) / 11) % 24;
- a_LogBlocks.reserve(Height * 4);
- a_OtherBlocks.reserve(2 * ARRAYCOUNT(BigO4) + ARRAYCOUNT(BigO3) + Height * ARRAYCOUNT(Vines) + 50);
+ a_LogBlocks.reserve(static_cast<size_t>(Height) * 4);
+ a_OtherBlocks.reserve(2 * ARRAYCOUNT(BigO4) + ARRAYCOUNT(BigO3) + static_cast<size_t>(Height) * ARRAYCOUNT(Vines) + 50);
for (int i = 0; i < Height; i++)
{
@@ -999,12 +1001,12 @@ void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise &
int Height = 7 + (a_Noise.IntNoise3DInt(a_BlockX + 5 * a_Seq, a_BlockY, a_BlockZ + 5 * a_Seq) / 5) % 3;
- a_LogBlocks.reserve(Height);
+ a_LogBlocks.reserve(static_cast<size_t>(Height));
a_OtherBlocks.reserve(
2 * ARRAYCOUNT(BigO3) + // O3 layer, 2x
2 * ARRAYCOUNT(BigO2) + // O2 layer, 2x
ARRAYCOUNT(BigO1) + 1 + // Plus on the top
- Height * ARRAYCOUNT(Vines) + // Vines
+ static_cast<size_t>(Height) * ARRAYCOUNT(Vines) + // Vines
50 // some safety
);
@@ -1041,3 +1043,89 @@ void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise &
+
+bool GetLargeTreeAdjustment(cWorld & a_World, int & a_X, int & a_Y, int & a_Z, NIBBLETYPE a_Meta)
+{
+ bool IsLarge = true;
+ a_Meta = a_Meta & 0x07;
+
+ // Check to see if we are the northwest corner
+ for (int x = 0; x < 2; ++x)
+ {
+ for (int z = 0; z < 2; ++z)
+ {
+ NIBBLETYPE meta;
+ BLOCKTYPE type;
+ a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta);
+ IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+ }
+ }
+
+ if (IsLarge)
+ {
+ return true;
+ }
+
+ IsLarge = true;
+ // Check to see if we are the southwest corner
+ for (int x = 0; x < 2; ++x)
+ {
+ for (int z = 0; z > -2; --z)
+ {
+ NIBBLETYPE meta;
+ BLOCKTYPE type;
+ a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta);
+ IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+ }
+ }
+
+ if (IsLarge)
+ {
+ --a_Z;
+ return true;
+ }
+
+ IsLarge = true;
+ // Check to see if we are the southeast corner
+ for (int x = 0; x > -2; --x)
+ {
+ for (int z = 0; z > -2; --z)
+ {
+ NIBBLETYPE meta;
+ BLOCKTYPE type;
+ a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta);
+ IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+ }
+ }
+
+ if (IsLarge)
+ {
+ --a_Z;
+ --a_X;
+ return true;
+ }
+
+ IsLarge = true;
+ // Check to see if we are the northeast corner
+ for (int x = 0; x > -2; --x)
+ {
+ for (int z = 0; z < 2; ++z)
+ {
+ NIBBLETYPE meta;
+ BLOCKTYPE type;
+ a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta);
+ IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta);
+ }
+ }
+
+ if (IsLarge)
+ {
+ --a_X;
+ }
+
+ return IsLarge;
+}
+
+
+
+
diff --git a/src/Generating/Trees.h b/src/Generating/Trees.h
index a2c8274f5..092d71182 100644
--- a/src/Generating/Trees.h
+++ b/src/Generating/Trees.h
@@ -20,6 +20,8 @@ logs can overwrite others(leaves), but others shouldn't overwrite logs. This is
#include "../ChunkDef.h"
#include "../Noise/Noise.h"
+class cWorld;
+
@@ -96,7 +98,7 @@ void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois
void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random jungle tree
-void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
+void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks, bool a_Large);
/// Generates an image of a large jungle tree (2x2 trunk)
void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
@@ -104,7 +106,7 @@ void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise &
/// Generates an image of a small jungle tree (1x1 trunk)
void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
-
+bool GetLargeTreeAdjustment(cWorld & a_World, int & a_X, int & a_Y, int & a_Z, NIBBLETYPE a_Meta);
diff --git a/src/Generating/TwoHeights.cpp b/src/Generating/TwoHeights.cpp
index e75c301de..06c474458 100644
--- a/src/Generating/TwoHeights.cpp
+++ b/src/Generating/TwoHeights.cpp
@@ -69,7 +69,7 @@ public:
}
- virtual void InitializeShapeGen(cIniFile & a_IniFile)
+ virtual void InitializeShapeGen(cIniFile & a_IniFile) override
{
m_FrequencyX = static_cast<NOISE_DATATYPE>(a_IniFile.GetValueSetF("Generator", "TwoHeightsFrequencyX", 40));
m_FrequencyY = static_cast<NOISE_DATATYPE>(a_IniFile.GetValueSetF("Generator", "TwoHeightsFrequencyY", 40));
diff --git a/src/Generating/UnderwaterBaseGen.cpp b/src/Generating/UnderwaterBaseGen.cpp
index dbc4aef1b..c5066ca1b 100644
--- a/src/Generating/UnderwaterBaseGen.cpp
+++ b/src/Generating/UnderwaterBaseGen.cpp
@@ -76,7 +76,7 @@ protected:
{
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
{
- cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
+ const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
Prefab.Draw(a_Chunk, *itr);
} // for itr - m_PlacedPieces[]
}
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index a3f8caa46..2475565c0 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -5,11 +5,6 @@
#include "Globals.h"
#include "VillageGen.h"
-#include "Prefabs/AlchemistVillagePrefabs.h"
-#include "Prefabs/JapaneseVillagePrefabs.h"
-#include "Prefabs/PlainsVillagePrefabs.h"
-#include "Prefabs/SandVillagePrefabs.h"
-#include "Prefabs/SandFlatRoofVillagePrefabs.h"
#include "PieceGenerator.h"
@@ -52,6 +47,16 @@ public:
) :
super(a_PieceDefs, a_NumPieceDefs, a_StartingPieceDefs, a_NumStartingPieceDefs)
{
+ AddRoadPieces();
+ }
+
+ cVillagePiecePool(void)
+ {
+ AddRoadPieces();
+ }
+
+ void AddRoadPieces(void)
+ {
// Add the road pieces:
for (int len = 27; len < 60; len += 12)
{
@@ -93,7 +98,7 @@ public:
return 0;
}
- return ((const cPrefab &)a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
+ return static_cast<const cPrefab &>(a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
}
};
@@ -115,10 +120,8 @@ public:
int a_MaxRoadDepth,
int a_MaxSize,
int a_Density,
- cPiecePool & a_Prefabs,
- cTerrainHeightGenPtr a_HeightGen,
- BLOCKTYPE a_RoadBlock,
- BLOCKTYPE a_WaterRoadBlock
+ cVillagePiecePool & a_Prefabs,
+ cTerrainHeightGenPtr a_HeightGen
) :
super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed),
@@ -127,9 +130,7 @@ public:
m_Density(a_Density),
m_Borders(a_OriginX - a_MaxSize, 0, a_OriginZ - a_MaxSize, a_OriginX + a_MaxSize, cChunkDef::Height - 1, a_OriginZ + a_MaxSize),
m_Prefabs(a_Prefabs),
- m_HeightGen(a_HeightGen),
- m_RoadBlock(a_RoadBlock),
- m_WaterRoadBlock(a_WaterRoadBlock)
+ m_HeightGen(a_HeightGen)
{
// Generate the pieces for this village; don't care about the Y coord:
cBFSPieceGenerator pg(*this, a_Seed);
@@ -141,7 +142,7 @@ public:
// If the central piece should be moved to ground, move it, and
// check all of its dependents and move those that are strictly connector-driven based on its new Y coord:
- if (((cPrefab &)m_Pieces[0]->GetPiece()).ShouldMoveToGround())
+ if (static_cast<const cPrefab &>(m_Pieces[0]->GetPiece()).ShouldMoveToGround())
{
int OrigPosY = m_Pieces[0]->GetCoords().y;
PlacePieceOnGround(*m_Pieces[0]);
@@ -172,7 +173,7 @@ protected:
cCuboid m_Borders;
/** Prefabs to use for buildings */
- cPiecePool & m_Prefabs;
+ cVillagePiecePool & m_Prefabs;
/** The underlying height generator, used for placing the structures on top of the terrain. */
cTerrainHeightGenPtr m_HeightGen;
@@ -180,12 +181,6 @@ protected:
/** The village pieces, placed by the generator. */
cPlacedPieces m_Pieces;
- /** The block to use for the roads. */
- BLOCKTYPE m_RoadBlock;
-
- /** The block used for the roads if the road is on water. */
- BLOCKTYPE m_WaterRoadBlock;
-
// cGridStructGen::cStructure overrides:
virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override
@@ -197,7 +192,7 @@ protected:
m_HeightGen->GenHeightMap(a_Chunk.GetChunkX(), a_Chunk.GetChunkZ(), HeightMap);
for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
{
- cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece());
+ const cPrefab & Prefab = static_cast<const cPrefab &>((*itr)->GetPiece());
if ((*itr)->GetPiece().GetSize().y == 1)
{
// It's a road, special handling (change top terrain blocks to m_RoadBlock)
@@ -241,17 +236,21 @@ protected:
int MaxX = std::min(RoadCoords.p2.x - a_Chunk.GetChunkX() * cChunkDef::Width, cChunkDef::Width - 1);
int MinZ = std::max(RoadCoords.p1.z - a_Chunk.GetChunkZ() * cChunkDef::Width, 0);
int MaxZ = std::min(RoadCoords.p2.z - a_Chunk.GetChunkZ() * cChunkDef::Width, cChunkDef::Width - 1);
+ auto WaterRoadBlockType = m_Prefabs.GetVillageWaterRoadBlockType();
+ auto WaterRoadBlockMeta = m_Prefabs.GetVillageWaterRoadBlockMeta();
+ auto RoadBlockType = m_Prefabs.GetVillageRoadBlockType();
+ auto RoadBlockMeta = m_Prefabs.GetVillageRoadBlockMeta();
for (int z = MinZ; z <= MaxZ; z++)
{
for (int x = MinX; x <= MaxX; x++)
{
if (IsBlockWater(a_Chunk.GetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z)))
{
- a_Chunk.SetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, m_WaterRoadBlock);
+ a_Chunk.SetBlockTypeMeta(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, WaterRoadBlockType, WaterRoadBlockMeta);
}
else
{
- a_Chunk.SetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, m_RoadBlock);
+ a_Chunk.SetBlockTypeMeta(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, RoadBlockType, RoadBlockMeta);
}
}
}
@@ -259,13 +258,13 @@ protected:
// cPiecePool overrides:
- virtual cPieces GetPiecesWithConnector(int a_ConnectorType)
+ virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override
{
return m_Prefabs.GetPiecesWithConnector(a_ConnectorType);
}
- virtual cPieces GetStartingPieces(void)
+ virtual cPieces GetStartingPieces(void) override
{
return m_Prefabs.GetStartingPieces();
}
@@ -319,7 +318,7 @@ protected:
{
if (
(a_PlacedPieces[i]->GetParent() == Pivot) && // It is a direct dependant of the pivot
- !((const cPrefab &)a_PlacedPieces[i]->GetPiece()).ShouldMoveToGround() // It attaches strictly by connectors
+ !(static_cast<const cPrefab &>(a_PlacedPieces[i]->GetPiece())).ShouldMoveToGround() // It attaches strictly by connectors
)
{
a_PlacedPieces[i]->MoveToGroundBy(a_HeightDifference);
@@ -336,30 +335,18 @@ protected:
////////////////////////////////////////////////////////////////////////////////
// cVillageGen:
-static cVillagePiecePool g_SandVillage(g_SandVillagePrefabs, g_SandVillagePrefabsCount, g_SandVillageStartingPrefabs, g_SandVillageStartingPrefabsCount);
-static cVillagePiecePool g_SandFlatRoofVillage(g_SandFlatRoofVillagePrefabs, g_SandFlatRoofVillagePrefabsCount, g_SandFlatRoofVillageStartingPrefabs, g_SandFlatRoofVillageStartingPrefabsCount);
-static cVillagePiecePool g_AlchemistVillage(g_AlchemistVillagePrefabs, g_AlchemistVillagePrefabsCount, g_AlchemistVillageStartingPrefabs, g_AlchemistVillageStartingPrefabsCount);
-static cVillagePiecePool g_PlainsVillage(g_PlainsVillagePrefabs, g_PlainsVillagePrefabsCount, g_PlainsVillageStartingPrefabs, g_PlainsVillageStartingPrefabsCount);
-static cVillagePiecePool g_JapaneseVillage(g_JapaneseVillagePrefabs, g_JapaneseVillagePrefabsCount, g_JapaneseVillageStartingPrefabs, g_JapaneseVillageStartingPrefabsCount);
-
-static cVillagePiecePool * g_DesertVillagePools[] =
-{
- &g_SandVillage,
- &g_SandFlatRoofVillage,
- &g_AlchemistVillage,
-} ;
-
-static cVillagePiecePool * g_PlainsVillagePools[] =
-{
- &g_PlainsVillage,
- &g_JapaneseVillage,
-} ;
-
-
-
-
-
-cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGenPtr a_BiomeGen, cTerrainHeightGenPtr a_HeightGen) :
+cVillageGen::cVillageGen(
+ int a_Seed,
+ int a_GridSize,
+ int a_MaxOffset,
+ int a_MaxDepth,
+ int a_MaxSize,
+ int a_MinDensity,
+ int a_MaxDensity,
+ cBiomeGenPtr a_BiomeGen,
+ cTerrainHeightGenPtr a_HeightGen,
+ const AStringVector & a_PrefabsToLoad
+) :
super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 1000),
m_MaxDepth(a_MaxDepth),
@@ -369,6 +356,21 @@ cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxD
m_BiomeGen(a_BiomeGen),
m_HeightGen(a_HeightGen)
{
+ for (const auto & toLoad: a_PrefabsToLoad)
+ {
+ auto prefabs = std::make_shared<cVillagePiecePool>();
+ auto fileName = Printf("Prefabs%sVillages%s%s.cubeset", cFile::GetPathSeparator().c_str(), cFile::GetPathSeparator().c_str(), toLoad.c_str());
+ if (prefabs->LoadFromFile(fileName, true))
+ {
+ if (NoCaseCompare(prefabs->GetIntendedUse(), "village") != 0)
+ {
+ LOGWARNING("Village generator: File %s is intended for use in \"%s\", rather than villages. Loading the file, but the generator may behave unexpectedly.",
+ fileName.c_str(), prefabs->GetIntendedUse().c_str()
+ );
+ }
+ m_Pools.push_back(std::move(prefabs));
+ }
+ }
}
@@ -383,60 +385,48 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_GridX, int a_Gr
cChunkDef::BiomeMap Biomes;
m_BiomeGen->GenBiomes(ChunkX, ChunkZ, Biomes);
- // Check if all the biomes are village-friendly:
- // If just one is not, no village is created, because it's likely that an unfriendly biome is too close
- cVillagePiecePool * VillagePrefabs = nullptr;
- BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL;
- BLOCKTYPE WaterRoadBlock = E_BLOCK_PLANKS;
- int rnd = m_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) / 11;
- cVillagePiecePool * PlainsVillage = g_PlainsVillagePools[rnd % ARRAYCOUNT(g_PlainsVillagePools)];
- cVillagePiecePool * DesertVillage = g_DesertVillagePools[rnd % ARRAYCOUNT(g_DesertVillagePools)];
+ // Get a list of pools that support each biome within the chunk:
+ // If just one column's biome is not allowed, the pool is not used because it's likely that an unfriendly biome is too close
+ auto availablePools = m_Pools;
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
{
- switch (Biomes[i])
- {
- case biDesert:
- case biDesertM:
+ auto biome = Biomes[i];
+ availablePools.erase(std::remove_if(availablePools.begin(), availablePools.end(),
+ [biome](SharedPtr<cPrefabPiecePool> a_Pool)
{
- // These biomes allow sand villages
- VillagePrefabs = DesertVillage;
- // RoadBlock = E_BLOCK_SANDSTONE;
- break;
- }
- case biPlains:
- case biSavanna:
- case biSavannaM:
- case biSunflowerPlains:
- {
- // These biomes allow plains-style villages
- VillagePrefabs = PlainsVillage;
- break;
- }
- default:
- {
- // Village-unfriendly biome, bail out with zero structure:
- return cStructurePtr();
- }
- } // switch (Biomes[i])
- } // for i - Biomes[]
+ return !a_Pool->IsBiomeAllowed(biome);
+ }),
+ availablePools.end()
+ );
+ // Bail out if no compatible pools left:
+ if (availablePools.empty())
+ {
+ return cStructurePtr();
+ }
+ }
+
+ // Pick one pool from the available pools:
+ if (availablePools.empty())
+ {
+ return cStructurePtr();
+ }
+ auto rnd = m_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) / 11;
+ auto pool = availablePools[static_cast<size_t>(rnd) % availablePools.size()];
+ rnd /= 137;
// Choose density for the village, random between m_MinDensity and m_MaxDensity:
int Density;
- if (m_MaxDensity > m_MinDensity)
+ if (pool->GetMaxDensity() > pool->GetMinDensity())
{
- Density = m_MinDensity + rnd % (m_MaxDensity - m_MinDensity);
+ Density = pool->GetMinDensity() + rnd % (pool->GetMaxDensity() - pool->GetMinDensity());
}
else
{
- Density = m_MinDensity;
+ Density = pool->GetMinDensity();
}
// Create a village based on the chosen prefabs:
- if (VillagePrefabs == nullptr)
- {
- return cStructurePtr();
- }
- return cStructurePtr(new cVillage(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock, WaterRoadBlock));
+ return cStructurePtr(new cVillage(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *pool.get(), m_HeightGen));
}
diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h
index c384ed9e5..e7f9f2529 100644
--- a/src/Generating/VillageGen.h
+++ b/src/Generating/VillageGen.h
@@ -16,15 +16,34 @@
+// fwd:
+class cVillagePiecePool;
+
+
+
+
+
class cVillageGen :
public cGridStructGen
{
typedef cGridStructGen super;
public:
- cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGenPtr a_BiomeGen, cTerrainHeightGenPtr a_HeightGen);
+ /** Creates a new instance of the generator with the specified parameters. */
+ cVillageGen(
+ int a_Seed,
+ int a_GridSize,
+ int a_MaxOffset,
+ int a_MaxDepth,
+ int a_MaxSize,
+ int a_MinDensity, int a_MaxDensity,
+ cBiomeGenPtr a_BiomeGen,
+ cTerrainHeightGenPtr a_HeightGen,
+ const AStringVector & a_PrefabsToLoad
+ );
protected:
class cVillage; // fwd: VillageGen.cpp
+ typedef std::vector<SharedPtr<cVillagePiecePool> > cVillagePiecePools;
/** The noise used for generating random numbers */
cNoise m_Noise;
@@ -47,6 +66,9 @@ protected:
/** The underlying height generator, used to position the prefabs crossing chunk borders */
cTerrainHeightGenPtr m_HeightGen;
+ /** All available prefab sets. Each village gets one of these chosen randomly. */
+ cVillagePiecePools m_Pools;
+
// cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
diff --git a/src/Globals.h b/src/Globals.h
index 1f354ae77..f0e370d2c 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -192,14 +192,13 @@ template class SizeChecker<UInt8, 1>;
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT _WIN32_WINNT_WS03 // We want to target Windows XP with Service Pack 2 & Windows Server 2003 with Service Pack 1 and higher
+ // Windows SDK defines min and max macros, messing up with our std::min and std::max usage
+ #define NOMINMAX
+
#include <Windows.h>
#include <winsock2.h>
#include <Ws2tcpip.h> // IPv6 stuff
- // Windows SDK defines min and max macros, messing up with our std::min and std::max usage
- #undef min
- #undef max
-
// Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
#ifdef GetFreeSpace
#undef GetFreeSpace
@@ -221,6 +220,7 @@ template class SizeChecker<UInt8, 1>;
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
+ #include <unistd.h>
#endif
#if defined(ANDROID_NDK)
@@ -261,15 +261,15 @@ template class SizeChecker<UInt8, 1>;
+// Common headers (part 1, without macros):
+#include "StringUtils.h"
+#include "OSSupport/CriticalSection.h"
+#include "OSSupport/Event.h"
+#include "OSSupport/File.h"
+#include "OSSupport/StackTrace.h"
+
#ifndef TEST_GLOBALS
- // Common headers (part 1, without macros):
- #include "StringUtils.h"
- #include "OSSupport/CriticalSection.h"
- #include "OSSupport/Semaphore.h"
- #include "OSSupport/Event.h"
- #include "OSSupport/File.h"
#include "Logger.h"
- #include "OSSupport/StackTrace.h"
#else
// Logging functions
void inline LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2);
@@ -316,6 +316,9 @@ void inline LOG(const char * a_Format, ...)
va_end(argList);
}
+#define LOGINFO LOG
+#define LOGWARN LOGWARNING
+
#endif
@@ -433,10 +436,14 @@ typename std::enable_if<std::is_arithmetic<T>::value, C>::type CeilC(T a_Value)
//temporary replacement for std::make_unique until we get c++14
-template <class T, class... Args>
-std::unique_ptr<T> make_unique(Args&&... args)
+
+namespace cpp14
{
- return std::unique_ptr<T>(new T(args...));
+ template <class T, class... Args>
+ std::unique_ptr<T> make_unique(Args&&... args)
+ {
+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+ }
}
// a tick is 50 ms
diff --git a/src/HTTPServer/CMakeLists.txt b/src/HTTPServer/CMakeLists.txt
index b0efc810d..ab3828aae 100644
--- a/src/HTTPServer/CMakeLists.txt
+++ b/src/HTTPServer/CMakeLists.txt
@@ -24,6 +24,11 @@ SET (HDRS
NameValueParser.h
SslHTTPConnection.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(HTTPServer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=old-style-cast")
+ set_source_files_properties(HTTPConnection.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
+endif()
+
if(NOT MSVC)
add_library(HTTPServer ${SRCS} ${HDRS})
endif()
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp
index a5c6afd18..c6a45e6ed 100644
--- a/src/HTTPServer/HTTPConnection.cpp
+++ b/src/HTTPServer/HTTPConnection.cpp
@@ -213,7 +213,7 @@ void cHTTPConnection::OnReceivedData(const char * a_Data, size_t a_Size)
ASSERT(m_CurrentRequest != nullptr);
if (m_CurrentRequestBodyRemaining > 0)
{
- size_t BytesToConsume = std::min(m_CurrentRequestBodyRemaining, (size_t)a_Size);
+ size_t BytesToConsume = std::min(m_CurrentRequestBodyRemaining, static_cast<size_t>(a_Size));
m_HTTPServer.RequestBody(*this, *m_CurrentRequest, a_Data, BytesToConsume);
m_CurrentRequestBodyRemaining -= BytesToConsume;
}
diff --git a/src/HTTPServer/HTTPFormParser.cpp b/src/HTTPServer/HTTPFormParser.cpp
index 72872078b..77f98e43b 100644
--- a/src/HTTPServer/HTTPFormParser.cpp
+++ b/src/HTTPServer/HTTPFormParser.cpp
@@ -90,11 +90,6 @@ void cHTTPFormParser::Parse(const char * a_Data, size_t a_Size)
m_MultipartParser->Parse(a_Data, a_Size);
break;
}
- default:
- {
- ASSERT(!"Unhandled form kind");
- break;
- }
}
}
@@ -113,7 +108,7 @@ bool cHTTPFormParser::Finish(void)
ParseFormUrlEncoded();
break;
}
- default:
+ case fpkMultipart:
{
// Nothing needed for other formats
break;
diff --git a/src/HTTPServer/HTTPServer.cpp b/src/HTTPServer/HTTPServer.cpp
index 71f974a97..2eb8bf1ff 100644
--- a/src/HTTPServer/HTTPServer.cpp
+++ b/src/HTTPServer/HTTPServer.cpp
@@ -112,7 +112,9 @@ class cDebugCallbacks :
// TODO
}
-} g_DebugCallbacks;
+};
+
+static cDebugCallbacks g_DebugCallbacks;
diff --git a/src/HTTPServer/SslHTTPConnection.cpp b/src/HTTPServer/SslHTTPConnection.cpp
index f8dea0731..7239741da 100644
--- a/src/HTTPServer/SslHTTPConnection.cpp
+++ b/src/HTTPServer/SslHTTPConnection.cpp
@@ -55,7 +55,7 @@ void cSslHTTPConnection::OnReceivedData(const char * a_Data, size_t a_Size)
int NumRead = m_Ssl.ReadPlain(Buffer, sizeof(Buffer));
if (NumRead > 0)
{
- super::OnReceivedData(Buffer, (size_t)NumRead);
+ super::OnReceivedData(Buffer, static_cast<size_t>(NumRead));
}
else if (NumRead == POLARSSL_ERR_NET_WANT_READ)
{
diff --git a/src/IniFile.cpp b/src/IniFile.cpp
index 99c0a5f0f..635af740d 100644
--- a/src/IniFile.cpp
+++ b/src/IniFile.cpp
@@ -49,6 +49,9 @@ cIniFile::cIniFile(void) :
bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect)
{
+
+ m_Filename = a_FileName;
+
// Normally you would use ifstream, but the SGI CC compiler has
// a few bugs with ifstream. So ... fstream used.
fstream f;
@@ -56,7 +59,8 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect)
AString keyname, valuename, value;
AString::size_type pLeft, pRight;
bool IsFromExampleRedirect = false;
-
+
+
f.open((FILE_IO_PREFIX + a_FileName).c_str(), ios::in);
if (f.fail())
{
@@ -239,7 +243,7 @@ int cIniFile::FindKey(const AString & a_KeyName) const
{
if (CheckCase(names[keyID]) == CaseKeyName)
{
- return (int)keyID;
+ return static_cast<int>(keyID);
}
}
return noID;
@@ -650,7 +654,7 @@ void cIniFile::Clear(void)
-bool cIniFile::HasValue(const AString & a_KeyName, const AString & a_ValueName)
+bool cIniFile::HasValue(const AString & a_KeyName, const AString & a_ValueName) const
{
// Find the key:
int keyID = FindKey(a_KeyName);
@@ -855,7 +859,7 @@ AString cIniFile::CheckCase(const AString & s) const
size_t len = res.length();
for (size_t i = 0; i < len; i++)
{
- res[i] = tolower(res[i]);
+ res[i] = static_cast<char>(tolower(res[i]));
}
return res;
}
@@ -889,8 +893,36 @@ void cIniFile::RemoveBom(AString & a_line) const
+bool cIniFile::KeyExists(AString a_keyname) const
+{
+ return FindKey(a_keyname) != noID;
+}
+
+
+
+
+
+std::vector<std::pair<AString, AString>> cIniFile::GetValues(AString a_keyName)
+{
+ std::vector<std::pair<AString, AString>> ret;
+ int keyID = FindKey(a_keyName);
+ if (keyID == noID)
+ {
+ return ret;
+ }
+ for (size_t valueID = 0; valueID < keys[keyID].names.size(); ++valueID)
+ {
+ ret.emplace_back(keys[keyID].names[valueID], keys[keyID].values[valueID]);
+ }
+ return ret;
+}
+
+
+
+
+
AStringVector ReadUpgradeIniPorts(
- cIniFile & a_IniFile,
+ cSettingsRepositoryInterface & a_Settings,
const AString & a_KeyName,
const AString & a_PortsValueName,
const AString & a_OldIPv4ValueName,
@@ -899,23 +931,34 @@ AStringVector ReadUpgradeIniPorts(
)
{
// Read the regular value, but don't use the default (in order to detect missing value for upgrade):
- AStringVector Ports = StringSplitAndTrim(a_IniFile.GetValue(a_KeyName, a_PortsValueName), ";,");
+
+ AStringVector Ports;
+
+ for (auto pair : a_Settings.GetValues(a_KeyName))
+ {
+ if (pair.first != a_PortsValueName)
+ {
+ continue;
+ }
+ AStringVector temp = StringSplitAndTrim(pair.second, ";,");
+ Ports.insert(Ports.end(), temp.begin(), temp.end());
+ }
if (Ports.empty())
{
// Historically there were two separate entries for IPv4 and IPv6, merge them and migrate:
- AString Ports4 = a_IniFile.GetValue(a_KeyName, a_OldIPv4ValueName, a_DefaultValue);
- AString Ports6 = a_IniFile.GetValue(a_KeyName, a_OldIPv6ValueName);
+ AString Ports4 = a_Settings.GetValue(a_KeyName, a_OldIPv4ValueName, a_DefaultValue);
+ AString Ports6 = a_Settings.GetValue(a_KeyName, a_OldIPv6ValueName);
Ports = MergeStringVectors(StringSplitAndTrim(Ports4, ";,"), StringSplitAndTrim(Ports6, ";,"));
- a_IniFile.DeleteValue(a_KeyName, a_OldIPv4ValueName);
- a_IniFile.DeleteValue(a_KeyName, a_OldIPv6ValueName);
+ a_Settings.DeleteValue(a_KeyName, a_OldIPv4ValueName);
+ a_Settings.DeleteValue(a_KeyName, a_OldIPv6ValueName);
// If those weren't present or were empty, use the default:"
if (Ports.empty())
{
Ports = StringSplitAndTrim(a_DefaultValue, ";,");
}
- a_IniFile.SetValue(a_KeyName, a_PortsValueName, StringsConcat(Ports, ','));
+ a_Settings.SetValue(a_KeyName, a_PortsValueName, StringsConcat(Ports, ','));
}
return Ports;
@@ -923,4 +966,3 @@ AStringVector ReadUpgradeIniPorts(
-
diff --git a/src/IniFile.h b/src/IniFile.h
index 71fea3a00..a05e8f734 100644
--- a/src/IniFile.h
+++ b/src/IniFile.h
@@ -18,7 +18,7 @@
#pragma once
-
+#include "SettingsRepositoryInterface.h"
#define MAX_KEYNAME 128
#define MAX_VALUENAME 128
@@ -30,10 +30,12 @@
// tolua_begin
-class cIniFile
+class cIniFile : public cSettingsRepositoryInterface
{
private:
bool m_IsCaseInsensitive;
+
+ AString m_Filename;
struct key
{
@@ -53,15 +55,19 @@ private:
void RemoveBom(AString & a_line) const;
public:
-
- enum errors
- {
- noID = -1,
- };
/// Creates a new instance with no data
cIniFile(void);
+// tolua_end
+ virtual ~cIniFile() = default;
+
+ virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) override;
+
+ virtual bool KeyExists(const AString a_keyName) const override;
+
+// tolua_begin
+
// Sets whether or not keynames and valuenames should be case sensitive.
// The default is case insensitive.
void CaseSensitive (void) { m_IsCaseInsensitive = false; }
@@ -77,11 +83,13 @@ public:
/// Writes data stored in class to the specified ini file
bool WriteFile(const AString & a_FileName) const;
+ virtual bool Flush() override { return WriteFile(m_Filename); }
+
/// Deletes all stored ini data (but doesn't touch the file)
void Clear(void);
/** Returns true iff the specified value exists. */
- bool HasValue(const AString & a_KeyName, const AString & a_ValueName);
+ bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const override;
/// Returns index of specified key, or noID if not found
int FindKey(const AString & keyname) const;
@@ -90,10 +98,10 @@ public:
int FindValue(const int keyID, const AString & valuename) const;
/// Returns number of keys currently in the ini
- int GetNumKeys(void) const { return (int)keys.size(); }
+ int GetNumKeys(void) const { return static_cast<int>(keys.size()); }
/// Add a key name
- int AddKeyName(const AString & keyname);
+ int AddKeyName(const AString & keyname) override;
// Returns key names by index.
AString GetKeyName(const int keyID) const;
@@ -109,7 +117,7 @@ public:
// Gets value of [keyname] valuename =.
// Overloaded to return string, int, and double.
// Returns defValue if key / value not found.
- AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const;
+ AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const override;
AString GetValue (const int keyID, const int valueID, const AString & defValue = "") const;
double GetValueF(const AString & keyname, const AString & valuename, const double defValue = 0) const;
int GetValueI(const AString & keyname, const AString & valuename, const int defValue = 0) const;
@@ -119,18 +127,18 @@ public:
}
// Gets the value; if not found, write the default to the INI file
- AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "");
+ AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "") override;
double GetValueSetF(const AString & keyname, const AString & valuename, const double defValue = 0.0);
- int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0);
- Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0);
- bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false)
+ int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0) override;
+ Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0) override;
+ bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false) override
{
return (GetValueSetI(keyname, valuename, defValue ? 1 : 0) != 0);
}
// Adds a new value to the specified key.
// If a value of the same name already exists, creates another one (non-standard INI file)
- void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value);
+ void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value) override;
void AddValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value);
void AddValueB(const AString & a_KeyName, const AString & a_ValueName, const bool a_Value)
{
@@ -143,8 +151,8 @@ public:
// Returns true if value set, false otherwise.
// Overloaded to accept string, int, and double.
bool SetValue (const int keyID, const int valueID, const AString & value);
- bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true);
- bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true);
+ bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true) override;
+ bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true) override;
bool SetValueI(const AString & a_Keyname, const AString & a_ValueName, const Int64 a_Value, const bool a_CreateIfNotExists = true);
bool SetValueB(const AString & a_KeyName, const AString & a_ValueName, const bool a_Value, const bool a_CreateIfNotExists = true)
{
@@ -155,7 +163,7 @@ public:
// Deletes specified value.
// Returns true if value existed and deleted, false otherwise.
bool DeleteValueByID(const int keyID, const int valueID);
- bool DeleteValue(const AString & keyname, const AString & valuename);
+ bool DeleteValue(const AString & keyname, const AString & valuename) override;
// Deletes specified key and all values contained within.
// Returns true if key existed and deleted, false otherwise.
@@ -165,7 +173,7 @@ public:
// Header comments are those comments before the first key.
/// Returns the number of header comments
- int GetNumHeaderComments(void) {return (int)comments.size();}
+ int GetNumHeaderComments(void) {return static_cast<int>(comments.size());}
/// Adds a header comment
void AddHeaderComment(const AString & comment);
@@ -196,15 +204,15 @@ public:
bool AddKeyComment(const int keyID, const AString & comment);
/// Add a key comment
- bool AddKeyComment(const AString & keyname, const AString & comment);
+ bool AddKeyComment(const AString & keyname, const AString & comment) override;
/// Return a key comment
AString GetKeyComment(const int keyID, const int commentID) const;
- AString GetKeyComment(const AString & keyname, const int commentID) const;
+ AString GetKeyComment(const AString & keyname, const int commentID) const override;
// Delete a key comment.
bool DeleteKeyComment(const int keyID, const int commentID);
- bool DeleteKeyComment(const AString & keyname, const int commentID);
+ bool DeleteKeyComment(const AString & keyname, const int commentID) override;
// Delete all comments for a key.
bool DeleteKeyComments(const int keyID);
@@ -222,7 +230,7 @@ Reads the list of ports from a_PortsValueName. If that value doesn't exist or is
in a_OldIPv4ValueName and a_OldIPv6ValueName; in this case the old values are removed from the INI file.
If there is none of the three values or they are all empty, the default is used and stored in the Ports value. */
AStringVector ReadUpgradeIniPorts(
- cIniFile & a_IniFile,
+ cSettingsRepositoryInterface & a_Settings,
const AString & a_KeyName,
const AString & a_PortsValueName,
const AString & a_OldIPv4ValueName,
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index c595da5b0..6b3c8e62f 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -98,7 +98,7 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
-int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst)
+int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks)
{
cItem ToAdd(a_Item);
int res = 0;
@@ -116,7 +116,28 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
}
}
- res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1);
+ for (int SlotIdx = 0; SlotIdx < m_InventorySlots.GetNumSlots(); ++SlotIdx)
+ {
+ auto & Slot = m_InventorySlots.GetSlot(SlotIdx);
+ if (Slot.IsEqual(a_Item))
+ {
+ cItemHandler Handler(Slot.m_ItemType);
+ int AmountToAdd = std::min(static_cast<char>(Handler.GetMaxStackSize() - Slot.m_ItemCount), ToAdd.m_ItemCount);
+ res += AmountToAdd;
+
+ cItem SlotAdjusted(Slot);
+ SlotAdjusted.m_ItemCount += AmountToAdd;
+ m_InventorySlots.SetSlot(SlotIdx, SlotAdjusted);
+
+ ToAdd.m_ItemCount -= AmountToAdd;
+ if (ToAdd.m_ItemCount == 0)
+ {
+ return res;
+ }
+ }
+ }
+
+ res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks);
ToAdd.m_ItemCount = a_Item.m_ItemCount - res;
if (ToAdd.m_ItemCount == 0)
{
@@ -131,12 +152,12 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
-int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst)
+int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks)
{
int TotalAdded = 0;
for (cItems::iterator itr = a_ItemStackList.begin(); itr != a_ItemStackList.end();)
{
- int NumAdded = AddItem(*itr, a_AllowNewStacks, a_tryToFillEquippedFirst);
+ int NumAdded = AddItem(*itr, a_AllowNewStacks);
if (itr->m_ItemCount == NumAdded)
{
itr = a_ItemStackList.erase(itr);
diff --git a/src/Inventory.h b/src/Inventory.h
index b2a8f658b..5501399bd 100644
--- a/src/Inventory.h
+++ b/src/Inventory.h
@@ -70,23 +70,17 @@ public:
/** Adds as many items out of a_ItemStack as can fit.
If a_AllowNewStacks is set to false, only existing stacks can be topped up;
if a_AllowNewStacks is set to true, empty slots can be used for the rest.
- If a_tryToFillEquippedFirst is set to true, the currently equipped slot will be used first (if empty or
- compatible with added items)
- if a_tryToFillEquippedFirst is set to false, the regular order applies.
Returns the number of items that fit.
*/
- int AddItem(const cItem & a_ItemStack, bool a_AllowNewStacks = true, bool a_tryToFillEquippedFirst = false);
+ int AddItem(const cItem & a_ItemStack, bool a_AllowNewStacks = true);
/** Same as AddItem, but works on an entire list of item stacks.
The a_ItemStackList is modified to reflect the leftover items.
If a_AllowNewStacks is set to false, only existing stacks can be topped up;
if a_AllowNewStacks is set to true, empty slots can be used for the rest.
- If a_tryToFillEquippedFirst is set to true, the currently equipped slot will be used first (if empty or
- compatible with added items)
- if a_tryToFillEquippedFirst is set to false, the regular order applies.
Returns the total number of items that fit.
*/
- int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst);
+ int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks);
/** Removes the specified item from the inventory, as many as possible, up to a_ItemStack.m_ItemCount.
Returns the number of items that were removed. */
diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp
index 06971a1ac..8433598f7 100644
--- a/src/ItemGrid.cpp
+++ b/src/ItemGrid.cpp
@@ -358,7 +358,7 @@ int cItemGrid::RemoveItem(const cItem & a_ItemStack)
if (m_Slots[i].IsEqual(a_ItemStack))
{
- int NumToRemove = std::min(NumLeft, (int)m_Slots[i].m_ItemCount);
+ int NumToRemove = std::min(NumLeft, static_cast<int>(m_Slots[i].m_ItemCount));
NumLeft -= NumToRemove;
m_Slots[i].m_ItemCount -= NumToRemove;
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index c50ddb372..71f2d9ceb 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -56,6 +56,10 @@ SET (HDRS
ItemThrowable.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(ItemHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=old-style-cast -Wno-error=switch-enum")
+endif()
+
if(NOT MSVC)
add_library(Items ${SRCS} ${HDRS})
endif()
diff --git a/src/Items/ItemBed.h b/src/Items/ItemBed.h
index 77d51d744..15b924a08 100644
--- a/src/Items/ItemBed.h
+++ b/src/Items/ItemBed.h
@@ -25,10 +25,11 @@ public:
}
- virtual bool OnPlayerPlace(
+ virtual bool GetBlocksToPlace(
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
- int a_CursorX, int a_CursorY, int a_CursorZ
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ sSetBlockVector & a_BlocksToPlace
) override
{
// Can only be placed on the floor:
@@ -36,12 +37,10 @@ public:
{
return false;
}
- AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
// The "foot" block:
- sSetBlockVector blks;
NIBBLETYPE BlockMeta = cBlockBedHandler::RotationToMetaData(a_Player.GetYaw());
- blks.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BED, BlockMeta);
+ a_BlocksToPlace.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BED, BlockMeta);
// Check if there is empty space for the "head" block:
// (Vanilla only allows beds to be placed into air)
@@ -50,10 +49,8 @@ public:
{
return false;
}
- blks.emplace_back(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, BlockMeta | 0x08);
-
- // Place both bed blocks:
- return a_Player.PlaceBlocks(blks);
+ a_BlocksToPlace.emplace_back(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, BlockMeta | 0x08);
+ return true;
}
} ;
diff --git a/src/Items/ItemBigFlower.h b/src/Items/ItemBigFlower.h
index 4341a1a17..a052485e4 100644
--- a/src/Items/ItemBigFlower.h
+++ b/src/Items/ItemBigFlower.h
@@ -27,10 +27,11 @@ public:
}
- virtual bool OnPlayerPlace(
+ virtual bool GetBlocksToPlace(
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
- int a_CursorX, int a_CursorY, int a_CursorZ
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ sSetBlockVector & a_BlocksToSet
) override
{
// Can only be placed on the floor:
@@ -38,16 +39,14 @@ public:
{
return false;
}
- AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
- // Place both blocks atomically:
- sSetBlockVector blks;
- blks.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BIG_FLOWER, a_EquippedItem.m_ItemDamage & 0x07);
+ AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
+ a_BlocksToSet.emplace_back(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BIG_FLOWER, a_EquippedItem.m_ItemDamage & 0x07);
if (a_BlockY < cChunkDef::Height - 1)
{
- blks.emplace_back(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_BIG_FLOWER, (a_EquippedItem.m_ItemDamage & 0x07) | 0x08);
+ a_BlocksToSet.emplace_back(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_BIG_FLOWER, (a_EquippedItem.m_ItemDamage & 0x07) | 0x08);
}
- return a_Player.PlaceBlocks(blks);
+ return true;
}
};
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index 5164ddf59..8bbaa3d8c 100644
--- a/src/Items/ItemBow.h
+++ b/src/Items/ItemBow.h
@@ -53,7 +53,7 @@ public:
ASSERT(a_Player != nullptr);
int BowCharge = a_Player->FinishChargingBow();
- double Force = (double)BowCharge / 20.0;
+ double Force = static_cast<double>(BowCharge) / 20.0;
Force = (Force * Force + 2.0 * Force) / 3.0; // This formula is used by the 1.6.2 client
if (Force < 0.1)
{
@@ -80,7 +80,14 @@ public:
Arrow = nullptr;
return;
}
- a_Player->GetWorld()->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY(), a_Player->GetPosZ(), 0.5, (float)Force);
+ a_Player->GetWorld()->BroadcastSoundEffect(
+ "random.bow",
+ a_Player->GetPosX(),
+ a_Player->GetPosY(),
+ a_Player->GetPosZ(),
+ 0.5,
+ static_cast<float>(Force)
+ );
if (!a_Player->IsGameModeCreative())
{
if (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchInfinity) == 0)
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h
index 015720415..4d39bde82 100644
--- a/src/Items/ItemBucket.h
+++ b/src/Items/ItemBucket.h
@@ -80,6 +80,13 @@ public:
return false;
}
+ // Check to see if destination block is too far away
+ // Reach Distance Multiplayer = 5 Blocks
+ if ((BlockPos.x - a_Player->GetPosX() > 5) || (BlockPos.z - a_Player->GetPosZ() > 5))
+ {
+ return false;
+ }
+
// Remove water / lava block (unless plugins disagree)
if (!a_Player->PlaceBlock(BlockPos.x, BlockPos.y, BlockPos.z, E_BLOCK_AIR, 0))
{
@@ -96,7 +103,7 @@ public:
ASSERT(!"Inventory bucket mismatch");
return true;
}
- if (a_Player->GetInventory().AddItem(cItem(NewItem), true, true) != 1)
+ if (a_Player->GetInventory().AddItem(cItem(NewItem)) != 1)
{
// The bucket didn't fit, toss it as a pickup:
a_Player->TossPickup(cItem(NewItem));
@@ -126,6 +133,13 @@ public:
{
return false;
}
+
+ // Check to see if destination block is too far away
+ // Reach Distance Multiplayer = 5 Blocks
+ if ((BlockPos.x - a_Player->GetPosX() > 5) || (BlockPos.z - a_Player->GetPosZ() > 5))
+ {
+ return false;
+ }
if (a_Player->GetGameMode() != gmCreative)
{
@@ -137,7 +151,7 @@ public:
return false;
}
cItem Item(E_ITEM_BUCKET, 1);
- if (!a_Player->GetInventory().AddItem(Item, true, true))
+ if (!a_Player->GetInventory().AddItem(Item))
{
return false;
}
@@ -236,7 +250,7 @@ public:
m_EntryFace = static_cast<eBlockFace>(a_CBEntryFace);
if (!cFluidSimulator::CanWashAway(a_CBBlockType) && !IsBlockLiquid(a_CBBlockType))
{
- AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, (eBlockFace)a_CBEntryFace); // Was an unwashawayable block, can't overwrite it!
+ AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, static_cast<eBlockFace>(a_CBEntryFace)); // Was an unwashawayable block, can't overwrite it!
}
m_Pos.Set(a_CBBlockX, a_CBBlockY, a_CBBlockZ); // (Block could be washed away, replace it)
return true; // Abort tracing
diff --git a/src/Items/ItemChest.h b/src/Items/ItemChest.h
index 1d23975cd..3dd112c91 100644
--- a/src/Items/ItemChest.h
+++ b/src/Items/ItemChest.h
@@ -27,6 +27,8 @@ public:
}
+ /** We need an OnPlayerPlace override because we're processing neighbor chests and changing their metas,
+ the parent class cannot do that. */
virtual bool OnPlayerPlace(
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@@ -118,34 +120,32 @@ public:
} // for j
} // for i
- // If there's no chest neighbor, place the single block chest and bail out:
+ // Get the meta of the placed chest; take existing neighbors into account:
BLOCKTYPE ChestBlockType = static_cast<BLOCKTYPE>(m_ItemType);
- if (NeighborIdx < 0)
+ NIBBLETYPE Meta;
+ auto yaw = a_Player.GetYaw();
+ switch (NeighborIdx)
{
- NIBBLETYPE Meta = cBlockChestHandler::PlayerYawToMetaData(a_Player.GetYaw());
- return a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, ChestBlockType, Meta);
- }
-
- // There is a neighbor to which we need to adjust
- double yaw = a_Player.GetYaw();
- if ((NeighborIdx == 0) || (NeighborIdx == 2))
- {
- // The neighbor is in the X axis, form a X-axis-aligned dblchest:
- NIBBLETYPE Meta = ((yaw >= -90) && (yaw < 90)) ? E_META_CHEST_FACING_ZM : E_META_CHEST_FACING_ZP;
-
- // Place the new chest:
- if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, ChestBlockType, Meta))
+ case 0:
+ case 2:
{
- return false;
+ // The neighbor is in the X axis, form a X-axis-aligned dblchest:
+ Meta = ((yaw >= -90) && (yaw < 90)) ? E_META_CHEST_FACING_ZM : E_META_CHEST_FACING_ZP;
+ break;
}
-
- // Adjust the existing chest:
- a_World.FastSetBlock(a_BlockX + CrossCoords[NeighborIdx].x, a_BlockY, a_BlockZ + CrossCoords[NeighborIdx].z, ChestBlockType, Meta);
- return true;
- }
-
- // The neighbor is in the Z axis, form a Z-axis-aligned dblchest:
- NIBBLETYPE Meta = (yaw < 0) ? E_META_CHEST_FACING_XM : E_META_CHEST_FACING_XP;
+ case 1:
+ case 3:
+ {
+ // The neighbor is in the Z axis, form a Z-axis-aligned dblchest:
+ Meta = (yaw < 0) ? E_META_CHEST_FACING_XM : E_META_CHEST_FACING_XP;
+ break;
+ }
+ default:
+ {
+ Meta = cBlockChestHandler::PlayerYawToMetaData(yaw);
+ break;
+ }
+ } // switch (NeighborIdx)
// Place the new chest:
if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, ChestBlockType, Meta))
@@ -153,8 +153,31 @@ public:
return false;
}
- // Adjust the existing chest:
- a_World.FastSetBlock(a_BlockX + CrossCoords[NeighborIdx].x, a_BlockY, a_BlockZ + CrossCoords[NeighborIdx].z, ChestBlockType, Meta);
+ // Adjust the existing chest, if any:
+ if (NeighborIdx > 0)
+ {
+ a_World.FastSetBlock(a_BlockX + CrossCoords[NeighborIdx].x, a_BlockY, a_BlockZ + CrossCoords[NeighborIdx].z, ChestBlockType, Meta);
+ }
+
+ // Play the placement sound:
+ AString PlaceSound = cBlockInfo::GetPlaceSound(ChestBlockType);
+ float Volume = 1.0f, Pitch = 0.8f;
+ if (PlaceSound == "dig.metal")
+ {
+ Pitch = 1.2f;
+ PlaceSound = "dig.stone";
+ }
+ else if (PlaceSound == "random.anvil_land")
+ {
+ Volume = 0.65f;
+ }
+ a_World.BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch);
+
+ // Remove the "placed" item:
+ if (a_Player.IsGameModeSurvival())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
return true;
}
diff --git a/src/Items/ItemDoor.h b/src/Items/ItemDoor.h
index ddd3d4e20..e92c567fb 100644
--- a/src/Items/ItemDoor.h
+++ b/src/Items/ItemDoor.h
@@ -20,10 +20,11 @@ public:
}
- virtual bool OnPlayerPlace(
+ virtual bool GetBlocksToPlace(
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
- int a_CursorX, int a_CursorY, int a_CursorZ
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ sSetBlockVector & a_BlocksToSet
) override
{
// Vanilla only allows door placement while clicking on the top face of the block below the door:
@@ -31,7 +32,6 @@ public:
{
return false;
}
- AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
// Door (bottom block) can be placed in Y range of [1, 254]:
if ((a_BlockY < 1) || (a_BlockY >= cChunkDef::Height - 2))
@@ -107,10 +107,9 @@ public:
}
// Set the blocks:
- sSetBlockVector blks;
- blks.emplace_back(a_BlockX, a_BlockY, a_BlockZ, BlockType, LowerBlockMeta);
- blks.emplace_back(a_BlockX, a_BlockY + 1, a_BlockZ, BlockType, UpperBlockMeta);
- return a_Player.PlaceBlocks(blks);
+ a_BlocksToSet.emplace_back(a_BlockX, a_BlockY, a_BlockZ, BlockType, LowerBlockMeta);
+ a_BlocksToSet.emplace_back(a_BlockX, a_BlockY + 1, a_BlockZ, BlockType, UpperBlockMeta);
+ return true;
}
diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h
index 273af826a..c2635bcb6 100644
--- a/src/Items/ItemDye.h
+++ b/src/Items/ItemDye.h
@@ -27,7 +27,7 @@ public:
) override
{
// Handle growing the plants:
- if (a_Item.m_ItemDamage == E_META_DYE_WHITE)
+ if ((a_Item.m_ItemDamage == E_META_DYE_WHITE) && (a_BlockFace != BLOCK_FACE_NONE))
{
if (a_World->GrowRipePlant(a_BlockX, a_BlockY, a_BlockZ, true))
{
diff --git a/src/Items/ItemEmptyMap.h b/src/Items/ItemEmptyMap.h
index 6e944b4da..fba8c0a2c 100644
--- a/src/Items/ItemEmptyMap.h
+++ b/src/Items/ItemEmptyMap.h
@@ -60,7 +60,7 @@ public:
return true;
}
- a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)), true, true);
+ a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)));
return true;
}
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index b7f89809e..a1fa67152 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -367,37 +367,51 @@ bool cItemHandler::OnPlayerPlace(
return false;
}
}
-
- BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- if (!GetPlacementBlockTypeMeta(&a_World, &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta))
+
+ // Get all the blocks to place:
+ sSetBlockVector blocks;
+ if (!GetBlocksToPlace(a_World, a_Player, a_EquippedItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, blocks))
{
// Handler refused the placement, send that information back to the client:
+ for (const auto & blk: blocks)
+ {
+ a_World.SendBlockTo(blk.GetX(), blk.GetY(), blk.GetZ(), &a_Player);
+ }
a_World.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, &a_Player);
a_Player.GetInventory().SendEquippedSlot();
return false;
}
- if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta))
+ // Try to place the blocks:
+ if (!a_Player.PlaceBlocks(blocks))
{
- // The placement failed, the block has already been re-sent, re-send inventory:
+ // The placement failed, the blocks have already been re-sent, re-send inventory:
a_Player.GetInventory().SendEquippedSlot();
return false;
}
- AString PlaceSound = cBlockInfo::GetPlaceSound(BlockType);
- float Volume = 1.0f, Pitch = 0.8f;
- if (PlaceSound == "dig.metal")
- {
- Pitch = 1.2f;
- PlaceSound = "dig.stone";
- }
- else if (PlaceSound == "random.anvil_land")
+ // Play the placement sound for the main block:
+ for (const auto & blk: blocks)
{
- Volume = 0.65f;
- }
-
- a_World.BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch);
+ // Find the main block by comparing the coords:
+ if ((blk.GetX() != a_BlockX) || (blk.GetY() != a_BlockY) || (blk.GetZ() != a_BlockZ))
+ {
+ continue;
+ }
+ AString PlaceSound = cBlockInfo::GetPlaceSound(blk.m_BlockType);
+ float Volume = 1.0f, Pitch = 0.8f;
+ if (PlaceSound == "dig.metal")
+ {
+ Pitch = 1.2f;
+ PlaceSound = "dig.stone";
+ }
+ else if (PlaceSound == "random.anvil_land")
+ {
+ Volume = 0.65f;
+ }
+ a_World.BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch);
+ break;
+ } // for blk - blocks[]
// Remove the "placed" item:
if (a_Player.IsGameModeSurvival())
@@ -411,6 +425,27 @@ bool cItemHandler::OnPlayerPlace(
+bool cItemHandler::GetBlocksToPlace(
+ cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
+ int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ sSetBlockVector & a_BlocksToSet
+)
+{
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ if (!GetPlacementBlockTypeMeta(&a_World, &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta))
+ {
+ return false;
+ }
+ a_BlocksToSet.emplace_back(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
+ return true;
+}
+
+
+
+
+
bool cItemHandler::OnItemUse(
cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h
index ec88aeb99..684b55788 100644
--- a/src/Items/ItemHandler.h
+++ b/src/Items/ItemHandler.h
@@ -35,8 +35,9 @@ public:
/** Called when the player tries to place the item (right mouse button, IsPlaceable() == true).
- The default handler uses GetPlacementBlockTypeMeta and places the returned block.
- Override this function for advanced behavior such as placing multiple blocks.
+ The block coords are for the block that has been clicked.
+ The default handler uses GetBlocksToPlace() and places the returned blocks.
+ Override if the item needs advanced processing, such as spawning a mob based on the blocks being placed.
If the block placement is refused inside this call, it will automatically revert the client-side changes.
Returns true if the placement succeeded, false if the placement was aborted for any reason. */
virtual bool OnPlayerPlace(
@@ -46,7 +47,20 @@ public:
);
- /** Called when the player right-clicks with this item and IsPlaceable() == true, and OnPlace() is not overridden.
+ /** Called from OnPlayerPlace() to determine the blocks that the current placement operation should set.
+ The block coords are where the new (main) block should be placed.
+ The default handler uses GetPlacementBlockTypeMeta() and provides that as the single block at the specified coords.
+ Returns true if the placement succeeded, false if the placement was aborted for any reason.
+ If aborted, the server then sends all original blocks in the coords provided in a_BlocksToSet to the client. */
+ virtual bool GetBlocksToPlace(
+ cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
+ int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ sSetBlockVector & a_BlocksToSet
+ );
+
+
+ /** Called when the player right-clicks with this item and IsPlaceable() == true, and OnPlayerPlace() is not overridden.
This function should provide the block type and meta for the placed block, or refuse the placement.
Returns true to allow placement, false to refuse. */
virtual bool GetPlacementBlockTypeMeta(
diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h
index 8780f7e4b..9a4044bc0 100644
--- a/src/Items/ItemMobHead.h
+++ b/src/Items/ItemMobHead.h
@@ -12,9 +12,11 @@
class cItemMobHeadHandler :
public cItemHandler
{
+ typedef cItemHandler super;
+
public:
cItemMobHeadHandler(int a_ItemType) :
- cItemHandler(a_ItemType)
+ super(a_ItemType)
{
}
@@ -30,34 +32,36 @@ public:
{
return true;
}
- AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
+ auto placedX = a_BlockX, placedY = a_BlockY, placedZ = a_BlockZ;
+ AddFaceDirection(placedY, placedY, placedZ, a_BlockFace);
// If the placed head is a wither, try to spawn the wither first:
if (a_EquippedItem.m_ItemDamage == E_META_HEAD_WITHER)
{
- if (TrySpawnWitherAround(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ))
+ if (TrySpawnWitherAround(a_World, a_Player, placedX, placedY, placedZ))
{
return true;
}
// Wither not created, proceed with regular head placement
}
- return PlaceRegularHead(a_World, a_Player, a_EquippedItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
+ cItem itemCopy(a_EquippedItem); // Make a copy in case this is the player's last head item and OnPlayerPlace removes it
+ if (!super::OnPlayerPlace(a_World, a_Player, a_EquippedItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ))
+ {
+ return false;
+ }
+ RegularHeadPlaced(a_World, a_Player, itemCopy, placedX, placedY, placedZ, a_BlockFace);
+ return true;
}
- /** Places a regular head block with no mob spawning checking. */
- bool PlaceRegularHead(
+ /** Called after placing a regular head block with no mob spawning.
+ Adjusts the mob head entity based on the equipped item's data. */
+ void RegularHeadPlaced(
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
)
{
- // Place the block:
- if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_HEAD, BlockFaceToBlockMeta(a_BlockFace)))
- {
- return false;
- }
-
// Use a callback to set the properties of the mob head block entity:
class cCallback : public cBlockEntityCallback
{
@@ -71,7 +75,7 @@ public:
{
return false;
}
- cMobHeadEntity * MobHeadEntity = static_cast<cMobHeadEntity *>(a_BlockEntity);
+ auto MobHeadEntity = static_cast<cMobHeadEntity *>(a_BlockEntity);
int Rotation = 0;
if (m_BlockMeta == 1)
@@ -94,7 +98,6 @@ public:
};
cCallback Callback(a_Player, static_cast<eMobHeadType>(a_EquippedItem.m_ItemDamage), static_cast<NIBBLETYPE>(a_BlockFace));
a_World.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, Callback);
- return true;
}
@@ -340,7 +343,7 @@ public:
) override
{
a_BlockType = E_BLOCK_HEAD;
- a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x0f);
+ a_BlockMeta = BlockFaceToBlockMeta(a_BlockFace);
return true;
}
} ;
diff --git a/src/Items/ItemMushroomSoup.h b/src/Items/ItemMushroomSoup.h
index dba313ec5..1a761cbf1 100644
--- a/src/Items/ItemMushroomSoup.h
+++ b/src/Items/ItemMushroomSoup.h
@@ -41,7 +41,7 @@ public:
// Return a bowl to the inventory
if (!a_Player->IsGameModeCreative())
{
- a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL), true, true);
+ a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL));
}
return true;
}
diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h
index dabbdbba1..3da93e2f1 100644
--- a/src/Items/ItemSign.h
+++ b/src/Items/ItemSign.h
@@ -25,7 +25,7 @@ public:
cWorld & a_World, cPlayer & a_Player, const cItem & a_EquippedItem,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ
- )
+ ) override
{
// If the regular placement doesn't work, do no further processing:
if (!super::OnPlayerPlace(a_World, a_Player, a_EquippedItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ))
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp
index effde03d0..7f13a94fd 100644
--- a/src/LightingThread.cpp
+++ b/src/LightingThread.cpp
@@ -43,8 +43,8 @@ class cReader :
{
// Copy the entire heightmap, distribute it into the 3x3 chunk blob:
typedef struct {HEIGHTTYPE m_Row[16]; } ROW;
- ROW * InputRows = (ROW *)a_Heightmap;
- ROW * OutputRows = (ROW *)m_HeightMap;
+ const ROW * InputRows = reinterpret_cast<const ROW *>(a_Heightmap);
+ ROW * OutputRows = reinterpret_cast<ROW *>(m_HeightMap);
int InputIdx = 0;
int OutputIdx = m_ReadingChunkX + m_ReadingChunkZ * cChunkDef::Width * 3;
for (int z = 0; z < cChunkDef::Width; z++)
@@ -149,11 +149,11 @@ void cLightingThread::Stop(void)
-void cLightingThread::QueueChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter)
+void cLightingThread::QueueChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallbackAfter)
{
ASSERT(m_World != nullptr); // Did you call Start() properly?
- cChunkStay * ChunkStay = new cLightingChunkStay(*this, a_ChunkX, a_ChunkZ, a_CallbackAfter);
+ cChunkStay * ChunkStay = new cLightingChunkStay(*this, a_ChunkX, a_ChunkZ, std::move(a_CallbackAfter));
{
// The ChunkStay will enqueue itself using the QueueChunkStay() once it is fully loaded
// In the meantime, put it into the PendingQueue so that it can be removed when stopping the thread
@@ -217,7 +217,7 @@ void cLightingThread::Execute(void)
{
continue;
}
- Item = (cLightingChunkStay *)m_Queue.front();
+ Item = static_cast<cLightingChunkStay *>(m_Queue.front());
m_Queue.pop_front();
if (m_Queue.empty())
{
@@ -599,11 +599,11 @@ void cLightingThread::QueueChunkStay(cLightingChunkStay & a_ChunkStay)
////////////////////////////////////////////////////////////////////////////////
// cLightingThread::cLightingChunkStay:
-cLightingThread::cLightingChunkStay::cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter) :
+cLightingThread::cLightingChunkStay::cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallbackAfter) :
m_LightingThread(a_LightingThread),
m_ChunkX(a_ChunkX),
m_ChunkZ(a_ChunkZ),
- m_CallbackAfter(a_CallbackAfter)
+ m_CallbackAfter(std::move(a_CallbackAfter))
{
Add(a_ChunkX + 1, a_ChunkZ + 1);
Add(a_ChunkX + 1, a_ChunkZ);
diff --git a/src/LightingThread.h b/src/LightingThread.h
index 87eb9c6d8..da6be12c8 100644
--- a/src/LightingThread.h
+++ b/src/LightingThread.h
@@ -61,7 +61,7 @@ public:
void Stop(void);
/** Queues the entire chunk for lighting */
- void QueueChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter = nullptr);
+ void QueueChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallbackAfter);
/** Blocks until the queue is empty or the thread is terminated */
void WaitForQueueEmpty(void);
@@ -77,9 +77,9 @@ protected:
cLightingThread & m_LightingThread;
int m_ChunkX;
int m_ChunkZ;
- cChunkCoordCallback * m_CallbackAfter;
+ std::unique_ptr<cChunkCoordCallback> m_CallbackAfter;
- cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter);
+ cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallbackAfter);
protected:
virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index e43a79566..587fa0e7c 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -96,17 +96,17 @@ bool cLineBlockTracer::Trace(double a_StartX, double a_StartY, double a_StartZ,
m_Callbacks->OnIntoWorld(m_StartX, m_StartY, m_StartZ);
}
- m_CurrentX = (int)floor(m_StartX);
- m_CurrentY = (int)floor(m_StartY);
- m_CurrentZ = (int)floor(m_StartZ);
+ m_CurrentX = FloorC(m_StartX);
+ m_CurrentY = FloorC(m_StartY);
+ m_CurrentZ = FloorC(m_StartZ);
m_DiffX = m_EndX - m_StartX;
m_DiffY = m_EndY - m_StartY;
m_DiffZ = m_EndZ - m_StartZ;
// The actual trace is handled with ChunkMapCS locked by calling our Item() for the specified chunk
- int BlockX = (int)floor(m_StartX);
- int BlockZ = (int)floor(m_StartZ);
+ int BlockX = FloorC(m_StartX);
+ int BlockZ = FloorC(m_StartZ);
int ChunkX, ChunkZ;
cChunkDef::BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ);
return m_World->DoWithChunk(ChunkX, ChunkZ, *this);
@@ -120,7 +120,7 @@ void cLineBlockTracer::FixStartAboveWorld(void)
{
// We must set the start Y to less than cChunkDef::Height so that it is considered inside the world later on
// Therefore we use an EPS-offset from the height, as small as reasonably possible.
- const double Height = (double)cChunkDef::Height - 0.00001;
+ const double Height = static_cast<double>(cChunkDef::Height) - 0.00001;
CalcXZIntersection(Height, m_StartX, m_StartZ);
m_StartY = Height;
}
@@ -154,38 +154,45 @@ bool cLineBlockTracer::MoveToNextBlock(void)
{
// Find out which of the current block's walls gets hit by the path:
static const double EPS = 0.00001;
- double Coeff = 1;
- enum eDirection
+ enum
{
dirNONE,
dirX,
dirY,
dirZ,
} Direction = dirNONE;
+
+ // Calculate the next YZ wall hit:
+ double Coeff = 1;
if (std::abs(m_DiffX) > EPS)
{
double DestX = (m_DirX > 0) ? (m_CurrentX + 1) : m_CurrentX;
- Coeff = (DestX - m_StartX) / m_DiffX;
- if (Coeff <= 1)
+ double CoeffX = (DestX - m_StartX) / m_DiffX;
+ if (CoeffX <= 1) // We need to include equality for the last block in the trace
{
+ Coeff = CoeffX;
Direction = dirX;
}
}
+
+ // If the next XZ wall hit is closer, use it instead:
if (std::abs(m_DiffY) > EPS)
{
double DestY = (m_DirY > 0) ? (m_CurrentY + 1) : m_CurrentY;
double CoeffY = (DestY - m_StartY) / m_DiffY;
- if (CoeffY < Coeff)
+ if (CoeffY <= Coeff) // We need to include equality for the last block in the trace
{
Coeff = CoeffY;
Direction = dirY;
}
}
+
+ // If the next XY wall hit is closer, use it instead:
if (std::abs(m_DiffZ) > EPS)
{
double DestZ = (m_DirZ > 0) ? (m_CurrentZ + 1) : m_CurrentZ;
double CoeffZ = (DestZ - m_StartZ) / m_DiffZ;
- if (CoeffZ < Coeff)
+ if (CoeffZ <= Coeff) // We need to include equality for the last block in the trace
{
Direction = dirZ;
}
diff --git a/src/LinearUpscale.h b/src/LinearUpscale.h
index 1b0fbd89a..adc873912 100644
--- a/src/LinearUpscale.h
+++ b/src/LinearUpscale.h
@@ -109,11 +109,11 @@ template <typename TYPE> void LinearUpscale2DArray(
TYPE RatioY[MAX_UPSCALE_Y];
for (int x = 0; x <= a_UpscaleX; x++)
{
- RatioX[x] = (TYPE)x / a_UpscaleX;
+ RatioX[x] = static_cast<TYPE>(x) / a_UpscaleX;
}
for (int y = 0; y <= a_UpscaleY; y++)
{
- RatioY[y] = (TYPE)y / a_UpscaleY;
+ RatioY[y] = static_cast<TYPE>(y) / a_UpscaleY;
}
// Interpolate each XY cell:
@@ -184,15 +184,15 @@ template <typename TYPE> void LinearUpscale3DArray(
TYPE RatioZ[MAX_UPSCALE_Z];
for (int x = 0; x <= a_UpscaleX; x++)
{
- RatioX[x] = (TYPE)x / a_UpscaleX;
+ RatioX[x] = static_cast<TYPE>(x) / a_UpscaleX;
}
for (int y = 0; y <= a_UpscaleY; y++)
{
- RatioY[y] = (TYPE)y / a_UpscaleY;
+ RatioY[y] = static_cast<TYPE>(y) / a_UpscaleY;
}
for (int z = 0; z <= a_UpscaleZ; z++)
{
- RatioZ[z] = (TYPE)z / a_UpscaleZ;
+ RatioZ[z] = static_cast<TYPE>(z) / a_UpscaleZ;
}
// Interpolate each XYZ cell:
diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp
index 5c7097956..91964c57e 100644
--- a/src/LoggerListeners.cpp
+++ b/src/LoggerListeners.cpp
@@ -3,6 +3,8 @@
#include "LoggerListeners.h"
+#include <chrono>
+
#if defined(_WIN32)
#include <io.h> // Needed for _isatty(), not available on Linux
#include <time.h>
@@ -236,8 +238,26 @@ public:
-cLogger::cListener * MakeConsoleListener(void)
+// Listener for when stdout is closed, i.e. When running as a daemon.
+class cNullConsoleListener
+ : public cLogger::cListener
{
+ virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override
+ {
+ }
+};
+
+
+
+
+
+cLogger::cListener * MakeConsoleListener(bool a_IsService)
+{
+ if (a_IsService)
+ {
+ return new cNullConsoleListener;
+ }
+
#ifdef _WIN32
// See whether we are writing to a console the default console attrib:
bool ShouldColorOutput = (_isatty(_fileno(stdin)) != 0);
@@ -279,9 +299,15 @@ cLogger::cListener * MakeConsoleListener(void)
cFileListener::cFileListener(void)
{
cFile::CreateFolder(FILE_IO_PREFIX + AString("logs"));
- AString FileName;
- FileName = Printf("%s%sLOG_%d.txt", FILE_IO_PREFIX, "logs/", (int)time(nullptr));
- m_File.Open(FileName, cFile::fmAppend);
+ m_File.Open(
+ FILE_IO_PREFIX + Printf(
+ "logs/LOG_%d.txt",
+ std::chrono::duration_cast<std::chrono::duration<int, std::ratio<1>>>(
+ std::chrono::system_clock::now().time_since_epoch()
+ ).count()
+ ),
+ cFile::fmAppend
+ );
}
@@ -300,7 +326,7 @@ void cFileListener::Log(AString a_Message, cLogger::eLogLevel a_LogLevel)
}
case cLogger::llInfo:
{
- LogLevelPrefix = "info ";
+ LogLevelPrefix = "Info ";
break;
}
case cLogger::llWarning:
diff --git a/src/LoggerListeners.h b/src/LoggerListeners.h
index c419aa75a..a7f9a35a5 100644
--- a/src/LoggerListeners.h
+++ b/src/LoggerListeners.h
@@ -25,7 +25,7 @@ private:
-cLogger::cListener * MakeConsoleListener();
+cLogger::cListener * MakeConsoleListener(bool a_IsService);
diff --git a/src/Map.cpp b/src/Map.cpp
index 5f296a5b2..48d7fb0ca 100644
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -224,7 +224,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z)
return false;
}
- unsigned int PixelWidth = m_Map->GetPixelWidth();
+ unsigned int CallbackPixelWidth = m_Map->GetPixelWidth();
if (m_Map->GetDimension() == dimNether)
{
@@ -237,9 +237,9 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z)
ColorCountMap ColorCounts;
// Count surface blocks
- for (unsigned int X = m_RelX; X < m_RelX + PixelWidth; ++X)
+ for (unsigned int X = m_RelX; X < m_RelX + CallbackPixelWidth; ++X)
{
- for (unsigned int Z = m_RelZ; Z < m_RelZ + PixelWidth; ++Z)
+ for (unsigned int Z = m_RelZ; Z < m_RelZ + CallbackPixelWidth; ++Z)
{
// unsigned int WaterDepth = 0;
diff --git a/src/MapManager.cpp b/src/MapManager.cpp
index fc67bd901..41b0d9e34 100644
--- a/src/MapManager.cpp
+++ b/src/MapManager.cpp
@@ -76,7 +76,7 @@ cMap * cMapManager::GetMapData(unsigned int a_ID)
-cMap * cMapManager::CreateMap(int a_CenterX, int a_CenterY, int a_Scale)
+cMap * cMapManager::CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale)
{
cCSLock Lock(m_CS);
@@ -86,7 +86,7 @@ cMap * cMapManager::CreateMap(int a_CenterX, int a_CenterY, int a_Scale)
return nullptr;
}
- cMap Map((unsigned)m_MapData.size(), a_CenterX, a_CenterY, m_World, a_Scale);
+ cMap Map(static_cast<unsigned>(m_MapData.size()), a_CenterX, a_CenterY, m_World, a_Scale);
m_MapData.push_back(Map);
@@ -151,7 +151,7 @@ void cMapManager::SaveMapData(void)
cIDCountSerializer IDSerializer(m_World->GetName());
- IDSerializer.SetMapCount((unsigned)m_MapData.size());
+ IDSerializer.SetMapCount(static_cast<unsigned>(m_MapData.size()));
if (!IDSerializer.Save())
{
diff --git a/src/MapManager.h b/src/MapManager.h
index 1059773c3..cacc6d816 100644
--- a/src/MapManager.h
+++ b/src/MapManager.h
@@ -36,7 +36,7 @@ public:
cMap * GetMapData(unsigned int a_ID);
/** Creates a new map. Returns nullptr on error */
- cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
+ cMap * CreateMap(int a_CenterX, int a_CenterY, unsigned int a_Scale = 3);
/** Calls the callback for the map with the specified ID.
Returns true if the map was found and the callback called, false if map not found.
diff --git a/src/Matrix4.h b/src/Matrix4.h
index 61ea60bfd..0558fa5f3 100644
--- a/src/Matrix4.h
+++ b/src/Matrix4.h
@@ -76,8 +76,8 @@ public:
inline void RotateX(T a_RX)
{
- T sx = (T) sin(a_RX * M_PI / 180);
- T cx = (T) cos(a_RX * M_PI / 180);
+ T sx = static_cast<T>(sin(a_RX * M_PI / 180));
+ T cx = static_cast<T>(cos(a_RX * M_PI / 180));
Identity();
@@ -87,8 +87,8 @@ public:
inline void RotateY(T a_RY)
{
- T sy = (T) sin(a_RY * M_PI / 180);
- T cy = (T) cos(a_RY * M_PI / 180);
+ T sy = static_cast<T>(sin(a_RY * M_PI / 180));
+ T cy = static_cast<T>(cos(a_RY * M_PI / 180));
Identity();
diff --git a/src/MemorySettingsRepository.cpp b/src/MemorySettingsRepository.cpp
new file mode 100644
index 000000000..21b4c769c
--- /dev/null
+++ b/src/MemorySettingsRepository.cpp
@@ -0,0 +1,312 @@
+
+#include "Globals.h"
+
+#include "MemorySettingsRepository.h"
+
+
+
+
+bool cMemorySettingsRepository::KeyExists(const AString keyname) const
+{
+ return m_Map.count(keyname) != 0;
+}
+
+
+
+
+
+bool cMemorySettingsRepository::HasValue(const AString & a_KeyName, const AString & a_ValueName) const
+{
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ return false;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ return false;
+ }
+ return true;
+}
+
+
+
+
+int cMemorySettingsRepository::AddKeyName(const AString & a_keyname)
+{
+ m_Map.emplace(a_keyname, std::unordered_multimap<AString, sValue>{});
+ return 0;
+}
+
+
+
+
+
+bool cMemorySettingsRepository::AddKeyComment(const AString & keyname, const AString & comment)
+{
+ return false;
+}
+
+
+
+
+
+AString cMemorySettingsRepository::GetKeyComment(const AString & keyname, const int commentID) const
+{
+ return "";
+}
+
+
+
+
+
+bool cMemorySettingsRepository::DeleteKeyComment(const AString & keyname, const int commentID)
+{
+ return false;
+}
+
+
+
+
+
+
+void cMemorySettingsRepository::AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value)
+{
+ if (m_Writable)
+ {
+ m_Map[a_KeyName].emplace(a_ValueName, sValue(a_Value));
+ }
+}
+
+
+
+
+void cMemorySettingsRepository::AddValue (const AString & a_KeyName, const AString & a_ValueName, Int64 a_Value)
+{
+ if (m_Writable)
+ {
+ m_Map[a_KeyName].emplace(a_ValueName, sValue(a_Value));
+ }
+}
+
+
+
+
+
+void cMemorySettingsRepository::AddValue (const AString & a_KeyName, const AString & a_ValueName, bool a_Value)
+{
+ if (m_Writable)
+ {
+ m_Map[a_KeyName].emplace(a_ValueName, sValue(a_Value));
+ }
+}
+
+
+
+
+
+std::vector<std::pair<AString, AString>> cMemorySettingsRepository::GetValues(AString a_keyName)
+{
+ std::vector<std::pair<AString, AString>> ret;
+ for (auto pair : m_Map[a_keyName])
+ {
+ ret.emplace_back(pair.first, pair.second.getStringValue());
+ }
+ return ret;
+}
+
+
+
+
+
+AString cMemorySettingsRepository::GetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & defValue) const
+{
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ return defValue;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ return defValue;
+ }
+ return iter->second.getStringValue();
+}
+
+
+
+
+
+AString cMemorySettingsRepository::GetValueSet (const AString & a_KeyName, const AString & a_ValueName, const AString & defValue)
+{
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ AddValue(a_KeyName, a_ValueName, defValue);
+ return defValue;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ AddValue(a_KeyName, a_ValueName, defValue);
+ return defValue;
+ }
+ return iter->second.getStringValue();
+}
+
+
+
+
+
+int cMemorySettingsRepository::GetValueSetI(const AString & a_KeyName, const AString & a_ValueName, const int defValue)
+{
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ AddValue(a_KeyName, a_ValueName, static_cast<Int64>(defValue));
+ return defValue;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ AddValue(a_KeyName, a_ValueName, static_cast<Int64>(defValue));
+ return defValue;
+ }
+ return static_cast<int>(iter->second.getIntValue());
+}
+
+
+
+
+
+Int64 cMemorySettingsRepository::GetValueSetI(const AString & a_KeyName, const AString & a_ValueName, const Int64 defValue)
+{
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ AddValue(a_KeyName, a_ValueName, defValue);
+ return defValue;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ AddValue(a_KeyName, a_ValueName, defValue);
+ return defValue;
+ }
+ return iter->second.getIntValue();
+}
+
+
+
+
+bool cMemorySettingsRepository::GetValueSetB(const AString & a_KeyName, const AString & a_ValueName, const bool defValue)
+{
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ AddValue(a_KeyName, a_ValueName, defValue);
+ return defValue;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ AddValue(a_KeyName, a_ValueName, defValue);
+ return defValue;
+ }
+ return iter->second.getBoolValue();
+}
+
+
+
+
+
+bool cMemorySettingsRepository::SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists)
+{
+ if (!m_Writable)
+ {
+ return false;
+ }
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ if (a_CreateIfNotExists)
+ {
+ AddValue(a_KeyName, a_ValueName, a_Value);
+ }
+ return a_CreateIfNotExists;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ if (a_CreateIfNotExists)
+ {
+ AddValue(a_KeyName, a_ValueName, a_Value);
+ }
+ return a_CreateIfNotExists;
+ }
+ iter->second = sValue(a_Value);
+ return true;
+}
+
+
+
+
+bool cMemorySettingsRepository::SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists)
+{
+ if (!m_Writable)
+ {
+ return false;
+ }
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ if (a_CreateIfNotExists)
+ {
+ AddValue(a_KeyName, a_ValueName, static_cast<Int64>(a_Value));
+ }
+ return a_CreateIfNotExists;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ if (a_CreateIfNotExists)
+ {
+ AddValue(a_KeyName, a_ValueName, static_cast<Int64>(a_Value));
+ }
+ return a_CreateIfNotExists;
+ }
+ iter->second = sValue(static_cast<Int64>(a_Value));
+ return true;
+}
+
+
+
+
+
+bool cMemorySettingsRepository::DeleteValue(const AString & a_KeyName, const AString & a_ValueName)
+{
+ if (!m_Writable)
+ {
+ return false;
+ }
+ auto outerIter = m_Map.find(a_KeyName);
+ if (outerIter == m_Map.end())
+ {
+ return false;
+ }
+ auto iter = outerIter->second.find(a_ValueName);
+ if (iter == outerIter->second.end())
+ {
+ return false;
+ }
+ outerIter->second.erase(iter);
+ return true;
+}
+
+bool cMemorySettingsRepository::Flush()
+{
+ return true;
+}
+
diff --git a/src/MemorySettingsRepository.h b/src/MemorySettingsRepository.h
new file mode 100644
index 000000000..335bc4513
--- /dev/null
+++ b/src/MemorySettingsRepository.h
@@ -0,0 +1,80 @@
+
+#pragma once
+
+#include "SettingsRepositoryInterface.h"
+
+#include <unordered_map>
+
+class cMemorySettingsRepository : public cSettingsRepositoryInterface
+{
+public:
+
+ virtual bool KeyExists(const AString keyname) const override;
+
+ virtual bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const override;
+
+ virtual int AddKeyName(const AString & keyname) override;
+
+ virtual bool AddKeyComment(const AString & keyname, const AString & comment) override;
+
+ virtual AString GetKeyComment(const AString & keyname, const int commentID) const override;
+
+ virtual bool DeleteKeyComment(const AString & keyname, const int commentID) override;
+
+ virtual void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value) override;
+ void AddValue (const AString & a_KeyName, const AString & a_ValueName, const Int64 a_Value);
+ void AddValue (const AString & a_KeyName, const AString & a_ValueName, const bool a_Value);
+
+ virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) override;
+
+ virtual AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const override;
+
+
+ virtual AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "") override;
+ virtual int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0) override;
+ virtual Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0) override;
+ virtual bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false) override;
+
+ virtual bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true) override;
+ virtual bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true) override;
+
+ virtual bool DeleteValue(const AString & keyname, const AString & valuename) override;
+
+ virtual bool Flush() override;
+
+ void SetReadOnly()
+ {
+ m_Writable = false;
+ }
+
+private:
+
+ bool m_Writable = true;
+
+ struct sValue
+ {
+ sValue(AString value) : m_Type(eType::String), m_stringValue (value) {}
+ sValue(Int64 value) : m_Type(eType::Int64), m_intValue(value) {}
+ sValue(bool value) : m_Type(eType::Bool), m_boolValue(value) {}
+
+ AString getStringValue() const { ASSERT(m_Type == eType::String); return m_stringValue; }
+ Int64 getIntValue() const { ASSERT(m_Type == eType::Int64); return m_intValue; }
+ bool getBoolValue() const { ASSERT(m_Type == eType::Bool); return m_boolValue; }
+ private:
+ enum class eType
+ {
+ String,
+ Int64,
+ Bool
+ } m_Type;
+ AString m_stringValue;
+ union
+ {
+ Int64 m_intValue;
+ bool m_boolValue;
+ };
+ };
+
+ std::unordered_map<AString, std::unordered_multimap<AString, sValue>> m_Map{};
+};
+
diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp
index 1a69d8370..79b5176d2 100644
--- a/src/MobCensus.cpp
+++ b/src/MobCensus.cpp
@@ -41,12 +41,17 @@ int cMobCensus::GetCapMultiplier(cMonster::eFamily a_MobFamily)
case cMonster::mfPassive: return 11;
case cMonster::mfAmbient: return 16;
case cMonster::mfWater: return 5;
- default:
+ case cMonster::mfNoSpawn:
+ case cMonster::mfUnhandled:
{
ASSERT(!"Unhandled mob family");
return -1;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown mob family");
+ return -1;
+ #endif
}
@@ -64,7 +69,7 @@ void cMobCensus::CollectSpawnableChunk(cChunk & a_Chunk)
int cMobCensus::GetNumChunks(void)
{
- return (int)m_EligibleForSpawnChunks.size();
+ return static_cast<int>(m_EligibleForSpawnChunks.size());
}
diff --git a/src/MobFamilyCollecter.cpp b/src/MobFamilyCollecter.cpp
index 6da330c83..c24ee48f5 100644
--- a/src/MobFamilyCollecter.cpp
+++ b/src/MobFamilyCollecter.cpp
@@ -18,7 +18,7 @@ void cMobFamilyCollecter::CollectMob(cMonster & a_Monster)
int cMobFamilyCollecter::GetNumberOfCollectedMobs(cMonster::eFamily a_Family)
{
- return (int)m_Mobs[a_Family].size();
+ return static_cast<int>(m_Mobs[a_Family].size());
}
diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp
index 468b0cfb2..27dc5a877 100644
--- a/src/MobSpawner.cpp
+++ b/src/MobSpawner.cpp
@@ -110,7 +110,7 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
if (allowedMobsSize > 0)
{
std::set<eMonsterType>::iterator itr = allowedMobs.begin();
- int iRandom = m_Random.NextInt((int)allowedMobsSize);
+ int iRandom = m_Random.NextInt(static_cast<int>(allowedMobsSize));
for (int i = 0; i < iRandom; i++)
{
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index d0fb79f6d..7fde1e56b 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -30,13 +30,12 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
{
if (m_Target->IsPlayer())
{
- if (((cPlayer *)m_Target)->IsGameModeCreative())
+ if (static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
{
m_EMState = IDLE;
return;
}
}
-
MoveToPosition(m_Target->GetPosition());
}
}
@@ -47,7 +46,7 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
void cAggressiveMonster::EventSeePlayer(cEntity * a_Entity)
{
- if (!((cPlayer *)a_Entity)->IsGameModeCreative())
+ if (!static_cast<cPlayer *>(a_Entity)->IsGameModeCreative())
{
super::EventSeePlayer(a_Entity);
m_EMState = CHASING;
@@ -77,11 +76,14 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
cTracer LineOfSight(GetWorld());
- Vector3d AttackDirection(m_Target->GetPosition() - GetPosition());
+ Vector3d MyHeadPosition = GetPosition() + Vector3d(0, GetHeight(), 0);
+ Vector3d AttackDirection(m_Target->GetPosition() + Vector3d(0, m_Target->GetHeight(), 0) - MyHeadPosition);
+
- if (ReachedFinalDestination() && !LineOfSight.Trace(GetPosition(), AttackDirection, (int)AttackDirection.Length()))
+ if (TargetIsInRange() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<int>(AttackDirection.Length())))
{
// Attack if reached destination, target isn't null, and have a clear line of sight to target (so won't attack through walls)
+ StopMovingToPosition();
Attack(a_Dt);
}
}
@@ -109,12 +111,12 @@ void cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
bool cAggressiveMonster::IsMovingToTargetPosition()
{
// Difference between destination x and target x is negligible (to 10^-12 precision)
- if (fabsf((float)m_FinalDestination.x - (float)m_Target->GetPosX()) < std::numeric_limits<float>::epsilon())
+ if (fabsf(static_cast<float>(m_FinalDestination.x) - static_cast<float>(m_Target->GetPosX())) < std::numeric_limits<float>::epsilon())
{
return false;
}
// Difference between destination z and target z is negligible (to 10^-12 precision)
- else if (fabsf((float)m_FinalDestination.z - (float)m_Target->GetPosZ()) > std::numeric_limits<float>::epsilon())
+ else if (fabsf(static_cast<float>(m_FinalDestination.z) - static_cast<float>(m_Target->GetPosZ())) > std::numeric_limits<float>::epsilon())
{
return false;
}
diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp
index d4ad24166..731da6b18 100644
--- a/src/Mobs/Blaze.cpp
+++ b/src/Mobs/Blaze.cpp
@@ -23,7 +23,7 @@ void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if ((a_Killer != nullptr) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
{
- int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ unsigned int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD);
}
}
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index ffbcdf3ea..e99494508 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -80,6 +80,12 @@ SET (HDRS
Zombie.h
ZombiePigman.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(Monster.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch -Wno-error=switch-enum -Wno-error=float-equal -Wno-error=old-style-cast")
+ set_source_files_properties(SnowGolem.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(Villager.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Mobs ${SRCS} ${HDRS})
endif()
diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp
index fa530db82..a8b40f52e 100644
--- a/src/Mobs/CaveSpider.cpp
+++ b/src/Mobs/CaveSpider.cpp
@@ -34,7 +34,7 @@ void cCaveSpider::Attack(std::chrono::milliseconds a_Dt)
if (m_Target->IsPawn())
{
// TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds
- ((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0);
+ static_cast<cPawn *>(m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0);
}
}
@@ -44,7 +44,7 @@ void cCaveSpider::Attack(std::chrono::milliseconds a_Dt)
void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp
index b2b21d4ae..a52d1a2da 100644
--- a/src/Mobs/Chicken.cpp
+++ b/src/Mobs/Chicken.cpp
@@ -48,7 +48,7 @@ void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp
index 7dc6f3f37..a45010201 100644
--- a/src/Mobs/Cow.cpp
+++ b/src/Mobs/Cow.cpp
@@ -21,7 +21,7 @@ cCow::cCow(void) :
void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index 41796402f..30bd41f13 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -27,7 +27,7 @@ void cCreeper::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
- if (!ReachedFinalDestination() && !m_BurnedWithFlintAndSteel)
+ if (!TargetIsInRange() && !m_BurnedWithFlintAndSteel)
{
m_ExplodingTimer = 0;
m_bIsBlowing = false;
@@ -60,7 +60,7 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
return;
}
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
@@ -124,7 +124,7 @@ void cCreeper::Attack(std::chrono::milliseconds a_Dt)
if (!m_bIsBlowing)
{
- m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
m_bIsBlowing = true;
m_World->BroadcastEntityMetadata(*this);
}
@@ -142,7 +142,7 @@ void cCreeper::OnRightClicked(cPlayer & a_Player)
{
a_Player.UseEquippedItem();
}
- m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (0.75f + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
m_bIsBlowing = true;
m_World->BroadcastEntityMetadata(*this);
m_BurnedWithFlintAndSteel = true;
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 42c33884a..30bf82067 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -55,7 +55,7 @@ public:
}
cTracer LineOfSight(a_Player->GetWorld());
- if (LineOfSight.Trace(m_EndermanPos, Direction, (int)Direction.Length()))
+ if (LineOfSight.Trace(m_EndermanPos, Direction, static_cast<int>(Direction.Length())))
{
// No direct line of sight
return false;
@@ -91,7 +91,7 @@ cEnderman::cEnderman(void) :
void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp
index d17047ab7..15bbe484b 100644
--- a/src/Mobs/Ghast.cpp
+++ b/src/Mobs/Ghast.cpp
@@ -19,7 +19,7 @@ cGhast::cGhast(void) :
void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Guardian.cpp b/src/Mobs/Guardian.cpp
index 5eb30785b..1429e2b13 100644
--- a/src/Mobs/Guardian.cpp
+++ b/src/Mobs/Guardian.cpp
@@ -21,7 +21,7 @@ cGuardian::cGuardian(void) :
void cGuardian::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
@@ -37,19 +37,20 @@ void cGuardian::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cGuardian::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
+ m_IsFollowingPath = false; // Disable Pathfinding until it's fixed. TODO
+
// We must first process current location, and only then tick, otherwise we risk processing a location in a chunk
// that is not where the entity currently resides (FS #411)
-
Vector3d Pos = GetPosition();
// TODO: Not a real behavior, but cool :D
- int RelY = (int)floor(Pos.y);
+ int RelY = FloorC(Pos.y);
if ((RelY < 0) || (RelY >= cChunkDef::Height))
{
return;
}
- int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
- int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
+ int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
+ int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
BLOCKTYPE BlockType;
if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire())
{
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index 5b4c78bfc..ce3bd65eb 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -55,10 +55,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
if (m_World->GetTickRandomNumber(50) == 25)
{
- m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 0);
- m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 2);
- m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 6);
- m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 8);
+ m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 0);
+ m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 2);
+ m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 6);
+ m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 8);
m_Attachee->Detach();
m_bIsRearing = true;
@@ -140,7 +140,7 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Horse.h b/src/Mobs/Horse.h
index be283705e..27168ebae 100644
--- a/src/Mobs/Horse.h
+++ b/src/Mobs/Horse.h
@@ -26,7 +26,7 @@ public:
bool IsEating (void) const {return m_bIsEating; }
bool IsRearing (void) const {return m_bIsRearing; }
bool IsMthOpen (void) const {return m_bIsMouthOpen; }
- bool IsTame (void) const {return m_bIsTame; }
+ bool IsTame (void) const override {return m_bIsTame; }
int GetHorseType (void) const {return m_Type; }
int GetHorseColor (void) const {return m_Color; }
int GetHorseStyle (void) const {return m_Style; }
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index f3f8c6b24..4befe307d 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -89,7 +89,7 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A
, m_SoundDeath(a_SoundDeath)
, m_AttackRate(3)
, m_AttackDamage(1)
- , m_AttackRange(2)
+ , m_AttackRange(1)
, m_AttackInterval(0)
, m_SightDistance(25)
, m_DropChanceWeapon(0.085f)
@@ -101,6 +101,7 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A
, m_TicksSinceLastDamaged(100)
, m_BurnsInDaylight(false)
, m_RelativeWalkSpeed(1)
+ , m_Age(1)
{
if (!a_ConfigName.empty())
{
@@ -147,10 +148,15 @@ bool cMonster::TickPathFinding(cChunk & a_Chunk)
(Recalculate lots when close, calculate rarely when far) */
if (
((GetPosition() - m_PathFinderDestination).Length() < 0.25) ||
- ((m_TicksSinceLastPathReset > 10) && (m_TicksSinceLastPathReset > (0.15 * (m_FinalDestination - GetPosition()).SqrLength())))
+ ((m_TicksSinceLastPathReset > 10) && (m_TicksSinceLastPathReset > (0.4 * (m_FinalDestination - GetPosition()).SqrLength())))
)
{
- ResetPathFinding();
+ /* Re-calculating is expensive when there's no path to target, and it results in mobs freezing very often as a result of always recalculating.
+ This is a workaround till we get better path recalculation. */
+ if (!m_NoPathToTarget)
+ {
+ ResetPathFinding();
+ }
}
}
@@ -161,15 +167,25 @@ bool cMonster::TickPathFinding(cChunk & a_Chunk)
StopMovingToPosition(); // Invalid chunks, probably world is loading or something, cancel movement.
return false;
}
+ m_NoPathToTarget = false;
+ m_NoMoreWayPoints = false;
m_PathFinderDestination = m_FinalDestination;
- m_Path = new cPath(a_Chunk, GetPosition().Floor(), m_PathFinderDestination.Floor(), 20);
+ m_Path = new cPath(a_Chunk, GetPosition(), m_PathFinderDestination, 20, GetWidth(), GetHeight());
}
switch (m_Path->Step(a_Chunk))
{
+ case ePathFinderStatus::NEARBY_FOUND:
+ {
+ m_NoPathToTarget = true;
+ m_PathFinderDestination = m_Path->AcceptNearbyPath();
+ break;
+ }
+
case ePathFinderStatus::PATH_NOT_FOUND:
{
- StopMovingToPosition(); // Give up pathfinding to that destination.
+ StopMovingToPosition(); // Try to calculate a path again.
+ // Note that the next time may succeed, e.g. if a player breaks a barrier.
break;
}
case ePathFinderStatus::CALCULATING:
@@ -179,15 +195,30 @@ bool cMonster::TickPathFinding(cChunk & a_Chunk)
}
case ePathFinderStatus::PATH_FOUND:
{
- if (--m_GiveUpCounter == 0)
+ if (m_NoMoreWayPoints || (--m_GiveUpCounter == 0))
{
- ResetPathFinding(); // Try to calculate a path again.
+ if (m_EMState == ATTACKING)
+ {
+ ResetPathFinding(); // Try to calculate a path again.
+ // This results in mobs hanging around an unreachable target (player).
+ }
+ else
+ {
+ StopMovingToPosition(); // Find a different place to go to.
+ }
return false;
}
- else if (!m_Path->IsLastPoint() && (m_Path->IsFirstPoint() || ReachedNextWaypoint())) // Have we arrived at the next cell, as denoted by m_NextWayPointPosition?
+ else if (!m_Path->IsLastPoint()) // Have we arrived at the next cell, as denoted by m_NextWayPointPosition?
+ {
+ if ((m_Path->IsFirstPoint() || ReachedNextWaypoint()))
+ {
+ m_NextWayPointPosition = m_Path->GetNextPoint();
+ m_GiveUpCounter = 40; // Give up after 40 ticks (2 seconds) if failed to reach m_NextWayPointPosition.
+ }
+ }
+ else
{
- m_NextWayPointPosition = Vector3d(0.5, 0, 0.5) + m_Path->GetNextPoint();
- m_GiveUpCounter = 40; // Give up after 40 ticks (2 seconds) if failed to reach m_NextWayPointPosition.
+ m_NoMoreWayPoints = true;
}
return true;
}
@@ -269,21 +300,59 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
{
return false;
}
-
+
int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
- // If destination in the air, go down to the lowest air block.
- while (m_FinalDestination.y > 0)
+ // If destination in the air, first try to go 1 block north, or east, or west.
+ // This fixes the player leaning issue.
+ // If that failed, we instead go down to the lowest air block.
+ Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y) - 1, RelZ, BlockType, BlockMeta);
+ if (!cBlockInfo::IsSolid(BlockType))
{
- Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y) - 1, RelZ, BlockType, BlockMeta);
- if (cBlockInfo::IsSolid(BlockType))
+ bool InTheAir = true;
+ int x, z;
+ for (z = -1; z <= 1; ++z)
{
- break;
+ for (x = -1; x <= 1; ++x)
+ {
+ if ((x==0) && (z==0))
+ {
+ continue;
+ }
+ Chunk = a_Chunk.GetNeighborChunk(FloorC(m_FinalDestination.x+x), FloorC(m_FinalDestination.z+z));
+ if ((Chunk == nullptr) || !Chunk->IsValid())
+ {
+ return false;
+ }
+ RelX = FloorC(m_FinalDestination.x+x) - Chunk->GetPosX() * cChunkDef::Width;
+ RelZ = FloorC(m_FinalDestination.z+z) - Chunk->GetPosZ() * cChunkDef::Width;
+ Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y) - 1, RelZ, BlockType, BlockMeta);
+ if (cBlockInfo::IsSolid(BlockType))
+ {
+ m_FinalDestination.x += x;
+ m_FinalDestination.z += z;
+ InTheAir = false;
+ goto breakBothLoops;
+ }
+ }
}
- m_FinalDestination.y -= 1;
- }
+ breakBothLoops:
+ // Go down to the lowest air block.
+ if (InTheAir)
+ {
+ while (m_FinalDestination.y > 0)
+ {
+ Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y) - 1, RelZ, BlockType, BlockMeta);
+ if (cBlockInfo::IsSolid(BlockType))
+ {
+ break;
+ }
+ m_FinalDestination.y -= 1;
+ }
+ }
+ }
// If destination in water, go up to the highest water block.
// If destination in solid, go up to first air block.
@@ -331,6 +400,7 @@ void cMonster::MoveToPosition(const Vector3d & a_Position)
void cMonster::StopMovingToPosition()
{
m_IsFollowingPath = false;
+ ResetPathFinding();
}
@@ -447,21 +517,36 @@ void cMonster::SetPitchAndYawFromDestination()
}
}
- Vector3d Distance = FinalDestination - GetPosition();
+
+ Vector3d BodyDistance;
+ if (!m_IsFollowingPath && (m_Target != nullptr))
{
- double Rotation, Pitch;
- Distance.Normalize();
- VectorToEuler(Distance.x, Distance.y, Distance.z, Rotation, Pitch);
- SetHeadYaw(Rotation);
- SetPitch(-Pitch);
+ BodyDistance = m_Target->GetPosition() - GetPosition();
}
+ else
+ {
+ BodyDistance = m_NextWayPointPosition - GetPosition();
+ }
+ double BodyRotation, BodyPitch;
+ BodyDistance.Normalize();
+ VectorToEuler(BodyDistance.x, BodyDistance.y, BodyDistance.z, BodyRotation, BodyPitch);
+ SetYaw(BodyRotation);
+ Vector3d Distance = FinalDestination - GetPosition();
{
- Vector3d BodyDistance = m_NextWayPointPosition - GetPosition();
- double Rotation, Pitch;
- BodyDistance.Normalize();
- VectorToEuler(BodyDistance.x, BodyDistance.y, BodyDistance.z, Rotation, Pitch);
- SetYaw(Rotation);
+ double HeadRotation, HeadPitch;
+ Distance.Normalize();
+ VectorToEuler(Distance.x, Distance.y, Distance.z, HeadRotation, HeadPitch);
+ if (std::abs(BodyRotation - HeadRotation) < 90)
+ {
+ SetHeadYaw(HeadRotation);
+ SetPitch(-HeadPitch);
+ }
+ else // We're not an owl. If it's more than 120, don't look behind and instead look at where you're walking.
+ {
+ SetHeadYaw(BodyRotation);
+ SetPitch(-BodyPitch);
+ }
}
}
@@ -989,9 +1074,9 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType)
case mtHorse:
{
// Horses take a type (species), a colour, and a style (dots, stripes, etc.)
- int HorseType = Random.NextInt(7);
- int HorseColor = Random.NextInt(6);
- int HorseStyle = Random.NextInt(6);
+ int HorseType = Random.NextInt(8);
+ int HorseColor = Random.NextInt(7);
+ int HorseStyle = Random.NextInt(5);
int HorseTameTimes = Random.NextInt(6) + 1;
if ((HorseType == 5) || (HorseType == 6) || (HorseType == 7))
@@ -1070,10 +1155,10 @@ void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short
-void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel)
+void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel)
{
MTRand r1;
- int Count = r1.randInt() % 200;
+ unsigned int Count = r1.randInt() % 200;
if (Count < (5 + a_LootingLevel))
{
int Rare = r1.randInt() % a_Items.Size();
@@ -1085,7 +1170,7 @@ void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a
-void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
+void cMonster::AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel)
{
MTRand r1;
if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2)))
@@ -1125,7 +1210,7 @@ void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
-void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel)
+void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel)
{
MTRand r1;
if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2)))
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 5d20ba810..2832a1570 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -112,10 +112,14 @@ public:
void SetRelativeWalkSpeed(double a_WalkSpeed) { m_RelativeWalkSpeed = a_WalkSpeed; } // tolua_export
// Overridables to handle ageable mobs
- virtual bool IsBaby (void) const { return false; }
virtual bool IsTame (void) const { return false; }
virtual bool IsSitting (void) const { return false; }
+ bool IsBaby (void) const { return m_Age < 0; }
+ char GetAge (void) const { return m_Age; }
+ void SetAge(char a_Age) { m_Age = a_Age; }
+
+
// tolua_begin
/** Returns true if the monster has a custom name. */
@@ -180,19 +184,29 @@ protected:
/** Coordinates for the ultimate, final destination last given to the pathfinder. */
Vector3d m_PathFinderDestination;
+ /** True if there's no path to target and we're walking to an approximated location. */
+ bool m_NoPathToTarget;
+
+ /** Whether The mob has finished their path, note that this does not imply reaching the destination,
+ the destination may sometimes differ from the current path. */
+ bool m_NoMoreWayPoints;
+
/** Finds the lowest non-air block position (not the highest, as cWorld::GetHeight does)
If current Y is nonsolid, goes down to try to find a solid block, then returns that + 1
If current Y is solid, goes up to find first nonsolid block, and returns that.
If no suitable position is found, returns cChunkDef::Height. */
int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ);
- /** Returns if the ultimate, final destination has been reached */
- bool ReachedFinalDestination(void) { return ((m_FinalDestination - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); }
+ /** Returns if the ultimate, final destination has been reached. */
+ bool ReachedFinalDestination(void) { return ((m_FinalDestination - GetPosition()).Length() < GetWidth()/2); }
+
+ /** Returns whether or not the target is close enough for attack. */
+ bool TargetIsInRange(void) { return ((m_FinalDestination - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); }
/** Returns if the intermediate waypoint of m_NextWayPointPosition has been reached */
bool ReachedNextWaypoint(void) { return ((m_NextWayPointPosition - GetPosition()).SqrLength() < 0.25); }
- /** Returns if a monster can reach a given height by jumping */
+ /** Returns if a monster can reach a given height by jumping. */
inline bool DoesPosYRequireJump(int a_PosY)
{
return ((a_PosY > POSY_TOINT) && (a_PosY == POSY_TOINT + 1));
@@ -260,6 +274,8 @@ protected:
bool m_BurnsInDaylight;
double m_RelativeWalkSpeed;
+ char m_Age;
+
/** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
@@ -267,13 +283,13 @@ protected:
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
/** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
- void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
+ void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel);
/** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
- void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel);
+ void AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
/** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
- void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel);
+ void AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
} ; // tolua_export
diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp
index ec533cfca..3b2fbad57 100644
--- a/src/Mobs/Mooshroom.cpp
+++ b/src/Mobs/Mooshroom.cpp
@@ -24,7 +24,7 @@ cMooshroom::cMooshroom(void) :
void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/PassiveAggressiveMonster.cpp b/src/Mobs/PassiveAggressiveMonster.cpp
index cb8650cb9..f5577f71f 100644
--- a/src/Mobs/PassiveAggressiveMonster.cpp
+++ b/src/Mobs/PassiveAggressiveMonster.cpp
@@ -28,7 +28,7 @@ bool cPassiveAggressiveMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((m_Target != nullptr) && (m_Target->IsPlayer()))
{
- if (!((cPlayer *)m_Target)->IsGameModeCreative())
+ if (!static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
{
m_EMState = CHASING;
}
diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp
index 012ca9949..c220a7128 100644
--- a/src/Mobs/PassiveMonster.cpp
+++ b/src/Mobs/PassiveMonster.cpp
@@ -48,7 +48,7 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
return;
}
- cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
+ cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), static_cast<float>(m_SightDistance));
if (a_Closest_Player != nullptr)
{
if (a_Closest_Player->GetEquippedItem().IsEqual(FollowedItem))
diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp
index dd306af13..e987381f7 100644
--- a/src/Mobs/Path.cpp
+++ b/src/Mobs/Path.cpp
@@ -6,20 +6,15 @@
#include "Path.h"
#include "../Chunk.h"
+#define JUMP_G_COST 20
+
#define DISTANCE_MANHATTAN 0 // 1: More speed, a bit less accuracy 0: Max accuracy, less speed.
#define HEURISTICS_ONLY 0 // 1: Much more speed, much less accurate.
-#define CALCULATIONS_PER_STEP 5 // Higher means more CPU load but faster path calculations.
+#define CALCULATIONS_PER_STEP 10 // Higher means more CPU load but faster path calculations.
// The only version which guarantees the shortest path is 0, 0.
-enum class eCellStatus {OPENLIST, CLOSEDLIST, NOLIST};
-struct cPathCell
-{
- Vector3i m_Location; // Location of the cell in the world.
- int m_F, m_G, m_H; // F, G, H as defined in regular A*.
- eCellStatus m_Status; // Which list is the cell in? Either non, open, or closed.
- cPathCell * m_Parent; // Cell's parent, as defined in regular A*.
- bool m_IsSolid; // Is the cell an air or a solid? Partial solids are currently considered solids.
-};
+
+
@@ -37,24 +32,40 @@ bool compareHeuristics::operator()(cPathCell * & a_Cell1, cPathCell * & a_Cell2)
/* cPath implementation */
cPath::cPath(
cChunk & a_Chunk,
- const Vector3i & a_StartingPoint, const Vector3i & a_EndingPoint, int a_MaxSteps,
+ const Vector3d & a_StartingPoint, const Vector3d & a_EndingPoint, int a_MaxSteps,
double a_BoundingBoxWidth, double a_BoundingBoxHeight,
int a_MaxUp, int a_MaxDown
) :
- m_Destination(a_EndingPoint.Floor()),
- m_Source(a_StartingPoint.Floor()),
+
m_CurrentPoint(0), // GetNextPoint increments this to 1, but that's fine, since the first cell is always a_StartingPoint
- m_Chunk(&a_Chunk)
+ m_Chunk(&a_Chunk),
+ m_BadChunkFound(false)
{
// TODO: if src not walkable OR dest not walkable, then abort.
// Borrow a new "isWalkable" from ProcessIfWalkable, make ProcessIfWalkable also call isWalkable
+ a_BoundingBoxWidth = 1; // Until we improve physics, if ever.
+
+ m_BoundingBoxWidth = CeilC(a_BoundingBoxWidth);
+ m_BoundingBoxHeight = CeilC(a_BoundingBoxHeight);
+ m_HalfWidth = a_BoundingBoxWidth / 2;
+
+ int HalfWidthInt = FloorC(a_BoundingBoxWidth / 2);
+ m_Source.x = FloorC(a_StartingPoint.x - HalfWidthInt);
+ m_Source.y = FloorC(a_StartingPoint.y);
+ m_Source.z = FloorC(a_StartingPoint.z - HalfWidthInt);
+
+ m_Destination.x = FloorC(a_EndingPoint.x - HalfWidthInt);
+ m_Destination.y = FloorC(a_EndingPoint.y);
+ m_Destination.z = FloorC(a_EndingPoint.z - HalfWidthInt);
+
if (GetCell(m_Source)->m_IsSolid || GetCell(m_Destination)->m_IsSolid)
{
m_Status = ePathFinderStatus::PATH_NOT_FOUND;
return;
}
+ m_NearestPointToTarget = GetCell(m_Source);
m_Status = ePathFinderStatus::CALCULATING;
m_StepsLeft = a_MaxSteps;
@@ -81,15 +92,20 @@ cPath::~cPath()
ePathFinderStatus cPath::Step(cChunk & a_Chunk)
{
m_Chunk = &a_Chunk;
-
if (m_Status != ePathFinderStatus::CALCULATING)
{
return m_Status;
}
- if (m_StepsLeft == 0)
+ if (m_BadChunkFound)
{
FinishCalculation(ePathFinderStatus::PATH_NOT_FOUND);
+ return m_Status;
+ }
+
+ if (m_StepsLeft == 0)
+ {
+ AttemptToFindAlternative();
}
else
{
@@ -102,9 +118,9 @@ ePathFinderStatus cPath::Step(cChunk & a_Chunk)
break; // if we're here, m_Status must have changed either to PATH_FOUND or PATH_NOT_FOUND.
}
}
- }
- m_Chunk = nullptr;
+ m_Chunk = nullptr;
+ }
return m_Status;
}
@@ -112,6 +128,17 @@ ePathFinderStatus cPath::Step(cChunk & a_Chunk)
+Vector3i cPath::AcceptNearbyPath()
+{
+ ASSERT(m_Status == ePathFinderStatus::NEARBY_FOUND);
+ m_Status = ePathFinderStatus::PATH_FOUND;
+ return m_Destination;
+}
+
+
+
+
+
bool cPath::IsSolid(const Vector3i & a_Location)
{
ASSERT(m_Chunk != nullptr);
@@ -119,6 +146,7 @@ bool cPath::IsSolid(const Vector3i & a_Location)
auto Chunk = m_Chunk->GetNeighborChunk(a_Location.x, a_Location.z);
if ((Chunk == nullptr) || !Chunk->IsValid())
{
+ m_BadChunkFound = true;
return true;
}
m_Chunk = Chunk;
@@ -129,13 +157,19 @@ bool cPath::IsSolid(const Vector3i & a_Location)
int RelZ = a_Location.z - m_Chunk->GetPosZ() * cChunkDef::Width;
m_Chunk->GetBlockTypeMeta(RelX, a_Location.y, RelZ, BlockType, BlockMeta);
- if ((BlockType == E_BLOCK_FENCE) || (BlockType == E_BLOCK_FENCE_GATE))
+ if (
+ (BlockType == E_BLOCK_FENCE) ||
+ (BlockType == E_BLOCK_FENCE_GATE) ||
+ (BlockType == E_BLOCK_NETHER_BRICK_FENCE) ||
+ ((BlockType >= E_BLOCK_SPRUCE_FENCE_GATE) && (BlockType <= E_BLOCK_ACACIA_FENCE))
+ )
{
+ // TODO move this out of IsSolid to a proper place.
GetCell(a_Location + Vector3i(0, 1, 0))->m_IsSolid = true; // Mobs will always think that the fence is 2 blocks high and therefore won't jump over.
}
if (BlockType == E_BLOCK_STATIONARY_WATER)
{
- GetCell(a_Location + Vector3i(0, -1, 0))->m_IsSolid = true; // Mobs will always think that the fence is 2 blocks high and therefore won't jump over.
+ GetCell(a_Location + Vector3i(0, -1, 0))->m_IsSolid = true;
}
return cBlockInfo::IsSolid(BlockType);
@@ -149,50 +183,81 @@ bool cPath::Step_Internal()
{
cPathCell * CurrentCell = OpenListPop();
- // Path not reachable, open list exauhsted.
+ // Path not reachable.
if (CurrentCell == nullptr)
{
- FinishCalculation(ePathFinderStatus::PATH_NOT_FOUND);
- ASSERT(m_Status == ePathFinderStatus::PATH_NOT_FOUND);
+ AttemptToFindAlternative();
return true;
}
// Path found.
- if (
- (CurrentCell->m_Location == m_Destination + Vector3i(0, 0, 1)) ||
- (CurrentCell->m_Location == m_Destination + Vector3i(1, 0, 0)) ||
- (CurrentCell->m_Location == m_Destination + Vector3i(-1, 0, 0)) ||
- (CurrentCell->m_Location == m_Destination + Vector3i(0, 0, -1)) ||
- (CurrentCell->m_Location == m_Destination + Vector3i(0, -1, 0))
- )
+ if (CurrentCell->m_Location == m_Destination)
{
- do
- {
- m_PathPoints.push_back(CurrentCell->m_Location); // Populate the cPath with points.
- CurrentCell = CurrentCell->m_Parent;
- } while (CurrentCell != nullptr);
-
+ BuildPath();
FinishCalculation(ePathFinderStatus::PATH_FOUND);
return true;
}
- // Calculation not finished yet, process a currentCell by inspecting all neighbors.
+ // Calculation not finished yet.
+ // Check if we have a new NearestPoint.
+ // TODO I don't like this that much, there should be a smarter way.
+ if ((m_Destination - CurrentCell->m_Location).Length() < 5)
+ {
+ if (m_Rand.NextInt(4) == 0)
+ {
+ m_NearestPointToTarget = CurrentCell;
+ }
+ }
+ else if (CurrentCell->m_H < m_NearestPointToTarget->m_H)
+ {
+ m_NearestPointToTarget = CurrentCell;
+ }
+ // process a currentCell by inspecting all neighbors.
+
- // Check North, South, East, West on all 3 different heights.
- int i;
- for (i = -1; i <= 1; ++i)
+ // Check North, South, East, West on our height.
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(1, 0, 0), CurrentCell, 10);
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(-1, 0, 0), CurrentCell, 10);
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, 0, 1), CurrentCell, 10);
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, 0, -1), CurrentCell, 10);
+
+ // Check diagonals on XY plane.
+ // x = -1: west, x = 1: east.
+ for (int x = -1; x <= 1; x += 2)
{
- ProcessIfWalkable(CurrentCell->m_Location + Vector3i(1, i, 0), CurrentCell, 10);
- ProcessIfWalkable(CurrentCell->m_Location + Vector3i(-1, i, 0), CurrentCell, 10);
- ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, i, 1), CurrentCell, 10);
- ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, i, -1), CurrentCell, 10);
+ if (GetCell(CurrentCell->m_Location + Vector3i(x, 0, 0))->m_IsSolid) // If there's a solid our east / west.
+ {
+ if (!GetCell(CurrentCell->m_Location + Vector3i(0, 1, 0))->m_IsSolid) // If there isn't a solid above.
+ {
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(x, 1, 0), CurrentCell, JUMP_G_COST); // Check east-up / west-up.
+ }
+ }
+ else
+ {
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(x, -1, 0), CurrentCell, 14); // Else check east-down / west-down.
+ }
+ }
+
+ // Check diagonals on the YZ plane.
+ for (int z = -1; z <= 1; z += 2)
+ {
+ if (GetCell(CurrentCell->m_Location + Vector3i(0, 0, z))->m_IsSolid) // If there's a solid our north / south.
+ {
+ if (!GetCell(CurrentCell->m_Location + Vector3i(0, 1, 0))->m_IsSolid) // If there isn't a solid above.
+ {
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, 1, z), CurrentCell, JUMP_G_COST); // Check north-up / south-up.
+ }
+ }
+ else
+ {
+ ProcessIfWalkable(CurrentCell->m_Location + Vector3i(0, -1, z), CurrentCell, 14); // Else check north-down / south-down.
+ }
}
- // Check diagonals on mob's height only.
- int x, z;
- for (x = -1; x <= 1; x += 2)
+ // Check diagonals on the XZ plane. (Normal diagonals, this plane is special because of gravity, etc)
+ for (int x = -1; x <= 1; x += 2)
{
- for (z = -1; z <= 1; z += 2)
+ for (int z = -1; z <= 1; z += 2)
{
// This condition prevents diagonal corner cutting.
if (!GetCell(CurrentCell->m_Location + Vector3i(x, 0, 0))->m_IsSolid && !GetCell(CurrentCell->m_Location + Vector3i(0, 0, z))->m_IsSolid)
@@ -213,6 +278,38 @@ bool cPath::Step_Internal()
+void cPath::AttemptToFindAlternative()
+{
+ if (m_NearestPointToTarget == GetCell(m_Source))
+ {
+ FinishCalculation(ePathFinderStatus::PATH_NOT_FOUND);
+ }
+ else
+ {
+ m_Destination = m_NearestPointToTarget->m_Location;
+ BuildPath();
+ FinishCalculation(ePathFinderStatus::NEARBY_FOUND);
+ }
+}
+
+
+
+
+
+void cPath::BuildPath()
+{
+ cPathCell * CurrentCell = GetCell(m_Destination);
+ do
+ {
+ m_PathPoints.push_back(CurrentCell->m_Location); // Populate the cPath with points.
+ CurrentCell = CurrentCell->m_Parent;
+ } while (CurrentCell != nullptr);
+}
+
+
+
+
+
void cPath::FinishCalculation()
{
m_Map.clear();
@@ -225,6 +322,10 @@ void cPath::FinishCalculation()
void cPath::FinishCalculation(ePathFinderStatus a_NewStatus)
{
+ if (m_BadChunkFound)
+ {
+ a_NewStatus = ePathFinderStatus::PATH_NOT_FOUND;
+ }
m_Status = a_NewStatus;
FinishCalculation();
}
@@ -250,7 +351,7 @@ cPathCell * cPath::OpenListPop() // Popping from the open list also means addin
{
if (m_OpenList.size() == 0)
{
- return nullptr; // We've exhausted the search space and nothing was found, this will trigger a PATH_NOT_FOUND status.
+ return nullptr; // We've exhausted the search space and nothing was found, this will trigger a PATH_NOT_FOUND or NEARBY_FOUND status.
}
cPathCell * Ret = m_OpenList.top();
@@ -269,7 +370,53 @@ si::setBlock((Ret)->m_Location.x, (Ret)->m_Location.y, (Ret)->m_Location.z, debu
void cPath::ProcessIfWalkable(const Vector3i & a_Location, cPathCell * a_Parent, int a_Cost)
{
cPathCell * cell = GetCell(a_Location);
- if (!cell->m_IsSolid && GetCell(a_Location + Vector3i(0, -1, 0))->m_IsSolid && !GetCell(a_Location + Vector3i(0, 1, 0))->m_IsSolid)
+ int x, y, z;
+
+ // Make sure we fit in the position.
+ for (y = 0; y < m_BoundingBoxHeight; ++y)
+ {
+ for (x = 0; x < m_BoundingBoxWidth; ++x)
+ {
+ for (z = 0; z < m_BoundingBoxWidth; ++z)
+ {
+ if (GetCell(a_Location + Vector3i(x, y, z))->m_IsSolid)
+ {
+ return;
+ }
+ }
+ }
+ }
+
+ /*y =-1;
+ for (x = 0; x < m_BoundingBoxWidth; ++x)
+ {
+ for (z = 0; z < m_BoundingBoxWidth; ++z)
+ {
+ if (!GetCell(a_Location + Vector3i(x, y, z))->m_IsSolid)
+ {
+ return;
+ }
+ }
+ }
+ ProcessCell(cell, a_Parent, a_Cost);*/
+
+ // Make sure there's at least 1 piece of solid below us.
+
+ bool GroundFlag = false;
+ y =-1;
+ for (x = 0; x < m_BoundingBoxWidth; ++x)
+ {
+ for (z = 0; z < m_BoundingBoxWidth; ++z)
+ {
+ if (GetCell(a_Location + Vector3i(x, y, z))->m_IsSolid)
+ {
+ GroundFlag = true;
+ break;
+ }
+ }
+ }
+
+ if (GroundFlag)
{
ProcessCell(cell, a_Parent, a_Cost);
}
@@ -338,23 +485,20 @@ void cPath::ProcessCell(cPathCell * a_Cell, cPathCell * a_Caller, int a_GDelta)
cPathCell * cPath::GetCell(const Vector3i & a_Location)
{
// Create the cell in the hash table if it's not already there.
- cPathCell * Cell;
if (m_Map.count(a_Location) == 0) // Case 1: Cell is not on any list. We've never checked this cell before.
{
- Cell = new cPathCell();
- Cell->m_Location = a_Location;
- m_Map[a_Location] = UniquePtr<cPathCell>(Cell);
- Cell->m_IsSolid = IsSolid(a_Location);
- Cell->m_Status = eCellStatus::NOLIST;
+ m_Map[a_Location].m_Location = a_Location;
+ m_Map[a_Location].m_IsSolid = IsSolid(a_Location);
+ m_Map[a_Location].m_Status = eCellStatus::NOLIST;
#ifdef COMPILING_PATHFIND_DEBUGGER
#ifdef COMPILING_PATHFIND_DEBUGGER_MARK_UNCHECKED
si::setBlock(a_Location.x, a_Location.y, a_Location.z, debug_unchecked, Cell->m_IsSolid ? NORMAL : MINI);
#endif
#endif
- return Cell;
+ return &m_Map[a_Location];
}
else
{
- return m_Map[a_Location].get();
+ return &m_Map[a_Location];
}
}
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index 008722d29..d4ad066e3 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -1,16 +1,13 @@
#pragma once
-/* Wanna use the pathfinder? Put this in your header file:
-
-// Fwd: cPath
+/*
+// Needed Fwds: cPath
enum class ePathFinderStatus;
class cPath;
-
-Put this in your .cpp:
-#include "...Path.h"
*/
+#include "../FastRandom.h"
#ifdef COMPILING_PATHFIND_DEBUGGER
/* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native / WiseOldMan95 to debug
this class outside of MCServer. This preprocessor flag is never set when compiling MCServer. */
@@ -23,14 +20,31 @@ Put this in your .cpp:
class cChunk;
/* Various little structs and classes */
-enum class ePathFinderStatus {CALCULATING, PATH_FOUND, PATH_NOT_FOUND};
-struct cPathCell; // Defined inside Path.cpp
+enum class ePathFinderStatus {CALCULATING, PATH_FOUND, PATH_NOT_FOUND, NEARBY_FOUND};
+enum class eCellStatus {OPENLIST, CLOSEDLIST, NOLIST};
+struct cPathCell
+{
+ Vector3i m_Location; // Location of the cell in the world.
+ int m_F, m_G, m_H; // F, G, H as defined in regular A*.
+ eCellStatus m_Status; // Which list is the cell in? Either non, open, or closed.
+ cPathCell * m_Parent; // Cell's parent, as defined in regular A*.
+ bool m_IsSolid; // Is the cell an air or a solid? Partial solids are currently considered solids.
+};
+
+
+
+
+
class compareHeuristics
{
public:
bool operator()(cPathCell * & a_V1, cPathCell * & a_V2);
};
+
+
+
+
class cPath
{
public:
@@ -54,23 +68,32 @@ public:
@param a_MaxSteps The maximum steps before giving up. */
cPath(
cChunk & a_Chunk,
- const Vector3i & a_StartingPoint, const Vector3i & a_EndingPoint, int a_MaxSteps,
- double a_BoundingBoxWidth = 1, double a_BoundingBoxHeight = 2,
+ const Vector3d & a_StartingPoint, const Vector3d & a_EndingPoint, int a_MaxSteps,
+ double a_BoundingBoxWidth, double a_BoundingBoxHeight,
int a_MaxUp = 1, int a_MaxDown = 1
);
/** Destroys the path and frees its memory. */
~cPath();
- /** Performs part of the path calculation and returns true if the path computation has finished. */
+ /** Performs part of the path calculation and returns the appropriate status.
+ If NEARBY_FOUND is returned, it means that the destination is not reachable, but a nearby destination
+ is reachable. If the user likes the alternative destination, they can call AcceptNearbyPath to treat the path as found,
+ and to make consequent calls to step return PATH_FOUND*/
ePathFinderStatus Step(cChunk & a_Chunk);
+ /** Called after the PathFinder's step returns NEARBY_FOUND.
+ Changes the PathFinder status from NEARBY_FOUND to PATH_FOUND, returns the nearby destination that
+ the PathFinder found a path to. */
+ Vector3i AcceptNearbyPath();
+
/* Point retrieval functions, inlined for performance. */
/** Returns the next point in the path. */
- inline Vector3i GetNextPoint()
+ inline Vector3d GetNextPoint()
{
ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
- return m_PathPoints[m_PathPoints.size() - 1 - (++m_CurrentPoint)];
+ Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - (++m_CurrentPoint)];
+ return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth);
}
/** Checks whether this is the last point or not. Never call getnextPoint when this is true. */
inline bool IsLastPoint()
@@ -84,34 +107,23 @@ public:
return (m_CurrentPoint == 0);
}
/** Get the point at a_index. Remark: Internally, the indexes are reversed. */
- inline Vector3i GetPoint(size_t a_index)
+ inline Vector3d GetPoint(size_t a_index)
{
ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
ASSERT(a_index < m_PathPoints.size());
- return m_PathPoints[m_PathPoints.size() - 1 - a_index];
+ Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - a_index];
+ return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth);
}
/** Returns the total number of points this path has. */
- inline int GetPointCount()
+ inline size_t GetPointCount()
{
- ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
+ if (m_Status != ePathFinderStatus::PATH_FOUND)
+ {
+ return 0;
+ }
return m_PathPoints.size();
}
- struct VectorHasher
- {
- std::size_t operator()(const Vector3i & a_Vector) const
- {
- // Guaranteed to have no hash collisions for any 128x128x128 area. Suitable for pathfinding.
- int32_t t = 0;
- t += (int8_t)a_Vector.x;
- t = t << 8;
- t += (int8_t)a_Vector.y;
- t = t << 8;
- t += (int8_t)a_Vector.z;
- t = t << 8;
- return (size_t)t;
- }
- };
private:
/* General */
@@ -119,6 +131,8 @@ private:
bool Step_Internal(); // The public version just calls this version * CALCULATIONS_PER_CALL times.
void FinishCalculation(); // Clears the memory used for calculating the path.
void FinishCalculation(ePathFinderStatus a_NewStatus); // Clears the memory used for calculating the path and changes the status.
+ void AttemptToFindAlternative();
+ void BuildPath();
/* Openlist and closedlist management */
void OpenListAdd(cPathCell * a_Cell);
@@ -131,10 +145,15 @@ private:
/* Pathfinding fields */
std::priority_queue<cPathCell *, std::vector<cPathCell *>, compareHeuristics> m_OpenList;
- std::unordered_map<Vector3i, UniquePtr<cPathCell>, VectorHasher> m_Map;
+ std::unordered_map<Vector3i, cPathCell, VectorHasher<int>> m_Map;
Vector3i m_Destination;
Vector3i m_Source;
+ int m_BoundingBoxWidth;
+ int m_BoundingBoxHeight;
+ double m_HalfWidth;
int m_StepsLeft;
+ cPathCell * m_NearestPointToTarget;
+ cFastRandom m_Rand;
/* Control fields */
ePathFinderStatus m_Status;
@@ -145,6 +164,7 @@ private:
/* Interfacing with the world */
cChunk * m_Chunk; // Only valid inside Step()!
+ bool m_BadChunkFound;
#ifdef COMPILING_PATHFIND_DEBUGGER
#include "../path_irrlicht.cpp"
#endif
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index 56d6abfd5..efa779ac2 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -21,7 +21,7 @@ cPig::cPig(void) :
void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Rabbit.cpp b/src/Mobs/Rabbit.cpp
index cf49d2744..c7f3d58f0 100644
--- a/src/Mobs/Rabbit.cpp
+++ b/src/Mobs/Rabbit.cpp
@@ -20,7 +20,7 @@ cRabbit::cRabbit(void) :
void cRabbit::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp
index ec24f167e..dcfef8135 100644
--- a/src/Mobs/Sheep.cpp
+++ b/src/Mobs/Sheep.cpp
@@ -37,10 +37,10 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if (!m_IsSheared)
{
- a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, m_WoolColor));
+ a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, static_cast<short>(m_WoolColor)));
}
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
@@ -65,7 +65,7 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
cItems Drops;
int NumDrops = m_World->GetTickRandomNumber(2) + 1;
- Drops.push_back(cItem(E_BLOCK_WOOL, NumDrops, m_WoolColor));
+ Drops.push_back(cItem(E_BLOCK_WOOL, static_cast<char>(NumDrops), static_cast<short>(m_WoolColor)));
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
m_World->BroadcastSoundEffect("mob.sheep.shear", GetPosX(), GetPosY(), GetPosZ(), 1.0f, 1.0f);
}
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index f99404669..767e5b95c 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -22,7 +22,7 @@ cSkeleton::cSkeleton(bool IsWither) :
void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
@@ -50,12 +50,13 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cSkeleton::Attack(std::chrono::milliseconds a_Dt)
{
+ cFastRandom Random;
m_AttackInterval += (static_cast<float>(a_Dt.count()) / 1000) * m_AttackRate;
if ((m_Target != nullptr) && (m_AttackInterval > 3.0))
{
- // Setting this higher gives us more wiggle room for attackrate
- Vector3d Speed = GetLookVector() * 20;
- Speed.y = Speed.y + 1;
+ Vector3d Inaccuracy = Vector3d(Random.NextFloat(0.5) - 0.25, Random.NextFloat(0.5) - 0.25, Random.NextFloat(0.5) - 0.25);
+ Vector3d Speed = (m_Target->GetPosition() + Inaccuracy - GetPosition()) * 5;
+ Speed.y = Speed.y - 1 + Random.NextInt(3);
cArrowEntity * Arrow = new cArrowEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed);
if (Arrow == nullptr)
{
diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp
index 7fc4821d8..4988d1082 100644
--- a/src/Mobs/Slime.cpp
+++ b/src/Mobs/Slime.cpp
@@ -29,7 +29,7 @@ cSlime::cSlime(int a_Size) :
void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp
index deb263c41..184a1d912 100644
--- a/src/Mobs/Spider.cpp
+++ b/src/Mobs/Spider.cpp
@@ -18,7 +18,7 @@ cSpider::cSpider(void) :
void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp
index 3c508b65f..30fbfa1ff 100644
--- a/src/Mobs/Squid.cpp
+++ b/src/Mobs/Squid.cpp
@@ -21,7 +21,7 @@ cSquid::cSquid(void) :
void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
@@ -35,19 +35,20 @@ void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cSquid::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
+ m_IsFollowingPath = false; // Disable Pathfinding until it's fixed. TODO
+
// We must first process current location, and only then tick, otherwise we risk processing a location in a chunk
// that is not where the entity currently resides (FS #411)
-
Vector3d Pos = GetPosition();
// TODO: Not a real behavior, but cool :D
- int RelY = (int)floor(Pos.y);
+ int RelY = FloorC(Pos.y);
if ((RelY < 0) || (RelY >= cChunkDef::Height))
{
return;
}
- int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
- int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
+ int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
+ int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
BLOCKTYPE BlockType;
if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire())
{
diff --git a/src/Mobs/Witch.cpp b/src/Mobs/Witch.cpp
index a3cadbaa0..1f672b4f7 100644
--- a/src/Mobs/Witch.cpp
+++ b/src/Mobs/Witch.cpp
@@ -19,7 +19,7 @@ cWitch::cWitch(void) :
void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index 3c2ec1520..7b5953523 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -20,6 +20,7 @@ cWolf::cWolf(void) :
m_OwnerName(""),
m_CollarColor(14)
{
+ m_RelativeWalkSpeed = 2;
}
@@ -50,7 +51,7 @@ void cWolf::Attack(std::chrono::milliseconds a_Dt)
if ((m_Target != nullptr) && (m_Target->IsPlayer()))
{
- if (((cPlayer *)m_Target)->GetName() != m_OwnerName)
+ if (static_cast<cPlayer *>(m_Target)->GetName() != m_OwnerName)
{
super::Attack(a_Dt);
}
@@ -157,7 +158,7 @@ void cWolf::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
super::Tick(a_Dt, a_Chunk);
}
- cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
+ cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), static_cast<float>(m_SightDistance));
if (a_Closest_Player != nullptr)
{
switch (a_Closest_Player->GetEquippedItem().m_ItemType)
@@ -230,7 +231,7 @@ void cWolf::TickFollowPlayer()
{
// The player is present in the world, follow him:
double Distance = (Callback.OwnerPos - GetPosition()).Length();
- if (Distance > 30)
+ if (Distance > 20)
{
Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h
index 73ffb55c2..5de83acd8 100644
--- a/src/Mobs/Wolf.h
+++ b/src/Mobs/Wolf.h
@@ -25,8 +25,8 @@ public:
virtual void Attack(std::chrono::milliseconds a_Dt) override;
// Get functions
- bool IsSitting (void) const { return m_IsSitting; }
- bool IsTame (void) const { return m_IsTame; }
+ bool IsSitting (void) const override { return m_IsSitting; }
+ bool IsTame (void) const override { return m_IsTame; }
bool IsBegging (void) const { return m_IsBegging; }
bool IsAngry (void) const { return m_IsAngry; }
AString GetOwnerName (void) const { return m_OwnerName; }
diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp
index fa4ac855d..a5b44e6c0 100644
--- a/src/Mobs/Zombie.cpp
+++ b/src/Mobs/Zombie.cpp
@@ -23,7 +23,7 @@ cZombie::cZombie(bool a_IsVillagerZombie) :
void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/Mobs/ZombiePigman.cpp b/src/Mobs/ZombiePigman.cpp
index 8b415b0af..96d587287 100644
--- a/src/Mobs/ZombiePigman.cpp
+++ b/src/Mobs/ZombiePigman.cpp
@@ -18,7 +18,7 @@ cZombiePigman::cZombiePigman(void) :
void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- int LootingLevel = 0;
+ unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp
index ae2cbbc6b..278e67b93 100644
--- a/src/MonsterConfig.cpp
+++ b/src/MonsterConfig.cpp
@@ -64,7 +64,7 @@ void cMonsterConfig::Initialize()
return;
}
- for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--)
+ for (int i = static_cast<int>(MonstersIniFile.GetNumKeys()); i >= 0; i--)
{
sAttributesStruct Attributes;
AString Name = MonstersIniFile.GetKeyName(i);
@@ -93,7 +93,7 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na
a_Monster->SetAttackDamage (itr->m_AttackDamage);
a_Monster->SetAttackRange (itr->m_AttackRange);
a_Monster->SetSightDistance(itr->m_SightDistance);
- a_Monster->SetAttackRate ((float)itr->m_AttackRate);
+ a_Monster->SetAttackRate (static_cast<float>(itr->m_AttackRate));
a_Monster->SetMaxHealth (itr->m_MaxHealth);
a_Monster->SetIsFireproof (itr->m_IsFireproof);
return;
diff --git a/src/NetherPortalScanner.cpp b/src/NetherPortalScanner.cpp
new file mode 100644
index 000000000..cebf09ceb
--- /dev/null
+++ b/src/NetherPortalScanner.cpp
@@ -0,0 +1,296 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NetherPortalScanner.h"
+#include "Vector3.h"
+#include "Entities/Entity.h"
+#include "World.h"
+
+
+
+
+
+cNetherPortalScanner::cNetherPortalScanner(cEntity * a_MovingEntity, cWorld * a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY) :
+ m_Entity(a_MovingEntity),
+ m_World(a_DestinationWorld),
+ m_FoundPortal(false),
+ m_BuildPlatform(true),
+ m_Dir(Direction::X),
+ m_PortalLoc(a_DestPosition.Floor()),
+ m_Position(a_DestPosition),
+ m_MaxY(a_MaxY)
+{
+ int MinX = FloorC((m_Position.x - SearchRadius) / cChunkDef::Width);
+ int MinZ = FloorC((m_Position.z - SearchRadius) / cChunkDef::Width);
+ int MaxX = CeilC((m_Position.x + SearchRadius) / cChunkDef::Width);
+ int MaxZ = CeilC((m_Position.z + SearchRadius) / cChunkDef::Width);
+ for (int x = MinX; x < MaxX; x++)
+ {
+ for (int z = MinZ; z < MaxZ; z++)
+ {
+ Add(x, z);
+ }
+ }
+ Enable(*a_DestinationWorld->GetChunkMap());
+}
+
+
+
+
+
+void cNetherPortalScanner::OnChunkAvailable(int a_ChunkX, int a_ChunkZ)
+{
+ cChunkDef::BlockTypes blocks;
+ m_World->GetChunkBlockTypes(a_ChunkX, a_ChunkZ, blocks);
+
+ // Iterate through all of the blocks in the chunk
+ for (unsigned int i = 0; i < cChunkDef::NumBlocks; i++)
+ {
+ if (blocks[i] == E_BLOCK_NETHER_PORTAL)
+ {
+ Vector3i Coordinate = cChunkDef::IndexToCoordinate(i);
+ if (Coordinate.y >= m_MaxY)
+ {
+ // This is above the map, don't consider it.
+ continue;
+ }
+
+ Vector3d PortalLoc = Vector3d(Coordinate.x + a_ChunkX * cChunkDef::Width, Coordinate.y, Coordinate.z + a_ChunkZ * cChunkDef::Width);
+ if (!m_FoundPortal)
+ {
+ m_FoundPortal = true;
+ m_PortalLoc = PortalLoc;
+ }
+ else
+ {
+ if ((PortalLoc - m_Position).SqrLength() < (m_PortalLoc - m_Position).SqrLength())
+ {
+ m_FoundPortal = true;
+ m_PortalLoc = PortalLoc;
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
+bool cNetherPortalScanner::IsValidBuildLocation(Vector3i a_BlockPos)
+{
+ // Check the base
+ for (int i = 0; i < SearchSolidBaseWidth; i++)
+ {
+ for (int j = 0; j < PortalLength; j++)
+ {
+ BLOCKTYPE blocktype = m_World->GetBlock(a_BlockPos.x + i, a_BlockPos.y, a_BlockPos.z + j);
+ if (!cBlockInfo::IsSolid(blocktype))
+ {
+ return false;
+ }
+
+ // Check the airspace
+ for (int k = 1; k < PortalHeight; k++)
+ {
+ blocktype = m_World->GetBlock(a_BlockPos.x + i, a_BlockPos.y + k, a_BlockPos.z + j);
+ if (blocktype != E_BLOCK_AIR)
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+
+
+
+
+bool cNetherPortalScanner::OnAllChunksAvailable(void)
+{
+ if (m_FoundPortal)
+ {
+ // Find the bottom of this portal
+ while (m_World->GetBlock(m_PortalLoc.x, m_PortalLoc.y, m_PortalLoc.z) == E_BLOCK_NETHER_PORTAL)
+ {
+ m_PortalLoc.y -= 1;
+ }
+ m_PortalLoc.y += 1;
+
+ // Figure out which way the portal is facing
+ int BXP = m_World->GetBlock(m_PortalLoc.x + 1, m_PortalLoc.y, m_PortalLoc.z);
+ int BXM = m_World->GetBlock(m_PortalLoc.x - 1, m_PortalLoc.y, m_PortalLoc.z);
+ if ((BXP == E_BLOCK_NETHER_PORTAL) || (BXM == E_BLOCK_NETHER_PORTAL))
+ {
+ // The long axis is along X
+ m_Dir = Direction::X;
+ }
+ else
+ {
+ // The long axis is along Z
+ m_Dir = Direction::Y;
+ }
+ }
+ else
+ {
+ // Scan the area for a suitable location
+ int minx = FloorC(m_Position.x) - BuildSearchRadius;
+ int minz = FloorC(m_Position.z) - BuildSearchRadius;
+ int maxx = FloorC(m_Position.x) + BuildSearchRadius;
+ int maxz = FloorC(m_Position.z) + BuildSearchRadius;
+ int maxy = m_MaxY;
+ std::vector<Vector3i> Possibilities;
+ int x, y, z;
+ for (y = 0; y < maxy - PortalHeight; y++)
+ {
+ for (x = minx; x < maxx - PortalLength; x++)
+ {
+ for (z = minz; z < maxz - SearchSolidBaseWidth; z++)
+ {
+ Vector3i Location = Vector3i(x, y, z);
+ if (IsValidBuildLocation(Location))
+ {
+ Possibilities.push_back(Vector3i(x, y, z));
+ }
+ }
+ }
+ }
+
+ if (Possibilities.size() > 0)
+ {
+ m_BuildPlatform = false;
+
+ // Find the nearest
+ double DistanceToClosest = (Possibilities[0] - m_Position).SqrLength();
+ Vector3i Closest = Possibilities[0];
+ for (const auto & itr : Possibilities)
+ {
+ double Distance = (itr - m_Position).SqrLength();
+ if (Distance < DistanceToClosest)
+ {
+ DistanceToClosest = Distance;
+ Closest = itr;
+ }
+ }
+
+ m_PortalLoc = Closest;
+ }
+ }
+ return true;
+}
+
+
+
+
+
+void cNetherPortalScanner::BuildNetherPortal(Vector3i a_Location, Direction a_Direction, bool a_IncludePlatform)
+{
+ int x = a_Location.x;
+ int y = a_Location.y;
+ int z = a_Location.z;
+
+ // Clear a 3x4x4 area starting right above the base
+ for (int i = 0; i < SearchSolidBaseWidth; i++)
+ {
+ for (int j = 0; j < PortalLength; j++)
+ {
+ for (int k = 1; k < PortalHeight; k++)
+ {
+ if (a_Direction == Direction::Y)
+ {
+ m_World->SetBlock(x + i, y + k, z + j, E_BLOCK_AIR, 0);
+ }
+ else if (a_Direction == Direction::X)
+ {
+ m_World->SetBlock(x + j, y + k, z + i, E_BLOCK_AIR, 0);
+ }
+ }
+ }
+ }
+
+ // Put in an obsidian base
+ if (a_IncludePlatform)
+ {
+ for (int j = 0; j < PortalLength; j++)
+ {
+ // +2 on the short axis because that's where we deposit the entity
+ if (a_Direction == Direction::Y)
+ {
+ m_World->SetBlock(x + 2, y, z + j, E_BLOCK_OBSIDIAN, 0);
+ }
+ else if (a_Direction == Direction::X)
+ {
+ m_World->SetBlock(x + j, y, z + 2, E_BLOCK_OBSIDIAN, 0);
+ }
+ }
+ }
+
+ // Build an obsidian frame
+ for (int i = 0; i < PortalHeight; i++)
+ {
+ if (a_Direction == Direction::Y)
+ {
+ m_World->SetBlock(x + 1, y + i, z, E_BLOCK_OBSIDIAN, 0);
+ m_World->SetBlock(x + 1, y + i, z + 3, E_BLOCK_OBSIDIAN, 0);
+ }
+ else if (a_Direction == Direction::X)
+ {
+ m_World->SetBlock(x, y + i, z + 1, E_BLOCK_OBSIDIAN, 0);
+ m_World->SetBlock(x + 3, y + i, z + 1, E_BLOCK_OBSIDIAN, 0);
+ }
+ }
+ for (int i = 0; i < PortalLength; i++)
+ {
+ if (a_Direction == Direction::Y)
+ {
+ m_World->SetBlock(x + 1, y + 4, z + i, E_BLOCK_OBSIDIAN, 0);
+ m_World->SetBlock(x + 1, y, z + i, E_BLOCK_OBSIDIAN, 0);
+ }
+ else if (a_Direction == Direction::X)
+ {
+ m_World->SetBlock(x + i, y + 4, z + 1, E_BLOCK_OBSIDIAN, 0);
+ m_World->SetBlock(x + i, y, z + 1, E_BLOCK_OBSIDIAN, 0);
+ }
+ }
+
+ // Fill the frame (place a fire in the bottom)
+ m_World->SetBlock(x + 1, y + 1, z + 1, E_BLOCK_FIRE, 0);
+}
+
+
+
+
+
+void cNetherPortalScanner::OnDisabled(void)
+{
+ // Now we actually move the player
+ if (!m_FoundPortal)
+ {
+ // Build a new nether portal.
+ LOGD("Building nether portal at {%d, %d, %d}", m_PortalLoc.x, m_PortalLoc.y, m_PortalLoc.z);
+ BuildNetherPortal(m_PortalLoc, m_Dir, m_BuildPlatform);
+ m_PortalLoc.x += 1;
+ m_PortalLoc.y += 2;
+ m_PortalLoc.z += 1;
+ }
+
+ // Put the entity near the opening
+ Vector3d Position = m_PortalLoc;
+ if (m_Dir == Direction::Y)
+ {
+ Position.x += OutOffset;
+ Position.z += AcrossOffset;
+ }
+ else if (m_Dir == Direction::X)
+ {
+ Position.x += AcrossOffset;
+ Position.z += OutOffset;
+ }
+
+ LOGD("Placing player at {%f, %f, %f}", Position.x, Position.y, Position.z);
+ m_Entity->ScheduleMoveToWorld(m_World, Position, true);
+ delete this;
+}
+
diff --git a/src/NetherPortalScanner.h b/src/NetherPortalScanner.h
new file mode 100644
index 000000000..393859b4d
--- /dev/null
+++ b/src/NetherPortalScanner.h
@@ -0,0 +1,75 @@
+
+#pragma once
+
+#include "Vector3.h"
+#include "ChunkStay.h"
+
+
+class cEntity;
+class cWorld;
+
+
+
+
+
+// This is the chunk stay which finds nearby nether portals
+class cNetherPortalScanner : public cChunkStay
+{
+public:
+ cNetherPortalScanner(cEntity * a_MovingEntity, cWorld * a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY);
+ virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkY) override;
+ virtual bool OnAllChunksAvailable(void) override;
+ virtual void OnDisabled(void) override;
+
+ enum class Direction
+ {
+ X,
+ Y
+ };
+
+private:
+
+ /** Length and height, including the obsidian. */
+ static const int PortalLength = 4;
+ static const int PortalHeight = 5;
+
+ static const int SearchRadius = 128;
+ static const int BuildSearchRadius = 16;
+
+ /** The width of a solid base to search for when building. */
+ static const int SearchSolidBaseWidth = 3;
+
+ /** Where to place the player out from the face and across the face */
+ const double OutOffset = 0.5;
+ const double AcrossOffset = 0.5;
+
+ /** Builds a portal. */
+ void BuildNetherPortal(Vector3i a_Location, Direction a_Direction, bool a_IncludePlatform);
+
+ /** Whether the given location is a valid location to build a portal. */
+ bool IsValidBuildLocation(Vector3i a_BlockPosition);
+
+ /** The entity that's being moved. */
+ cEntity * m_Entity;
+
+ /** The world we're moving the entity to. */
+ cWorld * m_World;
+
+ /** Whether we found a portal during the loading of the chunks. */
+ bool m_FoundPortal;
+
+ /** Whether to build a platform. True if we couldn't build the portal on solid ground */
+ bool m_BuildPlatform;
+
+ /** The direction of the portal. */
+ Direction m_Dir;
+
+ /** The position of the pre-existing portal. */
+ Vector3i m_PortalLoc;
+
+ /** The center of the search area */
+ Vector3d m_Position;
+
+ /** The maximum Y to scan to */
+ int m_MaxY;
+};
diff --git a/src/Noise/CMakeLists.txt b/src/Noise/CMakeLists.txt
index e1837500f..ab4cf031b 100644
--- a/src/Noise/CMakeLists.txt
+++ b/src/Noise/CMakeLists.txt
@@ -14,6 +14,10 @@ SET (HDRS
RidgedNoise.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(Noise.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Noise ${SRCS} ${HDRS})
diff --git a/src/Noise/Noise.cpp b/src/Noise/Noise.cpp
index d11c47bc2..703ec3d30 100644
--- a/src/Noise/Noise.cpp
+++ b/src/Noise/Noise.cpp
@@ -112,22 +112,22 @@ public:
////////////////////////////////////////////////////////////////////////////////
// Globals:
-void Debug3DNoise(const NOISE_DATATYPE * a_Noise, int a_SizeX, int a_SizeY, int a_SizeZ, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff)
+void Debug3DNoise(const NOISE_DATATYPE * a_Noise, size_t a_SizeX, size_t a_SizeY, size_t a_SizeZ, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff)
{
const int BUF_SIZE = 512;
ASSERT(a_SizeX <= BUF_SIZE); // Just stretch it, if needed
// Save in XY cuts:
cFile f1;
- if (f1.Open(Printf("%s_XY (%d).grab", a_FileNameBase.c_str(), a_SizeX), cFile::fmWrite))
+ if (f1.Open(Printf("%s_XY (" SIZE_T_FMT ").grab", a_FileNameBase.c_str(), a_SizeX), cFile::fmWrite))
{
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- for (int y = 0; y < a_SizeY; y++)
+ for (size_t y = 0; y < a_SizeY; y++)
{
- int idx = y * a_SizeX + z * a_SizeX * a_SizeY;
+ size_t idx = y * a_SizeX + z * a_SizeX * a_SizeY;
unsigned char buf[BUF_SIZE];
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
buf[x] = static_cast<unsigned char>(Clamp((int)(128 + a_Coeff * a_Noise[idx++]), 0, 255));
}
@@ -140,15 +140,15 @@ void Debug3DNoise(const NOISE_DATATYPE * a_Noise, int a_SizeX, int a_SizeY, int
} // if (XY file open)
cFile f2;
- if (f2.Open(Printf("%s_XZ (%d).grab", a_FileNameBase.c_str(), a_SizeX), cFile::fmWrite))
+ if (f2.Open(Printf("%s_XZ (" SIZE_T_FMT ").grab", a_FileNameBase.c_str(), a_SizeX), cFile::fmWrite))
{
- for (int y = 0; y < a_SizeY; y++)
+ for (size_t y = 0; y < a_SizeY; y++)
{
- for (int z = 0; z < a_SizeZ; z++)
+ for (size_t z = 0; z < a_SizeZ; z++)
{
- int idx = y * a_SizeX + z * a_SizeX * a_SizeY;
+ size_t idx = y * a_SizeX + z * a_SizeX * a_SizeY;
unsigned char buf[BUF_SIZE];
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
buf[x] = static_cast<unsigned char>(Clamp((int)(128 + a_Coeff * a_Noise[idx++]), 0, 255));
}
@@ -165,19 +165,19 @@ void Debug3DNoise(const NOISE_DATATYPE * a_Noise, int a_SizeX, int a_SizeY, int
-void Debug2DNoise(const NOISE_DATATYPE * a_Noise, int a_SizeX, int a_SizeY, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff)
+void Debug2DNoise(const NOISE_DATATYPE * a_Noise, size_t a_SizeX, size_t a_SizeY, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff)
{
const int BUF_SIZE = 512;
ASSERT(a_SizeX <= BUF_SIZE); // Just stretch it, if needed
cFile f1;
- if (f1.Open(Printf("%s (%d).grab", a_FileNameBase.c_str(), a_SizeX), cFile::fmWrite))
+ if (f1.Open(Printf("%s (" SIZE_T_FMT ").grab", a_FileNameBase.c_str(), a_SizeX), cFile::fmWrite))
{
- for (int y = 0; y < a_SizeY; y++)
+ for (size_t y = 0; y < a_SizeY; y++)
{
- int idx = y * a_SizeX;
+ size_t idx = y * a_SizeX;
unsigned char buf[BUF_SIZE];
- for (int x = 0; x < a_SizeX; x++)
+ for (size_t x = 0; x < a_SizeX; x++)
{
buf[x] = static_cast<unsigned char>(Clamp((int)(128 + a_Coeff * a_Noise[idx++]), 0, 255));
}
diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h
index 323194bfd..b08b96e24 100644
--- a/src/Noise/Noise.h
+++ b/src/Noise/Noise.h
@@ -185,7 +185,7 @@ typedef cOctavedNoise<cRidgedNoise<cCubicNoise>> cRidgedMultiNoise;
NOISE_DATATYPE cNoise::IntNoise1D(int a_X) const
{
int x = ((a_X * m_Seed) << 13) ^ a_X;
- return (1 - (NOISE_DATATYPE)((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
+ return (1 - static_cast<NOISE_DATATYPE>((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
// returns a float number in the range of [-1, 1]
}
@@ -197,7 +197,7 @@ NOISE_DATATYPE cNoise::IntNoise2D(int a_X, int a_Y) const
{
int n = a_X + a_Y * 57 + m_Seed * 57 * 57;
n = (n << 13) ^ n;
- return (1 - (NOISE_DATATYPE)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
+ return (1 - static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824);
// returns a float number in the range of [-1, 1]
}
@@ -209,7 +209,9 @@ NOISE_DATATYPE cNoise::IntNoise3D(int a_X, int a_Y, int a_Z) const
{
int n = a_X + a_Y * 57 + a_Z * 57 * 57 + m_Seed * 57 * 57 * 57;
n = (n << 13) ^ n;
- return ((NOISE_DATATYPE)1 - (NOISE_DATATYPE)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f);
+ return (static_cast<NOISE_DATATYPE>(1) -
+ static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f
+ );
// returns a float number in the range of [-1, 1]
}
@@ -265,8 +267,8 @@ NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B,
NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct)
{
- const NOISE_DATATYPE ft = a_Pct * (NOISE_DATATYPE)3.1415927;
- const NOISE_DATATYPE f = (NOISE_DATATYPE)((NOISE_DATATYPE)(1 - cos(ft)) * (NOISE_DATATYPE)0.5);
+ const NOISE_DATATYPE ft = a_Pct * static_cast<NOISE_DATATYPE>(3.1415927);
+ const NOISE_DATATYPE f = static_cast<NOISE_DATATYPE>(static_cast<NOISE_DATATYPE>(1 - cos(ft)) * static_cast<NOISE_DATATYPE>(0.5));
return a_A * (1 - f) + a_B * f;
}
@@ -288,11 +290,11 @@ NOISE_DATATYPE cNoise::LinearInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B,
/** Exports the noise array into a file.
a_Coeff specifies the value that each array value is multiplied by before being converted into a byte. */
-extern void Debug2DNoise(const NOISE_DATATYPE * a_Array, int a_SizeX, int a_SizeY, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32);
+extern void Debug2DNoise(const NOISE_DATATYPE * a_Array, size_t a_SizeX, size_t a_SizeY, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32);
/** Exports the noise array into a set of files, ordered by XY and XZ.
a_Coeff specifies the value that each array value is multiplied by before being converted into a byte. */
-extern void Debug3DNoise(const NOISE_DATATYPE * a_Array, int a_SizeX, int a_SizeY, int a_SizeZ, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32);
+extern void Debug3DNoise(const NOISE_DATATYPE * a_Array, size_t a_SizeX, size_t a_SizeY, size_t a_SizeZ, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32);
diff --git a/src/OSSupport/CMakeLists.txt b/src/OSSupport/CMakeLists.txt
index 0d3c9a63e..df47394ae 100644
--- a/src/OSSupport/CMakeLists.txt
+++ b/src/OSSupport/CMakeLists.txt
@@ -15,7 +15,6 @@ SET (SRCS
IsThread.cpp
NetworkInterfaceEnum.cpp
NetworkSingleton.cpp
- Semaphore.cpp
ServerHandleImpl.cpp
StackTrace.cpp
TCPLinkImpl.cpp
@@ -34,13 +33,16 @@ SET (HDRS
Network.h
NetworkSingleton.h
Queue.h
- Semaphore.h
ServerHandleImpl.h
StackTrace.h
TCPLinkImpl.h
UDPEndpointImpl.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ add_flags_cxx("-Wno-error=global-constructors -Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(OSSupport ${SRCS} ${HDRS})
diff --git a/src/OSSupport/Errors.cpp b/src/OSSupport/Errors.cpp
index a5361e1a6..407799495 100644
--- a/src/OSSupport/Errors.cpp
+++ b/src/OSSupport/Errors.cpp
@@ -22,7 +22,7 @@ AString GetOSErrorString( int a_ErrNo)
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
- #if !defined(__APPLE__) && ( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
+ #if !defined(__APPLE__) && defined( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer));
if (res != nullptr)
diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp
index 760e536a1..4c2adea3c 100644
--- a/src/OSSupport/Event.cpp
+++ b/src/OSSupport/Event.cpp
@@ -1,8 +1,8 @@
// Event.cpp
-// Implements the cEvent object representing an OS-specific synchronization primitive that can be waited-for
-// Implemented as an Event on Win and as a 1-semaphore on *nix
+// Interfaces to the cEvent object representing a synchronization primitive that can be waited-for
+// Implemented using C++11 condition variable and mutex
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
@@ -13,7 +13,7 @@
cEvent::cEvent(void) :
- m_ShouldWait(true)
+ m_ShouldContinue(false)
{
}
@@ -23,12 +23,11 @@ cEvent::cEvent(void) :
void cEvent::Wait(void)
{
- std::unique_lock<std::mutex> Lock(m_Mutex);
- while (m_ShouldWait)
{
- m_CondVar.wait(Lock);
+ std::unique_lock<std::mutex> Lock(m_Mutex);
+ m_CondVar.wait(Lock, [this](){ return m_ShouldContinue.load(); });
}
- m_ShouldWait = true;
+ m_ShouldContinue = false;
}
@@ -38,33 +37,13 @@ void cEvent::Wait(void)
bool cEvent::Wait(unsigned a_TimeoutMSec)
{
auto dst = std::chrono::system_clock::now() + std::chrono::milliseconds(a_TimeoutMSec);
- std::unique_lock<std::mutex> Lock(m_Mutex); // We assume that this lock is acquired without much delay - we are the only user of the mutex
- while (m_ShouldWait && (std::chrono::system_clock::now() <= dst))
+ bool Result;
{
- switch (m_CondVar.wait_until(Lock, dst))
- {
- case std::cv_status::no_timeout:
- {
- // The wait was successful, check for spurious wakeup:
- if (!m_ShouldWait)
- {
- m_ShouldWait = true;
- return true;
- }
- // This was a spurious wakeup, wait again:
- continue;
- }
-
- case std::cv_status::timeout:
- {
- // The wait timed out, return failure:
- return false;
- }
- } // switch (wait_until())
- } // while (m_ShouldWait && not timeout)
-
- // The wait timed out in the while condition:
- return false;
+ std::unique_lock<std::mutex> Lock(m_Mutex); // We assume that this lock is acquired without much delay - we are the only user of the mutex
+ Result = m_CondVar.wait_until(Lock, dst, [this](){ return m_ShouldContinue.load(); });
+ }
+ m_ShouldContinue = false;
+ return Result;
}
@@ -73,13 +52,20 @@ bool cEvent::Wait(unsigned a_TimeoutMSec)
void cEvent::Set(void)
{
- {
- std::unique_lock<std::mutex> Lock(m_Mutex);
- m_ShouldWait = false;
- }
+ m_ShouldContinue = true;
m_CondVar.notify_one();
}
+void cEvent::SetAll(void)
+{
+ m_ShouldContinue = true;
+ m_CondVar.notify_all();
+}
+
+
+
+
+
diff --git a/src/OSSupport/Event.h b/src/OSSupport/Event.h
index 572388a3f..2c58ba485 100644
--- a/src/OSSupport/Event.h
+++ b/src/OSSupport/Event.h
@@ -12,6 +12,7 @@
#include <mutex>
#include <condition_variable>
+#include <atomic>
@@ -28,7 +29,11 @@ public:
/** Sets the event - releases one thread that has been waiting in Wait().
If there was no thread waiting, the next call to Wait() will not block. */
- void Set (void);
+ void Set(void);
+
+ /** Sets the event - releases all threads that have been waiting in Wait().
+ If there was no thread waiting, the next call to Wait() will not block. */
+ void SetAll(void);
/** Waits for the event until either it is signalled, or the (relative) timeout is passed.
Returns true if the event was signalled, false if the timeout was hit or there was an error. */
@@ -37,9 +42,9 @@ public:
private:
/** Used for checking for spurious wakeups. */
- bool m_ShouldWait;
+ std::atomic<bool> m_ShouldContinue;
- /** Mutex protecting m_ShouldWait from multithreaded access. */
+ /** Mutex protecting m_ShouldContinue from multithreaded access. */
std::mutex m_Mutex;
/** The condition variable used as the Event. */
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp
index 43105b230..6327b3505 100644
--- a/src/OSSupport/File.cpp
+++ b/src/OSSupport/File.cpp
@@ -180,7 +180,7 @@ int cFile::Write(const void * iBuffer, size_t iNumBytes)
-int cFile::Seek (int iPosition)
+long cFile::Seek (int iPosition)
{
ASSERT(IsOpen());
@@ -193,7 +193,7 @@ int cFile::Seek (int iPosition)
{
return -1;
}
- return (int)ftell(m_File);
+ return ftell(m_File);
}
@@ -201,7 +201,7 @@ int cFile::Seek (int iPosition)
-int cFile::Tell (void) const
+long cFile::Tell (void) const
{
ASSERT(IsOpen());
@@ -210,14 +210,14 @@ int cFile::Tell (void) const
return -1;
}
- return (int)ftell(m_File);
+ return ftell(m_File);
}
-int cFile::GetSize(void) const
+long cFile::GetSize(void) const
{
ASSERT(IsOpen());
@@ -226,7 +226,7 @@ int cFile::GetSize(void) const
return -1;
}
- int CurPos = Tell();
+ long CurPos = Tell();
if (CurPos < 0)
{
return -1;
@@ -235,7 +235,7 @@ int cFile::GetSize(void) const
{
return -1;
}
- int res = Tell();
+ long res = Tell();
if (fseek(m_File, (long)CurPos, SEEK_SET) != 0)
{
return -1;
@@ -256,7 +256,19 @@ int cFile::ReadRestOfFile(AString & a_Contents)
return -1;
}
- size_t DataSize = GetSize() - Tell();
+ long TotalSize = GetSize();
+ if (TotalSize < 0)
+ {
+ return -1;
+ }
+
+ long Position = Tell();
+ if (Position < 0)
+ {
+ return -1;
+ }
+
+ auto DataSize = static_cast<size_t>(TotalSize - Position);
// HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly
a_Contents.assign(DataSize, '\0');
@@ -349,7 +361,7 @@ bool cFile::IsFile(const AString & a_Path)
-int cFile::GetSize(const AString & a_FileName)
+long cFile::GetSize(const AString & a_FileName)
{
struct stat st;
if (stat(a_FileName.c_str(), &st) == 0)
diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h
index 1b5e71a17..6281d1494 100644
--- a/src/OSSupport/File.h
+++ b/src/OSSupport/File.h
@@ -87,13 +87,13 @@ public:
int Write(const void * iBuffer, size_t iNumBytes);
/** Seeks to iPosition bytes from file start, returns old position or -1 for failure; asserts if not open */
- int Seek (int iPosition);
+ long Seek (int iPosition);
/** Returns the current position (bytes from file start) or -1 for failure; asserts if not open */
- int Tell (void) const;
+ long Tell (void) const;
/** Returns the size of file, in bytes, or -1 for failure; asserts if not open */
- int GetSize(void) const;
+ long GetSize(void) const;
/** Reads the file from current position till EOF into an AString; returns the number of bytes read or -1 for error */
int ReadRestOfFile(AString & a_Contents);
@@ -119,7 +119,7 @@ public:
static bool IsFile(const AString & a_Path);
/** Returns the size of the file, or a negative number on error */
- static int GetSize(const AString & a_FileName);
+ static long GetSize(const AString & a_FileName);
/** Creates a new folder with the specified name. Returns true if successful. Path may be relative or absolute */
static bool CreateFolder(const AString & a_FolderPath);
diff --git a/src/OSSupport/GZipFile.h b/src/OSSupport/GZipFile.h
index dfb4e8c31..286c98aff 100644
--- a/src/OSSupport/GZipFile.h
+++ b/src/OSSupport/GZipFile.h
@@ -37,7 +37,7 @@ public:
int ReadRestOfFile(AString & a_Contents);
/// Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported.
- bool Write(const AString & a_Contents) { return Write(a_Contents.data(), (int)(a_Contents.size())); }
+ bool Write(const AString & a_Contents) { return Write(a_Contents.data(), static_cast<int>(a_Contents.size())); }
bool Write(const char * a_Data, int a_Size);
diff --git a/src/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp
index 55e96b622..e295d5f25 100644
--- a/src/OSSupport/IsThread.cpp
+++ b/src/OSSupport/IsThread.cpp
@@ -134,9 +134,9 @@ bool cIsThread::Wait(void)
m_Thread.join();
return true;
}
- catch (std::system_error & a_Exception)
+ catch (const std::system_error & a_Exception)
{
- LOGERROR("cIsThread::Wait error %i: could not join thread %s; %s", a_Exception.code().value(), m_ThreadName.c_str(), a_Exception.code().message().c_str());
+ LOGERROR("%s error %i: could not join thread %s; %s", __FUNCTION__, a_Exception.code().value(), m_ThreadName.c_str(), a_Exception.code().message().c_str());
return false;
}
}
diff --git a/src/OSSupport/IsThread.h b/src/OSSupport/IsThread.h
index f642c8724..fa6813cd7 100644
--- a/src/OSSupport/IsThread.h
+++ b/src/OSSupport/IsThread.h
@@ -32,10 +32,6 @@ protected:
/** The overriden Execute() method should check this value periodically and terminate if this is true. */
volatile bool m_ShouldTerminate;
-private:
- /** Wrapper for Execute() that waits for the initialization event, to prevent race conditions in thread initialization. */
- void DoExecute(void);
-
public:
cIsThread(const AString & a_ThreadName);
virtual ~cIsThread();
@@ -51,14 +47,21 @@ public:
/** Returns true if the thread calling this function is the thread contained within this object. */
bool IsCurrentThread(void) const { return std::this_thread::get_id() == m_Thread.get_id(); }
+
+private:
-protected:
+ /** The name of the thread, used to aid debugging in IDEs which support named threads */
AString m_ThreadName;
+
+ /** The thread object which holds the created thread for later manipulation */
std::thread m_Thread;
/** The event that is used to wait with the thread's execution until the thread object is fully initialized.
- This prevents the IsCurrentThread() call to fail because of a race-condition. */
+ This prevents the IsCurrentThread() call to fail because of a race-condition where the thread starts before m_Thread has been fully assigned. */
cEvent m_evtStart;
+
+ /** Wrapper for Execute() that waits for the initialization event, to prevent race conditions in thread initialization. */
+ void DoExecute(void);
} ;
diff --git a/src/OSSupport/NetworkInterfaceEnum.cpp b/src/OSSupport/NetworkInterfaceEnum.cpp
index c4af1e93c..d74565e07 100644
--- a/src/OSSupport/NetworkInterfaceEnum.cpp
+++ b/src/OSSupport/NetworkInterfaceEnum.cpp
@@ -6,6 +6,8 @@
#include "Globals.h"
#include "Network.h"
#include "event2/util.h"
+#include "../SelfTests.h"
+
#ifdef _WIN32
#include <IPHlpApi.h>
#pragma comment(lib, "IPHLPAPI.lib")
@@ -27,13 +29,18 @@ static class cEnumIPAddressTest
public:
cEnumIPAddressTest(void)
{
- printf("Enumerating all IP addresses...\n");
+ cSelfTests::Get().Register(std::function<void(void)>(&Test), "Network IP enumeration");
+ }
+
+ static void Test(void)
+ {
+ LOG("Enumerating all IP addresses...");
auto IPs = cNetwork::EnumLocalIPAddresses();
for (auto & ip: IPs)
{
- printf(" %s\n", ip.c_str());
+ LOG(" %s", ip.c_str());
}
- printf("Done.\n");
+ LOG("Done.");
}
} g_EnumIPAddressTest;
diff --git a/src/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp
deleted file mode 100644
index 6a2d57901..000000000
--- a/src/OSSupport/Semaphore.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-
-
-
-
-cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */)
-#ifndef _WIN32
- : m_bNamed( false)
-#endif
-{
-#ifndef _WIN32
- (void)a_MaxCount;
- m_Handle = new sem_t;
- if (sem_init( (sem_t*)m_Handle, 0, 0))
- {
- LOG("WARNING cSemaphore: Could not create unnamed semaphore, fallback to named.");
- delete (sem_t*)m_Handle; // named semaphores return their own address
- m_bNamed = true;
-
- AString Name;
- Printf(Name, "cSemaphore%p", this);
- m_Handle = sem_open(Name.c_str(), O_CREAT, 777, a_InitialCount);
- if (m_Handle == SEM_FAILED)
- {
- LOG("ERROR: Could not create Semaphore. (%i)", errno);
- }
- else
- {
- if (sem_unlink(Name.c_str()) != 0)
- {
- LOG("ERROR: Could not unlink cSemaphore. (%i)", errno);
- }
- }
- }
-#else
- m_Handle = CreateSemaphore(
- nullptr, // security attribute
- a_InitialCount, // initial count
- a_MaxCount, // maximum count
- 0 // name (optional)
- );
-#endif
-}
-
-
-
-
-
-cSemaphore::~cSemaphore()
-{
-#ifdef _WIN32
- CloseHandle( m_Handle);
-#else
- if (m_bNamed)
- {
- if (sem_close( (sem_t*)m_Handle) != 0)
- {
- LOG("ERROR: Could not close cSemaphore. (%i)", errno);
- }
- }
- else
- {
- sem_destroy( (sem_t*)m_Handle);
- delete (sem_t*)m_Handle;
- }
- m_Handle = 0;
-
-#endif
-}
-
-
-
-
-
-void cSemaphore::Wait()
-{
-#ifndef _WIN32
- if (sem_wait( (sem_t*)m_Handle) != 0)
- {
- LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
- }
-#else
- WaitForSingleObject( m_Handle, INFINITE);
-#endif
-}
-
-
-
-
-
-void cSemaphore::Signal()
-{
-#ifndef _WIN32
- if (sem_post( (sem_t*)m_Handle) != 0)
- {
- LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
- }
-#else
- ReleaseSemaphore( m_Handle, 1, nullptr);
-#endif
-}
-
-
-
-
diff --git a/src/OSSupport/Semaphore.h b/src/OSSupport/Semaphore.h
deleted file mode 100644
index 57fa4bdb2..000000000
--- a/src/OSSupport/Semaphore.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-
-class cSemaphore
-{
-public:
- cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount = 0);
- ~cSemaphore();
-
- void Wait();
- void Signal();
-private:
- void * m_Handle; // HANDLE pointer
-
-#ifndef _WIN32
- bool m_bNamed;
-#endif
-};
diff --git a/src/OSSupport/ServerHandleImpl.cpp b/src/OSSupport/ServerHandleImpl.cpp
index 44ace448b..6f0a1ee16 100644
--- a/src/OSSupport/ServerHandleImpl.cpp
+++ b/src/OSSupport/ServerHandleImpl.cpp
@@ -294,14 +294,14 @@ void cServerHandleImpl::Callback(evconnlistener * a_Listener, evutil_socket_t a_
case AF_INET:
{
sockaddr_in * sin = reinterpret_cast<sockaddr_in *>(a_Addr);
- evutil_inet_ntop(AF_INET, sin, IPAddress, ARRAYCOUNT(IPAddress));
+ evutil_inet_ntop(AF_INET, &(sin->sin_addr), IPAddress, ARRAYCOUNT(IPAddress));
Port = ntohs(sin->sin_port);
break;
}
case AF_INET6:
{
sockaddr_in6 * sin6 = reinterpret_cast<sockaddr_in6 *>(a_Addr);
- evutil_inet_ntop(AF_INET, sin6, IPAddress, ARRAYCOUNT(IPAddress));
+ evutil_inet_ntop(AF_INET6, &(sin6->sin6_addr), IPAddress, ARRAYCOUNT(IPAddress));
Port = ntohs(sin6->sin6_port);
break;
}
diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp
index 015a53ba0..1ec10f20e 100644
--- a/src/OSSupport/StackTrace.cpp
+++ b/src/OSSupport/StackTrace.cpp
@@ -12,6 +12,13 @@
#include <unistd.h>
#endif
+// FreeBSD uses size_t for the return type of backtrace()
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 10)
+ #define btsize size_t
+#else
+ #define btsize int
+#endif
+
@@ -34,7 +41,7 @@ void PrintStackTrace(void)
// Use the backtrace() function to get and output the stackTrace:
// Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
void * stackTrace[30];
- int numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
+ btsize numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
#endif
}
diff --git a/src/OverridesSettingsRepository.cpp b/src/OverridesSettingsRepository.cpp
new file mode 100644
index 000000000..e63f2c44c
--- /dev/null
+++ b/src/OverridesSettingsRepository.cpp
@@ -0,0 +1,273 @@
+
+#include "Globals.h"
+#include "OverridesSettingsRepository.h"
+
+cOverridesSettingsRepository::cOverridesSettingsRepository(std::unique_ptr<cSettingsRepositoryInterface> a_Main, std::unique_ptr<cSettingsRepositoryInterface> a_Overrides) :
+ m_Main(std::move(a_Main)),
+ m_Overrides(std::move(a_Overrides))
+{
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::KeyExists(const AString a_keyName) const
+{
+ return m_Overrides->KeyExists(a_keyName) || m_Main->KeyExists(a_keyName);
+}
+
+
+
+
+bool cOverridesSettingsRepository::HasValue(const AString & a_KeyName, const AString & a_ValueName) const
+{
+ return m_Overrides->HasValue(a_KeyName, a_ValueName) || m_Main->HasValue(a_KeyName, a_ValueName);
+}
+
+
+
+
+
+int cOverridesSettingsRepository::AddKeyName(const AString & a_keyname)
+{
+
+ if (m_Overrides->KeyExists(a_keyname))
+ {
+ m_Overrides->AddKeyName(a_keyname);
+ return 0;
+ }
+
+ return m_Main->AddKeyName(a_keyname);
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::AddKeyComment(const AString & a_keyname, const AString & a_comment)
+{
+ if (m_Overrides->KeyExists(a_keyname))
+ {
+ return m_Overrides->AddKeyComment(a_keyname, a_comment);
+ }
+
+ return m_Main->AddKeyComment(a_keyname, a_comment);
+}
+
+
+
+
+
+AString cOverridesSettingsRepository::GetKeyComment(const AString & a_keyname, const int a_commentID) const
+{
+
+ if (m_Overrides->KeyExists(a_keyname))
+ {
+ return m_Overrides->GetKeyComment(a_keyname, a_commentID);
+ }
+
+ return m_Main->GetKeyComment(a_keyname, a_commentID);
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::DeleteKeyComment(const AString & a_keyname, const int a_commentID)
+{
+ if (m_Overrides->KeyExists(a_keyname))
+ {
+ return m_Overrides->DeleteKeyComment(a_keyname, a_commentID);
+ }
+
+ return m_Main->DeleteKeyComment(a_keyname, a_commentID);
+}
+
+
+
+
+
+void cOverridesSettingsRepository::AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ m_Overrides->AddValue(a_KeyName, a_ValueName, a_Value);
+ }
+ else
+ {
+ m_Main->AddValue(a_KeyName, a_ValueName, a_Value);
+ }
+}
+
+
+
+
+
+std::vector<std::pair<AString, AString>> cOverridesSettingsRepository::GetValues(AString a_keyName)
+{
+ auto overrides = m_Overrides->GetValues(a_keyName);
+ auto main = m_Main->GetValues(a_keyName);
+ std::sort(overrides.begin(), overrides.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;});
+ std::sort(main.begin(), main.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;});
+
+ std::vector<std::pair<AString, AString>> ret;
+
+
+ size_t overridesIndex = 0;
+ for (auto pair : main)
+ {
+ if (overridesIndex >= overrides.size())
+ {
+ ret.push_back(pair);
+ continue;
+ }
+ if (pair.first == overrides[overridesIndex].first)
+ {
+ continue;
+ }
+ while (pair.first > overrides[overridesIndex].first)
+ {
+ ret.push_back(overrides[overridesIndex]);
+ overridesIndex++;
+ }
+ ret.push_back(pair);
+ }
+ return ret;
+}
+
+
+
+
+
+AString cOverridesSettingsRepository::GetValue(const AString & a_KeyName, const AString & a_ValueName, const AString & defValue) const
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->GetValue(a_KeyName, a_ValueName, defValue);
+ }
+ else
+ {
+ return m_Main->GetValue(a_KeyName, a_ValueName, defValue);
+ }
+}
+
+
+
+
+
+AString cOverridesSettingsRepository::GetValueSet (const AString & a_KeyName, const AString & a_ValueName, const AString & defValue)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->GetValueSet(a_KeyName, a_ValueName, defValue);
+ }
+ else
+ {
+ return m_Main->GetValueSet(a_KeyName, a_ValueName, defValue);
+ }
+}
+
+
+
+
+
+int cOverridesSettingsRepository::GetValueSetI(const AString & a_KeyName, const AString & a_ValueName, const int defValue)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->GetValueSetI(a_KeyName, a_ValueName, defValue);
+ }
+ else
+ {
+ return m_Main->GetValueSetI(a_KeyName, a_ValueName, defValue);
+ }
+}
+
+
+
+
+
+Int64 cOverridesSettingsRepository::GetValueSetI(const AString & a_KeyName, const AString & a_ValueName, const Int64 defValue)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->GetValueSetI(a_KeyName, a_ValueName, defValue);
+ }
+ else
+ {
+ return m_Main->GetValueSetI(a_KeyName, a_ValueName, defValue);
+ }
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::GetValueSetB(const AString & a_KeyName, const AString & a_ValueName, const bool defValue)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->GetValueSetB(a_KeyName, a_ValueName, defValue);
+ }
+ else
+ {
+ return m_Main->GetValueSetB(a_KeyName, a_ValueName, defValue);
+ }
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->SetValue(a_KeyName, a_ValueName, a_Value, a_CreateIfNotExists);
+ }
+ else
+ {
+ return m_Main->SetValue(a_KeyName, a_ValueName, a_Value, a_CreateIfNotExists);
+ }
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->SetValueI(a_KeyName, a_ValueName, a_Value, a_CreateIfNotExists);
+ }
+ else
+ {
+ return m_Main->SetValueI(a_KeyName, a_ValueName, a_Value, a_CreateIfNotExists);
+ }
+}
+
+
+
+
+
+bool cOverridesSettingsRepository::DeleteValue(const AString & a_KeyName, const AString & a_ValueName)
+{
+ if (m_Overrides->HasValue(a_KeyName, a_ValueName))
+ {
+ return m_Overrides->DeleteValue(a_KeyName, a_ValueName);
+ }
+ else
+ {
+ return m_Main->DeleteValue(a_KeyName, a_ValueName);
+ }
+}
+
+
+
+bool cOverridesSettingsRepository::Flush()
+{
+ return m_Overrides->Flush() && m_Main->Flush();
+}
+
diff --git a/src/OverridesSettingsRepository.h b/src/OverridesSettingsRepository.h
new file mode 100644
index 000000000..04a53997f
--- /dev/null
+++ b/src/OverridesSettingsRepository.h
@@ -0,0 +1,52 @@
+
+#pragma once
+
+#include "SettingsRepositoryInterface.h"
+
+#include <unordered_map>
+
+class cOverridesSettingsRepository : public cSettingsRepositoryInterface
+{
+
+public:
+ cOverridesSettingsRepository(std::unique_ptr<cSettingsRepositoryInterface> a_Main, std::unique_ptr<cSettingsRepositoryInterface> a_Overrides);
+
+ virtual ~cOverridesSettingsRepository() = default;
+
+ virtual bool KeyExists(const AString keyname) const override;
+
+ virtual bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const override;
+
+ virtual int AddKeyName(const AString & keyname) override;
+
+ virtual bool AddKeyComment(const AString & keyname, const AString & comment) override;
+
+ virtual AString GetKeyComment(const AString & keyname, const int commentID) const override;
+
+ virtual bool DeleteKeyComment(const AString & keyname, const int commentID) override;
+
+ virtual void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value) override;
+
+ virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) override;
+
+ virtual AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const override;
+
+ virtual AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "") override;
+ virtual int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0) override;
+ virtual Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0) override;
+ virtual bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false) override;
+
+ virtual bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true) override;
+ virtual bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true) override;
+
+ virtual bool DeleteValue(const AString & keyname, const AString & valuename) override;
+
+ virtual bool Flush() override;
+
+private:
+
+ std::unique_ptr<cSettingsRepositoryInterface> m_Main;
+ std::unique_ptr<cSettingsRepositoryInterface> m_Overrides;
+
+};
+
diff --git a/src/PolarSSL++/BlockingSslClientSocket.cpp b/src/PolarSSL++/BlockingSslClientSocket.cpp
index 821125b31..a3c26f261 100644
--- a/src/PolarSSL++/BlockingSslClientSocket.cpp
+++ b/src/PolarSSL++/BlockingSslClientSocket.cpp
@@ -54,19 +54,19 @@ class cBlockingSslClientSocketLinkCallbacks:
}
- virtual void OnReceivedData(const char * a_Data, size_t a_Length)
+ virtual void OnReceivedData(const char * a_Data, size_t a_Length) override
{
m_Socket.OnReceivedData(a_Data, a_Length);
}
- virtual void OnRemoteClosed(void)
+ virtual void OnRemoteClosed(void) override
{
m_Socket.OnDisconnected();
}
- virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg)
+ virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override
{
m_Socket.OnDisconnected();
}
@@ -200,7 +200,7 @@ bool cBlockingSslClientSocket::Send(const void * a_Data, size_t a_NumBytes)
else
{
Data += res;
- NumBytes -= res;
+ NumBytes -= static_cast<size_t>(res);
if (NumBytes == 0)
{
return true;
diff --git a/src/PolarSSL++/BlockingSslClientSocket.h b/src/PolarSSL++/BlockingSslClientSocket.h
index 319e82bf2..462ee95a7 100644
--- a/src/PolarSSL++/BlockingSslClientSocket.h
+++ b/src/PolarSSL++/BlockingSslClientSocket.h
@@ -21,6 +21,11 @@ class cBlockingSslClientSocket :
{
public:
cBlockingSslClientSocket(void);
+
+ ~cBlockingSslClientSocket(void)
+ {
+ Disconnect();
+ }
/** Connects to the specified server and performs SSL handshake.
Returns true if successful, false on failure. Sets internal error text on failure. */
diff --git a/src/PolarSSL++/BufferedSslContext.cpp b/src/PolarSSL++/BufferedSslContext.cpp
index 9f7caeb8a..c8d4736f7 100644
--- a/src/PolarSSL++/BufferedSslContext.cpp
+++ b/src/PolarSSL++/BufferedSslContext.cpp
@@ -66,7 +66,7 @@ int cBufferedSslContext::ReceiveEncrypted(unsigned char * a_Buffer, size_t a_Num
return POLARSSL_ERR_NET_RECV_FAILED;
}
m_IncomingData.CommitRead();
- return (int)NumBytes;
+ return static_cast<int>(NumBytes);
}
@@ -81,11 +81,11 @@ int cBufferedSslContext::SendEncrypted(const unsigned char * a_Buffer, size_t a_
{
return POLARSSL_ERR_NET_WANT_WRITE;
}
- if (!m_OutgoingData.Write((const char *)a_Buffer, a_NumBytes))
+ if (!m_OutgoingData.Write(reinterpret_cast<const char *>(a_Buffer), a_NumBytes))
{
return POLARSSL_ERR_NET_SEND_FAILED;
}
- return (int)a_NumBytes;
+ return static_cast<int>(a_NumBytes);
}
diff --git a/src/PolarSSL++/CMakeLists.txt b/src/PolarSSL++/CMakeLists.txt
index b11d16e33..fddb37501 100644
--- a/src/PolarSSL++/CMakeLists.txt
+++ b/src/PolarSSL++/CMakeLists.txt
@@ -33,6 +33,10 @@ set(HDRS
X509Cert.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(RsaPrivateKey.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(PolarSSL++ ${SRCS} ${HDRS})
diff --git a/src/PolarSSL++/CryptoKey.cpp b/src/PolarSSL++/CryptoKey.cpp
index 9354ddf50..cc4eefdfe 100644
--- a/src/PolarSSL++/CryptoKey.cpp
+++ b/src/PolarSSL++/CryptoKey.cpp
@@ -77,7 +77,7 @@ int cCryptoKey::Decrypt(const Byte * a_EncryptedData, size_t a_EncryptedLength,
{
return res;
}
- return (int)DecryptedLen;
+ return static_cast<int>(DecryptedLen);
}
@@ -97,7 +97,7 @@ int cCryptoKey::Encrypt(const Byte * a_PlainData, size_t a_PlainLength, Byte * a
{
return res;
}
- return (int)EncryptedLength;
+ return static_cast<int>(EncryptedLength);
}
@@ -109,7 +109,7 @@ int cCryptoKey::ParsePublic(const void * a_Data, size_t a_NumBytes)
{
ASSERT(!IsValid()); // Cannot parse a second key
- return pk_parse_public_key(&m_Pk, (const unsigned char *)a_Data, a_NumBytes);
+ return pk_parse_public_key(&m_Pk, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
}
@@ -123,14 +123,14 @@ int cCryptoKey::ParsePrivate(const void * a_Data, size_t a_NumBytes, const AStri
if (a_Password.empty())
{
- return pk_parse_key(&m_Pk, (const unsigned char *)a_Data, a_NumBytes, nullptr, 0);
+ return pk_parse_key(&m_Pk, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes, nullptr, 0);
}
else
{
return pk_parse_key(
&m_Pk,
- (const unsigned char *)a_Data, a_NumBytes,
- (const unsigned char *)a_Password.c_str(), a_Password.size()
+ reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes,
+ reinterpret_cast<const unsigned char *>(a_Password.c_str()), a_Password.size()
);
}
}
diff --git a/src/PolarSSL++/CtrDrbgContext.cpp b/src/PolarSSL++/CtrDrbgContext.cpp
index 86e6d1ca5..25c2987b1 100644
--- a/src/PolarSSL++/CtrDrbgContext.cpp
+++ b/src/PolarSSL++/CtrDrbgContext.cpp
@@ -39,7 +39,7 @@ int cCtrDrbgContext::Initialize(const void * a_Custom, size_t a_CustomSize)
return 0;
}
- int res = ctr_drbg_init(&m_CtrDrbg, entropy_func, &(m_EntropyContext->m_Entropy), (const unsigned char *)a_Custom, a_CustomSize);
+ int res = ctr_drbg_init(&m_CtrDrbg, entropy_func, &(m_EntropyContext->m_Entropy), reinterpret_cast<const unsigned char *>(a_Custom), a_CustomSize);
m_IsValid = (res == 0);
return res;
}
diff --git a/src/PolarSSL++/SslContext.cpp b/src/PolarSSL++/SslContext.cpp
index 5ac4bc227..1409405bc 100644
--- a/src/PolarSSL++/SslContext.cpp
+++ b/src/PolarSSL++/SslContext.cpp
@@ -172,7 +172,7 @@ int cSslContext::WritePlain(const void * a_Data, size_t a_NumBytes)
}
}
- return ssl_write(&m_Ssl, (const unsigned char *)a_Data, a_NumBytes);
+ return ssl_write(&m_Ssl, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
}
@@ -191,7 +191,7 @@ int cSslContext::ReadPlain(void * a_Data, size_t a_MaxBytes)
}
}
- return ssl_read(&m_Ssl, (unsigned char *)a_Data, a_MaxBytes);
+ return ssl_read(&m_Ssl, reinterpret_cast<unsigned char *>(a_Data), a_MaxBytes);
}
diff --git a/src/PolarSSL++/SslContext.h b/src/PolarSSL++/SslContext.h
index 6b4f2c1e7..408fc7c56 100644
--- a/src/PolarSSL++/SslContext.h
+++ b/src/PolarSSL++/SslContext.h
@@ -127,13 +127,13 @@ protected:
/** The callback used by PolarSSL when it wants to read encrypted data. */
static int ReceiveEncrypted(void * a_This, unsigned char * a_Buffer, size_t a_NumBytes)
{
- return ((cSslContext *)a_This)->ReceiveEncrypted(a_Buffer, a_NumBytes);
+ return (reinterpret_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
}
/** The callback used by PolarSSL when it wants to write encrypted data. */
static int SendEncrypted(void * a_This, const unsigned char * a_Buffer, size_t a_NumBytes)
{
- return ((cSslContext *)a_This)->SendEncrypted(a_Buffer, a_NumBytes);
+ return (reinterpret_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
}
#ifdef _DEBUG
diff --git a/src/PolarSSL++/X509Cert.cpp b/src/PolarSSL++/X509Cert.cpp
index ecf664855..ed65639a5 100644
--- a/src/PolarSSL++/X509Cert.cpp
+++ b/src/PolarSSL++/X509Cert.cpp
@@ -30,7 +30,7 @@ cX509Cert::~cX509Cert()
int cX509Cert::Parse(const void * a_CertContents, size_t a_Size)
{
- return x509_crt_parse(&m_Cert, (const unsigned char *)a_CertContents, a_Size);
+ return x509_crt_parse(&m_Cert, reinterpret_cast<const unsigned char *>(a_CertContents), a_Size);
}
diff --git a/src/Protocol/Authenticator.cpp b/src/Protocol/Authenticator.cpp
index c9e4296a2..bfbe5028d 100644
--- a/src/Protocol/Authenticator.cpp
+++ b/src/Protocol/Authenticator.cpp
@@ -19,6 +19,10 @@
#define DEFAULT_AUTH_SERVER "sessionserver.mojang.com"
#define DEFAULT_AUTH_ADDRESS "/session/minecraft/hasJoined?username=%USERNAME%&serverId=%SERVERID%"
+
+
+
+
cAuthenticator::cAuthenticator(void) :
super("cAuthenticator"),
m_Server(DEFAULT_AUTH_SERVER),
@@ -40,11 +44,11 @@ cAuthenticator::~cAuthenticator()
-void cAuthenticator::ReadINI(cIniFile & IniFile)
+void cAuthenticator::ReadSettings(cSettingsRepositoryInterface & a_Settings)
{
- m_Server = IniFile.GetValueSet ("Authentication", "Server", DEFAULT_AUTH_SERVER);
- m_Address = IniFile.GetValueSet ("Authentication", "Address", DEFAULT_AUTH_ADDRESS);
- m_ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true);
+ m_Server = a_Settings.GetValueSet ("Authentication", "Server", DEFAULT_AUTH_SERVER);
+ m_Address = a_Settings.GetValueSet ("Authentication", "Address", DEFAULT_AUTH_ADDRESS);
+ m_ShouldAuthenticate = a_Settings.GetValueSetB("Authentication", "Authenticate", true);
}
@@ -69,9 +73,9 @@ void cAuthenticator::Authenticate(int a_ClientID, const AString & a_UserName, co
-void cAuthenticator::Start(cIniFile & IniFile)
+void cAuthenticator::Start(cSettingsRepositoryInterface & a_Settings)
{
- ReadINI(IniFile);
+ ReadSettings(a_Settings);
m_ShouldTerminate = false;
super::Start();
}
@@ -267,3 +271,7 @@ bool cAuthenticator::GetPlayerProperties(const AString & a_UUID, Json::Value & a
return true;
}
*/
+
+
+
+
diff --git a/src/Protocol/Authenticator.h b/src/Protocol/Authenticator.h
index 853eff535..02b349256 100644
--- a/src/Protocol/Authenticator.h
+++ b/src/Protocol/Authenticator.h
@@ -14,7 +14,7 @@
#include "../OSSupport/IsThread.h"
-
+class cSettingsRepositoryInterface;
@@ -40,13 +40,13 @@ public:
~cAuthenticator();
/** (Re-)read server and address from INI: */
- void ReadINI(cIniFile & IniFile);
+ void ReadSettings(cSettingsRepositoryInterface & a_Settings);
/** Queues a request for authenticating a user. If the auth fails, the user will be kicked */
void Authenticate(int a_ClientID, const AString & a_UserName, const AString & a_ServerHash);
/** Starts the authenticator thread. The thread may be started and stopped repeatedly */
- void Start(cIniFile & IniFile);
+ void Start(cSettingsRepositoryInterface & a_Settings);
/** Stops the authenticator thread. The thread may be started and stopped repeatedly */
void Stop(void);
diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt
index c3a45ca47..42a7d5a9d 100644
--- a/src/Protocol/CMakeLists.txt
+++ b/src/Protocol/CMakeLists.txt
@@ -25,6 +25,15 @@ SET (HDRS
ProtocolRecognizer.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(ChunkDataSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(MojangAPI.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(Packetizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast -Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch")
+ set_source_files_properties(Protocol17x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
+ set_source_files_properties(ProtocolRecognizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if (NOT MSVC)
add_library(Protocol ${SRCS} ${HDRS})
endif()
diff --git a/src/Protocol/ChunkDataSerializer.cpp b/src/Protocol/ChunkDataSerializer.cpp
index 2b9c06779..37fbae0e5 100644
--- a/src/Protocol/ChunkDataSerializer.cpp
+++ b/src/Protocol/ChunkDataSerializer.cpp
@@ -43,7 +43,6 @@ const AString & cChunkDataSerializer::Serialize(int a_Version, int a_ChunkX, int
AString data;
switch (a_Version)
{
- case RELEASE_1_2_5: Serialize29(data); break;
case RELEASE_1_3_2: Serialize39(data); break;
case RELEASE_1_8_0: Serialize47(data, a_ChunkX, a_ChunkZ); break;
// TODO: Other protocol versions may serialize the data differently; implement here
@@ -65,65 +64,6 @@ const AString & cChunkDataSerializer::Serialize(int a_Version, int a_ChunkX, int
-
-void cChunkDataSerializer::Serialize29(AString & a_Data)
-{
- // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream)
-
- const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
- const int MetadataOffset = sizeof(m_BlockTypes);
- const int BlockLightOffset = MetadataOffset + sizeof(m_BlockMetas);
- const int SkyLightOffset = BlockLightOffset + sizeof(m_BlockLight);
- const int BiomeOffset = SkyLightOffset + sizeof(m_BlockSkyLight);
- const int DataSize = BiomeOffset + BiomeDataSize;
-
- // Temporary buffer for the composed data:
- char AllData [DataSize];
-
- memcpy(AllData, m_BlockTypes, sizeof(m_BlockTypes));
- memcpy(AllData + MetadataOffset, m_BlockMetas, sizeof(m_BlockMetas));
- memcpy(AllData + BlockLightOffset, m_BlockLight, sizeof(m_BlockLight));
- memcpy(AllData + SkyLightOffset, m_BlockSkyLight, sizeof(m_BlockSkyLight));
- memcpy(AllData + BiomeOffset, m_BiomeData, BiomeDataSize);
-
- // Compress the data:
- // In order not to use allocation, use a fixed-size buffer, with the size
- // that uses the same calculation as compressBound():
- const uLongf CompressedMaxSize = DataSize + (DataSize >> 12) + (DataSize >> 14) + (DataSize >> 25) + 16;
- char CompressedBlockData[CompressedMaxSize];
-
- uLongf CompressedSize = compressBound(DataSize);
-
- // Run-time check that our compile-time guess about CompressedMaxSize was enough:
- ASSERT(CompressedSize <= CompressedMaxSize);
-
- compress2((Bytef*)CompressedBlockData, &CompressedSize, (const Bytef*)AllData, sizeof(AllData), Z_DEFAULT_COMPRESSION);
-
- // Now put all those data into a_Data:
-
- // "Ground-up continuous", or rather, "biome data present" flag:
- a_Data.push_back('\x01');
-
- // Two bitmaps; we're aways sending the full chunk with no additional data, so the bitmaps are 0xffff and 0, respectively
- // Also, no endian flipping is needed because of the const values
- unsigned short BitMap1 = 0xffff;
- unsigned short BitMap2 = 0;
- a_Data.append((const char *)&BitMap1, sizeof(short));
- a_Data.append((const char *)&BitMap2, sizeof(short));
-
- UInt32 CompressedSizeBE = htonl((UInt32)CompressedSize);
- a_Data.append((const char *)&CompressedSizeBE, sizeof(CompressedSizeBE));
-
- Int32 UnusedInt32 = 0;
- a_Data.append((const char *)&UnusedInt32, sizeof(UnusedInt32));
-
- a_Data.append(CompressedBlockData, CompressedSize);
-}
-
-
-
-
-
void cChunkDataSerializer::Serialize39(AString & a_Data)
{
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream)
diff --git a/src/Protocol/ChunkDataSerializer.h b/src/Protocol/ChunkDataSerializer.h
index a082ef3d8..6acc1544b 100644
--- a/src/Protocol/ChunkDataSerializer.h
+++ b/src/Protocol/ChunkDataSerializer.h
@@ -22,14 +22,12 @@ protected:
Serializations m_Serializations;
- void Serialize29(AString & a_Data); // Release 1.2.4 and 1.2.5
void Serialize39(AString & a_Data); // Release 1.3.1 to 1.7.10
void Serialize47(AString & a_Data, int a_ChunkX, int a_ChunkZ); // Release 1.8
public:
enum
{
- RELEASE_1_2_5 = 29,
RELEASE_1_3_2 = 39,
RELEASE_1_8_0 = 47,
} ;
diff --git a/src/Protocol/MojangAPI.cpp b/src/Protocol/MojangAPI.cpp
index 0d1441500..110590359 100644
--- a/src/Protocol/MojangAPI.cpp
+++ b/src/Protocol/MojangAPI.cpp
@@ -38,12 +38,36 @@ const int MAX_PER_QUERY = 100;
-/** This is the data of the root certs for Starfield Technologies, the CA that signed sessionserver.mojang.com's cert:
-Downloaded from http://certs.starfieldtech.com/repository/ */
-static const AString & StarfieldCACert(void)
+/** Returns the CA certificates that should be trusted for Mojang-related connections. */
+static const AString & GetCACerts(void)
{
static const AString Cert(
- // G2 cert
+ // Equifax root CA cert
+ // Currently used for signing *.mojang.com's cert
+ // Exported from Mozilla Firefox's built-in CA repository
+ "-----BEGIN CERTIFICATE-----\n"
+ "MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV\n"
+ "UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy\n"
+ "dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1\n"
+ "MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx\n"
+ "dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B\n"
+ "AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f\n"
+ "BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A\n"
+ "cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC\n"
+ "AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ\n"
+ "MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm\n"
+ "aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw\n"
+ "ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj\n"
+ "IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF\n"
+ "MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA\n"
+ "A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y\n"
+ "7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh\n"
+ "1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4\n"
+ "-----END CERTIFICATE-----\n\n"
+
+ // Starfield G2 cert
+ // This is the data of the root certs for Starfield Technologies, the CA that used to sign sessionserver.mojang.com's cert
+ // Downloaded from http://certs.starfieldtech.com/repository/
"-----BEGIN CERTIFICATE-----\n"
"MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx\n"
"EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT\n"
@@ -67,7 +91,8 @@ static const AString & StarfieldCACert(void)
"pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1\n"
"mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0\n"
"-----END CERTIFICATE-----\n\n"
- // Original (G1) cert:
+
+ // Starfield original (G1) cert:
"-----BEGIN CERTIFICATE-----\n"
"MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl\n"
"MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp\n"
@@ -226,12 +251,12 @@ cMojangAPI::~cMojangAPI()
-void cMojangAPI::Start(cIniFile & a_SettingsIni, bool a_ShouldAuth)
+void cMojangAPI::Start(cSettingsRepositoryInterface & a_Settings, bool a_ShouldAuth)
{
- m_NameToUUIDServer = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDServer", DEFAULT_NAME_TO_UUID_SERVER);
- m_NameToUUIDAddress = a_SettingsIni.GetValueSet("MojangAPI", "NameToUUIDAddress", DEFAULT_NAME_TO_UUID_ADDRESS);
- m_UUIDToProfileServer = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileServer", DEFAULT_UUID_TO_PROFILE_SERVER);
- m_UUIDToProfileAddress = a_SettingsIni.GetValueSet("MojangAPI", "UUIDToProfileAddress", DEFAULT_UUID_TO_PROFILE_ADDRESS);
+ m_NameToUUIDServer = a_Settings.GetValueSet("MojangAPI", "NameToUUIDServer", DEFAULT_NAME_TO_UUID_SERVER);
+ m_NameToUUIDAddress = a_Settings.GetValueSet("MojangAPI", "NameToUUIDAddress", DEFAULT_NAME_TO_UUID_ADDRESS);
+ m_UUIDToProfileServer = a_Settings.GetValueSet("MojangAPI", "UUIDToProfileServer", DEFAULT_UUID_TO_PROFILE_SERVER);
+ m_UUIDToProfileAddress = a_Settings.GetValueSet("MojangAPI", "UUIDToProfileAddress", DEFAULT_UUID_TO_PROFILE_ADDRESS);
LoadCachesFromDisk();
if (a_ShouldAuth)
{
@@ -390,7 +415,7 @@ bool cMojangAPI::SecureRequest(const AString & a_ServerName, const AString & a_R
{
// Connect the socket:
cBlockingSslClientSocket Socket;
- Socket.SetTrustedRootCertsFromString(StarfieldCACert(), a_ServerName);
+ Socket.SetTrustedRootCertsFromString(GetCACerts(), a_ServerName);
if (!Socket.Connect(a_ServerName, 443))
{
LOGWARNING("%s: Can't connect to %s: %s", __FUNCTION__, a_ServerName.c_str(), Socket.GetLastErrorText().c_str());
@@ -434,7 +459,6 @@ bool cMojangAPI::SecureRequest(const AString & a_ServerName, const AString & a_R
a_Response.append((const char *)buf, (size_t)ret);
}
- Socket.Disconnect();
return true;
}
diff --git a/src/Protocol/MojangAPI.h b/src/Protocol/MojangAPI.h
index 0dc2617b6..bea950740 100644
--- a/src/Protocol/MojangAPI.h
+++ b/src/Protocol/MojangAPI.h
@@ -25,7 +25,7 @@ namespace Json
-
+class cSettingsRepositoryInterface;
// tolua_begin
class cMojangAPI
@@ -38,7 +38,7 @@ public:
/** Initializes the API; reads the settings from the specified ini file.
Loads cached results from disk. */
- void Start(cIniFile & a_SettingsIni, bool a_ShouldAuth);
+ void Start(cSettingsRepositoryInterface & a_Settings, bool a_ShouldAuth);
/** Connects to the specified server using SSL, sends the given request and receives the response.
Checks Mojang certificates using the hard-coded Starfield root CA certificate.
diff --git a/src/Protocol/Packetizer.h b/src/Protocol/Packetizer.h
index 7f5e9c2c3..efed9c7a9 100644
--- a/src/Protocol/Packetizer.h
+++ b/src/Protocol/Packetizer.h
@@ -58,7 +58,7 @@ public:
}
- inline void WriteBEUInt16(short a_Value)
+ inline void WriteBEUInt16(UInt16 a_Value)
{
VERIFY(m_Out.WriteBEUInt16(a_Value));
}
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 3bca7551b..1a19249bf 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -70,6 +70,12 @@ public:
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) = 0;
virtual void SendChat (const AString & a_Message) = 0;
virtual void SendChat (const cCompositeChat & a_Message) = 0;
+ virtual void SendChatAboveActionBar (const AString & a_Message) = 0;
+ virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) = 0;
+ virtual void SendChatSystem (const AString & a_Message) = 0;
+ virtual void SendChatSystem (const cCompositeChat & a_Message) = 0;
+ virtual void SendChatType (const AString & a_Message, eChatType type) = 0;
+ virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) = 0;
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) = 0;
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) = 0;
virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
@@ -88,6 +94,7 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0;
virtual void SendGameMode (eGameMode a_GameMode) = 0;
virtual void SendHealth (void) = 0;
+ virtual void SendHideTitle (void) = 0;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0;
virtual void SendKeepAlive (int a_PingID) = 0;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
@@ -112,12 +119,17 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) = 0;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) = 0;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) = 0;
+ virtual void SendResetTitle (void) = 0;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) = 0;
virtual void SendExperience (void) = 0;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) = 0;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) = 0;
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) = 0;
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) = 0;
+ virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) = 0;
+ virtual void SendSetRawSubTitle (const AString & a_SubTitle) = 0;
+ virtual void SendSetTitle (const cCompositeChat & a_Title) = 0;
+ virtual void SendSetRawTitle (const AString & a_Title) = 0;
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) = 0;
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0;
@@ -128,6 +140,7 @@ public:
virtual void SendTabCompletionResults (const AStringVector & a_Results) = 0;
virtual void SendTeleportEntity (const cEntity & a_Entity) = 0;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
+ virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) = 0;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) = 0;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) = 0;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 799c021f3..c5c0f4a03 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -247,8 +247,67 @@ void cProtocol172::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV
void cProtocol172::SendChat(const AString & a_Message)
{
+ this->SendChatType(a_Message, ctChatBox);
+}
+
+
+
+
+
+void cProtocol172::SendChat(const cCompositeChat & a_Message)
+{
+ this->SendChatType(a_Message, ctChatBox);
+}
+
+
+
+
+
+void cProtocol172::SendChatSystem(const AString & a_Message)
+{
+ this->SendChatType(a_Message, ctSystem);
+}
+
+
+
+
+
+void cProtocol172::SendChatSystem(const cCompositeChat & a_Message)
+{
+ this->SendChatType(a_Message, ctSystem);
+}
+
+
+
+
+
+void cProtocol172::SendChatAboveActionBar(const AString & a_Message)
+{
+ this->SendChatType(a_Message, ctAboveActionBar);
+}
+
+
+
+
+
+void cProtocol172::SendChatAboveActionBar(const cCompositeChat & a_Message)
+{
+ this->SendChatType(a_Message, ctAboveActionBar);
+}
+
+
+
+
+
+void cProtocol172::SendChatType(const AString & a_Message, eChatType type)
+{
ASSERT(m_State == 3); // In game mode?
-
+
+ if (type != ctChatBox) // 1.7.2 doesn't support anything else
+ {
+ return;
+ }
+
cPacketizer Pkt(*this, 0x02); // Chat Message packet
Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()));
}
@@ -257,10 +316,15 @@ void cProtocol172::SendChat(const AString & a_Message)
-void cProtocol172::SendChat(const cCompositeChat & a_Message)
+void cProtocol172::SendChatType(const cCompositeChat & a_Message, eChatType type)
{
ASSERT(m_State == 3); // In game mode?
+ if (type != ctChatBox) // 1.7.2 doesn't support anything else
+ {
+ return;
+ }
+
cWorld * World = m_Client->GetPlayer()->GetWorld();
bool ShouldUseChatPrefixes = (World == nullptr) ? false : World->ShouldUseChatPrefixes();
@@ -555,6 +619,15 @@ void cProtocol172::SendHealth(void)
+void cProtocol172::SendHideTitle(void)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
void cProtocol172::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
{
ASSERT(m_State == 3); // In game mode?
@@ -995,6 +1068,15 @@ void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
+void cProtocol172::SendResetTitle(void)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
void cProtocol172::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
@@ -1023,8 +1105,8 @@ void cProtocol172::SendExperience (void)
cPacketizer Pkt(*this, 0x1f); // Experience Packet
cPlayer * Player = m_Client->GetPlayer();
Pkt.WriteBEFloat(Player->GetXpPercentage());
- Pkt.WriteBEInt16(static_cast<UInt16>(std::max<int>(Player->GetXpLevel(), std::numeric_limits<UInt16>::max())));
- Pkt.WriteBEInt16(static_cast<UInt16>(std::max<int>(Player->GetCurrentXp(), std::numeric_limits<UInt16>::max())));
+ Pkt.WriteBEInt16(static_cast<Int16>(std::min<int>(Player->GetXpLevel(), std::numeric_limits<Int16>::max())));
+ Pkt.WriteBEInt16(static_cast<Int16>(std::min<int>(Player->GetCurrentXp(), std::numeric_limits<Int16>::max())));
}
@@ -1094,6 +1176,42 @@ void cProtocol172::SendDisplayObjective(const AString & a_Objective, cScoreboard
+void cProtocol172::SendSetSubTitle(const cCompositeChat & a_SubTitle)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
+void cProtocol172::SendSetRawSubTitle(const AString & a_SubTitle)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
+void cProtocol172::SendSetTitle(const cCompositeChat & a_Title)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
+void cProtocol172::SendSetRawTitle(const AString & a_Title)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
void cProtocol172::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
{
ASSERT(m_State == 3); // In game mode?
@@ -1296,6 +1414,15 @@ void cProtocol172::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cProtocol172::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
+{
+ // Not implemented in this protocol version
+}
+
+
+
+
+
void cProtocol172::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
{
ASSERT(m_State == 3); // In game mode?
@@ -2247,7 +2374,7 @@ void cProtocol172::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer)
case 0x0206: Action = caNumber7; break;
case 0x0207: Action = caNumber8; break;
case 0x0208: Action = caNumber9; break;
- case 0x0300: Action = caMiddleClick; break;
+ case 0x0302: Action = caMiddleClick; break;
case 0x0400: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftClickOutsideHoldNothing : caDropKey; break;
case 0x0401: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caRightClickOutsideHoldNothing : caCtrlDropKey; break;
case 0x0500: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftPaintBegin : caUnknown; break;
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 773c39f87..b07fa9ed9 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -68,6 +68,12 @@ public:
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
virtual void SendChat (const AString & a_Message) override;
virtual void SendChat (const cCompositeChat & a_Message) override;
+ virtual void SendChatAboveActionBar (const AString & a_Message) override;
+ virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) override;
+ virtual void SendChatSystem (const AString & a_Message) override;
+ virtual void SendChatSystem (const cCompositeChat & a_Message) override;
+ virtual void SendChatType (const AString & a_Message, eChatType type) override;
+ virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) override;
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override;
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
@@ -90,6 +96,7 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
+ virtual void SendHideTitle (void) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
@@ -113,9 +120,14 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
+ virtual void SendResetTitle (void) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
+ virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) override;
+ virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
+ virtual void SendSetTitle (const cCompositeChat & a_Title) override;
+ virtual void SendSetRawTitle (const AString & a_Title) override;
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
@@ -126,6 +138,7 @@ public:
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 17faca27e..4708d67c9 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -51,7 +51,7 @@ Implements the 1.8.x protocol classes:
/** The slot number that the client uses to indicate "outside the window". */
-static const Int16 SLOT_NUM_OUTSIDE = -1;
+static const Int16 SLOT_NUM_OUTSIDE = -999;
@@ -234,18 +234,72 @@ void cProtocol180::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV
void cProtocol180::SendChat(const AString & a_Message)
{
+ this->SendChatType(a_Message, ctChatBox);
+}
+
+
+
+
+
+void cProtocol180::SendChat(const cCompositeChat & a_Message)
+{
+ this->SendChatType(a_Message, ctChatBox);
+}
+
+
+
+
+
+void cProtocol180::SendChatSystem(const AString & a_Message)
+{
+ this->SendChatType(a_Message, ctSystem);
+}
+
+
+
+
+
+void cProtocol180::SendChatSystem(const cCompositeChat & a_Message)
+{
+ this->SendChatType(a_Message, ctSystem);
+}
+
+
+
+
+
+void cProtocol180::SendChatAboveActionBar(const AString & a_Message)
+{
+ this->SendChatType(a_Message, ctAboveActionBar);
+}
+
+
+
+
+
+void cProtocol180::SendChatAboveActionBar(const cCompositeChat & a_Message)
+{
+ this->SendChatType(a_Message, ctAboveActionBar);
+}
+
+
+
+
+
+void cProtocol180::SendChatType(const AString & a_Message, eChatType type)
+{
ASSERT(m_State == 3); // In game mode?
cPacketizer Pkt(*this, 0x02); // Chat Message packet
Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()));
- Pkt.WriteBEInt8(0);
+ Pkt.WriteBEInt8(type);
}
-void cProtocol180::SendChat(const cCompositeChat & a_Message)
+void cProtocol180::SendChatType(const cCompositeChat & a_Message, eChatType type)
{
ASSERT(m_State == 3); // In game mode?
@@ -255,7 +309,7 @@ void cProtocol180::SendChat(const cCompositeChat & a_Message)
// Send the message to the client:
cPacketizer Pkt(*this, 0x02);
Pkt.WriteString(a_Message.CreateJsonString(ShouldUseChatPrefixes));
- Pkt.WriteBEInt8(0);
+ Pkt.WriteBEInt8(type);
}
@@ -542,6 +596,18 @@ void cProtocol180::SendHealth(void)
+void cProtocol180::SendHideTitle(void)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x45); // Title packet
+ Pkt.WriteVarInt32(3); // Hide title
+}
+
+
+
+
+
void cProtocol180::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item)
{
ASSERT(m_State == 3); // In game mode?
@@ -681,7 +747,7 @@ void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor
cPacketizer Pkt(*this, 0x34);
Pkt.WriteVarInt32(a_ID);
Pkt.WriteBEUInt8(m_Scale);
- Pkt.WriteVarInt32(a_Decorators.size());
+ Pkt.WriteVarInt32(static_cast<UInt32>(a_Decorators.size()));
for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it)
{
@@ -1065,6 +1131,18 @@ void cProtocol180::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect
+void cProtocol180::SendResetTitle(void)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x45); // Title packet
+ Pkt.WriteVarInt32(4); // Reset title
+}
+
+
+
+
+
void cProtocol180::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks)
@@ -1167,6 +1245,52 @@ void cProtocol180::SendDisplayObjective(const AString & a_Objective, cScoreboard
+void cProtocol180::SendSetSubTitle(const cCompositeChat & a_SubTitle)
+{
+ SendSetRawSubTitle(a_SubTitle.CreateJsonString(false));
+}
+
+
+
+
+
+void cProtocol180::SendSetRawSubTitle(const AString & a_SubTitle)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x45); // Title packet
+ Pkt.WriteVarInt32(1); // Set subtitle
+
+ Pkt.WriteString(a_SubTitle);
+}
+
+
+
+
+
+void cProtocol180::SendSetTitle(const cCompositeChat & a_Title)
+{
+ SendSetRawTitle(a_Title.CreateJsonString(false));
+}
+
+
+
+
+
+void cProtocol180::SendSetRawTitle(const AString & a_Title)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x45); // Title packet
+ Pkt.WriteVarInt32(0); // Set title
+
+ Pkt.WriteString(a_Title);
+}
+
+
+
+
+
void cProtocol180::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
{
ASSERT(m_State == 3); // In game mode?
@@ -1374,6 +1498,22 @@ void cProtocol180::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cProtocol180::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x45); // Title packet
+ Pkt.WriteVarInt32(2); // Set title display times
+
+ Pkt.WriteBEInt32(a_FadeInTicks);
+ Pkt.WriteBEInt32(a_DisplayTicks);
+ Pkt.WriteBEInt32(a_FadeOutTicks);
+}
+
+
+
+
+
void cProtocol180::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
{
ASSERT(m_State == 3); // In game mode?
@@ -1575,7 +1715,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
// Compress the data:
char CompressedData[MAX_COMPRESSED_PACKET_LEN];
- uLongf CompressedSize = compressBound(a_Packet.size());
+ uLongf CompressedSize = compressBound(static_cast<uLongf>(a_Packet.size()));
if (CompressedSize >= MAX_COMPRESSED_PACKET_LEN)
{
ASSERT(!"Too high packet size.");
@@ -1584,7 +1724,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
int Status = compress2(
reinterpret_cast<Bytef *>(CompressedData), &CompressedSize,
- reinterpret_cast<const Bytef *>(a_Packet.data()), a_Packet.size(), Z_DEFAULT_COMPRESSION
+ reinterpret_cast<const Bytef *>(a_Packet.data()), static_cast<uLongf>(a_Packet.size()), Z_DEFAULT_COMPRESSION
);
if (Status != Z_OK)
{
@@ -1597,7 +1737,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
Buffer.ReadAll(LengthData);
Buffer.CommitRead();
- Buffer.WriteVarInt32(CompressedSize + LengthData.size());
+ Buffer.WriteVarInt32(static_cast<UInt32>(CompressedSize + LengthData.size()));
Buffer.WriteVarInt32(static_cast<UInt32>(a_Packet.size()));
Buffer.ReadAll(LengthData);
Buffer.CommitRead();
@@ -1770,7 +1910,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
AString UncompressedData;
if (m_State == 3)
{
- UInt32 NumBytesRead = m_ReceivedData.GetReadableSpace();
+ UInt32 NumBytesRead = static_cast<UInt32>(m_ReceivedData.GetReadableSpace());
m_ReceivedData.ReadVarInt(CompressedSize);
if (CompressedSize > PacketLen)
{
@@ -1781,17 +1921,16 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
{
// Decompress the data:
AString CompressedData;
- if (!m_ReceivedData.ReadString(CompressedData, CompressedSize))
+ if (!m_ReceivedData.ReadString(CompressedData, CompressedSize) || (InflateString(CompressedData.data(), CompressedSize, UncompressedData) != Z_OK))
{
m_Client->Kick("Compression failure");
return;
}
- InflateString(CompressedData.data(), CompressedSize, UncompressedData);
- PacketLen = UncompressedData.size();
+ PacketLen = static_cast<UInt32>(UncompressedData.size());
}
else
{
- NumBytesRead -= m_ReceivedData.GetReadableSpace(); // How many bytes has the CompressedSize taken up?
+ NumBytesRead -= static_cast<UInt32>(m_ReceivedData.GetReadableSpace()); // How many bytes has the CompressedSize taken up?
ASSERT(PacketLen > NumBytesRead);
PacketLen -= NumBytesRead;
}
@@ -2265,7 +2404,7 @@ void cProtocol180::HandlePacketCreativeInventoryAction(cByteBuffer & a_ByteBuffe
{
return;
}
- m_Client->HandleCreativeInventory(SlotNum, Item, (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftClickOutside : caLeftClick);
+ m_Client->HandleCreativeInventory(SlotNum, Item, (SlotNum == -1) ? caLeftClickOutside : caLeftClick);
}
@@ -2553,7 +2692,7 @@ void cProtocol180::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer)
case 0x0206: Action = caNumber7; break;
case 0x0207: Action = caNumber8; break;
case 0x0208: Action = caNumber9; break;
- case 0x0300: Action = caMiddleClick; break;
+ case 0x0302: Action = caMiddleClick; break;
case 0x0400: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftClickOutsideHoldNothing : caDropKey; break;
case 0x0401: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caRightClickOutsideHoldNothing : caCtrlDropKey; break;
case 0x0500: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftPaintBegin : caUnknown; break;
@@ -3202,7 +3341,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(Bat.IsHanging() ? 1 : 0);
break;
} // case mtBat
-
+
case mtCreeper:
{
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
@@ -3212,7 +3351,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(Creeper.IsCharged() ? 1 : 0);
break;
} // case mtCreeper
-
+
case mtEnderman:
{
auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
@@ -3224,7 +3363,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(Enderman.IsScreaming() ? 1 : 0);
break;
} // case mtEnderman
-
+
case mtGhast:
{
auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
@@ -3232,7 +3371,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(Ghast.IsCharging());
break;
} // case mtGhast
-
+
case mtHorse:
{
auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
@@ -3249,10 +3388,6 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
{
Flags |= 0x08;
}
- if (Horse.IsBaby())
- {
- Flags |= 0x10;
- }
if (Horse.IsEating())
{
Flags |= 0x20;
@@ -3276,6 +3411,9 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEInt32(Appearance);
a_Pkt.WriteBEUInt8(0x56); // Int at index 22
a_Pkt.WriteBEInt32(Horse.GetHorseArmour());
+
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Horse.GetAge());
break;
} // case mtHorse
@@ -3287,17 +3425,38 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
break;
} // case mtMagmaCube
+ case mtOcelot:
+ {
+ auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Ocelot.GetAge());
+ break;
+ } // case mtOcelot
+
case mtPig:
{
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Pig.GetAge());
a_Pkt.WriteBEUInt8(0x10);
a_Pkt.WriteBEUInt8(Pig.IsSaddled() ? 1 : 0);
break;
} // case mtPig
-
+
+ case mtRabbit:
+ {
+ auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Rabbit.GetAge());
+ break;
+ } // case mtRabbit
+
case mtSheep:
{
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Sheep.GetAge());
+
a_Pkt.WriteBEUInt8(0x10);
Byte SheepMetadata = 0;
SheepMetadata = Sheep.GetFurColor();
@@ -3308,7 +3467,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(SheepMetadata);
break;
} // case mtSheep
-
+
case mtSkeleton:
{
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
@@ -3316,7 +3475,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(Skeleton.IsWither() ? 1 : 0);
break;
} // case mtSkeleton
-
+
case mtSlime:
{
auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
@@ -3330,9 +3489,11 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
a_Pkt.WriteBEUInt8(0x50);
a_Pkt.WriteBEInt32(Villager.GetVilType());
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Villager.GetAge());
break;
} // case mtVillager
-
+
case mtWitch:
{
auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
@@ -3350,7 +3511,7 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEFloat(static_cast<float>(a_Mob.GetHealth()));
break;
} // case mtWither
-
+
case mtWolf:
{
auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
@@ -3376,20 +3537,31 @@ void cProtocol180::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob)
a_Pkt.WriteBEUInt8(Wolf.IsBegging() ? 1 : 0);
a_Pkt.WriteBEUInt8(0x14);
a_Pkt.WriteBEUInt8(Wolf.GetCollarColor());
+
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(Wolf.GetAge());
break;
} // case mtWolf
-
+
case mtZombie:
{
auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
- a_Pkt.WriteBEUInt8(Zombie.IsBaby() ? 1 : 0);
+ a_Pkt.WriteBEInt8(Zombie.IsBaby() ? 1 : -1);
a_Pkt.WriteBEUInt8(0x0d);
a_Pkt.WriteBEUInt8(Zombie.IsVillagerZombie() ? 1 : 0);
a_Pkt.WriteBEUInt8(0x0e);
a_Pkt.WriteBEUInt8(Zombie.IsConverting() ? 1 : 0);
break;
} // case mtZombie
+
+ case mtZombiePigman:
+ {
+ auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
+ a_Pkt.WriteBEUInt8(0x0c);
+ a_Pkt.WriteBEInt8(ZombiePigman.IsBaby() ? 1 : -1);
+ break;
+ } // case mtZombiePigman
} // switch (a_Mob.GetType())
}
diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol18x.h
index 21024d702..36ed251fe 100644
--- a/src/Protocol/Protocol18x.h
+++ b/src/Protocol/Protocol18x.h
@@ -67,6 +67,12 @@ public:
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
virtual void SendChat (const AString & a_Message) override;
virtual void SendChat (const cCompositeChat & a_Message) override;
+ virtual void SendChatAboveActionBar (const AString & a_Message) override;
+ virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) override;
+ virtual void SendChatSystem (const AString & a_Message) override;
+ virtual void SendChatSystem (const cCompositeChat & a_Message) override;
+ virtual void SendChatType (const AString & a_Message, eChatType type) override;
+ virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) override;
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override;
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
@@ -85,6 +91,7 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
+ virtual void SendHideTitle (void) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
@@ -109,6 +116,7 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
+ virtual void SendResetTitle (void) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
virtual void SendExperience (void) override;
@@ -116,6 +124,10 @@ public:
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
+ virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) override;
+ virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
+ virtual void SendSetTitle (const cCompositeChat & a_Title) override;
+ virtual void SendSetRawTitle (const AString & a_Title) override;
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
virtual void SendSpawnMob (const cMonster & a_Mob) override;
@@ -125,6 +137,7 @@ public:
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index e7f7a4526..c89c745a4 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -158,6 +158,66 @@ void cProtocolRecognizer::SendChat(const cCompositeChat & a_Message)
+void cProtocolRecognizer::SendChatAboveActionBar(const AString & a_Message)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendChatAboveActionBar(a_Message);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendChatAboveActionBar(const cCompositeChat & a_Message)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendChatAboveActionBar(a_Message);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendChatSystem(const AString & a_Message)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendChatSystem(a_Message);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendChatSystem(const cCompositeChat & a_Message)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendChatSystem(a_Message);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendChatType(const AString & a_Message, eChatType type)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendChatType(a_Message, type);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendChatType(const cCompositeChat & a_Message, eChatType type)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendChatType(a_Message, type);
+}
+
+
+
+
+
void cProtocolRecognizer::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
{
ASSERT(m_Protocol != nullptr);
@@ -350,6 +410,16 @@ void cProtocolRecognizer::SendHealth(void)
+void cProtocolRecognizer::SendHideTitle(void)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendHideTitle();
+}
+
+
+
+
+
void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value)
{
ASSERT(m_Protocol != nullptr);
@@ -599,6 +669,16 @@ void cProtocolRecognizer::SendRemoveEntityEffect(const cEntity & a_Entity, int a
+void cProtocolRecognizer::SendResetTitle(void)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendResetTitle();
+}
+
+
+
+
+
void cProtocolRecognizer::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks)
{
ASSERT(m_Protocol != nullptr);
@@ -659,6 +739,46 @@ void cProtocolRecognizer::SendDisplayObjective(const AString & a_Objective, cSco
+void cProtocolRecognizer::SendSetSubTitle(const cCompositeChat & a_SubTitle)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendSetSubTitle(a_SubTitle);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendSetRawSubTitle(const AString & a_SubTitle)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendSetRawSubTitle(a_SubTitle);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendSetTitle(const cCompositeChat & a_Title)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendSetTitle(a_Title);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendSetRawTitle(const AString & a_Title)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendSetRawTitle(a_Title);
+}
+
+
+
+
+
void cProtocolRecognizer::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
{
ASSERT(m_Protocol != nullptr);
@@ -759,6 +879,16 @@ void cProtocolRecognizer::SendThunderbolt(int a_BlockX, int a_BlockY, int a_Bloc
+void cProtocolRecognizer::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendTitleTimes(a_FadeInTicks, a_DisplayTicks, a_FadeOutTicks);
+}
+
+
+
+
+
void cProtocolRecognizer::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle)
{
ASSERT(m_Protocol != nullptr);
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index 6c2185d6d..29eddcbc9 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -55,6 +55,12 @@ public:
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
virtual void SendChat (const AString & a_Message) override;
virtual void SendChat (const cCompositeChat & a_Message) override;
+ virtual void SendChatAboveActionBar (const AString & a_Message) override;
+ virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) override;
+ virtual void SendChatSystem (const AString & a_Message) override;
+ virtual void SendChatSystem (const cCompositeChat & a_Message) override;
+ virtual void SendChatType (const AString & a_Message, eChatType type) override;
+ virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) override;
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override;
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
@@ -73,6 +79,7 @@ public:
virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override;
virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
+ virtual void SendHideTitle (void) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
@@ -97,12 +104,17 @@ public:
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override;
+ virtual void SendResetTitle (void) override;
virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override;
virtual void SendExperience (void) override;
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
+ virtual void SendSetSubTitle (const cCompositeChat & a_SubTitle) override;
+ virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
+ virtual void SendSetTitle (const cCompositeChat & a_Title) override;
+ virtual void SendSetRawTitle (const AString & a_Title) override;
virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
@@ -113,6 +125,7 @@ public:
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
virtual void SendTeleportEntity (const cEntity & a_Entity) override;
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
diff --git a/src/RCONServer.cpp b/src/RCONServer.cpp
index 685bd92f5..c5dc9b69b 100644
--- a/src/RCONServer.cpp
+++ b/src/RCONServer.cpp
@@ -134,15 +134,15 @@ cRCONServer::~cRCONServer()
-void cRCONServer::Initialize(cIniFile & a_IniFile)
+void cRCONServer::Initialize(cSettingsRepositoryInterface & a_Settings)
{
- if (!a_IniFile.GetValueSetB("RCON", "Enabled", false))
+ if (!a_Settings.GetValueSetB("RCON", "Enabled", false))
{
return;
}
// Read the password, don't allow an empty one:
- m_Password = a_IniFile.GetValueSet("RCON", "Password", "");
+ m_Password = a_Settings.GetValueSet("RCON", "Password", "");
if (m_Password.empty())
{
LOGWARNING("RCON is requested, but the password is not set. RCON is now disabled.");
@@ -150,7 +150,7 @@ void cRCONServer::Initialize(cIniFile & a_IniFile)
}
// Read the listening ports for RCON from config:
- AStringVector Ports = ReadUpgradeIniPorts(a_IniFile, "RCON", "Ports", "PortsIPv4", "PortsIPv6", "25575");
+ AStringVector Ports = ReadUpgradeIniPorts(a_Settings, "RCON", "Ports", "PortsIPv4", "PortsIPv6", "25575");
// Start listening on each specified port:
for (auto port: Ports)
diff --git a/src/RCONServer.h b/src/RCONServer.h
index 352fa7b50..ecd936eeb 100644
--- a/src/RCONServer.h
+++ b/src/RCONServer.h
@@ -17,7 +17,7 @@
// fwd:
class cServer;
-class cIniFile;
+class cSettingsRepositoryInterface;
@@ -29,7 +29,7 @@ public:
cRCONServer(cServer & a_Server);
virtual ~cRCONServer();
- void Initialize(cIniFile & a_IniFile);
+ void Initialize(cSettingsRepositoryInterface & a_Settings);
protected:
friend class cRCONCommandOutput;
@@ -61,7 +61,7 @@ protected:
// cTCPLink::cCallbacks overrides:
- virtual void OnLinkCreated(cTCPLinkPtr a_Link);
+ virtual void OnLinkCreated(cTCPLinkPtr a_Link) override;
virtual void OnReceivedData(const char * a_Data, size_t a_Length) override;
virtual void OnRemoteClosed(void) override;
virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override;
diff --git a/src/Root.cpp b/src/Root.cpp
index 349608e8d..3ba391b7f 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -19,6 +19,11 @@
#include "LoggerListeners.h"
#include "BuildInfo.h"
#include "IniFile.h"
+#include "SettingsRepositoryInterface.h"
+#include "OverridesSettingsRepository.h"
+#include "SelfTests.h"
+
+#include <iostream>
#ifdef _WIN32
#include <conio.h>
@@ -70,7 +75,7 @@ cRoot::~cRoot()
void cRoot::InputThread(cRoot & a_Params)
{
cLogCommandOutputCallback Output;
-
+
while (!cRoot::m_ShouldStop && !a_Params.m_bRestart && !m_TerminateEventRaised && std::cin.good())
{
AString Command;
@@ -96,24 +101,29 @@ void cRoot::InputThread(cRoot & a_Params)
-void cRoot::Start(void)
+void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> overridesRepo)
{
#ifdef _WIN32
HWND hwnd = GetConsoleWindow();
HMENU hmenu = GetSystemMenu(hwnd, FALSE);
EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); // Disable close button when starting up; it causes problems with our CTRL-CLOSE handling
#endif
-
- cLogger::cListener * consoleLogListener = MakeConsoleListener();
+
+ cLogger::cListener * consoleLogListener = MakeConsoleListener(m_RunAsService);
cLogger::cListener * fileLogListener = new cFileListener();
cLogger::GetInstance().AttachListener(consoleLogListener);
cLogger::GetInstance().AttachListener(fileLogListener);
-
- LOG("--- Started Log ---\n");
+
+ LOG("--- Started Log ---");
#ifdef BUILD_ID
- LOG("MCServer " BUILD_SERIES_NAME " build id: " BUILD_ID);
- LOG("from commit id: " BUILD_COMMIT_ID " built at: " BUILD_DATETIME);
+ LOG("MCServer " BUILD_SERIES_NAME " build id: " BUILD_ID);
+ LOG("from commit id: " BUILD_COMMIT_ID " built at: " BUILD_DATETIME);
+ #endif
+
+ // Run the self-tests registered previously via cSelfTests::Register():
+ #ifdef SELF_TEST
+ cSelfTests::ExecuteAll();
#endif
cDeadlockDetect dd;
@@ -130,22 +140,24 @@ void cRoot::Start(void)
m_Server = new cServer();
LOG("Reading server config...");
- cIniFile IniFile;
- if (!IniFile.ReadFile("settings.ini"))
+
+ auto IniFile = cpp14::make_unique<cIniFile>();
+ if (!IniFile->ReadFile("settings.ini"))
{
LOGWARN("Regenerating settings.ini, all settings will be reset");
- IniFile.AddHeaderComment(" This is the main server configuration");
- IniFile.AddHeaderComment(" Most of the settings here can be configured using the webadmin interface, if enabled in webadmin.ini");
- IniFile.AddHeaderComment(" See: http://wiki.mc-server.org/doku.php?id=configure:settings.ini for further configuration help");
+ IniFile->AddHeaderComment(" This is the main server configuration");
+ IniFile->AddHeaderComment(" Most of the settings here can be configured using the webadmin interface, if enabled in webadmin.ini");
+ IniFile->AddHeaderComment(" See: http://wiki.mc-server.org/doku.php?id=configure:settings.ini for further configuration help");
}
+ auto settingsRepo = cpp14::make_unique<cOverridesSettingsRepository>(std::move(IniFile), std::move(overridesRepo));
LOG("Starting server...");
m_MojangAPI = new cMojangAPI;
- bool ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true);
- m_MojangAPI->Start(IniFile, ShouldAuthenticate); // Mojang API needs to be started before plugins, so that plugins may use it for DB upgrades on server init
- if (!m_Server->InitServer(IniFile, ShouldAuthenticate))
+ bool ShouldAuthenticate = settingsRepo->GetValueSetB("Authentication", "Authenticate", true);
+ m_MojangAPI->Start(*settingsRepo, ShouldAuthenticate); // Mojang API needs to be started before plugins, so that plugins may use it for DB upgrades on server init
+ if (!m_Server->InitServer(*settingsRepo, ShouldAuthenticate))
{
- IniFile.WriteFile("settings.ini");
+ settingsRepo->Flush();
LOGERROR("Failure starting server, aborting...");
return;
}
@@ -158,31 +170,31 @@ void cRoot::Start(void)
m_RankManager->Initialize(*m_MojangAPI);
m_CraftingRecipes = new cCraftingRecipes;
m_FurnaceRecipe = new cFurnaceRecipe();
-
+
LOGD("Loading worlds...");
- LoadWorlds(IniFile);
+ LoadWorlds(*settingsRepo);
LOGD("Loading plugin manager...");
m_PluginManager = new cPluginManager();
- m_PluginManager->ReloadPluginsNow(IniFile);
-
+ m_PluginManager->ReloadPluginsNow(*settingsRepo);
+
LOGD("Loading MonsterConfig...");
m_MonsterConfig = new cMonsterConfig;
// This sets stuff in motion
LOGD("Starting Authenticator...");
- m_Authenticator.Start(IniFile);
-
+ m_Authenticator.Start(*settingsRepo);
+
LOGD("Starting worlds...");
StartWorlds();
-
- if (IniFile.GetValueSetB("DeadlockDetect", "Enabled", true))
+
+ if (settingsRepo->GetValueSetB("DeadlockDetect", "Enabled", true))
{
LOGD("Starting deadlock detector...");
- dd.Start(IniFile.GetValueSetI("DeadlockDetect", "IntervalSec", 20));
+ dd.Start(settingsRepo->GetValueSetI("DeadlockDetect", "IntervalSec", 20));
}
-
- IniFile.WriteFile("settings.ini");
+
+ settingsRepo->Flush();
LOGD("Finalising startup...");
if (m_Server->Start())
@@ -203,6 +215,10 @@ void cRoot::Start(void)
#endif
LOG("Startup complete, took %ldms!", static_cast<long int>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - BeginTime).count()));
+
+ // Save the current time
+ m_StartTime = std::chrono::steady_clock::now();
+
#ifdef _WIN32
EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
#endif
@@ -247,9 +263,9 @@ void cRoot::Start(void)
delete m_FurnaceRecipe; m_FurnaceRecipe = nullptr;
delete m_CraftingRecipes; m_CraftingRecipes = nullptr;
- LOGD("Unloading worlds...");
+ LOG("Unloading worlds...");
UnloadWorlds();
-
+
LOGD("Stopping plugin manager...");
delete m_PluginManager; m_PluginManager = nullptr;
@@ -260,9 +276,9 @@ void cRoot::Start(void)
LOG("Shutdown successful!");
}
-
+
LOG("--- Stopped Log ---");
-
+
cLogger::GetInstance().DetachListener(consoleLogListener);
delete consoleLogListener;
cLogger::GetInstance().DetachListener(fileLogListener);
@@ -282,30 +298,29 @@ void cRoot::LoadGlobalSettings()
-void cRoot::LoadWorlds(cIniFile & IniFile)
+void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings)
{
// First get the default world
- AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
+ AString DefaultWorldName = a_Settings.GetValueSet("Worlds", "DefaultWorld", "world");
m_pDefaultWorld = new cWorld(DefaultWorldName.c_str());
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
// Then load the other worlds
- int KeyNum = IniFile.FindKey("Worlds");
- int NumWorlds = IniFile.GetNumValues(KeyNum);
- if (NumWorlds <= 0)
+ auto Worlds = a_Settings.GetValues("Worlds");
+ if (Worlds.size() <= 0)
{
return;
}
-
+
bool FoundAdditionalWorlds = false;
- for (int i = 0; i < NumWorlds; i++)
+ for (auto WorldNameValue : Worlds)
{
- AString ValueName = IniFile.GetValueName(KeyNum, i);
+ AString ValueName = WorldNameValue.first;
if (ValueName.compare("World") != 0)
{
continue;
}
- AString WorldName = IniFile.GetValue(KeyNum, i);
+ AString WorldName = WorldNameValue.second;
if (WorldName.empty())
{
continue;
@@ -317,10 +332,10 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
if (!FoundAdditionalWorlds)
{
- if (IniFile.GetKeyComment("Worlds", 0) != " World=secondworld")
+ if (a_Settings.GetKeyComment("Worlds", 0) != " World=secondworld")
{
- IniFile.DeleteKeyComment("Worlds", 0);
- IniFile.AddKeyComment("Worlds", " World=secondworld");
+ a_Settings.DeleteKeyComment("Worlds", 0);
+ a_Settings.AddKeyComment("Worlds", " World=secondworld");
}
}
}
@@ -329,7 +344,7 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
-cWorld * cRoot::CreateAndInitializeWorld(const AString & a_WorldName, eDimension a_Dimension, const AString & a_OverworldName)
+cWorld * cRoot::CreateAndInitializeWorld(const AString & a_WorldName, eDimension a_Dimension, const AString & a_OverworldName, bool a_InitSpawn)
{
cWorld * World = m_WorldsByName[a_WorldName];
if (World != nullptr)
@@ -340,7 +355,10 @@ cWorld * cRoot::CreateAndInitializeWorld(const AString & a_WorldName, eDimension
cWorld * NewWorld = new cWorld(a_WorldName.c_str(), a_Dimension, a_OverworldName);
m_WorldsByName[a_WorldName] = NewWorld;
NewWorld->Start();
- NewWorld->InitializeSpawn();
+ if (a_InitSpawn)
+ {
+ NewWorld->InitializeSpawn();
+ }
m_PluginManager->CallHookWorldStarted(*NewWorld);
return NewWorld;
}
@@ -551,6 +569,23 @@ void cRoot::SaveAllChunks(void)
+void cRoot::SendPlayerLists(cPlayer * a_DestPlayer)
+{
+ for (const auto & itr : m_WorldsByName)
+ {
+ itr.second->SendPlayerList(a_DestPlayer);
+ } // for itr - m_WorldsByName[]
+}
+
+
+
+void cRoot::BroadcastPlayerListsAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
+{
+ for (const auto & itr : m_WorldsByName)
+ {
+ itr.second->BroadcastPlayerListAddPlayer(a_Player);
+ } // for itr - m_WorldsByName[]
+}
void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix)
@@ -575,8 +610,6 @@ void cRoot::BroadcastChat(const cCompositeChat & a_Message)
-
-
bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2)
@@ -851,3 +884,4 @@ int cRoot::GetFurnaceFuelBurnTime(const cItem & a_Fuel)
+
diff --git a/src/Root.h b/src/Root.h
index e0b6cf26c..0eae21384 100644
--- a/src/Root.h
+++ b/src/Root.h
@@ -24,6 +24,7 @@ class cWorld;
class cPlayer;
class cCommandOutputCallback;
class cCompositeChat;
+class cSettingsRepositoryInterface;
typedef cItemCallback<cPlayer> cPlayerListCallback;
typedef cItemCallback<cWorld> cWorldListCallback;
@@ -37,7 +38,7 @@ namespace Json
-/// The root of the object hierarchy
+/** The root of the object hierarchy */
// tolua_begin
class cRoot
{
@@ -53,7 +54,7 @@ public:
cRoot(void);
~cRoot();
- void Start(void);
+ void Start(std::unique_ptr<cSettingsRepositoryInterface> overridesRepo);
// tolua_begin
cServer * GetServer(void) { return m_Server; }
@@ -68,23 +69,32 @@ public:
The dimension parameter is used to create a world with a specific dimension
a_OverworldName should be set for non-overworld dimensions if one wishes that world to link back to an overworld via portals
*/
- cWorld * CreateAndInitializeWorld(const AString & a_WorldName, eDimension a_Dimension = dimOverworld, const AString & a_OverworldName = "");
+ cWorld * CreateAndInitializeWorld(const AString & a_WorldName, eDimension a_Dimension = dimOverworld, const AString & a_OverworldName = "", bool a_InitSpawn = true);
+
+ /** Returns the up time of the server in seconds */
+ int GetServerUpTime(void)
+ {
+ return static_cast<int>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - m_StartTime).count());
+ }
// tolua_end
-
+
/// Calls the callback for each world; returns true if the callback didn't abort (return true)
bool ForEachWorld(cWorldListCallback & a_Callback); // >> Exported in ManualBindings <<
-
+
/// Writes chunkstats, for each world and totals, to the output callback
void LogChunkStats(cCommandOutputCallback & a_Output);
-
+
cMonsterConfig * GetMonsterConfig(void) { return m_MonsterConfig; }
cCraftingRecipes * GetCraftingRecipes(void) { return m_CraftingRecipes; } // tolua_export
cFurnaceRecipe * GetFurnaceRecipe (void) { return m_FurnaceRecipe; } // Exported in ManualBindings.cpp with quite a different signature
-
+
/// Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel
static int GetFurnaceFuelBurnTime(const cItem & a_Fuel); // tolua_export
-
+
+ /** The current time where the startup of the server has been completed */
+ std::chrono::steady_clock::time_point m_StartTime;
+
cWebAdmin * GetWebAdmin (void) { return m_WebAdmin; } // tolua_export
cPluginManager * GetPluginManager (void) { return m_PluginManager; } // tolua_export
cAuthenticator & GetAuthenticator (void) { return m_Authenticator; }
@@ -97,32 +107,32 @@ public:
"stop" and "restart" commands have special handling.
*/
void QueueExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
-
+
/** Queues a console command for execution through the cServer class.
The command will be executed in the tick thread
The command's output will be sent to console
"stop" and "restart" commands have special handling.
*/
void QueueExecuteConsoleCommand(const AString & a_Cmd); // tolua_export
-
+
/// Executes a console command through the cServer class; does special handling for "stop" and "restart".
void ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
-
+
/// Kicks the user, no matter in what world they are. Used from cAuthenticator
void KickUser(int a_ClientID, const AString & a_Reason);
-
+
/// Called by cAuthenticator to auth the specified user
void AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID, const Json::Value & a_Properties);
-
+
/// Executes commands queued in the command queue
void TickCommands(void);
/// Returns the number of chunks loaded
int GetTotalChunkCount(void); // tolua_export
-
+
/// Saves all chunks in all worlds
void SaveAllChunks(void); // tolua_export
-
+
/// Calls the callback for each player in all worlds
bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
@@ -131,12 +141,18 @@ public:
/** Finds the player over his uuid and calls the callback */
bool DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
-
+
/** Finds the player using it's complete username and calls the callback */
bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback);
-
+
+ /** Send playerlist of all worlds to player */
+ void SendPlayerLists(cPlayer * a_DestPlayer);
+
+ /** Broadcast Player through all worlds */
+ void BroadcastPlayerListsAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
+
// tolua_begin
-
+
/// Sends a chat message to all connected clients (in all worlds)
void BroadcastChat (const AString & a_Message, eMessageType a_ChatPrefix = mtCustom);
void BroadcastChat (const cCompositeChat & a_Message);
@@ -148,18 +164,18 @@ public:
void BroadcastChatLeave (const AString & a_Message) { BroadcastChat(a_Message, mtLeave); }
void BroadcastChatSuccess(const AString & a_Message) { BroadcastChat(a_Message, mtSuccess); }
void BroadcastChatWarning(const AString & a_Message) { BroadcastChat(a_Message, mtWarning); }
-
+
/// Returns the textual description of the protocol version: 49 -> "1.4.4". Provided specifically for Lua API
static AString GetProtocolVersionTextFromInt(int a_ProtocolVersionNum);
-
+
/// Returns the amount of virtual RAM used, in KiB. Returns a negative number on error
static int GetVirtualRAMUsage(void);
-
+
/// Returns the amount of virtual RAM used, in KiB. Returns a negative number on error
static int GetPhysicalRAMUsage(void);
-
+
// tolua_end
-
+
private:
class cCommand
{
@@ -169,17 +185,17 @@ private:
m_Output(a_Output)
{
}
-
+
AString m_Command;
cCommandOutputCallback * m_Output;
} ;
-
+
typedef std::map<AString, cWorld *> WorldMap;
typedef std::vector<cCommand> cCommandQueue;
cWorld * m_pDefaultWorld;
WorldMap m_WorldsByName;
-
+
cCriticalSection m_CSPendingCommands;
cCommandQueue m_PendingCommands;
@@ -201,23 +217,24 @@ private:
bool m_bRestart;
+
void LoadGlobalSettings();
/// Loads the worlds from settings.ini, creates the worldmap
- void LoadWorlds(cIniFile & IniFile);
-
+ void LoadWorlds(cSettingsRepositoryInterface & a_Settings);
+
/// Starts each world's life
void StartWorlds(void);
-
+
/// Stops each world's threads, so that it's safe to unload them
void StopWorlds(void);
-
+
/// Unloads all worlds from memory
void UnloadWorlds(void);
-
+
/// Does the actual work of executing a command
void DoExecuteConsoleCommand(const AString & a_Cmd);
-
+
static cRoot * s_Root;
static void InputThread(cRoot & a_Params);
@@ -226,3 +243,4 @@ private:
+
diff --git a/src/Scoreboard.cpp b/src/Scoreboard.cpp
index a4a4c3391..9f251ab94 100644
--- a/src/Scoreboard.cpp
+++ b/src/Scoreboard.cpp
@@ -276,7 +276,7 @@ size_t cTeam::GetNumPlayers(void) const
cScoreboard::cScoreboard(cWorld * a_World) : m_World(a_World)
{
- for (int i = 0; i < (int) dsCount; ++i)
+ for (int i = 0; i < static_cast<int>(dsCount); ++i)
{
m_Display[i] = nullptr;
}
@@ -323,11 +323,11 @@ bool cScoreboard::RemoveObjective(const AString & a_Name)
ASSERT(m_World != nullptr);
m_World->BroadcastScoreboardObjective(it->second.GetName(), it->second.GetDisplayName(), 1);
- for (unsigned int i = 0; i < (unsigned int) dsCount; ++i)
+ for (unsigned int i = 0; i < static_cast<unsigned int>(dsCount); ++i)
{
if (m_Display[i] == &it->second)
{
- SetDisplay(nullptr, (eDisplaySlot) i);
+ SetDisplay(nullptr, static_cast<eDisplaySlot>(i));
}
}
@@ -557,14 +557,14 @@ void cScoreboard::SendTo(cClientHandle & a_Client)
it->second.SendTo(a_Client);
}
- for (int i = 0; i < (int) dsCount; ++i)
+ for (int i = 0; i < static_cast<int>(dsCount); ++i)
{
// Avoid race conditions
cObjective * Objective = m_Display[i];
if (Objective)
{
- a_Client.SendDisplayObjective(Objective->GetName(), (eDisplaySlot) i);
+ a_Client.SendDisplayObjective(Objective->GetName(), static_cast<eDisplaySlot>(i));
}
}
}
diff --git a/src/SelfTests.cpp b/src/SelfTests.cpp
new file mode 100644
index 000000000..7e35e675e
--- /dev/null
+++ b/src/SelfTests.cpp
@@ -0,0 +1,71 @@
+
+// SelfTests.h
+
+// Implements the cSelfTests class representing the singleton used for registering self-tests
+// This class is only declared if SELF_TEST macro is defined.
+
+#include "Globals.h"
+#include "SelfTests.h"
+
+
+
+
+
+#ifdef SELF_TEST
+ cSelfTests::cSelfTests(void):
+ m_AllowRegistering(true)
+ {
+ }
+
+
+
+
+
+ cSelfTests & cSelfTests::Get(void)
+ {
+ static cSelfTests singleton;
+ return singleton;
+ }
+
+
+
+
+
+ void cSelfTests::Register(cSelfTests::SelfTestFunction a_FnToExecute, const AString & a_TestName)
+ {
+ ASSERT(Get().m_AllowRegistering);
+ Get().m_SelfTests.push_back(std::make_pair(a_FnToExecute, a_TestName));
+ }
+
+
+
+
+
+ void cSelfTests::ExecuteAll(void)
+ {
+ Get().m_AllowRegistering = false;
+ LOG("--- Performing self-tests ---");
+ for (auto & test: Get().m_SelfTests)
+ {
+ LOG("Performing self-test: %s", test.second.c_str());
+ try
+ {
+ test.first();
+ }
+ catch (const std::exception & exc)
+ {
+ LOGWARNING("Exception in test %s: %s", test.second.c_str(), exc.what());
+ }
+ catch (...)
+ {
+ LOGWARNING("Unknown exception in test %s", test.second.c_str());
+ }
+ } // for test - m_SelfTests[]
+ LOG("--- Self-tests finished ---");
+ }
+
+#endif // SELF_TEST
+
+
+
+
diff --git a/src/SelfTests.h b/src/SelfTests.h
new file mode 100644
index 000000000..03a3b5faa
--- /dev/null
+++ b/src/SelfTests.h
@@ -0,0 +1,51 @@
+
+// SelfTests.h
+
+// Declares the cSelfTests class representing the singleton used for registering self-tests
+// This class is only declared if SELF_TEST macro is defined.
+
+
+
+
+
+#pragma once
+
+
+
+
+
+#ifdef SELF_TEST
+ /** Singleton containing registered self-tests.
+ Used to schedule self-tests to run after the logging framework is initialized (#2228). */
+ class cSelfTests
+ {
+ public:
+ /** Returns the singleton instance of this class. */
+ static cSelfTests & Get(void);
+
+ // typedef void (* SelfTestFunction)(void);
+ typedef std::function<void(void)> SelfTestFunction;
+
+ /** Registers a self-test to be executed once the logging framework is initialized. */
+ static void Register(SelfTestFunction a_FnToExecute, const AString & a_TestName);
+
+ /** Executes all the registered self-tests. */
+ static void ExecuteAll(void);
+
+ protected:
+ typedef std::vector<std::pair<SelfTestFunction, AString>> SelfTestFunctions;
+
+ /** Functions (registered self-tests) to call once the logging framework is initialized. */
+ SelfTestFunctions m_SelfTests;
+
+ /** If true, tests may be registered. Set to false once the tests are executed, to detect tests that are registered too late. */
+ bool m_AllowRegistering;
+
+
+ cSelfTests(void);
+ };
+#endif // SELF_TEST
+
+
+
+
diff --git a/src/Server.cpp b/src/Server.cpp
index 996de2695..fd3188b18 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -72,7 +72,7 @@ class cServerListenCallbacks:
virtual void OnAccepted(cTCPLink & a_Link) override {}
- virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg)
+ virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override
{
LOGWARNING("Cannot listen on port %d: %d (%s).", m_Port, a_ErrorCode, a_ErrorMsg.c_str());
}
@@ -185,12 +185,12 @@ void cServer::PlayerDestroying(const cPlayer * a_Player)
-bool cServer::InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth)
+bool cServer::InitServer(cSettingsRepositoryInterface & a_Settings, bool a_ShouldAuth)
{
- m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!");
- m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
- m_bIsHardcore = a_SettingsIni.GetValueSetB("Server", "HardcoreEnabled", false);
- m_bAllowMultiLogin = a_SettingsIni.GetValueSetB("Server", "AllowMultiLogin", false);
+ m_Description = a_Settings.GetValueSet("Server", "Description", "MCServer - in C++!");
+ m_MaxPlayers = a_Settings.GetValueSetI("Server", "MaxPlayers", 100);
+ m_bIsHardcore = a_Settings.GetValueSetB("Server", "HardcoreEnabled", false);
+ m_bAllowMultiLogin = a_Settings.GetValueSetB("Server", "AllowMultiLogin", false);
m_PlayerCount = 0;
m_PlayerCountDiff = 0;
@@ -205,9 +205,9 @@ bool cServer::InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth)
LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
- m_Ports = ReadUpgradeIniPorts(a_SettingsIni, "Server", "Ports", "Port", "PortsIPv6", "25565");
+ m_Ports = ReadUpgradeIniPorts(a_Settings, "Server", "Ports", "Port", "PortsIPv6", "25565");
- m_RCONServer.Initialize(a_SettingsIni);
+ m_RCONServer.Initialize(a_Settings);
m_bIsConnected = true;
@@ -226,16 +226,16 @@ bool cServer::InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth)
}
// Check if both BungeeCord and online mode are on, if so, warn the admin:
- m_ShouldAllowBungeeCord = a_SettingsIni.GetValueSetB("Authentication", "AllowBungeeCord", false);
+ m_ShouldAllowBungeeCord = a_Settings.GetValueSetB("Authentication", "AllowBungeeCord", false);
if (m_ShouldAllowBungeeCord && m_ShouldAuthenticate)
{
LOGWARNING("WARNING: BungeeCord is allowed and server set to online mode. This is unsafe and will not work properly. Disable either authentication or BungeeCord in settings.ini.");
}
- m_ShouldLoadOfflinePlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false);
- m_ShouldLoadNamedPlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadNamedPlayerData", true);
+ m_ShouldLoadOfflinePlayerData = a_Settings.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false);
+ m_ShouldLoadNamedPlayerData = a_Settings.GetValueSetB("PlayerData", "LoadNamedPlayerData", true);
- m_ClientViewDistance = a_SettingsIni.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE);
+ m_ClientViewDistance = a_Settings.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE);
if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE)
{
m_ClientViewDistance = cClientHandle::MIN_VIEW_DISTANCE;
diff --git a/src/Server.h b/src/Server.h
index 1f30295b7..4d0bc1c18 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -38,8 +38,8 @@ class cClientHandle;
typedef SharedPtr<cClientHandle> cClientHandlePtr;
typedef std::list<cClientHandlePtr> cClientHandlePtrs;
typedef std::list<cClientHandle *> cClientHandles;
-class cIniFile;
class cCommandOutputCallback;
+class cSettingsRepositoryInterface;
namespace Json
@@ -58,7 +58,7 @@ public:
// tolua_end
virtual ~cServer() {}
- bool InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth);
+ bool InitServer(cSettingsRepositoryInterface & a_Settings, bool a_ShouldAuth);
// tolua_begin
diff --git a/src/SettingsRepositoryInterface.h b/src/SettingsRepositoryInterface.h
new file mode 100644
index 000000000..443b90ff5
--- /dev/null
+++ b/src/SettingsRepositoryInterface.h
@@ -0,0 +1,61 @@
+
+#pragma once
+
+class cSettingsRepositoryInterface
+{
+public:
+
+ enum errors
+ {
+ noID = -1,
+ };
+
+ virtual ~cSettingsRepositoryInterface() = default;
+
+ /** Returns true iff the specified key exists */
+ virtual bool KeyExists(const AString keyname) const = 0;
+
+ /** Returns true iff the specified value exists. */
+ virtual bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const = 0;
+
+ /** Add a key name. Return value is not required to mean anything **/
+ virtual int AddKeyName(const AString & keyname) = 0;
+
+ /** Add a key comment, will always fail if the repository does not support comments **/
+ virtual bool AddKeyComment(const AString & keyname, const AString & comment) = 0;
+
+ /** Return a key comment, returns "" for repositories that do not return comments **/
+ virtual AString GetKeyComment(const AString & keyname, const int commentID) const = 0;
+
+ /** Delete a key comment, will always fail if the repository does not support comments **/
+ virtual bool DeleteKeyComment(const AString & keyname, const int commentID) = 0;
+
+ /** Adds a new value to the specified key.
+ If a value of the same name already exists, creates another one **/
+ virtual void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value) = 0;
+
+ /** returns a vector containing a name, value pair for each value under the key **/
+ virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) = 0;
+
+ /** Get the value at the specified key and value, returns defValue on failure **/
+ virtual AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const = 0;
+
+ /** Gets the value; if not found, write the default to the repository **/
+ virtual AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "") = 0;
+ virtual int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0) = 0;
+ virtual Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0) = 0;
+ virtual bool GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false) = 0;
+
+ /** Overwrites the value of the key, value pair
+ Specify the optional parameter as false if you do not want the value created if it doesn't exist.
+ Returns true if value set, false otherwise. **/
+ virtual bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true) = 0;
+ virtual bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true) = 0;
+
+ /** Deletes the specified key, value pair **/
+ virtual bool DeleteValue(const AString & keyname, const AString & valuename) = 0;
+
+
+ /** Writes the changes to the backing store, if the repository has one **/
+ virtual bool Flush() = 0;
+};
diff --git a/src/Simulator/CMakeLists.txt b/src/Simulator/CMakeLists.txt
index 5aa406717..5ac39bb0f 100644
--- a/src/Simulator/CMakeLists.txt
+++ b/src/Simulator/CMakeLists.txt
@@ -31,6 +31,13 @@ SET (HDRS
VanillaFluidSimulator.h
VaporizeFluidSimulator.h)
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(FireSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion")
+ set_source_files_properties(FluidSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shadow")
+ set_source_files_properties(IncrementalRedstoneSimulator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Simulator ${SRCS} ${HDRS})
endif()
diff --git a/src/Simulator/DelayedFluidSimulator.cpp b/src/Simulator/DelayedFluidSimulator.cpp
index 0973962b6..e0da3ff61 100644
--- a/src/Simulator/DelayedFluidSimulator.cpp
+++ b/src/Simulator/DelayedFluidSimulator.cpp
@@ -99,8 +99,8 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ,
return;
}
- void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
- cDelayedFluidSimulatorChunkData * ChunkData = (cDelayedFluidSimulatorChunkData *)ChunkDataRaw;
+ auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
+ cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw);
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_AddSlotNum];
// Add, if not already present:
@@ -132,8 +132,8 @@ void cDelayedFluidSimulator::Simulate(float a_Dt)
void cDelayedFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
{
- void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
- cDelayedFluidSimulatorChunkData * ChunkData = (cDelayedFluidSimulatorChunkData *)ChunkDataRaw;
+ auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
+ cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw);
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum];
// Simulate all the blocks in the scheduled slot:
@@ -148,7 +148,7 @@ void cDelayedFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a
{
SimulateBlock(a_Chunk, itr->x, itr->y, itr->z);
}
- m_TotalBlocks -= (int)Blocks.size();
+ m_TotalBlocks -= static_cast<int>(Blocks.size());
Blocks.clear();
}
}
diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp
index a9481edb0..69c46f090 100644
--- a/src/Simulator/FloodyFluidSimulator.cpp
+++ b/src/Simulator/FloodyFluidSimulator.cpp
@@ -255,7 +255,14 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
);
a_NearChunk->SetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0);
- a_NearChunk->BroadcastSoundEffect("random.fizz", (double)BlockX, (double)a_RelY, (double)BlockZ, 0.5f, 1.5f);
+ a_NearChunk->BroadcastSoundEffect(
+ "random.fizz",
+ static_cast<double>(BlockX),
+ static_cast<double>(a_RelY),
+ static_cast<double>(BlockZ),
+ 0.5f,
+ 1.5f
+ );
return;
}
}
@@ -270,7 +277,14 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
);
a_NearChunk->SetBlock(a_RelX, a_RelY, a_RelZ, NewBlock, 0);
- a_NearChunk->BroadcastSoundEffect("random.fizz", (double)BlockX, (double)a_RelY, (double)BlockZ, 0.5f, 1.5f);
+ a_NearChunk->BroadcastSoundEffect(
+ "random.fizz",
+ static_cast<double>(BlockX),
+ static_cast<double>(a_RelY),
+ static_cast<double>(BlockZ),
+ 0.5f,
+ 1.5f
+ );
return;
}
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index 7f320af0d..7d9cc93b2 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -3,11 +3,10 @@
#include "BlockEntities/ChestEntity.h"
-typedef cItemCallback<cChestEntity> cChestCallback;
-
#include "Chunk.h"
#include "World.h"
#include "Blocks/GetHandlerCompileTimeTemplate.h"
+#include "Blocks/BlockComparator.h"
#include "Blocks/BlockTorch.h"
#include "Blocks/BlockLever.h"
#include "Blocks/BlockButton.h"
@@ -25,41 +24,42 @@ typedef cItemCallback<cChestEntity> cChestCallback;
-void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk, cChunk * a_OtherChunk)
+void cIncrementalRedstoneSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk)
{
- if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
+ AddBlock(cChunkDef::AbsoluteToRelative({ a_BlockX, a_BlockY, a_BlockZ }, a_Chunk->GetPosX(), a_Chunk->GetPosZ()), a_Chunk, nullptr);
+}
+
+
+
+
+
+void cIncrementalRedstoneSimulator::AddBlock(const Vector3i & a_RelBlockPosition, cChunk * a_OriginalChunk, cChunk * a_NeighborChunk)
+{
+ if ((a_OriginalChunk == nullptr) || !a_OriginalChunk->IsValid())
{
return;
}
- else if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
+ else if ((a_RelBlockPosition.y < 0) || (a_RelBlockPosition.y >= cChunkDef::Height))
{
return;
}
- // We may be called with coordinates in a chunk that is not the first chunk parameter
- // In that case, the actual chunk (which the coordinates are in), will be passed as the second parameter
- // Use that Chunk pointer to get a relative position
+ // The relative block position is relative to the neighboring chunk should it be passed as an argument
- int RelX = 0;
- int RelZ = 0;
BLOCKTYPE Block;
NIBBLETYPE Meta;
- if (a_OtherChunk != nullptr)
+ if (a_NeighborChunk != nullptr)
{
- RelX = a_BlockX - a_OtherChunk->GetPosX() * cChunkDef::Width;
- RelZ = a_BlockZ - a_OtherChunk->GetPosZ() * cChunkDef::Width;
- a_OtherChunk->GetBlockTypeMeta(RelX, a_BlockY, RelZ, Block, Meta);
+ a_NeighborChunk->UnboundedRelGetBlock(a_RelBlockPosition.x, a_RelBlockPosition.y, a_RelBlockPosition.z, Block, Meta);
- // If a_OtherChunk is passed (not nullptr), it is the chunk that had a block change, and a_Chunk will be the neighbouring chunk of that block
+ // If a_OtherChunk is passed (not nullptr), it is the neighbouring chunk of a_Chunk, which itself is the chunk with the block change
// Because said neighbouring chunk does not know of this change but still needs to update its redstone, we set it to dirty
- a_Chunk->SetIsRedstoneDirty(true);
+ a_NeighborChunk->SetIsRedstoneDirty(true);
}
else
{
- RelX = a_BlockX - a_Chunk->GetPosX() * cChunkDef::Width;
- RelZ = a_BlockZ - a_Chunk->GetPosZ() * cChunkDef::Width;
- a_Chunk->GetBlockTypeMeta(RelX, a_BlockY, RelZ, Block, Meta);
+ a_OriginalChunk->GetBlockTypeMeta(a_RelBlockPosition.x, a_RelBlockPosition.y, a_RelBlockPosition.z, Block, Meta);
}
// Every time a block is changed (AddBlock called), we want to go through all lists and check to see if the coordiantes stored within are still valid
@@ -77,68 +77,61 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
)
)
{
- SetSourceUnpowered(RelX, a_BlockY, RelZ, a_OtherChunk != nullptr ? a_OtherChunk : a_Chunk);
+ SetSourceUnpowered(a_RelBlockPosition.x, a_RelBlockPosition.y, a_RelBlockPosition.z, a_NeighborChunk != nullptr ? a_NeighborChunk : a_OriginalChunk);
}
if (!IsViableMiddleBlock(Block))
{
- SetInvalidMiddleBlock(RelX, a_BlockY, RelZ, a_OtherChunk != nullptr ? a_OtherChunk : a_Chunk);
+ SetInvalidMiddleBlock(a_RelBlockPosition.x, a_RelBlockPosition.y, a_RelBlockPosition.z, a_NeighborChunk != nullptr ? a_NeighborChunk : a_OriginalChunk);
}
- auto & SimulatedPlayerToggleableBlocks = ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData())->m_SimulatedPlayerToggleableBlocks;
- SimulatedPlayerToggleableBlocks.erase(std::remove_if(SimulatedPlayerToggleableBlocks.begin(), SimulatedPlayerToggleableBlocks.end(), [RelX, a_BlockY, RelZ, Block, this](const sSimulatedPlayerToggleableList & itr)
- {
- return itr.a_RelBlockPos.Equals(Vector3i(RelX, a_BlockY, RelZ)) && !IsAllowedBlock(Block);
- }
- ), SimulatedPlayerToggleableBlocks.end());
-
-
- auto & RepeatersDelayList = ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData())->m_RepeatersDelayList;
- RepeatersDelayList.erase(std::remove_if(RepeatersDelayList.begin(), RepeatersDelayList.end(), [RelX, a_BlockY, RelZ, Block](const sRepeatersDelayList & itr)
- {
- return itr.a_RelBlockPos.Equals(Vector3i(RelX, a_BlockY, RelZ)) && (Block != E_BLOCK_REDSTONE_REPEATER_ON) && (Block != E_BLOCK_REDSTONE_REPEATER_OFF);
- }
- ), RepeatersDelayList.end());
-
- if (a_OtherChunk != nullptr)
+ if (a_NeighborChunk != nullptr)
{
// DO NOT touch our chunk's data structure if we are being called with coordinates from another chunk - this one caused me massive grief :P
return;
}
+ auto RedstoneSimulatorData = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_OriginalChunk->GetRedstoneSimulatorData());
- cCoordWithBlockAndBoolVector & RedstoneSimulatorChunkData = ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData())->m_ChunkData;
- for (auto & itr : RedstoneSimulatorChunkData)
+ auto & SimulatedPlayerToggleableBlocks = RedstoneSimulatorData->m_SimulatedPlayerToggleableBlocks;
+ if (DoesIgnorePlayerToggle(Block))
{
- if ((itr.x == RelX) && (itr.y == a_BlockY) && (itr.z == RelZ)) // We are at an entry matching the current (changed) block
- {
- if (!IsAllowedBlock(Block))
- {
- itr.DataTwo = true; // The new blocktype is not redstone; it must be queued to be removed from this list
- }
- else
- {
- itr.DataTwo = false;
- itr.Data = Block; // Update block information
- }
- return;
- }
+ // Initialise the toggleable blocks list so that trapdoors etc. aren't reset on restart (#1887)
+ SimulatedPlayerToggleableBlocks.emplace(
+ a_RelBlockPosition,
+ AreCoordsDirectlyPowered(a_RelBlockPosition.x, a_RelBlockPosition.y, a_RelBlockPosition.z, a_OriginalChunk) || AreCoordsLinkedPowered(a_RelBlockPosition.x, a_RelBlockPosition.y, a_RelBlockPosition.z, a_OriginalChunk)
+ ); // This map won't insert if key already present, so no need to check
+ }
+ else
+ {
+ SimulatedPlayerToggleableBlocks.erase(a_RelBlockPosition);
}
+ if ((Block != E_BLOCK_REDSTONE_REPEATER_ON) && (Block != E_BLOCK_REDSTONE_REPEATER_OFF))
+ {
+ RedstoneSimulatorData->m_RepeatersDelayList.erase(a_RelBlockPosition);
+ }
+
+ auto & RedstoneSimulatorChunkData = RedstoneSimulatorData->m_ChunkData;
+ auto Iterator = RedstoneSimulatorChunkData.find(a_RelBlockPosition);
if (!IsAllowedBlock(Block))
{
+ if (Iterator != RedstoneSimulatorChunkData.end())
+ {
+ Iterator->second.second = true; // The new blocktype is not redstone; it must be queued to be removed from this list
+ }
return;
}
-
- cCoordWithBlockAndBoolVector & QueuedData = ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData())->m_QueuedChunkData;
- for (const auto & itr : QueuedData)
+ else
{
- if ((itr.x == RelX) && (itr.y == a_BlockY) && (itr.z == RelZ))
+ if (Iterator != RedstoneSimulatorChunkData.end())
{
- // Can't have duplicates in here either, in case something adds the block again before the structure can written to the main chunk data
+ Iterator->second.second = false; // De-schedule removal from list
+ Iterator->second.first = Block; // Update block information
return;
}
}
- QueuedData.emplace_back(cCoordWithBlockAndBool(RelX, a_BlockY, RelZ, Block, false));
+
+ RedstoneSimulatorChunkData.emplace(a_RelBlockPosition, std::make_pair(Block, false));
}
@@ -147,25 +140,17 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
{
- m_RedstoneSimulatorChunkData = (cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData();
+ m_RedstoneSimulatorChunkData = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk->GetRedstoneSimulatorData());
if (m_RedstoneSimulatorChunkData == nullptr)
{
m_RedstoneSimulatorChunkData = new cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData();
a_Chunk->SetRedstoneSimulatorData(m_RedstoneSimulatorChunkData);
}
- if (m_RedstoneSimulatorChunkData->m_ChunkData.empty() && ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData())->m_QueuedChunkData.empty())
+ if (m_RedstoneSimulatorChunkData->m_ChunkData.empty())
{
return;
}
- m_RedstoneSimulatorChunkData->m_ChunkData.insert(
- m_RedstoneSimulatorChunkData->m_ChunkData.end(),
- m_RedstoneSimulatorChunkData->m_QueuedChunkData.begin(),
- m_RedstoneSimulatorChunkData->m_QueuedChunkData.end()
- );
-
- m_RedstoneSimulatorChunkData->m_QueuedChunkData.clear();
-
m_PoweredBlocks = &m_RedstoneSimulatorChunkData->m_PoweredBlocks;
m_RepeatersDelayList = &m_RedstoneSimulatorChunkData->m_RepeatersDelayList;
m_SimulatedPlayerToggleableBlocks = &m_RedstoneSimulatorChunkData->m_SimulatedPlayerToggleableBlocks;
@@ -185,24 +170,25 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt
for (auto dataitr = m_RedstoneSimulatorChunkData->m_ChunkData.begin(); dataitr != m_RedstoneSimulatorChunkData->m_ChunkData.end();)
{
- if (dataitr->DataTwo)
+ if (dataitr->second.second)
{
+ // Removal was scheduled - do so
dataitr = m_RedstoneSimulatorChunkData->m_ChunkData.erase(dataitr);
continue;
}
- switch (dataitr->Data)
+ switch (dataitr->second.first) // Call the appropriate simulator for the entry's block type
{
- case E_BLOCK_DAYLIGHT_SENSOR: HandleDaylightSensor(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_TRIPWIRE: HandleTripwire(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_TRIPWIRE_HOOK: HandleTripwireHook(dataitr->x, dataitr->y, dataitr->z); break;
+ case E_BLOCK_DAYLIGHT_SENSOR: HandleDaylightSensor(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_TRIPWIRE: HandleTripwire(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_TRIPWIRE_HOOK: HandleTripwireHook(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
case E_BLOCK_WOODEN_PRESSURE_PLATE:
case E_BLOCK_STONE_PRESSURE_PLATE:
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE:
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE:
{
- HandlePressurePlate(dataitr->x, dataitr->y, dataitr->z, dataitr->Data);
+ HandlePressurePlate(dataitr->first.x, dataitr->first.y, dataitr->first.z, dataitr->second.first);
break;
}
default: break;
@@ -210,23 +196,23 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt
if (ShouldUpdateSimulateOnceBlocks)
{
- switch (dataitr->Data)
+ switch (dataitr->second.first)
{
- case E_BLOCK_REDSTONE_WIRE: HandleRedstoneWire(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_COMMAND_BLOCK: HandleCommandBlock(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_NOTE_BLOCK: HandleNoteBlock(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_BLOCK_OF_REDSTONE: HandleRedstoneBlock(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_LEVER: HandleRedstoneLever(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_TNT: HandleTNT(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_IRON_TRAPDOOR: HandleTrapdoor(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_TRAPDOOR: HandleTrapdoor(dataitr->x, dataitr->y, dataitr->z); break;
- case E_BLOCK_TRAPPED_CHEST: HandleTrappedChest(dataitr->x, dataitr->y, dataitr->z); break;
+ case E_BLOCK_REDSTONE_WIRE: HandleRedstoneWire(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_COMMAND_BLOCK: HandleCommandBlock(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_NOTE_BLOCK: HandleNoteBlock(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_BLOCK_OF_REDSTONE: HandleRedstoneBlock(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_LEVER: HandleRedstoneLever(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_TNT: HandleTNT(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_IRON_TRAPDOOR: HandleTrapdoor(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_TRAPDOOR: HandleTrapdoor(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
+ case E_BLOCK_TRAPPED_CHEST: HandleTrappedChest(dataitr->first.x, dataitr->first.y, dataitr->first.z); break;
case E_BLOCK_ACTIVATOR_RAIL:
case E_BLOCK_DETECTOR_RAIL:
case E_BLOCK_POWERED_RAIL:
{
- HandleRail(dataitr->x, dataitr->y, dataitr->z, dataitr->Data);
+ HandleRail(dataitr->first.x, dataitr->first.y, dataitr->first.z, dataitr->second.first);
break;
}
case E_BLOCK_ACACIA_DOOR:
@@ -237,7 +223,7 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt
case E_BLOCK_WOODEN_DOOR:
case E_BLOCK_IRON_DOOR:
{
- HandleDoor(dataitr->x, dataitr->y, dataitr->z);
+ HandleDoor(dataitr->first.x, dataitr->first.y, dataitr->first.z);
break;
}
case E_BLOCK_ACACIA_FENCE_GATE:
@@ -247,43 +233,49 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt
case E_BLOCK_JUNGLE_FENCE_GATE:
case E_BLOCK_SPRUCE_FENCE_GATE:
{
- HandleFenceGate(dataitr->x, dataitr->y, dataitr->z);
+ HandleFenceGate(dataitr->first.x, dataitr->first.y, dataitr->first.z);
break;
}
case E_BLOCK_REDSTONE_LAMP_OFF:
case E_BLOCK_REDSTONE_LAMP_ON:
{
- HandleRedstoneLamp(dataitr->x, dataitr->y, dataitr->z, dataitr->Data);
+ HandleRedstoneLamp(dataitr->first.x, dataitr->first.y, dataitr->first.z, dataitr->second.first);
break;
}
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
{
- HandleDropSpenser(dataitr->x, dataitr->y, dataitr->z);
+ HandleDropSpenser(dataitr->first.x, dataitr->first.y, dataitr->first.z);
break;
}
case E_BLOCK_PISTON:
case E_BLOCK_STICKY_PISTON:
{
- HandlePiston(dataitr->x, dataitr->y, dataitr->z);
+ HandlePiston(dataitr->first.x, dataitr->first.y, dataitr->first.z);
break;
}
case E_BLOCK_REDSTONE_REPEATER_OFF:
case E_BLOCK_REDSTONE_REPEATER_ON:
{
- HandleRedstoneRepeater(dataitr->x, dataitr->y, dataitr->z, dataitr->Data);
+ HandleRedstoneRepeater(dataitr->first.x, dataitr->first.y, dataitr->first.z, dataitr->second.first);
break;
}
case E_BLOCK_REDSTONE_TORCH_OFF:
case E_BLOCK_REDSTONE_TORCH_ON:
{
- HandleRedstoneTorch(dataitr->x, dataitr->y, dataitr->z, dataitr->Data);
+ HandleRedstoneTorch(dataitr->first.x, dataitr->first.y, dataitr->first.z, dataitr->second.first);
break;
}
case E_BLOCK_STONE_BUTTON:
case E_BLOCK_WOODEN_BUTTON:
{
- HandleRedstoneButton(dataitr->x, dataitr->y, dataitr->z);
+ HandleRedstoneButton(dataitr->first.x, dataitr->first.y, dataitr->first.z);
+ break;
+ }
+ case E_BLOCK_ACTIVE_COMPARATOR:
+ case E_BLOCK_INACTIVE_COMPARATOR:
+ {
+ HandleRedstoneComparator(dataitr->first.x, dataitr->first.y, dataitr->first.z);
break;
}
default: break;
@@ -299,23 +291,14 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt
void cIncrementalRedstoneSimulator::WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk)
{
- if (AreCoordsOnChunkBoundary(a_BlockX, a_BlockY, a_BlockZ))
- {
- // On a chunk boundary, alert all four sides (i.e. at least one neighbouring chunk)
- AddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk);
+ auto CurrentChunkRelative = cChunkDef::AbsoluteToRelative({a_BlockX, a_BlockY, a_BlockZ}, a_Chunk->GetPosX(), a_Chunk->GetPosZ());
+ AddBlock(CurrentChunkRelative, a_Chunk); // Alert the current chunk which the block is present in
- // Pass the original coordinates, because when adding things to our simulator lists, we get the chunk that they are in, and therefore any updates need to preseve their position
- // RedstoneAddBlock to pass both the neighbouring chunk and the chunk which the coordinates are in and +- 2 in GetNeighbour() to accomodate for LinkedPowered blocks being 2 away from chunk boundaries
- RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk->GetNeighborChunk(a_BlockX - 2, a_BlockZ), a_Chunk);
- RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk->GetNeighborChunk(a_BlockX + 2, a_BlockZ), a_Chunk);
- RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk->GetNeighborChunk(a_BlockX, a_BlockZ - 2), a_Chunk);
- RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk->GetNeighborChunk(a_BlockX, a_BlockZ + 2), a_Chunk);
-
- return;
+ for (const auto & BoundaryChunk : GetAdjacentChunks(CurrentChunkRelative, a_Chunk))
+ {
+ // On a chunk boundary, alert all neighbouring chunks which may have a connection with this block
+ AddBlock(cChunkDef::AbsoluteToRelative({a_BlockX, a_BlockY, a_BlockZ}, BoundaryChunk->GetPosX(), BoundaryChunk->GetPosZ()), a_Chunk, BoundaryChunk);
}
-
- // Not on boundary, just alert this chunk for speed
- AddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk);
}
@@ -503,152 +486,278 @@ void cIncrementalRedstoneSimulator::HandleRedstoneButton(int a_RelBlockX, int a_
void cIncrementalRedstoneSimulator::HandleRedstoneWire(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
{
- static const struct // Define which directions the wire can receive power from
- {
- int x, y, z;
- } gCrossCoords[] =
+ static const eBlockFace BlockFaceOffsets[] =
{
- { 1, 0, 0 }, /* Wires on same level start */
- { -1, 0, 0 },
- { 0, 0, 1 },
- { 0, 0, -1 }, /* Wires on same level stop */
- { 1, 1, 0 }, /* Wires one higher, surrounding self start */
- { -1, 1, 0 },
- { 0, 1, 1 },
- { 0, 1, -1 }, /* Wires one higher, surrounding self stop */
- { 1, -1, 0 }, /* Wires one lower, surrounding self start */
- { -1, -1, 0 },
- { 0, -1, 1 },
- { 0, -1, -1 }, /* Wires one lower, surrounding self stop */
+ BLOCK_FACE_XM,
+ BLOCK_FACE_XP,
+ BLOCK_FACE_ZM,
+ BLOCK_FACE_ZP
};
- static const struct // Define which directions the wire will check for repeater prescence
+ static const Vector3i VectorOffsets[] =
{
- int x, y, z;
- } gSideCoords[] =
- {
- { 1, 0, 0 },
{ -1, 0, 0 },
- { 0, 0, 1 },
+ { 1, 0, 0 },
{ 0, 0, -1 },
- { 0, 1, 0 },
+ { 0, 0, 1 }
};
+ auto RelBlock = Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+
// Check to see if directly beside a power source
- unsigned char MyPower;
- if (!IsWirePowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower))
+ unsigned char MyPower = IsWirePowered(RelBlock, m_Chunk);
+ m_Chunk->SetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
+ if (MyPower == 0)
{
- m_Chunk->SetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, 0);
+ SetSourceUnpowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk);
return;
}
- m_Chunk->SetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
-
- if (MyPower < 1)
+ if (MyPower == MAX_POWER_LEVEL)
+ {
+ std::vector<std::pair<Vector3i, cChunk *>> PotentialWireList = { std::make_pair(RelBlock, m_Chunk) };
+ while (!PotentialWireList.empty())
+ {
+ auto Current = PotentialWireList.back();
+ PotentialWireList.pop_back();
+ FindAndPowerBorderingWires(PotentialWireList, Current.first, Current.second);
+ }
+ }
+ else if (MyPower == 1)
{
return;
}
+ // Wire still powered, power blocks beneath and in direction of facing
MyPower--;
- for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) // Loop through all directions to transfer or receive power
+ SetBlockPowered(a_RelBlockX, a_RelBlockY - 1, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_YM, MyPower);
+
+ int BorderingMechanismCount = 0;
+ bool RepeaterPresent = false;
+ Vector3i OffsetToPower;
+
+ for (const auto & Offset : VectorOffsets)
{
- if ((i >= 4) && (i <= 7)) // If we are currently checking for wire surrounding ourself one block above...
+ BLOCKTYPE Block;
+ Vector3i AdjustedOffset = RelBlock + Offset;
+ if (m_Chunk->UnboundedRelGetBlockType(AdjustedOffset.x, AdjustedOffset.y, AdjustedOffset.z, Block))
{
- BLOCKTYPE Type = 0;
- if (a_RelBlockY >= cChunkDef::Height - 1)
+ switch (Block)
{
- continue;
- }
- if (!m_Chunk->UnboundedRelGetBlockType(a_RelBlockX, a_RelBlockY + 1, a_RelBlockZ, Type))
- {
- continue;
- }
- if (cBlockInfo::IsSolid(Type)) // If there is something solid above us (wire cut off)...
- {
- continue; // We don't receive power from that wire
+ case E_BLOCK_REDSTONE_REPEATER_OFF:
+ {
+ BorderingMechanismCount++;
+ if (!RepeaterPresent)
+ {
+ // TODO: only if wire is actually connected to repeater (repeater facing right way)
+ RepeaterPresent = true;
+ OffsetToPower = { -Offset.x, Offset.y, -Offset.z }; // Negate to obtain offset in opposite direction since wire powers that way
+ }
+ SetBlockPowered(AdjustedOffset, RelBlock, MyPower);
+ }
+ case E_BLOCK_REDSTONE_TORCH_ON:
+ case E_BLOCK_REDSTONE_WIRE:
+ {
+ BorderingMechanismCount++;
+ if (!RepeaterPresent)
+ {
+ OffsetToPower = { -Offset.x, Offset.y, -Offset.z };
+ }
+ }
+ default: break;
}
}
- else if ((i >= 8) && (i <= 11)) // See above, but this is for wire below us
+ }
+
+ if (BorderingMechanismCount == 0)
+ {
+ SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ for (const auto & BlockFaceOffset : BlockFaceOffsets)
{
- BLOCKTYPE Type = 0;
- if (!m_Chunk->UnboundedRelGetBlockType(a_RelBlockX + gCrossCoords[i].x, a_RelBlockY, a_RelBlockZ + gCrossCoords[i].z, Type))
- {
- continue;
- }
- if (cBlockInfo::IsSolid(Type))
- {
- continue;
- }
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BlockFaceOffset, MyPower);
}
+ }
+ else if (BorderingMechanismCount == 1)
+ {
+ eBlockFace Face = BlockFaceOffsets[std::distance(VectorOffsets, std::find(VectorOffsets, VectorOffsets + ARRAYCOUNT(VectorOffsets), OffsetToPower))];
+ SetBlockPowered(RelBlock + OffsetToPower, RelBlock, MyPower);
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Face, MyPower);
+ }
+}
- BLOCKTYPE Type = 0;
- if (!m_Chunk->UnboundedRelGetBlockType(a_RelBlockX + gCrossCoords[i].x, a_RelBlockY + gCrossCoords[i].y, a_RelBlockZ + gCrossCoords[i].z, Type))
+
+
+
+
+void cIncrementalRedstoneSimulator::FindAndPowerBorderingWires(std::vector<std::pair<Vector3i, cChunk *>> & a_PotentialWireList, const Vector3i & a_EntryRelBlockPosition, cChunk * a_EntryChunk)
+{
+ static const Vector3i LevelOffsets[] = // Wires on same level
+ {
+ { 1, 0, 0 },
+ { -1, 0, 0 },
+ { 0, 0, 1 },
+ { 0, 0, -1 },
+ };
+ static const Vector3i HigherOffsets[] = // Wires one higher, surrounding self
+ {
+ { 1, 1, 0 },
+ { -1, 1, 0 },
+ { 0, 1, 1 },
+ { 0, 1, -1 },
+ };
+ static const Vector3i LowerOffsets[] = // Wires one lower, surrounding self
+ {
+ { 1, -1, 0 },
+ { -1, -1, 0 },
+ { 0, -1, 1 },
+ { 0, -1, -1 },
+ };
+
+ for (auto Offset : LevelOffsets)
+ {
+ auto AdjustedPos = a_EntryRelBlockPosition + Offset;
+ auto Neighbour = a_EntryChunk->GetRelNeighborChunkAdjustCoords(AdjustedPos.x, AdjustedPos.z);
+ auto MyPower = IsWirePowered(a_EntryRelBlockPosition, a_EntryChunk);
+
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
- continue;
+ return;
}
- if (Type == E_BLOCK_REDSTONE_WIRE)
+
+ if ((Neighbour->GetBlock(AdjustedPos) == E_BLOCK_REDSTONE_WIRE) && (MyPower > 1) && (MyPower > IsWirePowered(AdjustedPos, Neighbour)))
{
- SetBlockPowered(a_RelBlockX + gCrossCoords[i].x, a_RelBlockY + gCrossCoords[i].y, a_RelBlockZ + gCrossCoords[i].z, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
+ PowerBorderingWires(a_PotentialWireList, a_EntryRelBlockPosition, a_EntryChunk, AdjustedPos, Neighbour, MyPower);
}
}
- for (size_t i = 0; i < ARRAYCOUNT(gSideCoords); i++) // Look for repeaters immediately surrounding self and try to power them
+ for (auto Offset : HigherOffsets)
{
- BLOCKTYPE Type = 0;
- if (!m_Chunk->UnboundedRelGetBlockType(a_RelBlockX + gSideCoords[i].x, a_RelBlockY + gSideCoords[i].y, a_RelBlockZ + gSideCoords[i].z, Type))
+ auto AdjustedPos = a_EntryRelBlockPosition + Offset;
+ auto Neighbour = a_EntryChunk->GetRelNeighborChunkAdjustCoords(AdjustedPos.x, AdjustedPos.z);
+ auto MyPower = IsWirePowered(a_EntryRelBlockPosition, a_EntryChunk);
+
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
- continue;
+ return;
}
- if (Type == E_BLOCK_REDSTONE_REPEATER_OFF)
+
+ if (
+ (Neighbour->GetBlock(AdjustedPos) == E_BLOCK_REDSTONE_WIRE) &&
+ (!cBlockInfo::FullyOccupiesVoxel(a_EntryChunk->GetBlock(a_EntryRelBlockPosition.x, a_EntryRelBlockPosition.y + 1, a_EntryRelBlockPosition.z))) &&
+ (MyPower > 1) && (MyPower > IsWirePowered(AdjustedPos, Neighbour)))
{
- SetBlockPowered(a_RelBlockX + gSideCoords[i].x, a_RelBlockY + gSideCoords[i].y, a_RelBlockZ + gSideCoords[i].z, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
+ PowerBorderingWires(a_PotentialWireList, a_EntryRelBlockPosition, a_EntryChunk, AdjustedPos, Neighbour, MyPower);
}
}
- // Wire still powered, power blocks beneath
- SetBlockPowered(a_RelBlockX, a_RelBlockY - 1, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_YM, MyPower);
-
- switch (GetWireDirection(a_RelBlockX, a_RelBlockY, a_RelBlockZ))
+ for (auto Offset : LowerOffsets)
{
- case REDSTONE_NONE:
- {
- SetBlockPowered(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetBlockPowered(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetBlockPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetBlockPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
+ auto AdjustedPos = a_EntryRelBlockPosition + Offset;
+ auto Neighbour = a_EntryChunk->GetRelNeighborChunkAdjustCoords(AdjustedPos.x, AdjustedPos.z);
+ auto MyPower = IsWirePowered(a_EntryRelBlockPosition, a_EntryChunk);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_XM, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_XP, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_ZM, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_ZP, MyPower);
- break;
- }
- case REDSTONE_X_POS:
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
- SetBlockPowered(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_XP, MyPower);
- break;
+ return;
}
- case REDSTONE_X_NEG:
+
+ if (
+ (Neighbour->GetBlock(AdjustedPos) == E_BLOCK_REDSTONE_WIRE) &&
+ (!cBlockInfo::FullyOccupiesVoxel(Neighbour->GetBlock(AdjustedPos.x, AdjustedPos.y + 1, AdjustedPos.z))) &&
+ (MyPower > 1) && (MyPower > IsWirePowered(AdjustedPos, Neighbour)))
{
- SetBlockPowered(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_XM, MyPower);
- break;
+ PowerBorderingWires(a_PotentialWireList, a_EntryRelBlockPosition, a_EntryChunk, AdjustedPos, Neighbour, MyPower);
}
- case REDSTONE_Z_POS:
+ }
+}
+
+
+
+
+
+void cIncrementalRedstoneSimulator::PowerBorderingWires(std::vector<std::pair<Vector3i, cChunk *>> & a_PotentialWireList, const Vector3i & a_EntryRelSourcePosition, cChunk * a_EntryChunk, const Vector3i & a_AdjustedPos, cChunk * a_NeighbourChunk, unsigned char a_MyPower)
+{
+ auto SourcePos = a_EntryRelSourcePosition + Vector3i((a_EntryChunk->GetPosX() - a_NeighbourChunk->GetPosX()) * cChunkDef::Width, 0, (a_EntryChunk->GetPosZ() - a_NeighbourChunk->GetPosZ()) * cChunkDef::Width);
+ auto & PoweredBlocks = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_NeighbourChunk->GetRedstoneSimulatorData())->m_PoweredBlocks; // We need to insert the value into the chunk who owns the block position
+ auto Position = std::find_if(PoweredBlocks.begin(), PoweredBlocks.end(), [a_AdjustedPos, SourcePos, a_MyPower](const sPoweredBlocks & itr) { return ((itr.m_BlockPos == a_AdjustedPos) && (itr.m_SourcePos == SourcePos)); });
+ if (Position != PoweredBlocks.end())
+ {
+ Position->m_PowerLevel = a_MyPower - 1;
+ }
+ else
+ {
+ PoweredBlocks.emplace_back(a_AdjustedPos, SourcePos, a_MyPower - 1);
+
+ a_NeighbourChunk->SetIsRedstoneDirty(true);
+ m_Chunk->SetIsRedstoneDirty(true);
+ }
+
+ a_NeighbourChunk->SetMeta(a_AdjustedPos.x, a_AdjustedPos.y, a_AdjustedPos.z, a_MyPower - 1);
+ a_PotentialWireList.emplace_back(std::make_pair(a_AdjustedPos, a_NeighbourChunk));
+}
+
+
+
+
+
+void cIncrementalRedstoneSimulator::HandleRedstoneComparator(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
+{
+ auto Meta = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ auto HighestSidePower = std::max(IsWirePowered(AdjustRelativeCoords(cBlockComparatorHandler::GetSideCoordinate(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta & 0x3, false)), m_Chunk), IsWirePowered(AdjustRelativeCoords(cBlockComparatorHandler::GetSideCoordinate(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta & 0x3, true)), m_Chunk));
+ auto FrontCoordinate = AdjustRelativeCoords(cBlockComparatorHandler::GetFrontCoordinate(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta & 0x3));
+ unsigned char Power = 0;
+
+ class cContainerCallback : public cBlockEntityCallback
+ {
+ public:
+ cContainerCallback() : m_SignalStrength(0)
{
- SetBlockPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_ZP, MyPower);
- break;
}
- case REDSTONE_Z_NEG:
+
+ virtual bool Item(cBlockEntity * a_BlockEntity) override
{
- SetBlockPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, a_RelBlockX, a_RelBlockY, a_RelBlockZ, MyPower);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_ZM, MyPower);
- break;
+ auto & Contents = static_cast<cBlockEntityWithItems *>(a_BlockEntity)->GetContents();
+ float Fullness = 0; // Is a floating-point type to allow later calculation to produce a non-truncated value
+ for (int Slot = 0; Slot != Contents.GetNumSlots(); ++Slot)
+ {
+ Fullness += Contents.GetSlot(Slot).m_ItemCount / Contents.GetSlot(Slot).GetMaxStackSize();
+ }
+
+ m_SignalStrength = static_cast<unsigned char>(1 + (Fullness / Contents.GetNumSlots()) * 14);
+ return false;
}
+
+ unsigned char m_SignalStrength;
+ } CCB;
+
+ auto AbsoluteComparatorCoords = cChunkDef::RelativeToAbsolute(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ), m_Chunk->GetPosX(), m_Chunk->GetPosZ());
+ auto AbsoluteRearCoords = cBlockComparatorHandler::GetRearCoordinate(AbsoluteComparatorCoords.x, AbsoluteComparatorCoords.y, AbsoluteComparatorCoords.z, Meta & 0x3);
+
+ m_Chunk->DoWithBlockEntityAt(AbsoluteRearCoords.x, AbsoluteRearCoords.y, AbsoluteRearCoords.z, CCB);
+ auto RearPower = std::max(CCB.m_SignalStrength, IsWirePowered(AdjustRelativeCoords(cBlockComparatorHandler::GetRearCoordinate(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta & 0x3)), m_Chunk));
+
+ if ((Meta & 0x4) == 0x4)
+ {
+ // Subtraction mode
+ Power = std::max(static_cast<unsigned char>(RearPower - HighestSidePower), std::numeric_limits<unsigned char>::min());
+ }
+ else
+ {
+ // Comparison mode
+ Power = (std::max(HighestSidePower, RearPower) == HighestSidePower) ? 0 : RearPower;
+ }
+
+ if (Power > 0)
+ {
+ m_Chunk->SetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ) | 0x8);
+ SetBlockPowered(FrontCoordinate, Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ), Power);
+ }
+ else
+ {
+ m_Chunk->SetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ) & 0x7);
+ SetSourceUnpowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk);
}
}
@@ -680,19 +789,50 @@ void cIncrementalRedstoneSimulator::HandleRedstoneRepeater(int a_RelBlockX, int
*/
// Create a variable holding my meta to avoid multiple lookups.
- NIBBLETYPE a_Meta = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ NIBBLETYPE Meta = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
bool IsOn = (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON);
- if (!IsRepeaterLocked(a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_Meta)) // If we're locked, change nothing. Otherwise:
+ if (!IsRepeaterLocked(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta)) // If we're locked, change nothing. Otherwise:
{
- bool IsSelfPowered = IsRepeaterPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_Meta);
+ bool IsSelfPowered = IsRepeaterPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta);
if (IsSelfPowered && !IsOn) // Queue a power change if powered, but not on and not locked.
{
- QueueRepeaterPowerChange(a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_Meta, true);
+ QueueRepeaterPowerChange(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta, true);
}
else if (!IsSelfPowered && IsOn) // Queue a power change if unpowered, on, and not locked.
{
- QueueRepeaterPowerChange(a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_Meta, false);
+ QueueRepeaterPowerChange(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Meta, false);
+ }
+ }
+
+ if (IsOn)
+ {
+ switch (Meta & 0x3) // We only want the direction (bottom) bits
+ {
+ case 0x0:
+ {
+ SetBlockPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_ZM);
+ break;
+ }
+ case 0x1:
+ {
+ SetBlockPowered(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_XP);
+ break;
+ }
+ case 0x2:
+ {
+ SetBlockPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_ZP);
+ break;
+ }
+ case 0x3:
+ {
+ SetBlockPowered(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, a_RelBlockX, a_RelBlockY, a_RelBlockZ);
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, BLOCK_FACE_XM);
+ break;
+ }
}
}
}
@@ -702,60 +842,29 @@ void cIncrementalRedstoneSimulator::HandleRedstoneRepeaterDelays()
{
for (auto itr = m_RepeatersDelayList->begin(); itr != m_RepeatersDelayList->end();)
{
- if (itr->a_ElapsedTicks >= itr->a_DelayTicks) // Has the elapsed ticks reached the target ticks?
+ if (itr->second.a_ElapsedTicks >= itr->second.a_DelayTicks) // Has the elapsed ticks reached the target ticks?
{
- int RelBlockX = itr->a_RelBlockPos.x;
- int RelBlockY = itr->a_RelBlockPos.y;
- int RelBlockZ = itr->a_RelBlockPos.z;
BLOCKTYPE Block;
NIBBLETYPE Meta;
- m_Chunk->GetBlockTypeMeta(RelBlockX, RelBlockY, RelBlockZ, Block, Meta);
- if (itr->ShouldPowerOn)
+ m_Chunk->GetBlockTypeMeta(itr->first.x, itr->first.y, itr->first.z, Block, Meta);
+ if (itr->second.ShouldPowerOn)
{
if (Block != E_BLOCK_REDSTONE_REPEATER_ON) // For performance
{
- m_Chunk->SetBlock(itr->a_RelBlockPos, E_BLOCK_REDSTONE_REPEATER_ON, Meta);
- }
-
- switch (Meta & 0x3) // We only want the direction (bottom) bits
- {
- case 0x0:
- {
- SetBlockPowered(RelBlockX, RelBlockY, RelBlockZ - 1, RelBlockX, RelBlockY, RelBlockZ);
- SetDirectionLinkedPowered(RelBlockX, RelBlockY, RelBlockZ, BLOCK_FACE_ZM);
- break;
- }
- case 0x1:
- {
- SetBlockPowered(RelBlockX + 1, RelBlockY, RelBlockZ, RelBlockX, RelBlockY, RelBlockZ);
- SetDirectionLinkedPowered(RelBlockX, RelBlockY, RelBlockZ, BLOCK_FACE_XP);
- break;
- }
- case 0x2:
- {
- SetBlockPowered(RelBlockX, RelBlockY, RelBlockZ + 1, RelBlockX, RelBlockY, RelBlockZ);
- SetDirectionLinkedPowered(RelBlockX, RelBlockY, RelBlockZ, BLOCK_FACE_ZP);
- break;
- }
- case 0x3:
- {
- SetBlockPowered(RelBlockX - 1, RelBlockY, RelBlockZ, RelBlockX, RelBlockY, RelBlockZ);
- SetDirectionLinkedPowered(RelBlockX, RelBlockY, RelBlockZ, BLOCK_FACE_XM);
- break;
- }
+ m_Chunk->SetBlock(itr->first, E_BLOCK_REDSTONE_REPEATER_ON, Meta);
}
}
else if (Block != E_BLOCK_REDSTONE_REPEATER_OFF)
{
- m_Chunk->SetBlock(RelBlockX, RelBlockY, RelBlockZ, E_BLOCK_REDSTONE_REPEATER_OFF, Meta);
+ m_Chunk->SetBlock(itr->first.x, itr->first.y, itr->first.z, E_BLOCK_REDSTONE_REPEATER_OFF, Meta);
}
itr = m_RepeatersDelayList->erase(itr);
}
else
{
- LOGD("Incremented a repeater @ {%i %i %i} | Elapsed ticks: %i | Target delay: %i", itr->a_RelBlockPos.x, itr->a_RelBlockPos.y, itr->a_RelBlockPos.z, itr->a_ElapsedTicks, itr->a_DelayTicks);
- itr->a_ElapsedTicks++;
- itr++;
+ LOGD("Incremented a repeater @ {%i %i %i} | Elapsed ticks: %i | Target delay: %i", itr->first.x, itr->first.y, itr->first.z, itr->second.a_ElapsedTicks, itr->second.a_DelayTicks);
+ itr->second.a_ElapsedTicks++;
+ ++itr;
}
}
}
@@ -1017,19 +1126,19 @@ void cIncrementalRedstoneSimulator::HandleDaylightSensor(int a_RelBlockX, int a_
int ChunkX, ChunkZ;
cChunkDef::BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ);
- if (!this->m_World.IsChunkLighted(ChunkX, ChunkZ))
+ if (!m_World.IsChunkLighted(ChunkX, ChunkZ))
{
- this->m_World.QueueLightChunk(ChunkX, ChunkZ);
+ m_World.QueueLightChunk(ChunkX, ChunkZ);
}
else
{
- if (m_Chunk->GetTimeAlteredLight(this->m_World.GetBlockSkyLight(BlockX, a_RelBlockY + 1, BlockZ)) > 8)
+ if (m_Chunk->GetTimeAlteredLight(m_Chunk->GetSkyLight(a_RelBlockX, a_RelBlockY + 1, a_RelBlockZ)) > 8)
{
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
}
else
{
- WakeUp(BlockX, a_RelBlockY, BlockZ, m_Chunk);
+ SetSourceUnpowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk);
}
}
}
@@ -1452,30 +1561,18 @@ bool cIncrementalRedstoneSimulator::AreCoordsDirectlyPowered(int a_RelBlockX, in
{
// Torches want to access neighbour's data when on a wall, hence the extra chunk parameter
- for (const auto & itr : ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData())->m_PoweredBlocks) // Check powered list
- {
- if (itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
- {
- return true;
- }
- }
- return false;
+ const auto & Data = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk->GetRedstoneSimulatorData())->m_PoweredBlocks;
+ return std::find_if(Data.begin(), Data.end(), [a_RelBlockX, a_RelBlockY, a_RelBlockZ](const sPoweredBlocks & itr) { return itr.m_BlockPos == Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ); }) != Data.end();
}
-bool cIncrementalRedstoneSimulator::AreCoordsLinkedPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
+bool cIncrementalRedstoneSimulator::AreCoordsLinkedPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, cChunk * a_Chunk)
{
- for (const auto & itr : *m_LinkedPoweredBlocks) // Check linked powered list
- {
- if (itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
- {
- return true;
- }
- }
- return false;
+ const auto & Data = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk->GetRedstoneSimulatorData())->m_LinkedBlocks;
+ return std::find_if(Data.begin(), Data.end(), [a_RelBlockX, a_RelBlockY, a_RelBlockZ](const sLinkedPoweredBlocks & itr) { return itr.a_BlockPos == Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ); }) != Data.end();
}
@@ -1488,7 +1585,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
for (const auto & itr : *m_PoweredBlocks)
{
- if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
+ if (!itr.m_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
continue;
}
@@ -1498,7 +1595,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
case 0x0:
{
// Flip the coords to check the back of the repeater
- if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1))))
+ if (itr.m_SourcePos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1)))
{
return true;
}
@@ -1506,7 +1603,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
}
case 0x1:
{
- if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ))))
+ if (itr.m_SourcePos.Equals(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ)))
{
return true;
}
@@ -1514,7 +1611,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
}
case 0x2:
{
- if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1))))
+ if (itr.m_SourcePos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1)))
{
return true;
}
@@ -1522,7 +1619,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
}
case 0x3:
{
- if (itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ))))
+ if (itr.m_SourcePos.Equals(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ)))
{
return true;
}
@@ -1542,7 +1639,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
{
case 0x0:
{
- if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1))))
+ if (itr.a_MiddlePos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1)))
{
return true;
}
@@ -1550,7 +1647,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
}
case 0x1:
{
- if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ))))
+ if (itr.a_MiddlePos.Equals(Vector3i(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ)))
{
return true;
}
@@ -1558,7 +1655,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
}
case 0x2:
{
- if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1))))
+ if (itr.a_MiddlePos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1)))
{
return true;
}
@@ -1566,7 +1663,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_RelBlockX, int a_Rel
}
case 0x3:
{
- if (itr.a_MiddlePos.Equals(AdjustRelativeCoords(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ))))
+ if (itr.a_MiddlePos.Equals(Vector3i(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ)))
{
return true;
}
@@ -1667,7 +1764,7 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
for (const auto & itr : *m_PoweredBlocks)
{
- if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
+ if (!itr.m_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
continue;
}
@@ -1675,7 +1772,7 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
int X = a_RelBlockX, Z = a_RelBlockZ;
AddFaceDirection(X, a_RelBlockY, Z, Face);
- if (!itr.a_SourcePos.Equals(AdjustRelativeCoords(Vector3i(X, a_RelBlockY, Z))))
+ if (!itr.m_SourcePos.Equals(AdjustRelativeCoords(Vector3i(X, a_RelBlockY, Z))))
{
return true;
}
@@ -1702,35 +1799,35 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
-bool cIncrementalRedstoneSimulator::IsWirePowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, unsigned char & a_PowerLevel)
+unsigned char cIncrementalRedstoneSimulator::IsWirePowered(Vector3i a_RelBlockPosition, cChunk * a_Chunk)
{
- a_PowerLevel = 0;
+ unsigned char PowerLevel = 0;
- for (const auto & itr : *m_PoweredBlocks) // Check powered list
+ for (const auto & itr : static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk->GetRedstoneSimulatorData())->m_PoweredBlocks) // Check powered list
{
- if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
+ if (itr.m_BlockPos != a_RelBlockPosition)
{
continue;
}
- a_PowerLevel = std::max(itr.a_PowerLevel, a_PowerLevel); // Get the highest power level (a_PowerLevel is initialised already and there CAN be multiple levels for one block)
+ PowerLevel = std::max(itr.m_PowerLevel, PowerLevel); // Get the highest power level (a_PowerLevel is initialised already and there CAN be multiple levels for one block)
}
- for (const auto & itr : *m_LinkedPoweredBlocks) // Check linked powered list
+ for (const auto & itr : static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk->GetRedstoneSimulatorData())->m_LinkedBlocks) // Check linked powered list
{
- if (!itr.a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
+ if (itr.a_BlockPos != a_RelBlockPosition)
{
continue;
}
BLOCKTYPE Type = E_BLOCK_AIR;
- if (!m_Chunk->UnboundedRelGetBlockType(itr.a_SourcePos.x, itr.a_SourcePos.y, itr.a_SourcePos.z, Type) || (Type == E_BLOCK_REDSTONE_WIRE))
+ if (!a_Chunk->UnboundedRelGetBlockType(itr.a_SourcePos.x, itr.a_SourcePos.y, itr.a_SourcePos.z, Type) || (Type == E_BLOCK_REDSTONE_WIRE))
{
continue;
}
- a_PowerLevel = std::max(itr.a_PowerLevel, a_PowerLevel);
+ PowerLevel = std::max(itr.a_PowerLevel, PowerLevel);
}
- return (a_PowerLevel != 0); // Answer the inital question: is the wire powered?
+ return PowerLevel;
}
@@ -1741,9 +1838,9 @@ bool cIncrementalRedstoneSimulator::AreCoordsSimulated(int a_RelBlockX, int a_Re
{
for (const auto & itr : *m_SimulatedPlayerToggleableBlocks)
{
- if (itr.a_RelBlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
+ if (itr.first.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
{
- if (itr.WasLastStatePowered != IsCurrentStatePowered) // Was the last power state different to the current?
+ if (itr.second != IsCurrentStatePowered) // Was the last power state different to the current?
{
return false; // It was, coordinates are no longer simulated
}
@@ -1869,22 +1966,19 @@ void cIncrementalRedstoneSimulator::SetDirectionLinkedPowered(int a_RelBlockX, i
void cIncrementalRedstoneSimulator::SetAllDirsAsPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, unsigned char a_PowerLevel)
{
- static const struct
- {
- int x, y, z;
- } gCrossCoords[] =
- {
- { 1, 0, 0 },
- { -1, 0, 0 },
- { 0, 0, 1 },
- { 0, 0, -1 },
- { 0, 1, 0 },
- { 0, -1, 0 }
+ static const Vector3i Offsets[] =
+ {
+ {1, 0, 0},
+ { -1, 0, 0},
+ {0, 0, 1},
+ {0, 0, -1},
+ {0, 1, 0},
+ {0, -1, 0}
};
- for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) // Loop through struct to power all directions
+ for (auto Offset : Offsets) // Loop through struct to power all directions
{
- SetBlockPowered(a_RelBlockX + gCrossCoords[i].x, a_RelBlockY + gCrossCoords[i].y, a_RelBlockZ + gCrossCoords[i].z, a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_PowerLevel);
+ SetBlockPowered(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ) + Offset, Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ), a_PowerLevel);
}
}
@@ -1892,62 +1986,33 @@ void cIncrementalRedstoneSimulator::SetAllDirsAsPowered(int a_RelBlockX, int a_R
-void cIncrementalRedstoneSimulator::SetBlockPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, unsigned char a_PowerLevel)
+void cIncrementalRedstoneSimulator::SetBlockPowered(Vector3i a_RelBlockPosition, Vector3i a_RelSourcePosition, unsigned char a_PowerLevel)
{
- cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelBlockX, a_RelBlockZ); // Adjust coordinates for the later call using these values
+ cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelBlockPosition.x, a_RelBlockPosition.z); // Adjust coordinates for the later call using these values
if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
return;
}
+ a_RelSourcePosition.x += (m_Chunk->GetPosX() - Neighbour->GetPosX()) * cChunkDef::Width;
+ a_RelSourcePosition.z += (m_Chunk->GetPosZ() - Neighbour->GetPosZ()) * cChunkDef::Width;
- auto & Powered = ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)Neighbour->GetRedstoneSimulatorData())->m_PoweredBlocks; // We need to insert the value into the chunk who owns the block position
- for (auto itr = Powered.begin(); itr != Powered.end(); ++itr)
+ auto & Powered = static_cast<cIncrementalRedstoneSimulatorChunkData *>(Neighbour->GetRedstoneSimulatorData())->m_PoweredBlocks; // We need to insert the value into the chunk who owns the block position
+ for (auto & itr : Powered)
{
- if (
- itr->a_BlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)) &&
- itr->a_SourcePos.Equals(Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ))
- )
+ if ((itr.m_BlockPos == a_RelBlockPosition) && (itr.m_SourcePos == a_RelSourcePosition))
{
- // Check for duplicates, update power level, don't add a new listing
- itr->a_PowerLevel = a_PowerLevel;
- return;
- }
- }
-
- // No need to get neighbouring chunk as we can guarantee that when something is powering us, the entry will be in our chunk
- for (auto itr = m_PoweredBlocks->begin(); itr != m_PoweredBlocks->end(); ++itr)
- {
- if (
- itr->a_BlockPos.Equals(Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ)) &&
- itr->a_SourcePos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)) &&
- (m_Chunk->GetBlock(a_RelSourceX, a_RelSourceY, a_RelSourceZ) == E_BLOCK_REDSTONE_WIRE)
- )
- {
- BLOCKTYPE Block;
- NIBBLETYPE Meta;
- Neighbour->GetBlockTypeMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Block, Meta);
-
- if (Block == E_BLOCK_REDSTONE_WIRE)
+ if (itr.m_PowerLevel != a_PowerLevel)
{
- if (Meta < a_PowerLevel)
- {
- m_PoweredBlocks->erase(itr); // Powering source with higher power level, allow it
- break;
- }
- else
- {
- // Powered wires try to power their source - don't let them!
- return;
- }
+ // Update power level, don't add a new listing
+ Neighbour->SetIsRedstoneDirty(true);
+ m_Chunk->SetIsRedstoneDirty(true);
+ itr.m_PowerLevel = a_PowerLevel;
}
+ return;
}
}
- sPoweredBlocks RC;
- RC.a_BlockPos = Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
- RC.a_SourcePos = Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ);
- RC.a_PowerLevel = a_PowerLevel;
- Powered.emplace_back(RC);
+ Powered.emplace_back(a_RelBlockPosition, a_RelSourcePosition, a_PowerLevel);
Neighbour->SetIsRedstoneDirty(true);
m_Chunk->SetIsRedstoneDirty(true);
}
@@ -1969,13 +2034,16 @@ void cIncrementalRedstoneSimulator::SetBlockLinkedPowered(
}
cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelBlockX, a_RelBlockZ);
- m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelMiddleX, a_RelMiddleZ);
if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
return;
}
+ a_RelMiddleX += (m_Chunk->GetPosX() - Neighbour->GetPosX()) * cChunkDef::Width;
+ a_RelMiddleZ += (m_Chunk->GetPosZ() - Neighbour->GetPosZ()) * cChunkDef::Width;
+ a_RelSourceX += (m_Chunk->GetPosX() - Neighbour->GetPosX()) * cChunkDef::Width;
+ a_RelSourceZ += (m_Chunk->GetPosZ() - Neighbour->GetPosZ()) * cChunkDef::Width;
- auto & Linked = ((cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)Neighbour->GetRedstoneSimulatorData())->m_LinkedBlocks;
+ auto & Linked = static_cast<cIncrementalRedstoneSimulatorChunkData *>(Neighbour->GetRedstoneSimulatorData())->m_LinkedBlocks;
for (auto & itr : Linked) // Check linked powered list
{
if (
@@ -1984,8 +2052,13 @@ void cIncrementalRedstoneSimulator::SetBlockLinkedPowered(
itr.a_SourcePos.Equals(Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ))
)
{
- // Check for duplicates, update power level, don't add a new listing
- itr.a_PowerLevel = a_PowerLevel;
+ if (itr.a_PowerLevel != a_PowerLevel)
+ {
+ // Update power level, don't add a new listing
+ Neighbour->SetIsRedstoneDirty(true);
+ m_Chunk->SetIsRedstoneDirty(true);
+ itr.a_PowerLevel = a_PowerLevel;
+ }
return;
}
}
@@ -2004,130 +2077,110 @@ void cIncrementalRedstoneSimulator::SetBlockLinkedPowered(
-void cIncrementalRedstoneSimulator::SetPlayerToggleableBlockAsSimulated(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, bool WasLastStatePowered)
+void cIncrementalRedstoneSimulator::SetPlayerToggleableBlockAsSimulated(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, bool a_WasLastStatePowered)
{
- for (auto itr = m_SimulatedPlayerToggleableBlocks->begin(); itr != m_SimulatedPlayerToggleableBlocks->end(); ++itr)
- {
- if (!itr->a_RelBlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
- {
- continue;
- }
-
- if (itr->WasLastStatePowered != WasLastStatePowered)
- {
- // If power states different, update listing
- itr->WasLastStatePowered = WasLastStatePowered;
- return;
- }
- else
- {
- // If states the same, just ignore
- return;
- }
- }
-
- // We have arrive here; no block must be in list - add one
- sSimulatedPlayerToggleableList RC;
- RC.a_RelBlockPos = Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
- RC.WasLastStatePowered = WasLastStatePowered;
- m_SimulatedPlayerToggleableBlocks->emplace_back(RC);
+ m_SimulatedPlayerToggleableBlocks->operator[](Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)) = a_WasLastStatePowered;
}
-bool cIncrementalRedstoneSimulator::QueueRepeaterPowerChange(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta, bool ShouldPowerOn)
+void cIncrementalRedstoneSimulator::QueueRepeaterPowerChange(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta, bool a_ShouldPowerOn)
{
- for (auto itr = m_RepeatersDelayList->begin(); itr != m_RepeatersDelayList->end(); ++itr)
- {
- if (itr->a_RelBlockPos.Equals(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ)))
- {
- if (ShouldPowerOn == itr->ShouldPowerOn) // We are queued already for the same thing, don't replace entry
- {
- return false;
- }
-
- // Already in here (normal to allow repeater to continue on powering and updating blocks in front) - just update info and quit
- itr->a_DelayTicks = (((a_Meta & 0xC) >> 0x2) + 1) * 2; // See below for description
- itr->a_ElapsedTicks = 0;
- itr->ShouldPowerOn = ShouldPowerOn;
- return false;
- }
- }
-
- // Self not in list, add self to list
sRepeatersDelayList RC;
- RC.a_RelBlockPos = Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
// Gets the top two bits (delay time), shifts them into the lower two bits, and adds one (meta 0 = 1 tick; 1 = 2 etc.)
// Multiply by 2 because in MCS, 1 redstone tick = 1 world tick, but in Vanilla, 1 redstone tick = 2 world ticks, and we need to maintain compatibility
RC.a_DelayTicks = (((a_Meta & 0xC) >> 0x2) + 1) * 2;
-
RC.a_ElapsedTicks = 0;
- RC.ShouldPowerOn = ShouldPowerOn;
- m_RepeatersDelayList->emplace_back(RC);
- return true;
+ RC.ShouldPowerOn = a_ShouldPowerOn;
+
+ auto Result = m_RepeatersDelayList->emplace(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ), RC);
+ if (!Result.second)
+ {
+ // Key exists
+ if (a_ShouldPowerOn == Result.first->second.ShouldPowerOn)
+ {
+ // We are queued already for the same thing, don't replace entry
+ return;
+ }
+
+ Result.first->second.a_DelayTicks = RC.a_DelayTicks;
+ Result.first->second.a_ElapsedTicks = 0;
+ Result.first->second.ShouldPowerOn = a_ShouldPowerOn;
+ }
}
-void cIncrementalRedstoneSimulator::SetSourceUnpowered(int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, cChunk * a_Chunk, bool a_IsFirstCall)
+void cIncrementalRedstoneSimulator::SetSourceUnpowered(int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, cChunk * a_Chunk)
{
- if (!a_IsFirstCall) // The neighbouring chunks passed when this parameter is false may be invalid
+ if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
+ {
+ return;
+ }
+ std::vector<std::pair<Vector3i, cChunk *>> BlocksPotentiallyUnpowered = { std::make_pair(Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ), a_Chunk) };
+
+ auto UnpoweringFunction = [&BlocksPotentiallyUnpowered](cChunk * a_LambdaChunk, const Vector3i & a_RelSource)
{
- if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
+ BLOCKTYPE RepeaterType;
+ if (a_LambdaChunk->UnboundedRelGetBlockType(a_RelSource.x, a_RelSource.y, a_RelSource.z, RepeaterType) && (RepeaterType == E_BLOCK_REDSTONE_REPEATER_ON))
{
return;
}
- }
- std::vector<Vector3i> BlocksPotentiallyUnpowered;
+ auto Data = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_LambdaChunk->GetRedstoneSimulatorData());
+ Data->m_PoweredBlocks.erase(std::remove_if(Data->m_PoweredBlocks.begin(), Data->m_PoweredBlocks.end(), [&BlocksPotentiallyUnpowered, a_LambdaChunk, a_RelSource](const sPoweredBlocks & itr)
+ {
+ if (itr.m_SourcePos != a_RelSource)
+ {
+ return false;
+ }
- auto Data = (cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData();
- Data->m_PoweredBlocks.erase(std::remove_if(Data->m_PoweredBlocks.begin(), Data->m_PoweredBlocks.end(), [&BlocksPotentiallyUnpowered, a_Chunk, a_RelSourceX, a_RelSourceY, a_RelSourceZ](const sPoweredBlocks & itr)
- {
- if (itr.a_SourcePos.Equals(Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ)))
+ BlocksPotentiallyUnpowered.emplace_back(std::make_pair(itr.m_BlockPos, a_LambdaChunk));
+ a_LambdaChunk->SetIsRedstoneDirty(true);
+ return true;
+ }
+ ), Data->m_PoweredBlocks.end());
+
+ Data->m_LinkedBlocks.erase(std::remove_if(Data->m_LinkedBlocks.begin(), Data->m_LinkedBlocks.end(), [&BlocksPotentiallyUnpowered, a_LambdaChunk, a_RelSource](const sLinkedPoweredBlocks & itr)
{
- BlocksPotentiallyUnpowered.emplace_back(itr.a_BlockPos);
- a_Chunk->SetIsRedstoneDirty(true);
+ if (itr.a_SourcePos != a_RelSource)
+ {
+ return false;
+ }
+
+ BlocksPotentiallyUnpowered.emplace_back(std::make_pair(itr.a_BlockPos, a_LambdaChunk));
+ a_LambdaChunk->SetIsRedstoneDirty(true);
return true;
}
- return false;
- }
- ), Data->m_PoweredBlocks.end());
+ ), Data->m_LinkedBlocks.end());
- Data->m_LinkedBlocks.erase(std::remove_if(Data->m_LinkedBlocks.begin(), Data->m_LinkedBlocks.end(), [&BlocksPotentiallyUnpowered, a_Chunk, a_RelSourceX, a_RelSourceY, a_RelSourceZ](const sLinkedPoweredBlocks & itr)
+ for (const auto & BoundaryChunk : GetAdjacentChunks(a_RelSource, a_LambdaChunk))
{
- if (itr.a_SourcePos.Equals(Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ)))
+ auto BoundaryData = static_cast<cIncrementalRedstoneSimulatorChunkData *>(BoundaryChunk->GetRedstoneSimulatorData());
+ Vector3i ChunkAdjustedSource = a_RelSource;
+ ChunkAdjustedSource.x += (a_LambdaChunk->GetPosX() - BoundaryChunk->GetPosX()) * cChunkDef::Width;
+ ChunkAdjustedSource.z += (a_LambdaChunk->GetPosZ() - BoundaryChunk->GetPosZ()) * cChunkDef::Width;
+
+ if (
+ (std::find_if(BoundaryData->m_PoweredBlocks.begin(), BoundaryData->m_PoweredBlocks.end(), [ChunkAdjustedSource](const sPoweredBlocks & itr) { return (itr.m_SourcePos == ChunkAdjustedSource); }) != BoundaryData->m_PoweredBlocks.end()) ||
+ (std::find_if(BoundaryData->m_LinkedBlocks.begin(), BoundaryData->m_LinkedBlocks.end(), [ChunkAdjustedSource](const sLinkedPoweredBlocks & itr) { return (itr.a_SourcePos == ChunkAdjustedSource); }) != BoundaryData->m_LinkedBlocks.end())
+ )
{
- BlocksPotentiallyUnpowered.emplace_back(itr.a_BlockPos);
- a_Chunk->SetIsRedstoneDirty(true);
- return true;
+ BlocksPotentiallyUnpowered.emplace_back(std::make_pair(ChunkAdjustedSource, BoundaryChunk));
}
- return false;
}
- ), Data->m_LinkedBlocks.end());
-
- if (a_IsFirstCall && AreCoordsOnChunkBoundary(a_RelSourceX, a_RelSourceY, a_RelSourceZ))
- {
- // +- 2 to accomodate linked powered blocks
- SetSourceUnpowered(a_RelSourceX, a_RelSourceY, a_RelSourceZ, a_Chunk->GetRelNeighborChunk(a_RelSourceX - 2, a_RelSourceZ), false);
- SetSourceUnpowered(a_RelSourceX, a_RelSourceY, a_RelSourceZ, a_Chunk->GetRelNeighborChunk(a_RelSourceX + 2, a_RelSourceZ), false);
- SetSourceUnpowered(a_RelSourceX, a_RelSourceY, a_RelSourceZ, a_Chunk->GetRelNeighborChunk(a_RelSourceX, a_RelSourceZ - 2), false);
- SetSourceUnpowered(a_RelSourceX, a_RelSourceY, a_RelSourceZ, a_Chunk->GetRelNeighborChunk(a_RelSourceX, a_RelSourceZ + 2), false);
- }
+ };
- for (const auto & itr : BlocksPotentiallyUnpowered)
+ while (!BlocksPotentiallyUnpowered.empty())
{
- auto Neighbour = a_Chunk->GetRelNeighborChunk(itr.x, itr.z);
- if (!AreCoordsPowered(itr.x, itr.y, itr.z) && (Neighbour->GetBlock(itr) != E_BLOCK_REDSTONE_REPEATER_ON))
- {
- // Repeaters time themselves with regards to unpowering; ensure we don't do it for them
- SetSourceUnpowered(itr.x, itr.y, itr.z, Neighbour);
- }
+ auto End = BlocksPotentiallyUnpowered.back();
+ BlocksPotentiallyUnpowered.pop_back();
+ UnpoweringFunction(End.second, End.first);
}
}
@@ -2135,45 +2188,48 @@ void cIncrementalRedstoneSimulator::SetSourceUnpowered(int a_RelSourceX, int a_R
-void cIncrementalRedstoneSimulator::SetInvalidMiddleBlock(int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, cChunk * a_Chunk, bool a_IsFirstCall)
+void cIncrementalRedstoneSimulator::SetInvalidMiddleBlock(int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, cChunk * a_Chunk)
{
- if (!a_IsFirstCall) // The neighbouring chunks passed when this parameter is false may be invalid
+ std::vector<std::pair<Vector3i, cChunk *>> BlocksPotentiallyUnpowered;
+
+ BLOCKTYPE RepeaterType;
+ if (a_Chunk->UnboundedRelGetBlockType(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ, RepeaterType) && (RepeaterType == E_BLOCK_REDSTONE_REPEATER_ON))
{
- if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
- {
- return;
- }
+ return;
}
- std::vector<Vector3i> BlocksPotentiallyUnpowered;
- auto Data = (cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData();
-
- Data->m_LinkedBlocks.erase(std::remove_if(Data->m_LinkedBlocks.begin(), Data->m_LinkedBlocks.end(), [&BlocksPotentiallyUnpowered, a_Chunk, a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ](const sLinkedPoweredBlocks & itr)
- {
- if (itr.a_MiddlePos.Equals(Vector3i(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ)))
+ auto MiddleBlockUnpoweringFunction = [&BlocksPotentiallyUnpowered](cChunk * a_LambdaChunk, const Vector3i & a_RelMiddle)
+ {
+ auto Data = static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_LambdaChunk->GetRedstoneSimulatorData());
+ Data->m_LinkedBlocks.erase(std::remove_if(Data->m_LinkedBlocks.begin(), Data->m_LinkedBlocks.end(), [&BlocksPotentiallyUnpowered, a_LambdaChunk, a_RelMiddle](const sLinkedPoweredBlocks & itr)
{
- BlocksPotentiallyUnpowered.emplace_back(itr.a_BlockPos);
- a_Chunk->SetIsRedstoneDirty(true);
+ if (itr.a_MiddlePos != a_RelMiddle)
+ {
+ return false;
+ }
+
+ BlocksPotentiallyUnpowered.emplace_back(std::make_pair(itr.a_BlockPos, a_LambdaChunk));
+ a_LambdaChunk->SetIsRedstoneDirty(true);
return true;
}
- return false;
- }
- ), Data->m_LinkedBlocks.end());
+ ), Data->m_LinkedBlocks.end());
+ };
- if (a_IsFirstCall && AreCoordsOnChunkBoundary(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ))
+ MiddleBlockUnpoweringFunction(a_Chunk, Vector3i(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ));
+ for (const auto & BoundaryChunk : GetAdjacentChunks(Vector3i(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ), a_Chunk))
{
- // +- 2 to accomodate linked powered blocks
- SetInvalidMiddleBlock(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ, a_Chunk->GetRelNeighborChunk(a_RelMiddleX - 2, a_RelMiddleZ), false);
- SetInvalidMiddleBlock(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ, a_Chunk->GetRelNeighborChunk(a_RelMiddleX + 2, a_RelMiddleZ), false);
- SetInvalidMiddleBlock(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ, a_Chunk->GetRelNeighborChunk(a_RelMiddleX, a_RelMiddleZ - 2), false);
- SetInvalidMiddleBlock(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ, a_Chunk->GetRelNeighborChunk(a_RelMiddleX, a_RelMiddleZ + 2), false);
+ Vector3i ChunkAdjustedMiddlePos = Vector3i(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ);
+ ChunkAdjustedMiddlePos.x += (a_Chunk->GetPosX() - BoundaryChunk->GetPosX()) * cChunkDef::Width;
+ ChunkAdjustedMiddlePos.z += (a_Chunk->GetPosZ() - BoundaryChunk->GetPosZ()) * cChunkDef::Width;
+
+ MiddleBlockUnpoweringFunction(a_Chunk, Vector3i(a_RelMiddleX, a_RelMiddleY, a_RelMiddleZ));
}
for (const auto & itr : BlocksPotentiallyUnpowered)
{
- if (!AreCoordsPowered(itr.x, itr.y, itr.z))
+ if (!AreCoordsPowered(itr.first.x, itr.first.y, itr.first.z))
{
- SetSourceUnpowered(itr.x, itr.y, itr.z, a_Chunk->GetRelNeighborChunk(itr.x, itr.z));
+ SetSourceUnpowered(itr.first.x, itr.first.y, itr.first.z, itr.second);
}
}
}
@@ -2182,76 +2238,48 @@ void cIncrementalRedstoneSimulator::SetInvalidMiddleBlock(int a_RelMiddleX, int
-cIncrementalRedstoneSimulator::eRedstoneDirection cIncrementalRedstoneSimulator::GetWireDirection(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
+bool cIncrementalRedstoneSimulator::IsLeverOn(NIBBLETYPE a_BlockMeta)
{
- int Dir = REDSTONE_NONE;
+ // Extract the ON bit from metadata and return if true if it is set:
+ return ((a_BlockMeta & 0x8) == 0x8);
+}
+
+
+
+
+
+std::vector<cChunk *> cIncrementalRedstoneSimulator::GetAdjacentChunks(const Vector3i & a_RelBlockPosition, cChunk * a_Chunk)
+{
+ std::vector<cChunk *> AdjacentChunks;
+ AdjacentChunks.reserve(2); // At most bordering two chunks; reserve that many
- BLOCKTYPE NegX = 0;
- if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, NegX))
+ auto CheckAndEmplace = [&AdjacentChunks](cChunk * a_LambdaChunk)
{
- if (IsPotentialSource(NegX))
+ if ((a_LambdaChunk != nullptr) && a_LambdaChunk->IsValid())
{
- Dir |= (REDSTONE_X_POS);
+ AdjacentChunks.emplace_back(a_LambdaChunk);
}
- }
+ };
- BLOCKTYPE PosX = 0;
- if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, PosX))
+ // Are we on a chunk boundary? +- 2 because of LinkedPowered blocks
+ if (a_RelBlockPosition.x <= 1)
{
- if (IsPotentialSource(PosX))
- {
- Dir |= (REDSTONE_X_NEG);
- }
+ CheckAndEmplace(a_Chunk->GetRelNeighborChunk(a_RelBlockPosition.x - 2, a_RelBlockPosition.z));
}
-
- BLOCKTYPE NegZ = 0;
- if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, NegZ))
+ if (a_RelBlockPosition.x >= 14)
{
- if (IsPotentialSource(NegZ))
- {
- if ((Dir & REDSTONE_X_POS) && !(Dir & REDSTONE_X_NEG)) // corner
- {
- Dir ^= REDSTONE_X_POS;
- Dir |= REDSTONE_X_NEG;
- }
- if ((Dir & REDSTONE_X_NEG) && !(Dir & REDSTONE_X_POS)) // corner
- {
- Dir ^= REDSTONE_X_NEG;
- Dir |= REDSTONE_X_POS;
- }
- Dir |= REDSTONE_Z_POS;
- }
+ CheckAndEmplace(a_Chunk->GetRelNeighborChunk(a_RelBlockPosition.x + 2, a_RelBlockPosition.z));
}
-
- BLOCKTYPE PosZ = 0;
- if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, PosZ))
+ if (a_RelBlockPosition.z <= 1)
{
- if (IsPotentialSource(PosZ))
- {
- if ((Dir & REDSTONE_X_POS) && !(Dir & REDSTONE_X_NEG)) // corner
- {
- Dir ^= REDSTONE_X_POS;
- Dir |= REDSTONE_X_NEG;
- }
- if ((Dir & REDSTONE_X_NEG) && !(Dir & REDSTONE_X_POS)) // corner
- {
- Dir ^= REDSTONE_X_NEG;
- Dir |= REDSTONE_X_POS;
- }
- Dir |= REDSTONE_Z_NEG;
- }
+ CheckAndEmplace(a_Chunk->GetRelNeighborChunk(a_RelBlockPosition.x, a_RelBlockPosition.z - 2));
+ }
+ if (a_RelBlockPosition.z >= 14)
+ {
+ CheckAndEmplace(a_Chunk->GetRelNeighborChunk(a_RelBlockPosition.x, a_RelBlockPosition.z + 2));
}
- return (eRedstoneDirection)Dir;
-}
-
-
-
-
-bool cIncrementalRedstoneSimulator::IsLeverOn(NIBBLETYPE a_BlockMeta)
-{
- // Extract the ON bit from metadata and return if true if it is set:
- return ((a_BlockMeta & 0x8) == 0x8);
+ return AdjacentChunks;
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h
index 43f0e89d0..e4250c0b9 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.h
+++ b/src/Simulator/IncrementalRedstoneSimulator.h
@@ -3,6 +3,7 @@
#include "RedstoneSimulator.h"
#include "BlockEntities/RedstonePoweredEntity.h"
+#include <unordered_map>
class cWorld;
class cChunk;
@@ -22,7 +23,8 @@ class cIncrementalRedstoneSimulator :
public:
cIncrementalRedstoneSimulator(cWorld & a_World)
- : cRedstoneSimulator(a_World)
+ : cRedstoneSimulator(a_World),
+ m_Chunk(nullptr)
{
}
@@ -36,25 +38,22 @@ public:
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override { return IsRedstone(a_BlockType); }
virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
- enum eRedstoneDirection
- {
- REDSTONE_NONE = 0,
- REDSTONE_X_POS = 0x1,
- REDSTONE_X_NEG = 0x2,
- REDSTONE_Z_POS = 0x4,
- REDSTONE_Z_NEG = 0x8,
- };
- eRedstoneDirection GetWireDirection(int a_BlockX, int a_BlockY, int a_BlockZ);
-
private:
#define MAX_POWER_LEVEL 15
struct sPoweredBlocks // Define structure of the directly powered blocks list
{
- Vector3i a_BlockPos; // Position of powered block
- Vector3i a_SourcePos; // Position of source powering the block at a_BlockPos
- unsigned char a_PowerLevel;
+ sPoweredBlocks(Vector3i a_BlockPos, Vector3i a_SourcePos, unsigned char a_PowerLevel) :
+ m_BlockPos(a_BlockPos),
+ m_SourcePos(a_SourcePos),
+ m_PowerLevel(a_PowerLevel)
+ {
+ }
+
+ Vector3i m_BlockPos; // Position of powered block
+ Vector3i m_SourcePos; // Position of source powering the block at a_BlockPos
+ unsigned char m_PowerLevel;
};
struct sLinkedPoweredBlocks // Define structure of the indirectly powered blocks list (i.e. repeaters powering through a block to the block at the other side)
@@ -65,15 +64,8 @@ private:
unsigned char a_PowerLevel;
};
- struct sSimulatedPlayerToggleableList // Define structure of the list containing simulate-on-update blocks (such as trapdoors that respond once to a block update, and can be toggled by a player)
- {
- Vector3i a_RelBlockPos;
- bool WasLastStatePowered; // Was the last state powered or not? Determines whether a source update has happened and if I should resimulate
- };
-
struct sRepeatersDelayList // Define structure of list containing repeaters' delay states
{
- Vector3i a_RelBlockPos;
unsigned char a_DelayTicks; // For how many ticks should the repeater delay
unsigned char a_ElapsedTicks; // How much of the previous has been elapsed?
bool ShouldPowerOn; // What happens when the delay time is fulfilled?
@@ -84,20 +76,21 @@ private:
{
public:
/// Per-chunk data for the simulator, specified individual chunks to simulate
- cCoordWithBlockAndBoolVector m_ChunkData;
- cCoordWithBlockAndBoolVector m_QueuedChunkData;
+
+ /** test */
+ std::unordered_map<Vector3i, std::pair<BLOCKTYPE, bool>, VectorHasher<int>> m_ChunkData;
std::vector<sPoweredBlocks> m_PoweredBlocks;
std::vector<sLinkedPoweredBlocks> m_LinkedBlocks;
- std::vector<sSimulatedPlayerToggleableList> m_SimulatedPlayerToggleableBlocks;
- std::vector<sRepeatersDelayList> m_RepeatersDelayList;
+ std::unordered_map<Vector3i, bool, VectorHasher<int>> m_SimulatedPlayerToggleableBlocks;
+ std::unordered_map<Vector3i, sRepeatersDelayList, VectorHasher<int>> m_RepeatersDelayList;
};
public:
typedef std::vector <sPoweredBlocks> PoweredBlocksList;
typedef std::vector <sLinkedPoweredBlocks> LinkedBlocksList;
- typedef std::vector <sSimulatedPlayerToggleableList> SimulatedPlayerToggleableList;
- typedef std::vector <sRepeatersDelayList> RepeatersDelayList;
+ typedef std::unordered_map<Vector3i, bool, VectorHasher<int>> SimulatedPlayerToggleableList;
+ typedef std::unordered_map<Vector3i, sRepeatersDelayList, VectorHasher<int>> RepeatersDelayList;
private:
@@ -107,126 +100,171 @@ private:
SimulatedPlayerToggleableList * m_SimulatedPlayerToggleableBlocks;
RepeatersDelayList * m_RepeatersDelayList;
- virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override { RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk); }
- void RedstoneAddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk, cChunk * a_OtherChunk = nullptr);
+ virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
+
+ void AddBlock(const Vector3i & a_BlockPosition, cChunk * a_Chunk, cChunk * a_OtherChunk = nullptr);
cChunk * m_Chunk;
// We want a_MyState for devices needing a full FastSetBlock (as opposed to meta) because with our simulation model, we cannot keep setting the block if it is already set correctly
// In addition to being non-performant, it would stop the player from actually breaking said device
- /* ====== SOURCES ====== */
+
/** Handles the redstone torch */
void HandleRedstoneTorch(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, BLOCKTYPE a_MyState);
+
/** Handles the redstone block */
void HandleRedstoneBlock(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles levers */
void HandleRedstoneLever(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles buttons */
void HandleRedstoneButton(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles daylight sensors */
void HandleDaylightSensor(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles pressure plates */
void HandlePressurePlate(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, BLOCKTYPE a_MyType);
+
/** Handles tripwire hooks
Performs correct meta and power setting for self by going in the direction it faces and looking for a continous line of tripwire bounded by another oppositely facing hook
If this line is complete, it verifies that at least on wire reports an entity is on top (via its meta), and performs its task
*/
void HandleTripwireHook(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles trapped chests */
void HandleTrappedChest(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
- /* ==================== */
- /* ====== CARRIERS ====== */
+
/** Handles redstone wire */
void HandleRedstoneWire(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles repeaters */
void HandleRedstoneRepeater(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, BLOCKTYPE a_MyState);
- /* ====================== */
- /* ====== DEVICES ====== */
+ /** Handles comparators */
+ void HandleRedstoneComparator(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
+
/** Handles pistons */
void HandlePiston(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles dispensers and droppers */
void HandleDropSpenser(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles TNT (exploding) */
void HandleTNT(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles redstone lamps */
void HandleRedstoneLamp(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, BLOCKTYPE a_MyState);
+
/** Handles doords */
void HandleDoor(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles command blocks */
void HandleCommandBlock(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles activator, detector, and powered rails */
void HandleRail(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, BLOCKTYPE a_MyType);
+
/** Handles trapdoors */
void HandleTrapdoor(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles fence gates */
void HandleFenceGate(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles noteblocks */
void HandleNoteBlock(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+
/** Handles tripwires */
void HandleTripwire(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
- /* ===================== */
- /* ====== Helper functions ====== */
+
/** Marks a block as powered */
- void SetBlockPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, unsigned char a_PowerLevel = MAX_POWER_LEVEL);
+ void SetBlockPowered(Vector3i a_RelBlockPosition, Vector3i a_RelSourcePosition, unsigned char a_PowerLevel = MAX_POWER_LEVEL);
+ void SetBlockPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, unsigned char a_PowerLevel = MAX_POWER_LEVEL) { SetBlockPowered(Vector3i(a_RelBlockX, a_RelBlockY, a_RelBlockZ), Vector3i(a_RelSourceX, a_RelSourceY, a_RelSourceZ), a_PowerLevel); }
+
+ /** Recursively searches for a wire path and powers everything that should be powered */
+ void FindAndPowerBorderingWires(std::vector<std::pair<Vector3i, cChunk *>> & a_PotentialWireList, const Vector3i & a_EntryRelBlockPosition, cChunk * a_EntryChunk);
+
+ /** Powers a specified wire block position with the specified source wire position
+ Checks are performed to ensure one wire does not power the same location more than once
+ a_EntryChunk will be the chunk which the source resides, and a_NeighbourChunk will be that which the to-be-powered wire resides
+ a_PotentialWireList is updated to include the new powered wire so that FindAndPowerBorderingWires can continue the redstone wire line tracing process
+ */
+ void PowerBorderingWires(std::vector<std::pair<Vector3i, cChunk *>> & a_PotentialWireList, const Vector3i & a_EntryRelSourcePosition, cChunk * a_EntryChunk, const Vector3i & a_AdjustedPos, cChunk * a_NeighbourChunk, unsigned char a_MyPower);
+
/** Marks a block as being powered through another block */
void SetBlockLinkedPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, BLOCKTYPE a_MiddeBlock, unsigned char a_PowerLevel = MAX_POWER_LEVEL);
+
/** Marks a block as simulated, who should not be simulated further unless their power state changes, to accomodate a player manually toggling the block without triggering the simulator toggling it back */
void SetPlayerToggleableBlockAsSimulated(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, bool WasLastStatePowered);
+
/** Marks the second block in a direction as linked powered */
void SetDirectionLinkedPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, char a_Direction, unsigned char a_PowerLevel = MAX_POWER_LEVEL);
+
/** Marks all blocks immediately surrounding a coordinate as powered */
void SetAllDirsAsPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, unsigned char a_PowerLevel = MAX_POWER_LEVEL);
+
/** Queues a repeater to be powered or unpowered and returns if the m_RepeatersDelayList iterators were invalidated */
- bool QueueRepeaterPowerChange(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta, bool ShouldPowerOn);
+ void QueueRepeaterPowerChange(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta, bool ShouldPowerOn);
+
/** Removes a block from the Powered and LinkedPowered lists
- Used for variable sources such as tripwire hooks, daylight sensors, and trapped chests
+ Recursively removes all blocks powered by the given one
*/
- void SetSourceUnpowered(int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, cChunk * a_Chunk, bool a_IsFirstCall = true);
- void SetInvalidMiddleBlock(int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, cChunk * a_Chunk, bool a_IsFirstCall = true);
+ void SetSourceUnpowered(int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, cChunk * a_Chunk);
+ void SetInvalidMiddleBlock(int a_RelMiddleX, int a_RelMiddleY, int a_RelMiddleZ, cChunk * a_Chunk);
/** Returns if a coordinate is powered or linked powered */
- bool AreCoordsPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ) { return AreCoordsDirectlyPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk) || AreCoordsLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ); }
+ bool AreCoordsPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ) { return AreCoordsDirectlyPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk) || AreCoordsLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, m_Chunk); }
+
/** Returns if a coordinate is in the directly powered blocks list */
- bool AreCoordsDirectlyPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, cChunk * a_Chunk);
+ static bool AreCoordsDirectlyPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, cChunk * a_Chunk);
+
/** Returns if a coordinate is in the indirectly powered blocks list */
- bool AreCoordsLinkedPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ);
+ static bool AreCoordsLinkedPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, cChunk * a_Chunk);
+
/** Returns if a coordinate was marked as simulated (for blocks toggleable by players) */
bool AreCoordsSimulated(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, bool IsCurrentStatePowered);
+
/** Returns if a repeater is powered by testing for power sources behind the repeater */
bool IsRepeaterPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta);
+
/** Returns if a repeater is locked */
bool IsRepeaterLocked(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta);
+
/** Returns if a piston is powered */
bool IsPistonPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, NIBBLETYPE a_Meta);
+
/** Returns if a wire is powered
The only diffence between this and a normal AreCoordsPowered is that this function checks for a wire powering another wire */
- bool IsWirePowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, unsigned char & a_PowerLevel);
+ static unsigned char IsWirePowered(Vector3i a_RelBlockPosition, cChunk * a_Chunk);
+
/** Handles delayed updates to repeaters **/
void HandleRedstoneRepeaterDelays(void);
/** Returns if lever metadata marks it as emitting power */
bool IsLeverOn(NIBBLETYPE a_BlockMeta);
+
/** Returns if button metadata marks it as emitting power */
bool IsButtonOn(NIBBLETYPE a_BlockMeta) { return IsLeverOn(a_BlockMeta); }
- /* ============================== */
- /* ====== Misc Functions ====== */
+
/** Returns if a block is viable to be the MiddleBlock of a SetLinkedPowered operation */
- inline static bool IsViableMiddleBlock(BLOCKTYPE Block) { return cBlockInfo::FullyOccupiesVoxel(Block); }
+ inline static bool IsViableMiddleBlock(BLOCKTYPE a_Block) { return cBlockInfo::FullyOccupiesVoxel(a_Block); }
/** Returns if a block is a mechanism (something that accepts power and does something)
Used by torches to determine if they power a block whilst not standing on the ground
*/
- inline static bool IsMechanism(BLOCKTYPE Block)
+ inline static bool IsMechanism(BLOCKTYPE a_Block)
{
- switch (Block)
+ switch (a_Block)
{
case E_BLOCK_ACACIA_DOOR:
case E_BLOCK_ACACIA_FENCE_GATE:
case E_BLOCK_ACTIVATOR_RAIL:
+ case E_BLOCK_ACTIVE_COMPARATOR:
case E_BLOCK_BIRCH_DOOR:
case E_BLOCK_BIRCH_FENCE_GATE:
case E_BLOCK_COMMAND_BLOCK:
@@ -236,6 +274,7 @@ private:
case E_BLOCK_DROPPER:
case E_BLOCK_FENCE_GATE:
case E_BLOCK_HOPPER:
+ case E_BLOCK_INACTIVE_COMPARATOR:
case E_BLOCK_IRON_DOOR:
case E_BLOCK_IRON_TRAPDOOR:
case E_BLOCK_JUNGLE_DOOR:
@@ -262,9 +301,9 @@ private:
}
/** Returns if a block has the potential to output power */
- inline static bool IsPotentialSource(BLOCKTYPE Block)
+ inline static bool IsPotentialSource(BLOCKTYPE a_Block)
{
- switch (Block)
+ switch (a_Block)
{
case E_BLOCK_DETECTOR_RAIL:
case E_BLOCK_DAYLIGHT_SENSOR:
@@ -276,6 +315,7 @@ private:
case E_BLOCK_REDSTONE_REPEATER_ON:
case E_BLOCK_BLOCK_OF_REDSTONE:
case E_BLOCK_ACTIVE_COMPARATOR:
+ case E_BLOCK_INACTIVE_COMPARATOR:
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE:
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE:
case E_BLOCK_STONE_PRESSURE_PLATE:
@@ -289,9 +329,9 @@ private:
}
/** Returns if a block is any sort of redstone device */
- inline static bool IsRedstone(BLOCKTYPE Block)
+ inline static bool IsRedstone(BLOCKTYPE a_Block)
{
- switch (Block)
+ switch (a_Block)
{
// All redstone devices, please alpha sort
case E_BLOCK_ACACIA_DOOR:
@@ -348,47 +388,30 @@ private:
}
}
- inline static bool AreCoordsOnChunkBoundary(int a_BlockX, int a_BlockY, int a_BlockZ)
- {
- return ( // Are we on a chunk boundary? +- 2 because of LinkedPowered blocks
- ((a_BlockX % cChunkDef::Width) <= 1) ||
- ((a_BlockX % cChunkDef::Width) >= 14) ||
- ((a_BlockZ % cChunkDef::Width) <= 1) ||
- ((a_BlockZ % cChunkDef::Width) >= 14)
- );
- }
-
- inline static Vector3i AdjustRelativeCoords(const Vector3i & a_RelPosition)
+ inline static bool DoesIgnorePlayerToggle(BLOCKTYPE a_Block)
{
- if (
- (a_RelPosition.x >= 0) && (a_RelPosition.x < cChunkDef::Width) &&
- (a_RelPosition.z >= 0) && (a_RelPosition.z < cChunkDef::Width)
- )
+ switch (a_Block)
{
- return a_RelPosition;
+ case E_BLOCK_ACACIA_FENCE_GATE:
+ case E_BLOCK_BIRCH_FENCE_GATE:
+ case E_BLOCK_DARK_OAK_FENCE_GATE:
+ case E_BLOCK_FENCE_GATE:
+ case E_BLOCK_JUNGLE_FENCE_GATE:
+ case E_BLOCK_SPRUCE_FENCE_GATE:
+ case E_BLOCK_IRON_TRAPDOOR:
+ case E_BLOCK_TRAPDOOR:
+ {
+ return true;
+ }
+ default: return false;
}
+ }
- Vector3i RelPos = a_RelPosition;
-
- // Request for a different chunk, calculate chunk offset:
- while (RelPos.x >= cChunkDef::Width)
- {
- RelPos.x -= cChunkDef::Width;
- }
- while (RelPos.x < 0)
- {
- RelPos.x += cChunkDef::Width;
- }
- while (RelPos.z >= cChunkDef::Width)
- {
- RelPos.z -= cChunkDef::Width;
- }
- while (RelPos.z < 0)
- {
- RelPos.z += cChunkDef::Width;
- }
+ inline static std::vector<cChunk *> GetAdjacentChunks(const Vector3i & a_RelBlockPosition, cChunk * a_Chunk);
- return RelPos;
+ inline static Vector3i AdjustRelativeCoords(const Vector3i & a_RelPosition)
+ {
+ return { (a_RelPosition.x % cChunkDef::Width + cChunkDef::Width) % cChunkDef::Width, a_RelPosition.y, (a_RelPosition.z % cChunkDef::Width + cChunkDef::Width) % cChunkDef::Width };
}
};
diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp
index 497f81999..70dde8cc0 100644
--- a/src/Simulator/SandSimulator.cpp
+++ b/src/Simulator/SandSimulator.cpp
@@ -65,7 +65,7 @@ void cSandSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX,
a_Chunk->SetBlock(itr->x, itr->y, itr->z, E_BLOCK_AIR, 0);
}
}
- m_TotalBlocks -= (int)ChunkData.size();
+ m_TotalBlocks -= static_cast<int>(ChunkData.size());
ChunkData.clear();
}
@@ -265,8 +265,13 @@ void cSandSimulator::FinishFalling(
// Create a pickup instead:
cItems Pickups;
- Pickups.Add((ENUM_ITEM_ID)a_FallingBlockType, 1, a_FallingBlockMeta);
- a_World->SpawnItemPickups(Pickups, (double)a_BlockX + 0.5, (double)a_BlockY + 0.5, (double)a_BlockZ + 0.5);
+ Pickups.Add(static_cast<ENUM_ITEM_ID>(a_FallingBlockType), 1, a_FallingBlockMeta);
+ a_World->SpawnItemPickups(
+ Pickups,
+ static_cast<double>(a_BlockX) + 0.5,
+ static_cast<double>(a_BlockY) + 0.5,
+ static_cast<double>(a_BlockZ) + 0.5
+ );
}
diff --git a/src/Simulator/VanillaFluidSimulator.cpp b/src/Simulator/VanillaFluidSimulator.cpp
index 6df75eebb..f6fe1e9ec 100644
--- a/src/Simulator/VanillaFluidSimulator.cpp
+++ b/src/Simulator/VanillaFluidSimulator.cpp
@@ -105,7 +105,7 @@ int cVanillaFluidSimulator::CalculateFlowCost(cChunk * a_Chunk, int a_RelX, int
if (IsPassableForFluid(BlockType) || IsBlockLiquid(BlockType))
{
// Path found, exit
- return a_Iteration;
+ return static_cast<int>(a_Iteration);
}
// 5 blocks away, bail out
diff --git a/src/Simulator/VaporizeFluidSimulator.cpp b/src/Simulator/VaporizeFluidSimulator.cpp
index 119742346..d766b069f 100644
--- a/src/Simulator/VaporizeFluidSimulator.cpp
+++ b/src/Simulator/VaporizeFluidSimulator.cpp
@@ -35,7 +35,14 @@ void cVaporizeFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ,
)
{
a_Chunk->SetBlock(RelX, a_BlockY, RelZ, E_BLOCK_AIR, 0);
- a_Chunk->BroadcastSoundEffect("random.fizz", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 1.0f, 0.6f);
+ a_Chunk->BroadcastSoundEffect(
+ "random.fizz",
+ static_cast<double>(a_BlockX),
+ static_cast<double>(a_BlockY),
+ static_cast<double>(a_BlockZ),
+ 1.0f,
+ 0.6f
+ );
}
}
diff --git a/src/SpawnPrepare.cpp b/src/SpawnPrepare.cpp
new file mode 100644
index 000000000..74dcb3ecd
--- /dev/null
+++ b/src/SpawnPrepare.cpp
@@ -0,0 +1,125 @@
+
+#include "Globals.h"
+
+#include "SpawnPrepare.h"
+#include "World.h"
+
+
+
+
+
+class cSpawnPrepareCallback :
+ public cChunkCoordCallback
+{
+public:
+ cSpawnPrepareCallback(cSpawnPrepare & a_SpawnPrepare) :
+ m_SpawnPrepare(a_SpawnPrepare)
+ {
+ }
+protected:
+
+ cSpawnPrepare & m_SpawnPrepare;
+
+ virtual void Call(int a_ChunkX, int a_ChunkZ) override
+ {
+ m_SpawnPrepare.PreparedChunkCallback(a_ChunkX, a_ChunkZ);
+ }
+};
+
+
+
+
+
+cSpawnPrepare::cSpawnPrepare(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance, int a_FirstIdx):
+ m_World(a_World),
+ m_SpawnChunkX(a_SpawnChunkX),
+ m_SpawnChunkZ(a_SpawnChunkZ),
+ m_PrepareDistance(a_PrepareDistance),
+ m_NextIdx(a_FirstIdx),
+ m_MaxIdx(a_PrepareDistance * a_PrepareDistance),
+ m_NumPrepared(0),
+ m_LastReportTime(std::chrono::steady_clock::now()),
+ m_LastReportChunkCount(0)
+{
+}
+
+
+
+
+
+
+
+void cSpawnPrepare::PrepareChunks(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance)
+{
+
+ // Queue the initial chunks:
+ int MaxIdx = a_PrepareDistance * a_PrepareDistance;
+ int maxQueue = std::min(MaxIdx - 1, 100); // Number of chunks to queue at once
+ cSpawnPrepare prep(a_World, a_SpawnChunkX, a_SpawnChunkZ, a_PrepareDistance, maxQueue);
+ for (int i = 0; i < maxQueue; i++)
+ {
+ int chunkX, chunkZ;
+ prep.DecodeChunkCoords(i, chunkX, chunkZ);
+ a_World.PrepareChunk(chunkX, chunkZ, cpp14::make_unique<cSpawnPrepareCallback>(prep));
+ } // for i
+
+ // Wait for the lighting thread to prepare everything. Event is set in the Call() callback:
+ prep.m_EvtFinished.Wait();
+}
+
+
+
+
+
+void cSpawnPrepare::DecodeChunkCoords(int a_Idx, int & a_ChunkX, int & a_ChunkZ)
+{
+ // A zigzag pattern from the top to bottom, each row alternating between forward-x and backward-x:
+ int z = a_Idx / m_PrepareDistance;
+ int x = a_Idx % m_PrepareDistance;
+ if ((z & 1) == 0)
+ {
+ // Reverse every second row:
+ x = m_PrepareDistance - 1 - x;
+ }
+ a_ChunkZ = m_SpawnChunkZ + z - m_PrepareDistance / 2;
+ a_ChunkX = m_SpawnChunkX + x - m_PrepareDistance / 2;
+}
+
+
+
+
+
+void cSpawnPrepare::PreparedChunkCallback(int a_ChunkX, int a_ChunkZ)
+{
+ // Check if this was the last chunk:
+ m_NumPrepared += 1;
+ if (m_NumPrepared >= m_MaxIdx)
+ {
+ m_EvtFinished.Set();
+ // Must return here, because "this" may have gotten deleted by the previous line
+ return;
+ }
+
+ // Queue another chunk, if appropriate:
+ if (m_NextIdx < m_MaxIdx)
+ {
+ int chunkX, chunkZ;
+ DecodeChunkCoords(m_NextIdx, chunkX, chunkZ);
+ m_World.GetLightingThread().QueueChunk(chunkX, chunkZ, cpp14::make_unique<cSpawnPrepareCallback>(*this));
+ m_NextIdx += 1;
+ }
+
+ // Report progress every 1 second:
+ auto Now = std::chrono::steady_clock::now();
+ if (Now - m_LastReportTime > std::chrono::seconds(1))
+ {
+ float PercentDone = static_cast<float>(m_NumPrepared * 100) / m_MaxIdx;
+ float ChunkSpeed = static_cast<float>((m_NumPrepared - m_LastReportChunkCount) * 1000) / std::chrono::duration_cast<std::chrono::milliseconds>(Now - m_LastReportTime).count();
+ LOG("Preparing spawn (%s): %.02f%% (%d/%d; %.02f chunks / sec)",
+ m_World.GetName().c_str(), PercentDone, m_NumPrepared, m_MaxIdx, ChunkSpeed
+ );
+ m_LastReportTime = Now;
+ m_LastReportChunkCount = m_NumPrepared;
+ }
+}
+
diff --git a/src/SpawnPrepare.h b/src/SpawnPrepare.h
new file mode 100644
index 000000000..cc0da504e
--- /dev/null
+++ b/src/SpawnPrepare.h
@@ -0,0 +1,49 @@
+
+#pragma once
+
+class cWorld;
+
+
+
+/** Generates and lights the spawn area of the world. Runs as a separate thread. */
+class cSpawnPrepare
+{
+
+public:
+ static void PrepareChunks(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance);
+
+protected:
+ cWorld & m_World;
+ int m_SpawnChunkX;
+ int m_SpawnChunkZ;
+ int m_PrepareDistance;
+
+ /** The index of the next chunk to be queued in the lighting thread. */
+ int m_NextIdx;
+
+ /** The maximum index of the prepared chunks. Queueing stops when m_NextIdx reaches this number. */
+ int m_MaxIdx;
+
+ /** Total number of chunks already finished preparing. Preparation finishes when this number reaches m_MaxIdx. */
+ int m_NumPrepared;
+
+ /** Event used to signal that the preparation is finished. */
+ cEvent m_EvtFinished;
+
+ /** The timestamp of the last progress report emitted. */
+ std::chrono::steady_clock::time_point m_LastReportTime;
+
+ /** Number of chunks prepared when the last progress report was emitted. */
+ int m_LastReportChunkCount;
+
+ cSpawnPrepare(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance, int a_FirstIdx);
+
+ void PreparedChunkCallback(int a_ChunkX, int a_ChunkZ);
+
+ /** Decodes the index into chunk coords. Provides the specific chunk ordering. */
+ void DecodeChunkCoords(int a_Idx, int & a_ChunkX, int & a_ChunkZ);
+
+ friend class cSpawnPrepareCallback;
+
+};
+
diff --git a/src/Statistics.cpp b/src/Statistics.cpp
index e0c0dd925..fcaf3e7bc 100644
--- a/src/Statistics.cpp
+++ b/src/Statistics.cpp
@@ -185,7 +185,7 @@ StatValue cStatManager::AddValue(const eStatistic a_Stat, const StatValue a_Delt
void cStatManager::Reset(void)
{
- for (unsigned int i = 0; i < (unsigned int)statCount; ++i)
+ for (unsigned int i = 0; i < static_cast<unsigned int>(statCount); ++i)
{
m_MainStats[i] = 0;
}
diff --git a/src/StringUtils.h b/src/StringUtils.h
index b5fc58a2d..62767d007 100644
--- a/src/StringUtils.h
+++ b/src/StringUtils.h
@@ -158,7 +158,7 @@ bool StringToInteger(const AString & a_str, T & a_Num)
return false;
}
result *= 10;
- T digit = a_str[i] - '0';
+ T digit = static_cast<T>(a_str[i] - '0');
if (std::numeric_limits<T>::max() - digit < result)
{
return false;
@@ -168,6 +168,12 @@ bool StringToInteger(const AString & a_str, T & a_Num)
}
else
{
+ // Unsigned result cannot be signed!
+ if (!std::numeric_limits<T>::is_signed)
+ {
+ return false;
+ }
+
for (size_t size = a_str.size(); i < size; i++)
{
if ((a_str[i] < '0') || (a_str[i] > '9'))
@@ -179,7 +185,7 @@ bool StringToInteger(const AString & a_str, T & a_Num)
return false;
}
result *= 10;
- T digit = a_str[i] - '0';
+ T digit = static_cast<T>(a_str[i] - '0');
if (std::numeric_limits<T>::min() + digit > result)
{
return false;
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index 5fdaff15d..b54a50798 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -277,7 +277,7 @@ bool cTracer::Trace(const Vector3f & a_Start, const Vector3f & a_Direction, int
// return 1 = hit, other is not hit
-int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
+static int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
{
// float linx, liny;
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
index ef4afc40a..178498479 100644
--- a/src/UI/CMakeLists.txt
+++ b/src/UI/CMakeLists.txt
@@ -34,6 +34,12 @@ SET (HDRS
MinecartWithChestWindow.h
WindowOwner.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(SlotArea.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=switch-enum -Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(Window.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=conversion -Wno-error=switch-enum -Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(ChestWindow.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(UI ${SRCS} ${HDRS})
endif()
diff --git a/src/UI/EnchantingWindow.cpp b/src/UI/EnchantingWindow.cpp
index fe21ee83d..4c5bcbfd5 100644
--- a/src/UI/EnchantingWindow.cpp
+++ b/src/UI/EnchantingWindow.cpp
@@ -30,7 +30,7 @@ cEnchantingWindow::cEnchantingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) :
void cEnchantingWindow::SetProperty(short a_Property, short a_Value, cPlayer & a_Player)
{
- if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue)))
+ if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= ARRAYCOUNT(m_PropertyValue)))
{
ASSERT(!"a_Property is invalid");
return;
@@ -47,7 +47,7 @@ void cEnchantingWindow::SetProperty(short a_Property, short a_Value, cPlayer & a
void cEnchantingWindow::SetProperty(short a_Property, short a_Value)
{
- if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue)))
+ if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= ARRAYCOUNT(m_PropertyValue)))
{
ASSERT(!"a_Property is invalid");
return;
@@ -63,7 +63,7 @@ void cEnchantingWindow::SetProperty(short a_Property, short a_Value)
short cEnchantingWindow::GetPropertyValue(short a_Property)
{
- if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue)))
+ if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= ARRAYCOUNT(m_PropertyValue)))
{
ASSERT(!"a_Property is invalid");
return 0;
diff --git a/src/UI/EnderChestWindow.cpp b/src/UI/EnderChestWindow.cpp
index a5484468f..c597f3a9b 100644
--- a/src/UI/EnderChestWindow.cpp
+++ b/src/UI/EnderChestWindow.cpp
@@ -24,7 +24,14 @@ cEnderChestWindow::cEnderChestWindow(cEnderChestEntity * a_EnderChest) :
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
// Play the opening sound:
- m_World->BroadcastSoundEffect("random.chestopen", (double)m_BlockX, (double)m_BlockY, (double)m_BlockZ, 1, 1);
+ m_World->BroadcastSoundEffect(
+ "random.chestopen",
+ static_cast<double>(m_BlockX),
+ static_cast<double>(m_BlockY),
+ static_cast<double>(m_BlockZ),
+ 1,
+ 1
+ );
// Send out the chest-open packet:
m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_ENDER_CHEST);
@@ -40,7 +47,13 @@ cEnderChestWindow::~cEnderChestWindow()
m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 0, E_BLOCK_ENDER_CHEST);
// Play the closing sound
- m_World->BroadcastSoundEffect("random.chestclosed", (double)m_BlockX, (double)m_BlockY, (double)m_BlockZ, 1, 1);
+ m_World->BroadcastSoundEffect(
+ "random.chestclosed",
+ static_cast<double>(m_BlockX),
+ static_cast<double>(m_BlockY),
+ static_cast<double>(m_BlockZ),
+ 1, 1
+ );
}
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 37683a8e5..5b58b18b6 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1394,7 +1394,7 @@ void cSlotAreaBeacon::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
// cSlotAreaEnchanting:
cSlotAreaEnchanting::cSlotAreaEnchanting(cWindow & a_ParentWindow, int a_BlockX, int a_BlockY, int a_BlockZ) :
- cSlotAreaTemporary(1, a_ParentWindow),
+ cSlotAreaTemporary(2, a_ParentWindow),
m_BlockX(a_BlockX),
m_BlockY(a_BlockY),
m_BlockZ(a_BlockZ)
@@ -2154,10 +2154,10 @@ bool cSlotAreaArmor::CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item)
{
switch (a_SlotNum)
{
- case 0: return ItemCategory::IsHelmet (a_Item.m_ItemType);
+ case 0: return (ItemCategory::IsHelmet(a_Item.m_ItemType) || (a_Item.m_ItemType == E_BLOCK_PUMPKIN));
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);
+ case 2: return ItemCategory::IsLeggings(a_Item.m_ItemType);
+ case 3: return ItemCategory::IsBoots(a_Item.m_ItemType);
}
return false;
}
diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h
index f6a9972d6..664c6502c 100644
--- a/src/UI/SlotArea.h
+++ b/src/UI/SlotArea.h
@@ -239,7 +239,7 @@ public:
// cSlotAreaTemporary overrides:
virtual void Clicked (cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
- virtual void DblClicked (cPlayer & a_Player, int a_SlotNum);
+ virtual void DblClicked (cPlayer & a_Player, int a_SlotNum) override;
virtual void OnPlayerRemoved(cPlayer & a_Player) override;
virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override;
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index d1c08acec..61e25651b 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -92,9 +92,9 @@ const AString cWindow::GetWindowTypeName(void) const
int cWindow::GetNumSlots(void) const
{
int res = 0;
- for (cSlotAreas::const_iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ for (const auto & itr : m_SlotAreas)
{
- res += (*itr)->GetNumSlots();
+ res += itr->GetNumSlots();
} // for itr - m_SlotAreas[]
return res;
}
@@ -261,16 +261,14 @@ void cWindow::Clicked(
}
int LocalSlotNum = a_SlotNum;
- int idx = 0;
- for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ for (const auto & itr : m_SlotAreas)
{
- if (LocalSlotNum < (*itr)->GetNumSlots())
+ if (LocalSlotNum < itr->GetNumSlots())
{
- (*itr)->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
+ itr->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
return;
}
- LocalSlotNum -= (*itr)->GetNumSlots();
- idx++;
+ LocalSlotNum -= itr->GetNumSlots();
}
LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.",
diff --git a/src/Vector3.h b/src/Vector3.h
index 346bc1bbb..168071469 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -384,6 +384,28 @@ template <> inline Vector3<int> Vector3<int>::Floor(void) const
+template <typename What>
+class VectorHasher
+{
+public:
+ /** Provides a hash of a vector's contents */
+ size_t operator()(const Vector3<What> & a_Vector) const
+ {
+ // Guaranteed to have no hash collisions for any 128x128x128 area
+ size_t Hash = 0;
+ Hash ^= static_cast<size_t>(a_Vector.x);
+ Hash <<= 8;
+ Hash ^= static_cast<size_t>(a_Vector.y);
+ Hash <<= 8;
+ Hash ^= static_cast<size_t>(a_Vector.z);
+ return Hash;
+ }
+};
+
+
+
+
+
template <typename T>
const double Vector3<T>::EPS = 0.000001;
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index 1cb4463e1..91fad96c6 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -321,7 +321,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque
int MemUsageKiB = cRoot::GetPhysicalRAMUsage();
if (MemUsageKiB > 0)
{
- ReplaceString(Template, "{MEM}", Printf("%.02f", (double)MemUsageKiB / 1024));
+ ReplaceString(Template, "{MEM}", Printf("%.02f", static_cast<double>(MemUsageKiB) / 1024));
ReplaceString(Template, "{MEMKIB}", Printf("%d", MemUsageKiB));
}
else
@@ -648,7 +648,7 @@ void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_
void cWebAdmin::OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size)
{
UNUSED(a_Connection);
- cRequestData * Data = (cRequestData *)(a_Request.GetUserData());
+ cRequestData * Data = reinterpret_cast<cRequestData *>(a_Request.GetUserData());
if (Data == nullptr)
{
return;
@@ -681,7 +681,7 @@ void cWebAdmin::OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest &
}
// Delete any request data assigned to the request:
- cRequestData * Data = (cRequestData *)(a_Request.GetUserData());
+ cRequestData * Data = reinterpret_cast<cRequestData *>(a_Request.GetUserData());
delete Data;
Data = nullptr;
}
diff --git a/src/World.cpp b/src/World.cpp
index c0a79b9d0..123e4a8da 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -58,6 +58,8 @@
#endif
#include "Broadcaster.h"
+#include "SpawnPrepare.h"
+#include "FastRandom.h"
@@ -72,140 +74,6 @@ const int TIME_SPAWN_DIVISOR = 148;
////////////////////////////////////////////////////////////////////////////////
-// cSpawnPrepare:
-
-/** Generates and lights the spawn area of the world. Runs as a separate thread. */
-class cSpawnPrepare:
- public cIsThread,
- public cChunkCoordCallback
-{
- typedef cIsThread super;
-
-public:
- cSpawnPrepare(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance):
- super("SpawnPrepare"),
- m_World(a_World),
- m_SpawnChunkX(a_SpawnChunkX),
- m_SpawnChunkZ(a_SpawnChunkZ),
- m_PrepareDistance(a_PrepareDistance),
- m_MaxIdx(a_PrepareDistance * a_PrepareDistance),
- m_NumPrepared(0),
- m_LastReportChunkCount(0)
- {
- // Start the thread:
- Start();
-
- // Wait for start confirmation, so that the thread can be waited-upon after the constructor returns:
- m_EvtStarted.Wait();
- }
-
-
- // cIsThread override:
- virtual void Execute(void) override
- {
- // Confirm thread start:
- m_EvtStarted.Set();
-
- // Queue the initial chunks:
- m_MaxIdx = m_PrepareDistance * m_PrepareDistance;
- int maxQueue = std::min(m_MaxIdx - 1, 100); // Number of chunks to queue at once
- m_NextIdx = maxQueue;
- m_LastReportTime = std::chrono::steady_clock::now();
- for (int i = 0; i < maxQueue; i++)
- {
- int chunkX, chunkZ;
- DecodeChunkCoords(i, chunkX, chunkZ);
- m_World.PrepareChunk(chunkX, chunkZ, this);
- } // for i
-
- // Wait for the lighting thread to prepare everything. Event is set in the Call() callback:
- m_EvtFinished.Wait();
- }
-
-protected:
- cWorld & m_World;
- int m_SpawnChunkX;
- int m_SpawnChunkZ;
- int m_PrepareDistance;
-
- /** The index of the next chunk to be queued in the lighting thread. */
- int m_NextIdx;
-
- /** The maximum index of the prepared chunks. Queueing stops when m_NextIdx reaches this number. */
- int m_MaxIdx;
-
- /** Total number of chunks already finished preparing. Preparation finishes when this number reaches m_MaxIdx. */
- int m_NumPrepared;
-
- /** Event used to signal that the thread has started. */
- cEvent m_EvtStarted;
-
- /** Event used to signal that the preparation is finished. */
- cEvent m_EvtFinished;
-
- /** The timestamp of the last progress report emitted. */
- std::chrono::steady_clock::time_point m_LastReportTime;
-
- /** Number of chunks prepared when the last progress report was emitted. */
- int m_LastReportChunkCount;
-
- // cChunkCoordCallback override:
- virtual void Call(int a_ChunkX, int a_ChunkZ)
- {
- // Check if this was the last chunk:
- m_NumPrepared += 1;
- if (m_NumPrepared >= m_MaxIdx)
- {
- m_EvtFinished.Set();
- // Must return here, because "this" may have gotten deleted by the previous line
- return;
- }
-
- // Queue another chunk, if appropriate:
- if (m_NextIdx < m_MaxIdx)
- {
- int chunkX, chunkZ;
- DecodeChunkCoords(m_NextIdx, chunkX, chunkZ);
- m_World.GetLightingThread().QueueChunk(chunkX, chunkZ, this);
- m_NextIdx += 1;
- }
-
- // Report progress every 1 second:
- auto Now = std::chrono::steady_clock::now();
- if (Now - m_LastReportTime > std::chrono::seconds(1))
- {
- float PercentDone = static_cast<float>(m_NumPrepared * 100) / m_MaxIdx;
- float ChunkSpeed = static_cast<float>((m_NumPrepared - m_LastReportChunkCount) * 1000) / std::chrono::duration_cast<std::chrono::milliseconds>(Now - m_LastReportTime).count();
- LOG("Preparing spawn (%s): %.02f%% (%d/%d; %.02f chunks / sec)",
- m_World.GetName().c_str(), PercentDone, m_NumPrepared, m_MaxIdx, ChunkSpeed
- );
- m_LastReportTime = Now;
- m_LastReportChunkCount = m_NumPrepared;
- }
- }
-
-
- /** Decodes the index into chunk coords. Provides the specific chunk ordering. */
- void DecodeChunkCoords(int a_Idx, int & a_ChunkX, int & a_ChunkZ)
- {
- // A zigzag pattern from the top to bottom, each row alternating between forward-x and backward-x:
- int z = a_Idx / m_PrepareDistance;
- int x = a_Idx % m_PrepareDistance;
- if ((z & 1) == 0)
- {
- // Reverse every second row:
- x = m_PrepareDistance - 1 - x;
- }
- a_ChunkZ = m_SpawnChunkZ + z - m_PrepareDistance / 2;
- a_ChunkX = m_SpawnChunkX + x - m_PrepareDistance / 2;
- }
-};
-
-
-
-
-
-////////////////////////////////////////////////////////////////////////////////
// cWorld::cLock:
cWorld::cLock::cLock(cWorld & a_World) :
@@ -319,6 +187,7 @@ cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AStrin
m_Scoreboard(this),
m_MapManager(this),
m_GeneratorCallbacks(*this),
+ m_ChunkSender(*this),
m_TickThread(*this)
{
LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str());
@@ -362,6 +231,7 @@ cWorld::~cWorld()
void cWorld::CastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ)
{
BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ);
+ BroadcastSoundEffect("ambient.weather.thunder", a_BlockX, a_BlockY, a_BlockZ, 50, 1);
}
@@ -469,8 +339,7 @@ void cWorld::InitializeSpawn(void)
int ViewDist = IniFile.GetValueSetI("SpawnPosition", "PregenerateDistance", DefaultViewDist);
IniFile.WriteFile(m_IniFileName);
- cSpawnPrepare prep(*this, ChunkX, ChunkZ, ViewDist);
- prep.Wait();
+ cSpawnPrepare::PrepareChunks(*this, ChunkX, ChunkZ, ViewDist);
#ifdef TEST_LINEBLOCKTRACER
// DEBUG: Test out the cLineBlockTracer class by tracing a few lines:
@@ -597,6 +466,10 @@ void cWorld::Start(void)
m_bCommandBlocksEnabled = IniFile.GetValueSetB("Mechanics", "CommandBlocksEnabled", false);
m_bEnabledPVP = IniFile.GetValueSetB("Mechanics", "PVPEnabled", true);
m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true);
+ m_MinNetherPortalWidth = IniFile.GetValueSetI("Mechanics", "MinNetherPortalWidth", 2);
+ m_MaxNetherPortalWidth = IniFile.GetValueSetI("Mechanics", "MaxNetherPortalWidth", 21);
+ m_MinNetherPortalHeight = IniFile.GetValueSetI("Mechanics", "MinNetherPortalHeight", 3);
+ m_MaxNetherPortalHeight = IniFile.GetValueSetI("Mechanics", "MaxNetherPortalHeight", 21);
m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true);
m_IsDaylightCycleEnabled = IniFile.GetValueSetB("General", "IsDaylightCycleEnabled", true);
int GameMode = IniFile.GetValueSetI("General", "Gamemode", (int)m_GameMode);
@@ -621,18 +494,18 @@ void cWorld::Start(void)
InitialiseAndLoadMobSpawningValues(IniFile);
SetTimeOfDay(IniFile.GetValueSetI("General", "TimeInTicks", GetTimeOfDay()));
- m_ChunkMap = make_unique<cChunkMap>(this);
+ m_ChunkMap = cpp14::make_unique<cChunkMap>(this);
// preallocate some memory for ticking blocks so we don't need to allocate that often
m_BlockTickQueue.reserve(1000);
m_BlockTickQueueCopy.reserve(1000);
// Simulators:
- m_SimulatorManager = make_unique<cSimulatorManager>(*this);
+ m_SimulatorManager = cpp14::make_unique<cSimulatorManager>(*this);
m_WaterSimulator = InitializeFluidSimulator(IniFile, "Water", E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER);
m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA);
- m_SandSimulator = make_unique<cSandSimulator>(*this, IniFile);
- m_FireSimulator = make_unique<cFireSimulator>(*this, IniFile);
+ m_SandSimulator = cpp14::make_unique<cSandSimulator>(*this, IniFile);
+ m_FireSimulator = cpp14::make_unique<cFireSimulator>(*this, IniFile);
m_RedstoneSimulator = InitializeRedstoneSimulator(IniFile);
// Water, Lava and Redstone simulators get registered in their initialize function.
@@ -642,7 +515,7 @@ void cWorld::Start(void)
m_Lighting.Start(this);
m_Storage.Start(this, m_StorageSchema, m_StorageCompressionFactor);
m_Generator.Start(m_GeneratorCallbacks, m_GeneratorCallbacks, IniFile);
- m_ChunkSender.Start(this);
+ m_ChunkSender.Start();
m_TickThread.Start();
// Init of the spawn monster time (as they are supposed to have different spawn rate)
@@ -800,7 +673,7 @@ void cWorld::InitialiseGeneratorDefaults(cIniFile & a_IniFile)
a_IniFile.GetValueSet("Generator", "BiomeGen", "Grown");
a_IniFile.GetValueSet("Generator", "ShapeGen", "BiomalNoise3D");
a_IniFile.GetValueSet("Generator", "CompositionGen", "Biomal");
- a_IniFile.GetValueSet("Generator", "Finishers", "Ravines, WormNestCaves, WaterLakes, WaterSprings, LavaLakes, LavaSprings, OreNests, Mineshafts, Trees, Villages, SprinkleFoliage, Ice, Snow, Lilypads, BottomLava, DeadBushes, NaturalPatches, PreSimulator, Animals");
+ a_IniFile.GetValueSet("Generator", "Finishers", "RoughRavines, WormNestCaves, WaterLakes, WaterSprings, LavaLakes, LavaSprings, OreNests, Mineshafts, Trees, Villages, TallGrass, SprinkleFoliage, Ice, Snow, Lilypads, BottomLava, DeadBushes, NaturalPatches, PreSimulator, Animals");
break;
}
case dimNether:
@@ -1459,6 +1332,30 @@ bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback
+bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, std::function<bool(cChunk &)> a_Callback)
+{
+ struct cCallBackWrapper : cChunkCallback
+ {
+ cCallBackWrapper(std::function<bool(cChunk &)> a_InnerCallback) :
+ m_Callback(a_InnerCallback)
+ {
+ }
+
+ virtual bool Item(cChunk * a_Chunk)
+ {
+ return m_Callback(*a_Chunk);
+ }
+
+ private:
+ std::function<bool(cChunk &)> m_Callback;
+ } callback(a_Callback);
+ return m_ChunkMap->DoWithChunk(a_ChunkX, a_ChunkZ, callback);
+}
+
+
+
+
+
bool cWorld::DoWithChunkAt(Vector3i a_BlockPos, std::function<bool(cChunk &)> a_Callback)
{
return m_ChunkMap->DoWithChunkAt(a_BlockPos, a_Callback);
@@ -1496,9 +1393,23 @@ void cWorld::GrowTreeFromSapling(int a_X, int a_Y, int a_Z, NIBBLETYPE a_Sapling
case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other); break;
case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other); break;
case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other); break;
- case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other); break;
case E_META_SAPLING_ACACIA: GetAcaciaTreeImage (a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other); break;
- case E_META_SAPLING_DARK_OAK: GetDarkoakTreeImage(a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other); break;
+ case E_META_SAPLING_JUNGLE:
+ {
+ bool IsLarge = GetLargeTreeAdjustment(*this, a_X, a_Y, a_Z, a_SaplingMeta);
+ GetJungleTreeImage (a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other, IsLarge);
+ break;
+ }
+ case E_META_SAPLING_DARK_OAK:
+ {
+ if (!GetLargeTreeAdjustment(*this, a_X, a_Y, a_Z, a_SaplingMeta))
+ {
+ return;
+ }
+
+ GetDarkoakTreeImage(a_X, a_Y, a_Z, Noise, WorldAge, Logs, Other);
+ break;
+ }
}
Other.insert(Other.begin(), Logs.begin(), Logs.end());
Logs.clear();
@@ -1569,6 +1480,7 @@ void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks)
bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal)
{
+ cFastRandom random;
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
@@ -1582,10 +1494,19 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
if (BlockMeta < 7)
{
- FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
+ if (!a_IsByBonemeal)
+ {
+ ++BlockMeta;
+ }
+ else
+ {
+ BlockMeta += random.NextInt(4) + 2;
+ BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
+ }
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
}
- return true;
+ return BlockMeta == 7;
}
case E_BLOCK_COCOA_POD:
@@ -1599,7 +1520,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, (NIBBLETYPE) (GrowState << 2 | TypeMeta));
BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
}
- return true;
+ return GrowState == 2;
}
case E_BLOCK_CROPS:
@@ -1610,10 +1531,19 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
if (BlockMeta < 7)
{
- FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
+ if (!a_IsByBonemeal)
+ {
+ ++BlockMeta;
+ }
+ else
+ {
+ BlockMeta += random.NextInt(4) + 2;
+ BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
+ }
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
}
- return true;
+ return BlockMeta == 7;
}
case E_BLOCK_MELON_STEM:
@@ -1624,7 +1554,17 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
return false;
}
- FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
+
+ if (!a_IsByBonemeal)
+ {
+ ++BlockMeta;
+ }
+ else
+ {
+ BlockMeta += random.NextInt(4) + 2;
+ BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
+ }
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
}
else
@@ -1635,7 +1575,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType);
}
- return true;
+ return BlockMeta == 7;
}
case E_BLOCK_POTATOES:
@@ -1646,10 +1586,19 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
if (BlockMeta < 7)
{
- FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
+ if (!a_IsByBonemeal)
+ {
+ ++BlockMeta;
+ }
+ else
+ {
+ BlockMeta += random.NextInt(4) + 2;
+ BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
+ }
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
}
- return true;
+ return BlockMeta == 7;
}
case E_BLOCK_PUMPKIN_STEM:
@@ -1660,7 +1609,17 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
return false;
}
- FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
+
+ if (!a_IsByBonemeal)
+ {
+ ++BlockMeta;
+ }
+ else
+ {
+ BlockMeta += random.NextInt(4) + 2;
+ BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
+ }
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
}
else
@@ -1671,7 +1630,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType);
}
- return true;
+ return BlockMeta == 7;
}
case E_BLOCK_SAPLING:
@@ -1680,8 +1639,31 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
{
return false;
}
- GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
- return true;
+ NIBBLETYPE TypeMeta = BlockMeta & 0x07;
+ int GrowState = BlockMeta >> 3;
+
+ if (GrowState < 1)
+ {
+ // Non-bonemeal forces a growth, while bonemeal only has a chance of growing it
+ if (!a_IsByBonemeal)
+ {
+ ++GrowState;
+ }
+ else if (random.NextInt(99) < 45)
+ {
+ ++GrowState;
+ }
+
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, static_cast<NIBBLETYPE>(GrowState << 3 | TypeMeta));
+ BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
+ }
+ else if (random.NextInt(99) < 45)
+ {
+
+ GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
+ return true;
+ }
+ return false;
}
case E_BLOCK_GRASS:
@@ -2071,7 +2053,7 @@ void cWorld::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_V
-void cWorld::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
+void cWorld::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
{
m_ChunkMap->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType, a_Exclude);
}
@@ -2134,15 +2116,6 @@ void cWorld::BroadcastChat(const cCompositeChat & a_Message, const cClientHandle
-void cWorld::BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude)
-{
- m_ChunkMap->BroadcastChunkData(a_ChunkX, a_ChunkZ, a_Serializer, a_Exclude);
-}
-
-
-
-
-
void cWorld::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude)
{
m_ChunkMap->BroadcastCollectEntity(a_Entity, a_Player, a_Exclude);
@@ -2594,10 +2567,23 @@ void cWorld::SetChunkData(cSetChunkData & a_SetChunkData)
// If a client is requesting this chunk, send it to them:
int ChunkX = a_SetChunkData.GetChunkX();
int ChunkZ = a_SetChunkData.GetChunkZ();
- if (m_ChunkMap->HasChunkAnyClients(ChunkX, ChunkZ))
- {
- m_ChunkSender.ChunkReady(ChunkX, ChunkZ);
- }
+ cChunkSender & ChunkSender = m_ChunkSender;
+ DoWithChunk(
+ ChunkX, ChunkZ,
+ [&ChunkSender] (cChunk & a_Chunk) -> bool
+ {
+ if (a_Chunk.HasAnyClients())
+ {
+ ChunkSender.QueueSendChunkTo(
+ a_Chunk.GetPosX(),
+ a_Chunk.GetPosZ(),
+ cChunkSender::E_CHUNK_PRIORITY_MEDIUM,
+ a_Chunk.GetAllClients()
+ );
+ }
+ return true;
+ }
+ );
// Save the chunk right after generating, so that we don't have to generate it again on next run
if (a_SetChunkData.ShouldMarkDirty())
@@ -2680,7 +2666,7 @@ void cWorld::UnloadUnusedChunks(void)
void cWorld::QueueUnloadUnusedChunks(void)
{
- QueueTask(make_unique<cWorld::cTaskUnloadUnusedChunks>());
+ QueueTask(cpp14::make_unique<cWorld::cTaskUnloadUnusedChunks>());
}
@@ -3005,9 +2991,9 @@ void cWorld::TouchChunk(int a_ChunkX, int a_ChunkZ)
-void cWorld::PrepareChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallAfter)
+void cWorld::PrepareChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallAfter)
{
- m_ChunkMap->PrepareChunk(a_ChunkX, a_ChunkZ, a_CallAfter);
+ m_ChunkMap->PrepareChunk(a_ChunkX, a_ChunkZ, std::move(a_CallAfter));
}
@@ -3097,7 +3083,7 @@ bool cWorld::SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Op
return false;
}
- bool IsOpen = (Meta & 0x4) > 0;
+ bool IsOpen = (Meta & 0x4) != 0;
if (a_Open != IsOpen)
{
SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta ^ 0x4);
@@ -3131,9 +3117,9 @@ void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ)
-void cWorld::QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback)
+void cWorld::QueueLightChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_Callback)
{
- m_Lighting.QueueChunk(a_ChunkX, a_ChunkZ, a_Callback);
+ m_Lighting.QueueChunk(a_ChunkX, a_ChunkZ, std::move(a_Callback));
}
@@ -3184,7 +3170,11 @@ void cWorld::QueueTask(cTaskPtr a_Task)
}
-
+void cWorld::ScheduleTask(int a_DelayTicks, std::function<void (cWorld&)> a_Func)
+{
+ cTaskLambda task(a_Func);
+ ScheduleTask(a_DelayTicks, static_cast<cTaskPtr>(std::make_shared<cTaskLambda>(task)));
+}
void cWorld::ScheduleTask(int a_DelayTicks, cTaskPtr a_Task)
@@ -3687,8 +3677,10 @@ void cWorld::cTaskSendBlockToAllPlayers::Run(cWorld & a_World)
a_World.ForEachPlayer(PlayerCallback);
}
-
-
+void cWorld::cTaskLambda::Run(cWorld & a_World)
+{
+ m_func(a_World);
+}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/World.h b/src/World.h
index 6c0548ae6..aeab7bfa5 100644
--- a/src/World.h
+++ b/src/World.h
@@ -103,8 +103,12 @@ public:
class cTask
{
public:
+ cTask(const cTask & other) = default;
virtual ~cTask() {}
virtual void Run(cWorld & a_World) = 0;
+
+ protected:
+ cTask() {}
} ;
typedef SharedPtr<cTask> cTaskPtr;
@@ -142,6 +146,21 @@ public:
std::vector<Vector3i> m_SendQueue;
};
+ class cTaskLambda :
+ public cTask
+ {
+
+ public:
+ cTaskLambda(std::function<void(cWorld&)> a_Func) :
+ m_func(a_Func)
+ { }
+
+ protected:
+ virtual void Run(cWorld & a_World) override;
+
+ std::function<void(cWorld&)> m_func;
+ };
+
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
{
@@ -203,10 +222,10 @@ public:
bool VillagersShouldHarvestCrops(void) const { return m_VillagersShouldHarvestCrops; }
- virtual eDimension GetDimension(void) const { return m_Dimension; }
+ virtual eDimension GetDimension(void) const override { return m_Dimension; }
/** Returns the world height at the specified coords; waits for the chunk to get loaded / generated */
- virtual int GetHeight(int a_BlockX, int a_BlockZ);
+ virtual int GetHeight(int a_BlockX, int a_BlockZ) override;
// tolua_end
@@ -216,7 +235,7 @@ public:
// Broadcast respective packets to all clients of the chunk where the event is taking place
// (Please keep these alpha-sorted)
void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
- void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr); // tolua_export
+ void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr); // tolua_export
void BroadcastBlockBreakAnimation(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = nullptr);
void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = nullptr); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
@@ -231,7 +250,6 @@ public:
void BroadcastChat (const cCompositeChat & a_Message, const cClientHandle * a_Exclude = nullptr);
// tolua_end
- void BroadcastChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude = nullptr);
void BroadcastCollectEntity (const cEntity & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr);
void BroadcastDestroyEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr);
void BroadcastEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration, const cClientHandle * a_Exclude = nullptr);
@@ -253,7 +271,7 @@ public:
void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display);
- void BroadcastSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr); // tolua_export
+ void BroadcastSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
void BroadcastSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = nullptr); // tolua_export
void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr);
void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr);
@@ -385,7 +403,7 @@ public:
The specified chunk is queued to be loaded or generated, and lit if needed.
The specified callback is called after the chunk has been prepared. If there's no preparation to do, only the callback is called.
It is legal to call with no callback. */
- void PrepareChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallAfter = nullptr);
+ void PrepareChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallAfter = {});
/** Marks the chunk as failed-to-load: */
void ChunkLoadFailed(int a_ChunkX, int a_ChunkZ);
@@ -409,7 +427,7 @@ public:
void GenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
/** Queues a chunk for lighting; a_Callback is called after the chunk is lighted */
- void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = nullptr);
+ void QueueLightChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_Callback = {});
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
@@ -609,6 +627,7 @@ public:
/** Calls the callback for the chunk specified, with ChunkMapCS locked; returns false if the chunk doesn't exist, otherwise returns the same value as the callback */
bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback);
+ bool DoWithChunk(int a_ChunkX, int a_ChunkZ, std::function<bool(cChunk &)> a_Callback);
/** Calls the callback for the chunk at the block position specified, with ChunkMapCS locked; returns false if the chunk doesn't exist, otherwise returns the same value as the callback **/
bool DoWithChunkAt(Vector3i a_BlockPos, std::function<bool(cChunk &)> a_Callback);
@@ -694,6 +713,18 @@ public:
AString GetLinkedOverworldName(void) const { return m_LinkedOverworldName; }
void SetLinkedOverworldName(const AString & a_Name) { m_LinkedOverworldName = a_Name; }
+ /** Returns or sets the minumim or maximum netherportal width */
+ virtual int GetMinNetherPortalWidth(void) const override { return m_MinNetherPortalWidth; }
+ virtual int GetMaxNetherPortalWidth(void) const override { return m_MaxNetherPortalWidth; }
+ virtual void SetMinNetherPortalWidth(int a_NewMinWidth) override { m_MinNetherPortalWidth = a_NewMinWidth; }
+ virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) override { m_MaxNetherPortalWidth = a_NewMaxWidth; }
+
+ /** Returns or sets the minumim or maximum netherportal height */
+ virtual int GetMinNetherPortalHeight(void) const override { return m_MinNetherPortalHeight; }
+ virtual int GetMaxNetherPortalHeight(void) const override { return m_MaxNetherPortalHeight; }
+ virtual void SetMinNetherPortalHeight(int a_NewMinHeight) override { m_MinNetherPortalHeight = a_NewMinHeight; }
+ virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) override { m_MaxNetherPortalHeight = a_NewMaxHeight; }
+
// tolua_end
/** Saves all chunks immediately. Dangerous interface, may deadlock, use QueueSaveAllChunks() instead */
@@ -705,6 +736,9 @@ public:
/** Queues a task onto the tick thread. The task object will be deleted once the task is finished */
void QueueTask(cTaskPtr a_Task); // Exported in ManualBindings.cpp
+ /** Queues a lambda task onto the tick thread, with the specified delay. */
+ void ScheduleTask(int a_DelayTicks, std::function<void(cWorld&)> a_Func);
+
/** Queues a task onto the tick thread, with the specified delay. */
void ScheduleTask(int a_DelayTicks, cTaskPtr a_Task);
@@ -788,7 +822,7 @@ public:
bool IsWeatherWet(void) const { return !IsWeatherSunny(); }
/** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */
- virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ)
+ virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) override
{
return (IsWeatherWet() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ)));
}
@@ -817,7 +851,7 @@ public:
UInt32 CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed = nullptr); // tolua_export
/** Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread! */
- int GetTickRandomNumber(int a_Range) { return (int)(m_TickRand.randInt(a_Range)); }
+ int GetTickRandomNumber(int a_Range) { return static_cast<int>(m_TickRand.randInt(a_Range)); }
/** Appends all usernames starting with a_Text (case-insensitive) into Results */
void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
@@ -920,6 +954,12 @@ private:
double m_SpawnY;
double m_SpawnZ;
+ // Variables defining the minimum and maximum size for a nether portal
+ int m_MinNetherPortalWidth;
+ int m_MaxNetherPortalWidth;
+ int m_MinNetherPortalHeight;
+ int m_MaxNetherPortalHeight;
+
bool m_BroadcastDeathMessages;
bool m_BroadcastAchievementMessages;
diff --git a/src/WorldStorage/CMakeLists.txt b/src/WorldStorage/CMakeLists.txt
index 59193db2a..017d85f27 100644
--- a/src/WorldStorage/CMakeLists.txt
+++ b/src/WorldStorage/CMakeLists.txt
@@ -14,7 +14,8 @@ SET (SRCS
ScoreboardSerializer.cpp
StatSerializer.cpp
WSSAnvil.cpp
- WorldStorage.cpp)
+ WorldStorage.cpp
+)
SET (HDRS
EnchantmentSerializer.h
@@ -26,7 +27,20 @@ SET (HDRS
ScoreboardSerializer.h
StatSerializer.h
WSSAnvil.h
- WorldStorage.h)
+ WorldStorage.h
+)
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(EnchantmentSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(FastNBT.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
+ set_source_files_properties(FireworksSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
+ set_source_files_properties(MapSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(NBTChunkSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=sign-conversion -Wno-error=conversion -Wno-error=old-style-cast")
+ set_source_files_properties(SchematicFileSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=shadow -Wno-error=conversion -Wno-error=old-style-cast -Wno-error=global-constructors")
+ set_source_files_properties(ScoreboardSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(WSSAnvil.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=shorten-64-to-32 -Wno-error=switch -Wno-error=switch-enum -Wno-error=conversion -Wno-error=old-style-cast")
+ set_source_files_properties(WorldStorage.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
if(NOT MSVC)
add_library(WorldStorage ${SRCS} ${HDRS})
diff --git a/src/WorldStorage/EnchantmentSerializer.cpp b/src/WorldStorage/EnchantmentSerializer.cpp
index a6e562956..b28e16b1d 100644
--- a/src/WorldStorage/EnchantmentSerializer.cpp
+++ b/src/WorldStorage/EnchantmentSerializer.cpp
@@ -14,8 +14,8 @@ void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantme
for (cEnchantments::cMap::const_iterator itr = a_Enchantments.m_Enchantments.begin(), end = a_Enchantments.m_Enchantments.end(); itr != end; ++itr)
{
a_Writer.BeginCompound("");
- a_Writer.AddShort("id", itr->first);
- a_Writer.AddShort("lvl", itr->second);
+ a_Writer.AddShort("id", static_cast<Int16>(itr->first));
+ a_Writer.AddShort("lvl", static_cast<Int16>(itr->second));
a_Writer.EndCompound();
} // for itr - m_Enchantments[]
a_Writer.EndList();
@@ -82,7 +82,7 @@ void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const c
}
// Store the enchantment:
- a_Enchantments.m_Enchantments[id] = lvl;
+ a_Enchantments.m_Enchantments[id] = static_cast<unsigned int>(lvl);
} // for tag - children of the ench list tag
}
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index 033a07601..860eb3a4a 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -257,7 +257,10 @@ bool cParsedNBT::ReadTag(void)
return true;
}
+ #if !defined(__clang__)
default:
+ #endif
+ case TAG_Min:
{
ASSERT(!"Unhandled NBT tag type");
return false;
@@ -503,7 +506,7 @@ void cFastNBTWriter::AddString(const AString & a_Name, const AString & a_Value)
void cFastNBTWriter::AddByteArray(const AString & a_Name, const char * a_Value, size_t a_NumElements)
{
TagCommon(a_Name, TAG_ByteArray);
- u_long len = htonl(static_cast<u_long>(a_NumElements));
+ u_int len = htonl(static_cast<u_int>(a_NumElements));
m_Result.append(reinterpret_cast<const char *>(&len), 4);
m_Result.append(a_Value, a_NumElements);
}
@@ -515,7 +518,7 @@ void cFastNBTWriter::AddByteArray(const AString & a_Name, const char * a_Value,
void cFastNBTWriter::AddIntArray(const AString & a_Name, const int * a_Value, size_t a_NumElements)
{
TagCommon(a_Name, TAG_IntArray);
- u_long len = htonl(static_cast<u_long>(a_NumElements));
+ u_int len = htonl(static_cast<u_int>(a_NumElements));
size_t cap = m_Result.capacity();
size_t size = m_Result.length();
if ((cap - size) < (4 + a_NumElements * 4))
diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h
index 35e47c8e4..a23dc7af2 100644
--- a/src/WorldStorage/FastNBT.h
+++ b/src/WorldStorage/FastNBT.h
@@ -126,33 +126,33 @@ public:
int GetRoot(void) const {return 0; }
/** Returns the first child of the specified tag, or -1 if none / not applicable. */
- int GetFirstChild (int a_Tag) const { return m_Tags[(size_t)a_Tag].m_FirstChild; }
+ int GetFirstChild (int a_Tag) const { return m_Tags[static_cast<size_t>(a_Tag)].m_FirstChild; }
/** Returns the last child of the specified tag, or -1 if none / not applicable. */
- int GetLastChild (int a_Tag) const { return m_Tags[(size_t)a_Tag].m_LastChild; }
+ int GetLastChild (int a_Tag) const { return m_Tags[static_cast<size_t>(a_Tag)].m_LastChild; }
/** Returns the next sibling of the specified tag, or -1 if none. */
- int GetNextSibling(int a_Tag) const { return m_Tags[(size_t)a_Tag].m_NextSibling; }
+ int GetNextSibling(int a_Tag) const { return m_Tags[static_cast<size_t>(a_Tag)].m_NextSibling; }
/** Returns the previous sibling of the specified tag, or -1 if none. */
- int GetPrevSibling(int a_Tag) const { return m_Tags[(size_t)a_Tag].m_PrevSibling; }
+ int GetPrevSibling(int a_Tag) const { return m_Tags[static_cast<size_t>(a_Tag)].m_PrevSibling; }
/** Returns the length of the tag's data, in bytes.
Not valid for Compound or List tags! */
size_t GetDataLength (int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type != TAG_List);
- ASSERT(m_Tags[(size_t)a_Tag].m_Type != TAG_Compound);
- return m_Tags[(size_t)a_Tag].m_DataLength;
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type != TAG_List);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type != TAG_Compound);
+ return m_Tags[static_cast<size_t>(a_Tag)].m_DataLength;
}
/** Returns the data stored in this tag.
Not valid for Compound or List tags! */
const char * GetData(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type != TAG_List);
- ASSERT(m_Tags[(size_t)a_Tag].m_Type != TAG_Compound);
- return m_Data + m_Tags[(size_t)a_Tag].m_DataStart;
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type != TAG_List);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type != TAG_Compound);
+ return m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart;
}
/** Returns the direct child tag of the specified name, or -1 if no such tag. */
@@ -167,47 +167,47 @@ public:
/** Returns the child tag of the specified path (Name1 / Name2 / Name3...), or -1 if no such tag. */
int FindTagByPath(int a_Tag, const AString & a_Path) const;
- eTagType GetType(int a_Tag) const { return m_Tags[(size_t)a_Tag].m_Type; }
+ eTagType GetType(int a_Tag) const { return m_Tags[static_cast<size_t>(a_Tag)].m_Type; }
/** Returns the children type for a List tag; undefined on other tags. If list empty, returns TAG_End. */
eTagType GetChildrenType(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_List);
- return (m_Tags[(size_t)a_Tag].m_FirstChild < 0) ? TAG_End : m_Tags[(size_t)m_Tags[(size_t)a_Tag].m_FirstChild].m_Type;
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_List);
+ return (m_Tags[static_cast<size_t>(a_Tag)].m_FirstChild < 0) ? TAG_End : m_Tags[static_cast<size_t>(m_Tags[static_cast<size_t>(a_Tag)].m_FirstChild)].m_Type;
}
/** Returns the value stored in a Byte tag. Not valid for any other tag type. */
inline unsigned char GetByte(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Byte);
- return (unsigned char)(m_Data[(size_t)m_Tags[(size_t)a_Tag].m_DataStart]);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_Byte);
+ return static_cast<unsigned char>(m_Data[static_cast<size_t>(m_Tags[static_cast<size_t>(a_Tag)].m_DataStart)]);
}
/** Returns the value stored in a Short tag. Not valid for any other tag type. */
inline Int16 GetShort(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Short);
- return GetBEShort(m_Data + m_Tags[(size_t)a_Tag].m_DataStart);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_Short);
+ return GetBEShort(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart);
}
/** Returns the value stored in an Int tag. Not valid for any other tag type. */
inline Int32 GetInt(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Int);
- return GetBEInt(m_Data + m_Tags[(size_t)a_Tag].m_DataStart);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_Int);
+ return GetBEInt(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart);
}
/** Returns the value stored in a Long tag. Not valid for any other tag type. */
inline Int64 GetLong(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Long);
- return NetworkToHostLong8(m_Data + m_Tags[(size_t)a_Tag].m_DataStart);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_Long);
+ return NetworkToHostLong8(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart);
}
/** Returns the value stored in a Float tag. Not valid for any other tag type. */
inline float GetFloat(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Float);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_Float);
// Cause a compile-time error if sizeof(float) != 4
// If your platform produces a compiler error here, you'll need to add code that manually decodes 32-bit floats
@@ -216,7 +216,7 @@ public:
UNUSED_VAR(Check1);
UNUSED_VAR(Check2);
- Int32 i = GetBEInt(m_Data + m_Tags[(size_t)a_Tag].m_DataStart);
+ Int32 i = GetBEInt(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart);
float f;
memcpy(&f, &i, sizeof(f));
return f;
@@ -232,16 +232,16 @@ public:
UNUSED_VAR(Check1);
UNUSED_VAR(Check2);
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Double);
- return NetworkToHostDouble8(m_Data + m_Tags[(size_t)a_Tag].m_DataStart);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_Double);
+ return NetworkToHostDouble8(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart);
}
/** Returns the value stored in a String tag. Not valid for any other tag type. */
inline AString GetString(int a_Tag) const
{
- ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_String);
+ ASSERT(m_Tags[static_cast<size_t>(a_Tag)].m_Type == TAG_String);
AString res;
- res.assign(m_Data + m_Tags[(size_t)a_Tag].m_DataStart, (size_t)m_Tags[(size_t)a_Tag].m_DataLength);
+ res.assign(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_DataStart, static_cast<size_t>(m_Tags[static_cast<size_t>(a_Tag)].m_DataLength));
return res;
}
@@ -249,7 +249,7 @@ public:
inline AString GetName(int a_Tag) const
{
AString res;
- res.assign(m_Data + m_Tags[(size_t)a_Tag].m_NameStart, (size_t)m_Tags[(size_t)a_Tag].m_NameLength);
+ res.assign(m_Data + m_Tags[static_cast<size_t>(a_Tag)].m_NameStart, static_cast<size_t>(m_Tags[static_cast<size_t>(a_Tag)].m_NameLength));
return res;
}
@@ -333,8 +333,8 @@ protected:
if (IsStackTopCompound())
{
// Compound: add the type and name:
- m_Result.push_back((char)a_Type);
- WriteString(a_Name.c_str(), (UInt16)a_Name.length());
+ m_Result.push_back(static_cast<char>(a_Type));
+ WriteString(a_Name.c_str(), static_cast<UInt16>(a_Name.length()));
}
else
{
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp
index 91a5b8b63..0398f4da8 100644
--- a/src/WorldStorage/FireworksSerializer.cpp
+++ b/src/WorldStorage/FireworksSerializer.cpp
@@ -14,7 +14,7 @@ void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFa
case E_ITEM_FIREWORK_ROCKET:
{
a_Writer.BeginCompound("Fireworks");
- a_Writer.AddByte("Flight", a_FireworkItem.m_FlightTimeInTicks / 20);
+ a_Writer.AddByte("Flight", static_cast<Byte>(a_FireworkItem.m_FlightTimeInTicks / 20));
a_Writer.BeginList("Explosions", TAG_Compound);
a_Writer.BeginCompound("");
a_Writer.AddByte("Flicker", a_FireworkItem.m_HasFlicker);
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index da7b9d929..d4925dcab 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -102,11 +102,11 @@ void cMapSerializer::SaveMapToNBT(cFastNBTWriter & a_Writer)
{
a_Writer.BeginCompound("data");
- a_Writer.AddByte("scale", m_Map->GetScale());
- a_Writer.AddByte("dimension", (int) m_Map->GetDimension());
+ a_Writer.AddByte("scale", static_cast<Byte>(m_Map->GetScale()));
+ a_Writer.AddByte("dimension", static_cast<Byte>(m_Map->GetDimension()));
- a_Writer.AddShort("width", m_Map->GetWidth());
- a_Writer.AddShort("height", m_Map->GetHeight());
+ a_Writer.AddShort("width", static_cast<Int16>(m_Map->GetWidth()));
+ a_Writer.AddShort("height", static_cast<Int16>(m_Map->GetHeight()));
a_Writer.AddInt("xCenter", m_Map->GetCenterX());
a_Writer.AddInt("zCenter", m_Map->GetCenterZ());
@@ -235,7 +235,7 @@ bool cIDCountSerializer::Load(void)
int CurrLine = NBT.FindChildByName(0, "map");
if (CurrLine >= 0)
{
- m_MapCount = (int)NBT.GetShort(CurrLine) + 1;
+ m_MapCount = static_cast<unsigned int>(NBT.GetShort(CurrLine) + 1);
}
else
{
@@ -255,7 +255,7 @@ bool cIDCountSerializer::Save(void)
if (m_MapCount > 0)
{
- Writer.AddShort("map", m_MapCount - 1);
+ Writer.AddShort("map", static_cast<Int16>(m_MapCount - 1));
}
Writer.Finish();
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 10231ae3b..234c60d62 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -554,6 +554,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddInt ("Style", Horse.GetHorseStyle());
m_Writer.AddInt ("ArmorType", Horse.GetHorseArmour());
m_Writer.AddByte("Saddle", Horse.IsSaddled());
+ m_Writer.AddByte("Age", Horse.GetAge());
break;
}
case mtMagmaCube:
@@ -565,6 +566,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
{
m_Writer.AddByte("Sheared", ((const cSheep *)a_Monster)->IsSheared());
m_Writer.AddByte("Color", ((const cSheep *)a_Monster)->GetFurColor());
+ m_Writer.AddByte("Age", ((const cSheep *)a_Monster)->GetAge());
break;
}
case mtSlime:
@@ -580,6 +582,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtVillager:
{
m_Writer.AddInt("Profession", ((const cVillager *)a_Monster)->GetVilType());
+ m_Writer.AddByte("Age", ((const cVillager *)a_Monster)->GetAge());
break;
}
case mtWither:
@@ -601,13 +604,37 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddByte("Sitting", Wolf.IsSitting() ? 1 : 0);
m_Writer.AddByte("Angry", Wolf.IsAngry() ? 1 : 0);
m_Writer.AddByte("CollarColor", (unsigned char)Wolf.GetCollarColor());
+ m_Writer.AddByte("Age", Wolf.GetAge());
break;
}
case mtZombie:
{
m_Writer.AddByte("IsVillager", (((const cZombie *)a_Monster)->IsVillagerZombie() ? 1 : 0));
- m_Writer.AddByte("IsBaby", (((const cZombie *)a_Monster)->IsBaby() ? 1 : 0));
m_Writer.AddByte("IsConverting", (((const cZombie *)a_Monster)->IsConverting() ? 1 : 0));
+ m_Writer.AddByte("Age", (((const cZombie *)a_Monster)->GetAge()));
+ break;
+ }
+ case mtZombiePigman:
+ {
+ m_Writer.AddByte("Age", (((const cZombiePigman *)a_Monster)->GetAge()));
+ break;
+ }
+ case mtOcelot:
+ {
+ const cOcelot & Ocelot = *((cOcelot *)a_Monster);
+ m_Writer.AddByte("Age", Ocelot.GetAge());
+ break;
+ }
+ case mtPig:
+ {
+ const cPig & Pig = *((cPig *)a_Monster);
+ m_Writer.AddByte("Age", Pig.GetAge());
+ break;
+ }
+ case mtRabbit:
+ {
+ const cRabbit & Rabbit = *((cRabbit *)a_Monster);
+ m_Writer.AddByte("Age", Rabbit.GetAge());
break;
}
case mtInvalidType:
@@ -621,15 +648,11 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtGuardian:
case mtIronGolem:
case mtMooshroom:
- case mtOcelot:
- case mtPig:
- case mtRabbit:
case mtSilverfish:
case mtSnowGolem:
case mtSpider:
case mtSquid:
case mtWitch:
- case mtZombiePigman:
{
// Other mobs have no special tags.
break;
diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp
index fb881e290..3e9ed5bef 100644
--- a/src/WorldStorage/SchematicFileSerializer.cpp
+++ b/src/WorldStorage/SchematicFileSerializer.cpp
@@ -9,6 +9,7 @@
#include "FastNBT.h"
#include "SchematicFileSerializer.h"
#include "../StringCompression.h"
+#include "../SelfTests.h"
@@ -21,6 +22,11 @@ static class cSchematicStringSelfTest
public:
cSchematicStringSelfTest(void)
{
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&Test), "Schematic-to-string serialization");
+ }
+
+ static void Test(void)
+ {
cBlockArea ba;
ba.Create(21, 256, 21);
ba.RelLine(0, 0, 0, 9, 8, 7, cBlockArea::baTypes | cBlockArea::baMetas, E_BLOCK_WOODEN_STAIRS, 1);
@@ -232,27 +238,27 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP
}
// Copy the block types and metas:
- size_t NumBytes = a_BlockArea.GetBlockCount();
- if (a_NBT.GetDataLength(TBlockTypes) < NumBytes)
+ size_t NumTypeBytes = a_BlockArea.GetBlockCount();
+ if (a_NBT.GetDataLength(TBlockTypes) < NumTypeBytes)
{
- LOG("BlockTypes truncated in the schematic file (exp %d, got %d bytes). Loading partial.",
- (int)NumBytes, (int)a_NBT.GetDataLength(TBlockTypes)
+ LOG("BlockTypes truncated in the schematic file (exp %u, got %u bytes). Loading partial.",
+ static_cast<unsigned>(NumTypeBytes), static_cast<unsigned>(a_NBT.GetDataLength(TBlockTypes))
);
- NumBytes = a_NBT.GetDataLength(TBlockTypes);
+ NumTypeBytes = a_NBT.GetDataLength(TBlockTypes);
}
- memcpy(a_BlockArea.m_BlockTypes, a_NBT.GetData(TBlockTypes), NumBytes);
+ memcpy(a_BlockArea.m_BlockTypes, a_NBT.GetData(TBlockTypes), NumTypeBytes);
if (AreMetasPresent)
{
- size_t NumBytes = a_BlockArea.GetBlockCount();
- if (a_NBT.GetDataLength(TBlockMetas) < NumBytes)
+ size_t NumMetaBytes = a_BlockArea.GetBlockCount();
+ if (a_NBT.GetDataLength(TBlockMetas) < NumMetaBytes)
{
- LOG("BlockMetas truncated in the schematic file (exp %d, got %d bytes). Loading partial.",
- (int)NumBytes, (int)a_NBT.GetDataLength(TBlockMetas)
+ LOG("BlockMetas truncated in the schematic file (exp %u, got %u bytes). Loading partial.",
+ static_cast<unsigned>(NumMetaBytes), static_cast<unsigned>(a_NBT.GetDataLength(TBlockMetas))
);
- NumBytes = a_NBT.GetDataLength(TBlockMetas);
+ NumMetaBytes = a_NBT.GetDataLength(TBlockMetas);
}
- memcpy(a_BlockArea.m_BlockMetas, a_NBT.GetData(TBlockMetas), NumBytes);
+ memcpy(a_BlockArea.m_BlockMetas, a_NBT.GetData(TBlockMetas), NumMetaBytes);
}
return true;
diff --git a/src/WorldStorage/StatSerializer.cpp b/src/WorldStorage/StatSerializer.cpp
index 99a702c39..29f9b3cd6 100644
--- a/src/WorldStorage/StatSerializer.cpp
+++ b/src/WorldStorage/StatSerializer.cpp
@@ -79,13 +79,13 @@ bool cStatSerializer::Save(void)
void cStatSerializer::SaveStatToJSON(Json::Value & a_Out)
{
- for (unsigned int i = 0; i < (unsigned int)statCount; ++i)
+ for (unsigned int i = 0; i < static_cast<unsigned int>(statCount); ++i)
{
- StatValue Value = m_Manager->GetValue((eStatistic) i);
+ StatValue Value = m_Manager->GetValue(static_cast<eStatistic>(i));
if (Value != 0)
{
- const AString & StatName = cStatInfo::GetName((eStatistic) i);
+ const AString & StatName = cStatInfo::GetName(static_cast<eStatistic>(i));
a_Out[StatName] = Value;
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 392b9bf83..62918f44e 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -130,7 +130,7 @@ cWSSAnvil::cWSSAnvil(cWorld * a_World, int a_CompressionFactor) :
gzFile gz = gzopen((FILE_IO_PREFIX + fnam).c_str(), "wb");
if (gz != nullptr)
{
- gzwrite(gz, Writer.GetResult().data(), (unsigned)Writer.GetResult().size());
+ gzwrite(gz, Writer.GetResult().data(), static_cast<unsigned>(Writer.GetResult().size()));
}
gzclose(gz);
}
@@ -497,7 +497,7 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_
a_Writer.AddByteArray("Data", BlockMetas + Y * SliceSizeNibble, SliceSizeNibble);
a_Writer.AddByteArray("SkyLight", BlockSkyLight + Y * SliceSizeNibble, SliceSizeNibble);
a_Writer.AddByteArray("BlockLight", BlockLight + Y * SliceSizeNibble, SliceSizeNibble);
- a_Writer.AddByte("Y", (unsigned char)Y);
+ a_Writer.AddByte("Y", static_cast<unsigned char>(Y));
a_Writer.EndCompound();
}
a_Writer.EndList(); // "Sections"
@@ -859,7 +859,7 @@ cBlockEntity * cWSSAnvil::LoadBeaconFromNBT(const cParsedNBT & a_NBT, int a_TagI
return nullptr;
}
- std::unique_ptr<cBeaconEntity> Beacon(new cBeaconEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cBeaconEntity> Beacon = cpp14::make_unique<cBeaconEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
int CurrentLine = a_NBT.FindChildByName(a_TagIdx, "Levels");
if (CurrentLine >= 0)
@@ -909,7 +909,7 @@ cBlockEntity * cWSSAnvil::LoadChestFromNBT(const cParsedNBT & a_NBT, int a_TagId
{
return nullptr; // Make it an empty chest - the chunk loader will provide an empty cChestEntity for this
}
- std::unique_ptr<cChestEntity> Chest(new cChestEntity(a_BlockX, a_BlockY, a_BlockZ, m_World, a_ChestBlockType));
+ std::unique_ptr<cChestEntity> Chest = cpp14::make_unique<cChestEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World, a_ChestBlockType);
LoadItemGridFromNBT(Chest->GetContents(), a_NBT, Items);
return Chest.release();
}
@@ -926,7 +926,7 @@ cBlockEntity * cWSSAnvil::LoadCommandBlockFromNBT(const cParsedNBT & a_NBT, int
return nullptr;
}
- std::unique_ptr<cCommandBlockEntity> CmdBlock(new cCommandBlockEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cCommandBlockEntity> CmdBlock = cpp14::make_unique<cCommandBlockEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
int currentLine = a_NBT.FindChildByName(a_TagIdx, "Command");
if (currentLine >= 0)
@@ -968,7 +968,7 @@ cBlockEntity * cWSSAnvil::LoadDispenserFromNBT(const cParsedNBT & a_NBT, int a_T
{
return nullptr; // Make it an empty dispenser - the chunk loader will provide an empty cDispenserEntity for this
}
- std::unique_ptr<cDispenserEntity> Dispenser(new cDispenserEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cDispenserEntity> Dispenser = cpp14::make_unique<cDispenserEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
LoadItemGridFromNBT(Dispenser->GetContents(), a_NBT, Items);
return Dispenser.release();
}
@@ -990,7 +990,7 @@ cBlockEntity * cWSSAnvil::LoadDropperFromNBT(const cParsedNBT & a_NBT, int a_Tag
{
return nullptr; // Make it an empty dropper - the chunk loader will provide an empty cDropperEntity for this
}
- std::unique_ptr<cDropperEntity> Dropper(new cDropperEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cDropperEntity> Dropper = cpp14::make_unique<cDropperEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
LoadItemGridFromNBT(Dropper->GetContents(), a_NBT, Items);
return Dropper.release();
}
@@ -1007,7 +1007,7 @@ cBlockEntity * cWSSAnvil::LoadFlowerPotFromNBT(const cParsedNBT & a_NBT, int a_T
return nullptr;
}
- std::unique_ptr<cFlowerPotEntity> FlowerPot(new cFlowerPotEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cFlowerPotEntity> FlowerPot = cpp14::make_unique<cFlowerPotEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
cItem Item;
int currentLine = a_NBT.FindChildByName(a_TagIdx, "Item");
@@ -1051,8 +1051,9 @@ cBlockEntity * cWSSAnvil::LoadFurnaceFromNBT(const cParsedNBT & a_NBT, int a_Tag
return nullptr; // Make it an empty furnace - the chunk loader will provide an empty cFurnaceEntity for this
}
- std::unique_ptr<cFurnaceEntity> Furnace(new cFurnaceEntity(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, m_World));
-
+ std::unique_ptr<cFurnaceEntity> Furnace = cpp14::make_unique<cFurnaceEntity>(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, m_World);
+ Furnace->SetLoading(true);
+
// Load slots:
for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child))
{
@@ -1085,9 +1086,9 @@ cBlockEntity * cWSSAnvil::LoadFurnaceFromNBT(const cParsedNBT & a_NBT, int a_Tag
// Anvil doesn't store the time that an item takes to cook. We simply use the default - 10 seconds (200 ticks)
Furnace->SetCookTimes(200, ct);
}
-
// Restart cooking:
Furnace->ContinueCooking();
+ Furnace->SetLoading(false);
return Furnace.release();
}
@@ -1103,7 +1104,7 @@ cBlockEntity * cWSSAnvil::LoadMobSpawnerFromNBT(const cParsedNBT & a_NBT, int a_
return nullptr;
}
- std::unique_ptr<cMobSpawnerEntity> MobSpawner(new cMobSpawnerEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cMobSpawnerEntity> MobSpawner = cpp14::make_unique<cMobSpawnerEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
// Load entity (MCServer worlds):
int Type = a_NBT.FindChildByName(a_TagIdx, "Entity");
@@ -1156,7 +1157,7 @@ cBlockEntity * cWSSAnvil::LoadHopperFromNBT(const cParsedNBT & a_NBT, int a_TagI
{
return nullptr; // Make it an empty hopper - the chunk loader will provide an empty cHopperEntity for this
}
- std::unique_ptr<cHopperEntity> Hopper(new cHopperEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cHopperEntity> Hopper = cpp14::make_unique<cHopperEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
LoadItemGridFromNBT(Hopper->GetContents(), a_NBT, Items);
return Hopper.release();
}
@@ -1173,7 +1174,7 @@ cBlockEntity * cWSSAnvil::LoadJukeboxFromNBT(const cParsedNBT & a_NBT, int a_Tag
return nullptr;
}
- std::unique_ptr<cJukeboxEntity> Jukebox(new cJukeboxEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cJukeboxEntity> Jukebox = cpp14::make_unique<cJukeboxEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
int Record = a_NBT.FindChildByName(a_TagIdx, "Record");
if (Record >= 0)
{
@@ -1194,7 +1195,7 @@ cBlockEntity * cWSSAnvil::LoadMobHeadFromNBT(const cParsedNBT & a_NBT, int a_Tag
return nullptr;
}
- std::unique_ptr<cMobHeadEntity> MobHead(new cMobHeadEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cMobHeadEntity> MobHead = cpp14::make_unique<cMobHeadEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
int currentLine = a_NBT.FindChildByName(a_TagIdx, "SkullType");
if (currentLine >= 0)
@@ -1229,7 +1230,7 @@ cBlockEntity * cWSSAnvil::LoadNoteBlockFromNBT(const cParsedNBT & a_NBT, int a_T
return nullptr;
}
- std::unique_ptr<cNoteEntity> NoteBlock(new cNoteEntity(a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cNoteEntity> NoteBlock = cpp14::make_unique<cNoteEntity>(a_BlockX, a_BlockY, a_BlockZ, m_World);
int note = a_NBT.FindChildByName(a_TagIdx, "note");
if (note >= 0)
{
@@ -1250,7 +1251,7 @@ cBlockEntity * cWSSAnvil::LoadSignFromNBT(const cParsedNBT & a_NBT, int a_TagIdx
return nullptr;
}
- std::unique_ptr<cSignEntity> Sign(new cSignEntity(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, m_World));
+ std::unique_ptr<cSignEntity> Sign = cpp14::make_unique<cSignEntity>(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, m_World);
int currentLine = a_NBT.FindChildByName(a_TagIdx, "Text1");
if (currentLine >= 0)
@@ -1515,7 +1516,7 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cBoat> Boat(new cBoat(0, 0, 0));
+ std::unique_ptr<cBoat> Boat = cpp14::make_unique<cBoat>(0, 0, 0);
if (!LoadEntityBaseFromNBT(*Boat.get(), a_NBT, a_TagIdx))
{
return;
@@ -1529,7 +1530,7 @@ void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
void cWSSAnvil::LoadEnderCrystalFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cEnderCrystal> EnderCrystal(new cEnderCrystal(0, 0, 0));
+ std::unique_ptr<cEnderCrystal> EnderCrystal = cpp14::make_unique<cEnderCrystal>(0, 0, 0);
if (!LoadEntityBaseFromNBT(*EnderCrystal.get(), a_NBT, a_TagIdx))
{
return;
@@ -1554,7 +1555,7 @@ void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedN
int Type = a_NBT.GetInt(TypeIdx);
NIBBLETYPE Meta = (NIBBLETYPE)a_NBT.GetByte(MetaIdx);
- std::unique_ptr<cFallingBlock> FallingBlock(new cFallingBlock(Vector3i(0, 0, 0), Type, Meta));
+ std::unique_ptr<cFallingBlock> FallingBlock = cpp14::make_unique<cFallingBlock>(Vector3i(0, 0, 0), Type, Meta);
if (!LoadEntityBaseFromNBT(*FallingBlock.get(), a_NBT, a_TagIdx))
{
return;
@@ -1568,7 +1569,7 @@ void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedN
void cWSSAnvil::LoadMinecartRFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cRideableMinecart> Minecart(new cRideableMinecart(0, 0, 0, cItem(), 1)); // TODO: Load the block and the height
+ std::unique_ptr<cRideableMinecart> Minecart = cpp14::make_unique<cRideableMinecart>(0, 0, 0, cItem(), 1); // TODO: Load the block and the height
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
@@ -1587,7 +1588,7 @@ void cWSSAnvil::LoadMinecartCFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return; // Make it an empty chest - the chunk loader will provide an empty cChestEntity for this
}
- std::unique_ptr<cMinecartWithChest> Minecart(new cMinecartWithChest(0, 0, 0));
+ std::unique_ptr<cMinecartWithChest> Minecart = cpp14::make_unique<cMinecartWithChest>(0, 0, 0);
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
@@ -1614,7 +1615,7 @@ void cWSSAnvil::LoadMinecartCFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadMinecartFFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cMinecartWithFurnace> Minecart(new cMinecartWithFurnace(0, 0, 0));
+ std::unique_ptr<cMinecartWithFurnace> Minecart = cpp14::make_unique<cMinecartWithFurnace>(0, 0, 0);
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
@@ -1631,7 +1632,7 @@ void cWSSAnvil::LoadMinecartFFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadMinecartTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cMinecartWithTNT> Minecart(new cMinecartWithTNT(0, 0, 0));
+ std::unique_ptr<cMinecartWithTNT> Minecart = cpp14::make_unique<cMinecartWithTNT>(0, 0, 0);
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
@@ -1648,7 +1649,7 @@ void cWSSAnvil::LoadMinecartTFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadMinecartHFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cMinecartWithHopper> Minecart(new cMinecartWithHopper(0, 0, 0));
+ std::unique_ptr<cMinecartWithHopper> Minecart = cpp14::make_unique<cMinecartWithHopper>(0, 0, 0);
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
@@ -1677,7 +1678,7 @@ void cWSSAnvil::LoadPickupFromNBT(cEntityList & a_Entities, const cParsedNBT & a
return;
}
- std::unique_ptr<cPickup> Pickup(new cPickup(0, 0, 0, Item, false)); // Pickup delay doesn't matter, just say false
+ std::unique_ptr<cPickup> Pickup = cpp14::make_unique<cPickup>(0, 0, 0, Item, false); // Pickup delay doesn't matter, just say false
if (!LoadEntityBaseFromNBT(*Pickup.get(), a_NBT, a_TagIdx))
{
return;
@@ -1699,7 +1700,7 @@ void cWSSAnvil::LoadPickupFromNBT(cEntityList & a_Entities, const cParsedNBT & a
void cWSSAnvil::LoadTNTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cTNTEntity> TNT(new cTNTEntity(0.0, 0.0, 0.0, 0));
+ std::unique_ptr<cTNTEntity> TNT = cpp14::make_unique<cTNTEntity>(0.0, 0.0, 0.0, 0);
if (!LoadEntityBaseFromNBT(*TNT.get(), a_NBT, a_TagIdx))
{
return;
@@ -1721,7 +1722,7 @@ void cWSSAnvil::LoadTNTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadExpOrbFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cExpOrb> ExpOrb(new cExpOrb(0.0, 0.0, 0.0, 0));
+ std::unique_ptr<cExpOrb> ExpOrb = cpp14::make_unique<cExpOrb>(0.0, 0.0, 0.0, 0);
if (!LoadEntityBaseFromNBT(*ExpOrb.get(), a_NBT, a_TagIdx))
{
return;
@@ -1790,7 +1791,7 @@ void cWSSAnvil::LoadItemFrameFromNBT(cEntityList & a_Entities, const cParsedNBT
return;
}
- std::unique_ptr<cItemFrame> ItemFrame(new cItemFrame(BLOCK_FACE_NONE, 0.0, 0.0, 0.0));
+ std::unique_ptr<cItemFrame> ItemFrame = cpp14::make_unique<cItemFrame>(BLOCK_FACE_NONE, 0.0, 0.0, 0.0);
if (!LoadEntityBaseFromNBT(*ItemFrame.get(), a_NBT, a_TagIdx))
{
return;
@@ -1822,7 +1823,7 @@ void cWSSAnvil::LoadPaintingFromNBT(cEntityList & a_Entities, const cParsedNBT &
return;
}
- std::unique_ptr<cPainting> Painting(new cPainting(a_NBT.GetString(MotiveTag), BLOCK_FACE_NONE, 0.0, 0.0, 0.0));
+ std::unique_ptr<cPainting> Painting = cpp14::make_unique<cPainting>(a_NBT.GetString(MotiveTag), BLOCK_FACE_NONE, 0.0, 0.0, 0.0);
if (!LoadEntityBaseFromNBT(*Painting.get(), a_NBT, a_TagIdx))
{
return;
@@ -1838,7 +1839,7 @@ void cWSSAnvil::LoadPaintingFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cArrowEntity> Arrow(new cArrowEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0)));
+ std::unique_ptr<cArrowEntity> Arrow = cpp14::make_unique<cArrowEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0));
if (!LoadProjectileBaseFromNBT(*Arrow.get(), a_NBT, a_TagIdx))
{
return;
@@ -1908,7 +1909,7 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadSplashPotionFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cSplashPotionEntity> SplashPotion(new cSplashPotionEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0), cItem()));
+ std::unique_ptr<cSplashPotionEntity> SplashPotion = cpp14::make_unique<cSplashPotionEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0), cItem());
if (!LoadProjectileBaseFromNBT(*SplashPotion.get(), a_NBT, a_TagIdx))
{
return;
@@ -1932,7 +1933,7 @@ void cWSSAnvil::LoadSplashPotionFromNBT(cEntityList & a_Entities, const cParsedN
void cWSSAnvil::LoadSnowballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cThrownSnowballEntity> Snowball(new cThrownSnowballEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0)));
+ std::unique_ptr<cThrownSnowballEntity> Snowball = cpp14::make_unique<cThrownSnowballEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0));
if (!LoadProjectileBaseFromNBT(*Snowball.get(), a_NBT, a_TagIdx))
{
return;
@@ -1948,7 +1949,7 @@ void cWSSAnvil::LoadSnowballFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadEggFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cThrownEggEntity> Egg(new cThrownEggEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0)));
+ std::unique_ptr<cThrownEggEntity> Egg = cpp14::make_unique<cThrownEggEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0));
if (!LoadProjectileBaseFromNBT(*Egg.get(), a_NBT, a_TagIdx))
{
return;
@@ -1964,7 +1965,7 @@ void cWSSAnvil::LoadEggFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadFireballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cGhastFireballEntity> Fireball(new cGhastFireballEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0)));
+ std::unique_ptr<cGhastFireballEntity> Fireball = cpp14::make_unique<cGhastFireballEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0));
if (!LoadProjectileBaseFromNBT(*Fireball.get(), a_NBT, a_TagIdx))
{
return;
@@ -1980,7 +1981,7 @@ void cWSSAnvil::LoadFireballFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadFireChargeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cFireChargeEntity> FireCharge(new cFireChargeEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0)));
+ std::unique_ptr<cFireChargeEntity> FireCharge = cpp14::make_unique<cFireChargeEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0));
if (!LoadProjectileBaseFromNBT(*FireCharge.get(), a_NBT, a_TagIdx))
{
return;
@@ -1996,7 +1997,7 @@ void cWSSAnvil::LoadFireChargeFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadThrownEnderpearlFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cThrownEnderPearlEntity> Enderpearl(new cThrownEnderPearlEntity(nullptr, 0, 0, 0, Vector3d(0, 0, 0)));
+ std::unique_ptr<cThrownEnderPearlEntity> Enderpearl = cpp14::make_unique<cThrownEnderPearlEntity>(nullptr, 0, 0, 0, Vector3d(0, 0, 0));
if (!LoadProjectileBaseFromNBT(*Enderpearl.get(), a_NBT, a_TagIdx))
{
return;
@@ -2012,7 +2013,7 @@ void cWSSAnvil::LoadThrownEnderpearlFromNBT(cEntityList & a_Entities, const cPar
void cWSSAnvil::LoadBatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cBat> Monster(new cBat());
+ std::unique_ptr<cBat> Monster = cpp14::make_unique<cBat>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2032,7 +2033,7 @@ void cWSSAnvil::LoadBatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadBlazeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cBlaze> Monster(new cBlaze());
+ std::unique_ptr<cBlaze> Monster = cpp14::make_unique<cBlaze>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2052,7 +2053,7 @@ void cWSSAnvil::LoadBlazeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadCaveSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cCaveSpider> Monster(new cCaveSpider());
+ std::unique_ptr<cCaveSpider> Monster = cpp14::make_unique<cCaveSpider>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2072,7 +2073,7 @@ void cWSSAnvil::LoadCaveSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadChickenFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cChicken> Monster(new cChicken());
+ std::unique_ptr<cChicken> Monster = cpp14::make_unique<cChicken>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2092,7 +2093,7 @@ void cWSSAnvil::LoadChickenFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadCowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cCow> Monster(new cCow());
+ std::unique_ptr<cCow> Monster = cpp14::make_unique<cCow>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2112,7 +2113,7 @@ void cWSSAnvil::LoadCowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadCreeperFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cCreeper> Monster(new cCreeper());
+ std::unique_ptr<cCreeper> Monster = cpp14::make_unique<cCreeper>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2132,7 +2133,7 @@ void cWSSAnvil::LoadCreeperFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadEnderDragonFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cEnderDragon> Monster(new cEnderDragon());
+ std::unique_ptr<cEnderDragon> Monster = cpp14::make_unique<cEnderDragon>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2152,7 +2153,7 @@ void cWSSAnvil::LoadEnderDragonFromNBT(cEntityList & a_Entities, const cParsedNB
void cWSSAnvil::LoadEndermanFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cEnderman> Monster(new cEnderman());
+ std::unique_ptr<cEnderman> Monster = cpp14::make_unique<cEnderman>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2172,7 +2173,7 @@ void cWSSAnvil::LoadEndermanFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadGhastFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cGhast> Monster(new cGhast());
+ std::unique_ptr<cGhast> Monster = cpp14::make_unique<cGhast>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2192,7 +2193,7 @@ void cWSSAnvil::LoadGhastFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadGiantFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cGiant> Monster(new cGiant());
+ std::unique_ptr<cGiant> Monster = cpp14::make_unique<cGiant>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2212,7 +2213,7 @@ void cWSSAnvil::LoadGiantFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadGuardianFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cGuardian> Monster(new cGuardian());
+ std::unique_ptr<cGuardian> Monster = cpp14::make_unique<cGuardian>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2244,7 +2245,7 @@ void cWSSAnvil::LoadHorseFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
int Color = a_NBT.GetInt(ColorIdx);
int Style = a_NBT.GetInt(StyleIdx);
- std::unique_ptr<cHorse> Monster(new cHorse(Type, Color, Style, 1));
+ std::unique_ptr<cHorse> Monster = cpp14::make_unique<cHorse>(Type, Color, Style, 1);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
@@ -2255,7 +2256,14 @@ void cWSSAnvil::LoadHorseFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2265,7 +2273,7 @@ void cWSSAnvil::LoadHorseFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadIronGolemFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cIronGolem> Monster(new cIronGolem());
+ std::unique_ptr<cIronGolem> Monster = cpp14::make_unique<cIronGolem>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2294,7 +2302,7 @@ void cWSSAnvil::LoadMagmaCubeFromNBT(cEntityList & a_Entities, const cParsedNBT
int Size = a_NBT.GetInt(SizeIdx);
- std::unique_ptr<cMagmaCube> Monster(new cMagmaCube(Size));
+ std::unique_ptr<cMagmaCube> Monster = cpp14::make_unique<cMagmaCube>(Size);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2314,7 +2322,7 @@ void cWSSAnvil::LoadMagmaCubeFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadMooshroomFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cMooshroom> Monster(new cMooshroom());
+ std::unique_ptr<cMooshroom> Monster = cpp14::make_unique<cMooshroom>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2334,7 +2342,7 @@ void cWSSAnvil::LoadMooshroomFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadOcelotFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cOcelot> Monster(new cOcelot());
+ std::unique_ptr<cOcelot> Monster = cpp14::make_unique<cOcelot>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2345,6 +2353,13 @@ void cWSSAnvil::LoadOcelotFromNBT(cEntityList & a_Entities, const cParsedNBT & a
return;
}
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2354,7 +2369,7 @@ void cWSSAnvil::LoadOcelotFromNBT(cEntityList & a_Entities, const cParsedNBT & a
void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cPig> Monster(new cPig());
+ std::unique_ptr<cPig> Monster = cpp14::make_unique<cPig>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2364,7 +2379,14 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2374,7 +2396,7 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadRabbitFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cRabbit> Monster(new cRabbit());
+ std::unique_ptr<cRabbit> Monster = cpp14::make_unique<cRabbit>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2384,7 +2406,14 @@ void cWSSAnvil::LoadRabbitFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2401,7 +2430,7 @@ void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
Color = (int)a_NBT.GetByte(ColorIdx);
}
- std::unique_ptr<cSheep> Monster(new cSheep(Color));
+ std::unique_ptr<cSheep> Monster = cpp14::make_unique<cSheep>(Color);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2417,7 +2446,14 @@ void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
Monster->SetSheared(a_NBT.GetByte(ShearedIdx) != 0);
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2427,7 +2463,7 @@ void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadSilverfishFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cSilverfish> Monster(new cSilverfish());
+ std::unique_ptr<cSilverfish> Monster = cpp14::make_unique<cSilverfish>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2455,7 +2491,7 @@ void cWSSAnvil::LoadSkeletonFromNBT(cEntityList & a_Entities, const cParsedNBT &
bool Type = ((a_NBT.GetByte(TypeIdx) == 1) ? true : false);
- std::unique_ptr<cSkeleton> Monster(new cSkeleton(Type));
+ std::unique_ptr<cSkeleton> Monster = cpp14::make_unique<cSkeleton>(Type);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2484,7 +2520,7 @@ void cWSSAnvil::LoadSlimeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
int Size = a_NBT.GetInt(SizeIdx);
- std::unique_ptr<cSlime> Monster(new cSlime(Size));
+ std::unique_ptr<cSlime> Monster = cpp14::make_unique<cSlime>(Size);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2504,7 +2540,7 @@ void cWSSAnvil::LoadSlimeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadSnowGolemFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cSnowGolem> Monster(new cSnowGolem());
+ std::unique_ptr<cSnowGolem> Monster = cpp14::make_unique<cSnowGolem>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2524,7 +2560,7 @@ void cWSSAnvil::LoadSnowGolemFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cSpider> Monster(new cSpider());
+ std::unique_ptr<cSpider> Monster = cpp14::make_unique<cSpider>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2544,7 +2580,7 @@ void cWSSAnvil::LoadSpiderFromNBT(cEntityList & a_Entities, const cParsedNBT & a
void cWSSAnvil::LoadSquidFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cSquid> Monster(new cSquid());
+ std::unique_ptr<cSquid> Monster = cpp14::make_unique<cSquid>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2572,7 +2608,7 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
int Type = a_NBT.GetInt(TypeIdx);
- std::unique_ptr<cVillager> Monster(new cVillager(cVillager::eVillagerType(Type)));
+ std::unique_ptr<cVillager> Monster = cpp14::make_unique<cVillager>(cVillager::eVillagerType(Type));
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2582,7 +2618,15 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
+
a_Entities.push_back(Monster.release());
}
@@ -2592,7 +2636,7 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
void cWSSAnvil::LoadWitchFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cWitch> Monster(new cWitch());
+ std::unique_ptr<cWitch> Monster = cpp14::make_unique<cWitch>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2612,7 +2656,7 @@ void cWSSAnvil::LoadWitchFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadWitherFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cWither> Monster(new cWither());
+ std::unique_ptr<cWither> Monster = cpp14::make_unique<cWither>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2638,7 +2682,7 @@ void cWSSAnvil::LoadWitherFromNBT(cEntityList & a_Entities, const cParsedNBT & a
void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cWolf> Monster(new cWolf());
+ std::unique_ptr<cWolf> Monster = cpp14::make_unique<cWolf>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2682,6 +2726,14 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
}
}
}
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2699,7 +2751,7 @@ void cWSSAnvil::LoadZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a
bool IsVillagerZombie = ((a_NBT.GetByte(IsVillagerIdx) == 1) ? true : false);
- std::unique_ptr<cZombie> Monster(new cZombie(IsVillagerZombie));
+ std::unique_ptr<cZombie> Monster = cpp14::make_unique<cZombie>(IsVillagerZombie);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2709,7 +2761,14 @@ void cWSSAnvil::LoadZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2719,7 +2778,7 @@ void cWSSAnvil::LoadZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a
void cWSSAnvil::LoadPigZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cZombiePigman> Monster(new cZombiePigman());
+ std::unique_ptr<cZombiePigman> Monster = cpp14::make_unique<cZombiePigman>();
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
@@ -2729,7 +2788,14 @@ void cWSSAnvil::LoadPigZombieFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -3069,7 +3135,7 @@ bool cWSSAnvil::cMCAFile::GetChunkData(const cChunkCoords & a_Chunk, AString & a
LOAD_FAILED(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ);
return false;
}
- ChunkSize = ntohl((u_long)ChunkSize);
+ ChunkSize = ntohl(static_cast<u_long>(ChunkSize));
char CompressionType = 0;
if (m_File.Read(&CompressionType, 1) != 1)
{
@@ -3121,7 +3187,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri
// Store the chunk data:
m_File.Seek(ChunkSector * 4096);
- u_long ChunkSize = htonl((u_long)a_Data.size() + 1);
+ u_long ChunkSize = htonl(static_cast<u_long>(a_Data.size()) + 1);
if (m_File.Write(&ChunkSize, 4) != 4)
{
LOGWARNING("Cannot save chunk [%d, %d], writing(1) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str());
@@ -3148,11 +3214,11 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri
}
// Store the header:
- ChunkSize = ((u_long)a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size up to nearest 4KB sector, make it a sector number
+ ChunkSize = (static_cast<u_long>(a_Data.size()) + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size up to nearest 4KB sector, make it a sector number
if (ChunkSize > 255)
{
LOGWARNING("Cannot save chunk [%d, %d], the data is too large (%u KiB, maximum is 1024 KiB). Remove some entities and retry.",
- a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, (unsigned)(ChunkSize * 4)
+ a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, static_cast<unsigned>(ChunkSize * 4)
);
return false;
}
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp
index c7a295175..7e6cadb7e 100644
--- a/src/WorldStorage/WorldStorage.cpp
+++ b/src/WorldStorage/WorldStorage.cpp
@@ -84,7 +84,7 @@ void cWorldStorage::Stop(void)
void cWorldStorage::WaitForFinish(void)
{
- LOG("Waiting for the world storage to finish saving");
+ LOGD("Waiting for the world storage to finish saving");
{
m_LoadQueue.Clear();
@@ -97,7 +97,7 @@ void cWorldStorage::WaitForFinish(void)
m_ShouldTerminate = true;
m_Event.Set(); // Wake up the thread if waiting
super::Wait();
- LOG("World storage thread finished");
+ LOGD("World storage thread finished");
}
diff --git a/src/main.cpp b/src/main.cpp
index 1c34b8f61..2103f3356 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,6 +2,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Root.h"
+#include "tclap/CmdLine.h"
#include <exception>
#include <csignal>
@@ -14,7 +15,7 @@
#include "OSSupport/NetworkSingleton.h"
#include "BuildInfo.h"
-
+#include "MemorySettingsRepository.h"
@@ -38,7 +39,7 @@ bool cRoot::m_RunAsService = false;
#if defined(_WIN32)
- SERVICE_STATUS_HANDLE g_StatusHandle = NULL;
+ SERVICE_STATUS_HANDLE g_StatusHandle = nullptr;
HANDLE g_ServiceThread = INVALID_HANDLE_VALUE;
#define SERVICE_NAME "MCServerService"
#endif
@@ -144,7 +145,7 @@ Its purpose is to create the crashdump using the dbghlp DLLs
*/
LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_ExceptionInfo)
{
- char * newStack = &g_ExceptionStack[sizeof(g_ExceptionStack)];
+ char * newStack = &g_ExceptionStack[sizeof(g_ExceptionStack) - 1];
char * oldStack;
// Use the substitute stack:
@@ -206,7 +207,7 @@ BOOL CtrlHandler(DWORD fdwCtrlType)
////////////////////////////////////////////////////////////////////////////////
// universalMain - Main startup logic for both standard running and as a service
-void universalMain()
+void universalMain(std::unique_ptr<cSettingsRepositoryInterface> overridesRepo)
{
#ifdef _WIN32
if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE))
@@ -226,7 +227,7 @@ void universalMain()
#endif
{
cRoot Root;
- Root.Start();
+ Root.Start(std::move(overridesRepo));
}
#if !defined(ANDROID_NDK)
catch (std::exception & e)
@@ -248,7 +249,8 @@ void universalMain()
-#if defined(_WIN32)
+
+#if defined(_WIN32) // Windows service support.
////////////////////////////////////////////////////////////////////////////////
// serviceWorkerThread: Keep the service alive
@@ -257,7 +259,7 @@ DWORD WINAPI serviceWorkerThread(LPVOID lpParam)
UNREFERENCED_PARAMETER(lpParam);
// Do the normal startup
- universalMain();
+ universalMain(cpp14::make_unique<cMemorySettingsRepository>());
return ERROR_SUCCESS;
}
@@ -265,6 +267,7 @@ DWORD WINAPI serviceWorkerThread(LPVOID lpParam)
+
////////////////////////////////////////////////////////////////////////////////
// serviceSetState: Set the internal status of the service
@@ -318,14 +321,10 @@ void WINAPI serviceCtrlHandler(DWORD CtrlCode)
void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
{
- #if defined(_DEBUG) && defined(DEBUG_SERVICE_STARTUP)
- Sleep(10000);
- #endif
-
char applicationFilename[MAX_PATH];
char applicationDirectory[MAX_PATH];
- GetModuleFileName(NULL, applicationFilename, sizeof(applicationFilename)); // This binary's file path.
+ GetModuleFileName(nullptr, applicationFilename, sizeof(applicationFilename)); // This binary's file path.
// Strip off the filename, keep only the path:
strncpy_s(applicationDirectory, sizeof(applicationDirectory), applicationFilename, (strrchr(applicationFilename, '\\') - applicationFilename));
@@ -336,8 +335,7 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
SetCurrentDirectory(applicationDirectory);
g_StatusHandle = RegisterServiceCtrlHandler(SERVICE_NAME, serviceCtrlHandler);
-
- if (g_StatusHandle == NULL)
+ if (g_StatusHandle == nullptr)
{
OutputDebugStringA("RegisterServiceCtrlHandler() failed\n");
serviceSetState(0, SERVICE_STOPPED, GetLastError());
@@ -346,8 +344,9 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
serviceSetState(SERVICE_ACCEPT_STOP, SERVICE_RUNNING, 0);
- g_ServiceThread = CreateThread(NULL, 0, serviceWorkerThread, NULL, 0, NULL);
- if (g_ServiceThread == NULL)
+ DWORD ThreadID;
+ g_ServiceThread = CreateThread(nullptr, 0, serviceWorkerThread, nullptr, 0, &ThreadID);
+ if (g_ServiceThread == nullptr)
{
OutputDebugStringA("CreateThread() failed\n");
serviceSetState(0, SERVICE_STOPPED, GetLastError());
@@ -359,135 +358,180 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
serviceSetState(0, SERVICE_STOPPED, 0);
}
-#endif
+#endif // Windows service support.
-////////////////////////////////////////////////////////////////////////////////
-// main:
-int main( int argc, char **argv)
+std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
{
- UNUSED(argc);
- UNUSED(argv);
-
- #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
- InitLeakFinder();
- #endif
-
- // Magic code to produce dump-files on Windows if the server crashes:
- #if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER)
- HINSTANCE hDbgHelp = LoadLibrary("DBGHELP.DLL");
- g_WriteMiniDump = (pMiniDumpWriteDump)GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
- if (g_WriteMiniDump != nullptr)
+ try
{
- _snprintf_s(g_DumpFileName, ARRAYCOUNT(g_DumpFileName), _TRUNCATE, "crash_mcs_%x.dmp", GetCurrentProcessId());
- SetUnhandledExceptionFilter(LastChanceExceptionFilter);
-
- // Parse arguments for minidump flags:
- for (int i = 0; i < argc; i++)
+ // Parse the comand line args:
+ TCLAP::CmdLine cmd("MCServer");
+ TCLAP::ValueArg<int> slotsArg ("s", "max-players", "Maximum number of slots for the server to use, overrides setting in setting.ini", false, -1, "number", cmd);
+ TCLAP::MultiArg<int> portsArg ("p", "port", "The port number the server should listen to", false, "port", cmd);
+ TCLAP::SwitchArg commLogArg ("", "log-comm", "Log server client communications to file", cmd);
+ TCLAP::SwitchArg commLogInArg ("", "log-comm-in", "Log inbound server client communications to file", cmd);
+ TCLAP::SwitchArg commLogOutArg ("", "log-comm-out", "Log outbound server client communications to file", cmd);
+ TCLAP::SwitchArg crashDumpFull ("", "crash-dump-full", "Crashdumps created by the server will contain full server memory", cmd);
+ TCLAP::SwitchArg crashDumpGlobals("", "crash-dump-globals", "Crashdumps created by the server will contain the global variables' values", cmd);
+ TCLAP::SwitchArg noBufArg ("", "no-output-buffering", "Disable output buffering", cmd);
+ TCLAP::SwitchArg runAsServiceArg ("d", "service", "Run as a service on Windows, or daemon on UNIX like systems", cmd);
+ cmd.parse(argc, argv);
+
+ // Copy the parsed args' values into a settings repository:
+ auto repo = cpp14::make_unique<cMemorySettingsRepository>();
+ if (slotsArg.isSet())
+ {
+ int slots = slotsArg.getValue();
+ repo->AddValue("Server", "MaxPlayers", static_cast<Int64>(slots));
+ }
+ if (portsArg.isSet())
{
- if (_stricmp(argv[i], "/cdg") == 0)
+ for (auto port: portsArg.getValue())
{
- // Add globals to the dump
- g_DumpFlags = (MINIDUMP_TYPE)(g_DumpFlags | MiniDumpWithDataSegs);
+ repo->AddValue("Server", "Port", static_cast<Int64>(port));
}
- else if (_stricmp(argv[i], "/cdf") == 0)
+ }
+ if (commLogArg.getValue())
+ {
+ g_ShouldLogCommIn = true;
+ g_ShouldLogCommOut = true;
+ }
+ else
+ {
+ g_ShouldLogCommIn = commLogInArg.getValue();
+ g_ShouldLogCommOut = commLogOutArg.getValue();
+ }
+ if (noBufArg.getValue())
+ {
+ setvbuf(stdout, nullptr, _IONBF, 0);
+ }
+ repo->SetReadOnly();
+
+ // Set the service flag directly to cRoot:
+ if (runAsServiceArg.getValue())
+ {
+ cRoot::m_RunAsService = true;
+ }
+
+ // Apply the CrashDump flags for platforms that support them:
+ #if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER) // 32-bit Windows app compiled in MSVC
+ if (crashDumpGlobals.getValue())
+ {
+ g_DumpFlags = static_cast<MINIDUMP_TYPE>(g_DumpFlags | MiniDumpWithDataSegs);
+ }
+ if (crashDumpFull.getValue())
{
- // Add full memory to the dump (HUUUGE file)
- g_DumpFlags = (MINIDUMP_TYPE)(g_DumpFlags | MiniDumpWithFullMemory);
+ g_DumpFlags = static_cast<MINIDUMP_TYPE>(g_DumpFlags | MiniDumpWithFullMemory);
}
- } // for i - argv[]
+ #endif // 32-bit Windows app compiled in MSVC
+
+ return repo;
+ }
+ catch (const TCLAP::ArgException & exc)
+ {
+ printf("Error reading command line %s for arg %s", exc.error().c_str(), exc.argId().c_str());
+ return cpp14::make_unique<cMemorySettingsRepository>();
}
- #endif // _WIN32 && !_WIN64
+}
+
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// main:
+
+int main(int argc, char **argv)
+{
+ #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
+ InitLeakFinder();
+ #endif
+
+ // Magic code to produce dump-files on Windows if the server crashes:
+ #if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER) // 32-bit Windows app compiled in MSVC
+ HINSTANCE hDbgHelp = LoadLibrary("DBGHELP.DLL");
+ g_WriteMiniDump = (pMiniDumpWriteDump)GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
+ if (g_WriteMiniDump != nullptr)
+ {
+ _snprintf_s(g_DumpFileName, ARRAYCOUNT(g_DumpFileName), _TRUNCATE, "crash_mcs_%x.dmp", GetCurrentProcessId());
+ SetUnhandledExceptionFilter(LastChanceExceptionFilter);
+ }
+ #endif // 32-bit Windows app compiled in MSVC
// End of dump-file magic
+
#if defined(_DEBUG) && defined(_MSC_VER)
- _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
- // _X: The simple built-in CRT leak finder - simply break when allocating the Nth block ({N} is listed in the leak output)
- // Only useful when the leak is in the same sequence all the time
- // _CrtSetBreakAlloc(85950);
+ // _X: The simple built-in CRT leak finder - simply break when allocating the Nth block ({N} is listed in the leak output)
+ // Only useful when the leak is in the same sequence all the time
+ // _CrtSetBreakAlloc(85950);
#endif // _DEBUG && _MSC_VER
#ifndef _DEBUG
- std::signal(SIGSEGV, NonCtrlHandler);
- std::signal(SIGTERM, NonCtrlHandler);
- std::signal(SIGINT, NonCtrlHandler);
- std::signal(SIGABRT, NonCtrlHandler);
- #ifdef SIGABRT_COMPAT
- std::signal(SIGABRT_COMPAT, NonCtrlHandler);
- #endif // SIGABRT_COMPAT
+ std::signal(SIGSEGV, NonCtrlHandler);
+ std::signal(SIGTERM, NonCtrlHandler);
+ std::signal(SIGINT, NonCtrlHandler);
+ std::signal(SIGABRT, NonCtrlHandler);
+ #ifdef SIGABRT_COMPAT
+ std::signal(SIGABRT_COMPAT, NonCtrlHandler);
+ #endif // SIGABRT_COMPAT
#endif
- // DEBUG: test the dumpfile creation:
- // *((int *)0) = 0;
-
- // Check if comm logging is to be enabled:
- for (int i = 0; i < argc; i++)
- {
- AString Arg(argv[i]);
- if (
- (NoCaseCompare(Arg, "/commlog") == 0) ||
- (NoCaseCompare(Arg, "/logcomm") == 0)
- )
- {
- g_ShouldLogCommIn = true;
- g_ShouldLogCommOut = true;
- }
- else if (
- (NoCaseCompare(Arg, "/commlogin") == 0) ||
- (NoCaseCompare(Arg, "/comminlog") == 0) ||
- (NoCaseCompare(Arg, "/logcommin") == 0)
- )
- {
- g_ShouldLogCommIn = true;
- }
- else if (
- (NoCaseCompare(Arg, "/commlogout") == 0) ||
- (NoCaseCompare(Arg, "/commoutlog") == 0) ||
- (NoCaseCompare(Arg, "/logcommout") == 0)
- )
- {
- g_ShouldLogCommOut = true;
- }
- else if (NoCaseCompare(Arg, "nooutbuf") == 0)
- {
- setvbuf(stdout, nullptr, _IONBF, 0);
- }
- else if (NoCaseCompare(Arg, "/service") == 0)
- {
- cRoot::m_RunAsService = true;
- }
- } // for i - argv[]
+ auto argsRepo = parseArguments(argc, argv);
- #if defined(_WIN32)
// Attempt to run as a service
if (cRoot::m_RunAsService)
{
- SERVICE_TABLE_ENTRY ServiceTable[] =
- {
- { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION)serviceMain },
- { NULL, NULL }
- };
+ #if defined(_WIN32) // Windows service.
+ SERVICE_TABLE_ENTRY ServiceTable[] =
+ {
+ { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION)serviceMain },
+ { nullptr, nullptr }
+ };
- if (StartServiceCtrlDispatcher(ServiceTable) == FALSE)
- {
- LOGERROR("Attempted, but failed, service startup.");
- return GetLastError();
- }
+ if (StartServiceCtrlDispatcher(ServiceTable) == FALSE)
+ {
+ LOGERROR("Attempted, but failed, service startup.");
+ return GetLastError();
+ }
+ #else // UNIX daemon.
+ pid_t pid = fork();
+
+ // fork() returns a negative value on error.
+ if (pid < 0)
+ {
+ LOGERROR("Could not fork process.");
+ return EXIT_FAILURE;
+ }
+
+ // Check if we are the parent or child process. Parent stops here.
+ if (pid > 0)
+ {
+ return EXIT_SUCCESS;
+ }
+
+ // Child process now goes quiet, running in the background.
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+
+ universalMain(std::move(argsRepo));
+ #endif
}
else
- #endif
{
// Not running as a service, do normal startup
- universalMain();
+ universalMain(std::move(argsRepo));
}
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
- DeinitLeakFinder();
+ DeinitLeakFinder();
#endif
return EXIT_SUCCESS;