diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-17 15:51:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 15:51:42 +0200 |
commit | c3d2956ba588a4559fabc36a0c1fc7dd28279314 (patch) | |
tree | b8210f994441a20ab08499df442e15fb9afaaf30 | |
parent | Add some const qualifiers to functions (#4874) (diff) | |
download | cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.gz cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.bz2 cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.lz cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.xz cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.tar.zst cuberite-c3d2956ba588a4559fabc36a0c1fc7dd28279314.zip |
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/BlockInfo.cpp | 20 | ||||
-rw-r--r-- | src/BlockInfo.h | 14 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 724 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.h | 6 | ||||
-rw-r--r-- | tests/Generating/Stubs.cpp | 6 | ||||
-rw-r--r-- | tests/LuaThreadStress/Stubs.cpp | 15 | ||||
-rw-r--r-- | tests/SchematicFileSerializer/Stubs.cpp | 13 |
8 files changed, 552 insertions, 249 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fd2f2b22..7bd7c1941 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # File failed to follow NHS guidelines on handwashing and has not maintained good hygiene set_source_files_properties("${CMAKE_SOURCE_DIR}/src/IniFile.cpp" PROPERTIES COMPILE_OPTIONS -Wno-header-hygiene) + + # Enforce BlockHandler handling all blocks in switch statements + set_source_files_properties("${CMAKE_SOURCE_DIR}/src/Blocks/BlockHandler.cpp" PROPERTIES COMPILE_OPTIONS -Werror=switch) endif() if(${BUILD_TOOLS}) diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index 78ae4c24c..41c8536a7 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -414,8 +414,7 @@ cBlockInfo::cBlockInfo(): m_FullyOccupiesVoxel(false), m_CanBeTerraformed(false), m_BlockHeight(1.0), - m_Hardness(0.0f), - m_Handler() + m_Hardness(0.0f) { } @@ -423,13 +422,9 @@ cBlockInfo::cBlockInfo(): -bool cBlockInfo::IsSnowable(BLOCKTYPE a_BlockType) +cBlockHandler * cBlockInfo::GetHandler(BLOCKTYPE a_Type) { - return ( - (a_BlockType == E_BLOCK_ICE) || - (a_BlockType == E_BLOCK_LEAVES) || - (!IsTransparent(a_BlockType) && (a_BlockType != E_BLOCK_PACKED_ICE)) - ); + return &cBlockHandler::GetBlockHandler(a_Type); } @@ -557,9 +552,13 @@ float cBlockInfo::GetExplosionAbsorption(const BLOCKTYPE Block) -void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler) +bool cBlockInfo::IsSnowable(BLOCKTYPE a_BlockType) { - delete a_Handler; + return ( + (a_BlockType == E_BLOCK_ICE) || + (a_BlockType == E_BLOCK_LEAVES) || + (!IsTransparent(a_BlockType) && (a_BlockType != E_BLOCK_PACKED_ICE)) + ); } @@ -573,7 +572,6 @@ cBlockInfo::cBlockInfoArray::cBlockInfoArray() for (size_t i = 0; i < Info.size(); ++i) { Info[i].m_BlockType = static_cast<BLOCKTYPE>(i); - Info[i].m_Handler.reset(cBlockHandler::CreateBlockHandler(Info[i].m_BlockType)); } // Emissive blocks diff --git a/src/BlockInfo.h b/src/BlockInfo.h index 5992db9d9..44e8b5d43 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -51,13 +51,14 @@ public: See Physics\Explodinator.cpp for details of explosion block destruction. */ static float GetExplosionAbsorption(BLOCKTYPE Block); - inline static cBlockHandler * GetHandler (BLOCKTYPE a_Type) { return Get(a_Type).m_Handler.get(); } - /** Creates a default BlockInfo structure, initializes all values to their defaults */ cBlockInfo(); + /** Gets the blockhandler for the given block type. */ + static cBlockHandler * GetHandler(BLOCKTYPE a_Type); private: + /** Storage for all the BlockInfo structures. */ class cBlockInfoArray; @@ -99,15 +100,6 @@ private: /** Block's hardness. The greater the value the longer the player needs to break the block. */ float m_Hardness; - - /** Custom deleter allows cBlockHandler to be an incomplete type. */ - struct sHandlerDeleter - { - void operator () (cBlockHandler * a_Handler); - }; - - /** Associated block handler. */ - std::unique_ptr<cBlockHandler, sHandlerDeleter> m_Handler; }; // tolua_export diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index c3535987c..7938ec065 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -1,5 +1,5 @@ - #include "Globals.h" + #include "BlockHandler.h" #include "../Item.h" #include "../World.h" @@ -189,203 +189,260 @@ public: -/** Creates a block handler instance based on the specified block type. */ -static cBlockHandler * CreateBlockHandler(BLOCKTYPE a_BlockType) +namespace { - switch (a_BlockType) - { - // Block handlers, alphabetically sorted: - case E_BLOCK_ACACIA_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_ACACIA_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_ACACIA_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); - case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType); - case E_BLOCK_ACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); - case E_BLOCK_AIR: return new cBlockWithNoDrops<> (a_BlockType); - case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType); - case E_BLOCK_BEACON: return new cBlockEntityHandler (a_BlockType); - case E_BLOCK_BED: return new cBlockBedHandler (a_BlockType); - case E_BLOCK_BEETROOTS: return new cBlockCropsHandler<3> (a_BlockType); // 4 stages of growth - case E_BLOCK_BIG_FLOWER: return new cBlockBigFlowerHandler (a_BlockType); - case E_BLOCK_BIRCH_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_BIRCH_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_BIRCH_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); - case E_BLOCK_BIRCH_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_BLACK_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_BLUE_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_BOOKCASE: return new cBlockBookShelfHandler (a_BlockType); - case E_BLOCK_BREWING_STAND: return new cBlockBrewingStandHandler (a_BlockType); - case E_BLOCK_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_BROWN_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_BROWN_MUSHROOM: return new cBlockMushroomHandler (a_BlockType); - case E_BLOCK_CACTUS: return new cBlockCactusHandler (a_BlockType); - case E_BLOCK_CAKE: return new cBlockCakeHandler (a_BlockType); - case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType); - case E_BLOCK_CARROTS: return new cBlockCropsHandler<7> (a_BlockType); // 8 stages of growth - case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType); - case E_BLOCK_CHAIN_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType); - case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType); - case E_BLOCK_CLAY: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_COBBLESTONE: return new cBlockStoneHandler (a_BlockType); - case E_BLOCK_COBBLESTONE_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_COBWEB: return new cBlockCobWebHandler (a_BlockType); - case E_BLOCK_COCOA_POD: return new cBlockCocoaPodHandler (a_BlockType); - case E_BLOCK_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType); - case E_BLOCK_CONCRETE_POWDER: return new cBlockConcretePowderHandler (a_BlockType); - case E_BLOCK_CROPS: return new cBlockCropsHandler<7> (a_BlockType); // 8 stages of growth - case E_BLOCK_CYAN_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_DARK_OAK_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_DARK_OAK_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_DARK_OAK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); - case E_BLOCK_DARK_OAK_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_DEAD_BUSH: return new cBlockDeadBushHandler (a_BlockType); - case E_BLOCK_DETECTOR_RAIL: return new cBlockRailHandler (a_BlockType); - case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_DIRT: return new cBlockDirtHandler (a_BlockType); - case E_BLOCK_DISPENSER: return new cBlockDropSpenserHandler (a_BlockType); - case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType); - case E_BLOCK_DOUBLE_STONE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType); - case E_BLOCK_DOUBLE_WOODEN_SLAB: return new cBlockDoubleSlabHandler (a_BlockType); - case E_BLOCK_DROPPER: return new cBlockDropSpenserHandler (a_BlockType); - case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_ENCHANTMENT_TABLE: return new cBlockEnchantmentTableHandler (a_BlockType); - case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType); - case E_BLOCK_END_PORTAL_FRAME: return new cBlockEndPortalFrameHandler (a_BlockType); - case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler (a_BlockType); - case E_BLOCK_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType); - case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType); - case E_BLOCK_FROSTED_ICE: return new cBlockIceHandler (a_BlockType); - case E_BLOCK_FURNACE: return new cBlockFurnaceHandler (a_BlockType); - case E_BLOCK_GLASS: return new cBlockGlassHandler (a_BlockType); - case E_BLOCK_GLASS_PANE: return new cBlockGlassHandler (a_BlockType); - case E_BLOCK_GLOWSTONE: return new cBlockGlowstoneHandler (a_BlockType); - case E_BLOCK_GOLD_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_GRASS: return new cBlockGrassHandler (a_BlockType); - case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType); - case E_BLOCK_GRAY_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_GREEN_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_HAY_BALE: return new cBlockSidewaysHandler (a_BlockType); - case E_BLOCK_HEAD: return new cBlockMobHeadHandler (a_BlockType); - case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE: return new cBlockPressurePlateHandler (a_BlockType); - case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType); - case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType); - case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); - case E_BLOCK_IRON_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_IRON_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_IRON_TRAPDOOR: return new cBlockTrapdoorHandler (a_BlockType); - case E_BLOCK_JACK_O_LANTERN: return new cBlockPumpkinHandler (a_BlockType); - case E_BLOCK_JUKEBOX: return new cBlockJukeboxHandler (a_BlockType); - case E_BLOCK_JUNGLE_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_JUNGLE_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_JUNGLE_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); - case E_BLOCK_JUNGLE_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_LADDER: return new cBlockLadderHandler (a_BlockType); - case E_BLOCK_LAPIS_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_LAVA: return new cBlockLavaHandler (a_BlockType); - case E_BLOCK_LEAVES: return new cBlockLeavesHandler (a_BlockType); - case E_BLOCK_LEVER: return new cBlockLeverHandler (a_BlockType); - case E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: return new cBlockPressurePlateHandler (a_BlockType); - case E_BLOCK_LILY_PAD: return new cBlockLilypadHandler (a_BlockType); - case E_BLOCK_LIME_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler (a_BlockType); - case E_BLOCK_LOG: return new cBlockSidewaysHandler (a_BlockType); - case E_BLOCK_MAGENTA_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_MELON: return new cBlockMelonHandler (a_BlockType); - case E_BLOCK_MELON_STEM: return new cBlockMelonStemHandler (a_BlockType); - case E_BLOCK_MOB_SPAWNER: return new cBlockMobSpawnerHandler (a_BlockType); - case E_BLOCK_MYCELIUM: return new cBlockMyceliumHandler (a_BlockType); - case E_BLOCK_NETHERRACK: return new cBlockNetherrack (a_BlockType); - case E_BLOCK_NETHER_BRICK_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType); - case E_BLOCK_NETHER_QUARTZ_ORE: return new cBlockOreHandler (a_BlockType); - case E_BLOCK_NETHER_WART: return new cBlockNetherWartHandler (a_BlockType); - case E_BLOCK_NEW_LEAVES: return new cBlockLeavesHandler (a_BlockType); - case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType); - case E_BLOCK_NOTE_BLOCK: return new cBlockEntityHandler (a_BlockType); - case E_BLOCK_OAK_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_OAK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); - case E_BLOCK_OAK_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_OBSERVER: return new cBlockObserverHandler (a_BlockType); - case E_BLOCK_ORANGE_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_PACKED_ICE: return new cBlockIceHandler (a_BlockType); - case E_BLOCK_PINK_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType); - case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler; - case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType); - case E_BLOCK_POTATOES: return new cBlockCropsHandler<7> (a_BlockType); // 8 stages of growth - case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType); - case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType); - case E_BLOCK_PUMPKIN_STEM: return new cBlockPumpkinStemHandler (a_BlockType); - case E_BLOCK_PURPLE_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_PURPUR_DOUBLE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType); - case E_BLOCK_PURPUR_SLAB: return new cBlockSlabHandler (a_BlockType); - case E_BLOCK_PURPUR_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_QUARTZ_BLOCK: return new cBlockQuartzHandler (a_BlockType); - case E_BLOCK_QUARTZ_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType); - case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType); - case E_BLOCK_REDSTONE_ORE: return new cBlockRedstoneOreHandler (a_BlockType); - case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockGlowingRedstoneOreHandler(a_BlockType); - case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler (a_BlockType); - case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler (a_BlockType); - case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType); - case E_BLOCK_REDSTONE_TORCH_ON: return new cBlockRedstoneTorchHandler (a_BlockType); - case E_BLOCK_REDSTONE_WIRE: return new cBlockRedstoneHandler (a_BlockType); - case E_BLOCK_RED_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_RED_MUSHROOM: return new cBlockMushroomHandler (a_BlockType); - case E_BLOCK_RED_ROSE: return new cBlockFlowerHandler (a_BlockType); - case E_BLOCK_RED_SANDSTONE_SLAB: return new cBlockSlabHandler (a_BlockType); - case E_BLOCK_RED_SANDSTONE_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_REPEATING_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType); - case E_BLOCK_SAND: return new cBlockSandHandler (a_BlockType); - case E_BLOCK_SANDSTONE_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_SAPLING: return new cBlockSaplingHandler (a_BlockType); - case E_BLOCK_SEA_LANTERN: return new cBlockSeaLanternHandler (a_BlockType); - case E_BLOCK_SIGN_POST: return new cBlockSignPostHandler (a_BlockType); - case E_BLOCK_SLIME_BLOCK: return new cBlockSlimeHandler (a_BlockType); - case E_BLOCK_SNOW: return new cBlockSnowHandler (a_BlockType); - case E_BLOCK_SPONGE: return new cBlockSpongeHandler (a_BlockType); - case E_BLOCK_SPRUCE_DOOR: return new cBlockDoorHandler (a_BlockType); - case E_BLOCK_SPRUCE_FENCE: return new cBlockFenceHandler (a_BlockType); - case E_BLOCK_SPRUCE_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); - case E_BLOCK_SPRUCE_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_STAINED_GLASS: return new cBlockGlassHandler (a_BlockType); - case E_BLOCK_STAINED_GLASS_PANE: return new cBlockGlassHandler (a_BlockType); - case E_BLOCK_STATIONARY_LAVA: return new cBlockLavaHandler (a_BlockType); - case E_BLOCK_STATIONARY_WATER: return new cBlockFluidHandler (a_BlockType); - case E_BLOCK_STICKY_PISTON: return new cBlockPistonHandler (a_BlockType); - case E_BLOCK_STONE: return new cBlockStoneHandler (a_BlockType); - case E_BLOCK_STONE_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); - case E_BLOCK_STONE_BUTTON: return new cBlockButtonHandler (a_BlockType); - case E_BLOCK_STONE_PRESSURE_PLATE: return new cBlockPressurePlateHandler (a_BlockType); - case E_BLOCK_STONE_SLAB: return new cBlockSlabHandler (a_BlockType); - case E_BLOCK_SUGARCANE: return new cBlockSugarcaneHandler (a_BlockType); - case E_BLOCK_TALL_GRASS: return new cBlockTallGrassHandler (a_BlockType); - case E_BLOCK_TNT: return new cBlockTNTHandler (a_BlockType); - case E_BLOCK_TORCH: return new cBlockTorchHandler (a_BlockType); - case E_BLOCK_TRAPDOOR: return new cBlockTrapdoorHandler (a_BlockType); - case E_BLOCK_TRAPPED_CHEST: return new cBlockChestHandler (a_BlockType); - case E_BLOCK_TRIPWIRE: return new cBlockTripwireHandler (a_BlockType); - case E_BLOCK_TRIPWIRE_HOOK: return new cBlockTripwireHookHandler (a_BlockType); - case E_BLOCK_VINES: return new cBlockVineHandler (a_BlockType); - case E_BLOCK_WALLSIGN: return new cBlockWallSignHandler (a_BlockType); - case E_BLOCK_WATER: return new cBlockFluidHandler (a_BlockType); - case E_BLOCK_WHITE_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - case E_BLOCK_WOODEN_BUTTON: return new cBlockButtonHandler (a_BlockType); - case E_BLOCK_WOODEN_PRESSURE_PLATE: return new cBlockPressurePlateHandler (a_BlockType); - case E_BLOCK_WOODEN_SLAB: return new cBlockSlabHandler (a_BlockType); - case E_BLOCK_WOOL: return new cBlockClothHandler (a_BlockType); - case E_BLOCK_WORKBENCH: return new cBlockWorkbenchHandler (a_BlockType); - case E_BLOCK_YELLOW_FLOWER: return new cBlockFlowerHandler (a_BlockType); - case E_BLOCK_YELLOW_GLAZED_TERRACOTTA: return new cBlockGlazedTerracottaHandler (a_BlockType); - - default: return new cBlockHandler(a_BlockType); - } + cBlockDoorHandler BlockAcaciaDoorHandler (E_BLOCK_ACACIA_DOOR); + cBlockFenceGateHandler BlockAcaciaFenceGateHandler (E_BLOCK_ACACIA_FENCE_GATE); + cBlockFenceHandler BlockAcaciaFenceHandler (E_BLOCK_ACACIA_FENCE); + cBlockStairsHandler BlockAcaciaWoodStairsHandler (E_BLOCK_ACACIA_WOOD_STAIRS); + cBlockRailHandler BlockActivatorRailHandler (E_BLOCK_ACTIVATOR_RAIL); + cBlockComparatorHandler BlockActiveComparatorHandler (E_BLOCK_ACTIVE_COMPARATOR); + cBlockWithNoDrops<> BlockAirHandler (E_BLOCK_AIR); + cBlockAnvilHandler BlockAnvilHandler (E_BLOCK_ANVIL); + cBlockHandler BlockBarrierHandler (E_BLOCK_BARRIER); + cBlockEntityHandler BlockBeaconHandler (E_BLOCK_BEACON); + cBlockBedHandler BlockBedHandler (E_BLOCK_BED); + cBlockHandler BlockBedrockHandler (E_BLOCK_BEDROCK); + cBlockCropsHandler<3> BlockBeetrootsHandler (E_BLOCK_BEETROOTS); // 4 stages of growth + cBlockBigFlowerHandler BlockBigFlowerHandler (E_BLOCK_BIG_FLOWER); + cBlockDoorHandler BlockBirchDoorHandler (E_BLOCK_BIRCH_DOOR); + cBlockFenceGateHandler BlockBirchFenceGateHandler (E_BLOCK_BIRCH_FENCE_GATE); + cBlockFenceHandler BlockBirchFenceHandler (E_BLOCK_BIRCH_FENCE); + cBlockStairsHandler BlockBirchWoodStairsHandler (E_BLOCK_BIRCH_WOOD_STAIRS); + cBlockGlazedTerracottaHandler BlockBlackGlazedTerracottaHandler (E_BLOCK_BLACK_GLAZED_TERRACOTTA); + cBlockHandler BlockBlackShulkerBoxHandler (E_BLOCK_BLACK_SHULKER_BOX); + cBlockHandler BlockBlockOfCoalHandler (E_BLOCK_BLOCK_OF_COAL); + cBlockHandler BlockBlockOfRedstoneHandler (E_BLOCK_BLOCK_OF_REDSTONE); + cBlockGlazedTerracottaHandler BlockBlueGlazedTerracottaHandler (E_BLOCK_BLUE_GLAZED_TERRACOTTA); + cBlockHandler BlockBlueShulkerBoxHandler (E_BLOCK_BLUE_SHULKER_BOX); + cBlockHandler BlockBoneBlockHandler (E_BLOCK_BONE_BLOCK); + cBlockBookShelfHandler BlockBookcaseHandler (E_BLOCK_BOOKCASE); + cBlockBrewingStandHandler BlockBrewingStandHandler (E_BLOCK_BREWING_STAND); + cBlockHandler BlockBrickHandler (E_BLOCK_BRICK); + cBlockStairsHandler BlockBrickStairsHandler (E_BLOCK_BRICK_STAIRS); + cBlockGlazedTerracottaHandler BlockBrownGlazedTerracottaHandler (E_BLOCK_BROWN_GLAZED_TERRACOTTA); + cBlockMushroomHandler BlockBrownMushroomHandler (E_BLOCK_BROWN_MUSHROOM); + cBlockHandler BlockBrownShulkerBoxHandler (E_BLOCK_BROWN_SHULKER_BOX); + cBlockCactusHandler BlockCactusHandler (E_BLOCK_CACTUS); + cBlockCakeHandler BlockCakeHandler (E_BLOCK_CAKE); + cBlockCarpetHandler BlockCarpetHandler (E_BLOCK_CARPET); + cBlockCropsHandler<7> BlockCarrotsHandler (E_BLOCK_CARROTS); // 8 stages of growth + cBlockCauldronHandler BlockCauldronHandler (E_BLOCK_CAULDRON); + cBlockCommandBlockHandler BlockChainCommandBlockHandler (E_BLOCK_CHAIN_COMMAND_BLOCK); + cBlockChestHandler BlockChestHandler (E_BLOCK_CHEST); + cBlockHandler BlockChorusFlowerHandler (E_BLOCK_CHORUS_FLOWER); + cBlockHandler BlockChorusPlantHandler (E_BLOCK_CHORUS_PLANT); + cBlockOreHandler BlockClayHandler (E_BLOCK_CLAY); + cBlockOreHandler BlockCoalOreHandler (E_BLOCK_COAL_ORE); + cBlockStoneHandler BlockCobblestoneHandler (E_BLOCK_COBBLESTONE); + cBlockStairsHandler BlockCobblestoneStairsHandler (E_BLOCK_COBBLESTONE_STAIRS); + cBlockHandler BlockCobblestoneWallHandler (E_BLOCK_COBBLESTONE_WALL); + cBlockCobWebHandler BlockCobwebHandler (E_BLOCK_COBWEB); + cBlockCocoaPodHandler BlockCocoaPodHandler (E_BLOCK_COCOA_POD); + cBlockCommandBlockHandler BlockCommandBlockHandler (E_BLOCK_COMMAND_BLOCK); + cBlockHandler BlockConcreteHandler (E_BLOCK_CONCRETE); + cBlockConcretePowderHandler BlockConcretePowderHandler (E_BLOCK_CONCRETE_POWDER); + cBlockCropsHandler<7> BlockCropsHandler (E_BLOCK_CROPS); // 8 stages of growth + cBlockGlazedTerracottaHandler BlockCyanGlazedTerracottaHandler (E_BLOCK_CYAN_GLAZED_TERRACOTTA); + cBlockHandler BlockCyanShulkerBoxHandler (E_BLOCK_CYAN_SHULKER_BOX); + cBlockDoorHandler BlockDarkOakDoorHandler (E_BLOCK_DARK_OAK_DOOR); + cBlockFenceGateHandler BlockDarkOakFenceGateHandler (E_BLOCK_DARK_OAK_FENCE_GATE); + cBlockFenceHandler BlockDarkOakFenceHandler (E_BLOCK_DARK_OAK_FENCE); + cBlockStairsHandler BlockDarkOakWoodStairsHandler (E_BLOCK_DARK_OAK_WOOD_STAIRS); + cBlockHandler BlockDaylightSensorHandler (E_BLOCK_DAYLIGHT_SENSOR); + cBlockDeadBushHandler BlockDeadBushHandler (E_BLOCK_DEAD_BUSH); + cBlockRailHandler BlockDetectorRailHandler (E_BLOCK_DETECTOR_RAIL); + cBlockHandler BlockDiamondBlockHandler (E_BLOCK_DIAMOND_BLOCK); + cBlockOreHandler BlockDiamondOreHandler (E_BLOCK_DIAMOND_ORE); + cBlockDirtHandler BlockDirtHandler (E_BLOCK_DIRT); + cBlockDropSpenserHandler BlockDispenserHandler (E_BLOCK_DISPENSER); + cBlockDoubleSlabHandler BlockDoubleRedSandstoneSlabHandler(E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB); + cBlockDoubleSlabHandler BlockDoubleStoneSlabHandler (E_BLOCK_DOUBLE_STONE_SLAB); + cBlockDoubleSlabHandler BlockDoubleWoodenSlabHandler (E_BLOCK_DOUBLE_WOODEN_SLAB); + cBlockHandler BlockDragonEggHandler (E_BLOCK_DRAGON_EGG); + cBlockDropSpenserHandler BlockDropperHandler (E_BLOCK_DROPPER); + cBlockHandler BlockEmeraldBlockHandler (E_BLOCK_EMERALD_BLOCK); + cBlockOreHandler BlockEmeraldOreHandler (E_BLOCK_EMERALD_ORE); + cBlockEnchantmentTableHandler BlockEnchantmentTableHandler (E_BLOCK_ENCHANTMENT_TABLE); + cBlockHandler BlockEndBricksHandler (E_BLOCK_END_BRICKS); + cBlockHandler BlockEndGatewayHandler (E_BLOCK_END_GATEWAY); + cBlockEndPortalFrameHandler BlockEndPortalFrameHandler (E_BLOCK_END_PORTAL_FRAME); + cBlockHandler BlockEndPortalHandler (E_BLOCK_END_PORTAL); + cBlockHandler BlockEndRodHandler (E_BLOCK_END_ROD); + cBlockHandler BlockEndStoneHandler (E_BLOCK_END_STONE); + cBlockEnderchestHandler BlockEnderChestHandler (E_BLOCK_ENDER_CHEST); + cBlockFarmlandHandler BlockFarmlandHandler (E_BLOCK_FARMLAND); + cBlockFenceHandler BlockFenceHandler (E_BLOCK_FENCE); + cBlockFireHandler BlockFireHandler (E_BLOCK_FIRE); + cBlockFlowerPotHandler BlockFlowerPotHandler (E_BLOCK_FLOWER_POT); + cBlockIceHandler BlockFrostedIceHandler (E_BLOCK_FROSTED_ICE); + cBlockFurnaceHandler BlockFurnaceHandler (E_BLOCK_FURNACE); + cBlockGlassHandler BlockGlassHandler (E_BLOCK_GLASS); + cBlockGlassHandler BlockGlassPaneHandler (E_BLOCK_GLASS_PANE); + cBlockGlowstoneHandler BlockGlowstoneHandler (E_BLOCK_GLOWSTONE); + cBlockHandler BlockGoldBlockHandler (E_BLOCK_GOLD_BLOCK); + cBlockOreHandler BlockGoldOreHandler (E_BLOCK_GOLD_ORE); + cBlockGrassHandler BlockGrassHandler (E_BLOCK_GRASS); + cBlockHandler BlockGrassPathHandler (E_BLOCK_GRASS_PATH); + cBlockGravelHandler BlockGravelHandler (E_BLOCK_GRAVEL); + cBlockGlazedTerracottaHandler BlockGrayGlazedTerracottaHandler (E_BLOCK_GRAY_GLAZED_TERRACOTTA); + cBlockHandler BlockGrayShulkerBoxHandler (E_BLOCK_GRAY_SHULKER_BOX); + cBlockGlazedTerracottaHandler BlockGreenGlazedTerracottaHandler (E_BLOCK_GREEN_GLAZED_TERRACOTTA); + cBlockHandler BlockGreenShulkerBoxHandler (E_BLOCK_GREEN_SHULKER_BOX); + cBlockHandler BlockHardenedClayHandler (E_BLOCK_HARDENED_CLAY); + cBlockSidewaysHandler BlockHayBaleHandler (E_BLOCK_HAY_BALE); + cBlockMobHeadHandler BlockHeadHandler (E_BLOCK_HEAD); + cBlockPressurePlateHandler BlockHeavyWeightedPressurePHandler(E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE); + cBlockHopperHandler BlockHopperHandler (E_BLOCK_HOPPER); + cBlockHandler BlockHugeBrownMushroomHandler (E_BLOCK_HUGE_BROWN_MUSHROOM); + cBlockHandler BlockHugeRedMushroomHandler (E_BLOCK_HUGE_RED_MUSHROOM); + cBlockIceHandler BlockIceHandler (E_BLOCK_ICE); + cBlockComparatorHandler BlockInactiveComparatorHandler (E_BLOCK_INACTIVE_COMPARATOR); + cBlockHandler BlockInfestedBlockHandler (E_BLOCK_SILVERFISH_EGG); + cBlockHandler BlockIronBarsHandler (E_BLOCK_IRON_BARS); + cBlockHandler BlockIronBlockHandler (E_BLOCK_IRON_BLOCK); + cBlockDoorHandler BlockIronDoorHandler (E_BLOCK_IRON_DOOR); + cBlockOreHandler BlockIronOreHandler (E_BLOCK_IRON_ORE); + cBlockTrapdoorHandler BlockIronTrapdoorHandler (E_BLOCK_IRON_TRAPDOOR); + cBlockPumpkinHandler BlockJackOLanternHandler (E_BLOCK_JACK_O_LANTERN); + cBlockJukeboxHandler BlockJukeboxHandler (E_BLOCK_JUKEBOX); + cBlockDoorHandler BlockJungleDoorHandler (E_BLOCK_JUNGLE_DOOR); + cBlockFenceGateHandler BlockJungleFenceGateHandler (E_BLOCK_JUNGLE_FENCE_GATE); + cBlockFenceHandler BlockJungleFenceHandler (E_BLOCK_JUNGLE_FENCE); + cBlockStairsHandler BlockJungleWoodStairsHandler (E_BLOCK_JUNGLE_WOOD_STAIRS); + cBlockLadderHandler BlockLadderHandler (E_BLOCK_LADDER); + cBlockHandler BlockLapisBlockHandler (E_BLOCK_LAPIS_BLOCK); + cBlockOreHandler BlockLapisOreHandler (E_BLOCK_LAPIS_ORE); + cBlockLavaHandler BlockLavaHandler (E_BLOCK_LAVA); + cBlockLeavesHandler BlockLeavesHandler (E_BLOCK_LEAVES); + cBlockLeverHandler BlockLeverHandler (E_BLOCK_LEVER); + cBlockGlazedTerracottaHandler BlockLightBlueGlazedTerracoHandler(E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA); + cBlockHandler BlockLightBlueShulkerBoxHandler (E_BLOCK_LIGHT_BLUE_SHULKER_BOX); + cBlockGlazedTerracottaHandler BlockLightGrayGlazedTerracoHandler(E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA); + cBlockHandler BlockLightGrayShulkerBoxHandler (E_BLOCK_LIGHT_GRAY_SHULKER_BOX); + cBlockPressurePlateHandler BlockLightWeightedPressurePHandler(E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE); + cBlockLilypadHandler BlockLilyPadHandler (E_BLOCK_LILY_PAD); + cBlockGlazedTerracottaHandler BlockLimeGlazedTerracottaHandler (E_BLOCK_LIME_GLAZED_TERRACOTTA); + cBlockHandler BlockLimeShulkerBoxHandler (E_BLOCK_LIME_SHULKER_BOX); + cBlockFurnaceHandler BlockLitFurnaceHandler (E_BLOCK_LIT_FURNACE); + cBlockSidewaysHandler BlockLogHandler (E_BLOCK_LOG); + cBlockGlazedTerracottaHandler BlockMagentaGlazedTerracottHandler(E_BLOCK_MAGENTA_GLAZED_TERRACOTTA); + cBlockHandler BlockMagentaShulkerBoxHandler (E_BLOCK_MAGENTA_SHULKER_BOX); + cBlockHandler BlockMagmaHandler (E_BLOCK_MAGMA); + cBlockMelonHandler BlockMelonHandler (E_BLOCK_MELON); + cBlockMelonStemHandler BlockMelonStemHandler (E_BLOCK_MELON_STEM); + cBlockMobSpawnerHandler BlockMobSpawnerHandler (E_BLOCK_MOB_SPAWNER); + cBlockHandler BlockMossyCobblestoneHandler (E_BLOCK_MOSSY_COBBLESTONE); + cBlockMyceliumHandler BlockMyceliumHandler (E_BLOCK_MYCELIUM); + cBlockFenceHandler BlockNetherBrickFenceHandler (E_BLOCK_NETHER_BRICK_FENCE); + cBlockHandler BlockNetherBrickHandler (E_BLOCK_NETHER_BRICK); + cBlockStairsHandler BlockNetherBrickStairsHandler (E_BLOCK_NETHER_BRICK_STAIRS); + cBlockPortalHandler BlockNetherPortalHandler (E_BLOCK_NETHER_PORTAL); + cBlockOreHandler BlockNetherQuartzOreHandler (E_BLOCK_NETHER_QUARTZ_ORE); + cBlockHandler BlockNetherWartBlockHandler (E_BLOCK_NETHER_WART_BLOCK); + cBlockNetherWartHandler BlockNetherWartHandler (E_BLOCK_NETHER_WART); + cBlockNetherrack BlockNetherrackHandler (E_BLOCK_NETHERRACK); + cBlockLeavesHandler BlockNewLeavesHandler (E_BLOCK_NEW_LEAVES); + cBlockSidewaysHandler BlockNewLogHandler (E_BLOCK_NEW_LOG); + cBlockEntityHandler BlockNoteBlockHandler (E_BLOCK_NOTE_BLOCK); + cBlockDoorHandler BlockOakDoorHandler (E_BLOCK_OAK_DOOR); + cBlockFenceGateHandler BlockOakFenceGateHandler (E_BLOCK_OAK_FENCE_GATE); + cBlockStairsHandler BlockOakWoodStairsHandler (E_BLOCK_OAK_WOOD_STAIRS); + cBlockObserverHandler BlockObserverHandler (E_BLOCK_OBSERVER); + cBlockHandler BlockObsidianHandler (E_BLOCK_OBSIDIAN); + cBlockGlazedTerracottaHandler BlockOrangeGlazedTerracottaHandler(E_BLOCK_ORANGE_GLAZED_TERRACOTTA); + cBlockHandler BlockOrangeShulkerBoxHandler (E_BLOCK_ORANGE_SHULKER_BOX); + cBlockIceHandler BlockPackedIceHandler (E_BLOCK_PACKED_ICE); + cBlockGlazedTerracottaHandler BlockPinkGlazedTerracottaHandler (E_BLOCK_PINK_GLAZED_TERRACOTTA); + cBlockHandler BlockPinkShulkerBoxHandler (E_BLOCK_PINK_SHULKER_BOX); + cBlockPistonHandler BlockPistonHandler (E_BLOCK_PISTON); + cBlockPistonHeadHandler BlockPistonHeadHandler; + cBlockHandler BlockPistonMovedBlockHandler (E_BLOCK_PISTON_MOVED_BLOCK); + cBlockPlanksHandler BlockPlanksHandler (E_BLOCK_PLANKS); + cBlockCropsHandler<7> BlockPotatoesHandler (E_BLOCK_POTATOES); // 8 stages of growth + cBlockRailHandler BlockPoweredRailHandler (E_BLOCK_POWERED_RAIL); + cBlockHandler BlockPrismarineBlockHandler (E_BLOCK_PRISMARINE_BLOCK); + cBlockPumpkinHandler BlockPumpkinHandler (E_BLOCK_PUMPKIN); + cBlockPumpkinStemHandler BlockPumpkinStemHandler (E_BLOCK_PUMPKIN_STEM); + cBlockGlazedTerracottaHandler BlockPurpleGlazedTerracottaHandler(E_BLOCK_PURPLE_GLAZED_TERRACOTTA); + cBlockHandler BlockPurpleShulkerBoxHandler (E_BLOCK_PURPLE_SHULKER_BOX); + cBlockHandler BlockPurpurBlockHandler (E_BLOCK_PURPUR_BLOCK); + cBlockDoubleSlabHandler BlockPurpurDoubleSlabHandler (E_BLOCK_PURPUR_DOUBLE_SLAB); + cBlockHandler BlockPurpurPillarHandler (E_BLOCK_PURPUR_PILLAR); + cBlockSlabHandler BlockPurpurSlabHandler (E_BLOCK_PURPUR_SLAB); + cBlockStairsHandler BlockPurpurStairsHandler (E_BLOCK_PURPUR_STAIRS); + cBlockQuartzHandler BlockQuartzBlockHandler (E_BLOCK_QUARTZ_BLOCK); + cBlockStairsHandler BlockQuartzStairsHandler (E_BLOCK_QUARTZ_STAIRS); + cBlockRailHandler BlockRailHandler (E_BLOCK_RAIL); + cBlockGlazedTerracottaHandler BlockRedGlazedTerracottaHandler (E_BLOCK_RED_GLAZED_TERRACOTTA); + cBlockMushroomHandler BlockRedMushroomHandler (E_BLOCK_RED_MUSHROOM); + cBlockHandler BlockRedNetherBrickHandler (E_BLOCK_RED_NETHER_BRICK); + cBlockFlowerHandler BlockRedRoseHandler (E_BLOCK_RED_ROSE); + cBlockHandler BlockRedSandstoneHandler (E_BLOCK_RED_SANDSTONE); + cBlockSlabHandler BlockRedSandstoneSlabHandler (E_BLOCK_RED_SANDSTONE_SLAB); + cBlockStairsHandler BlockRedSandstoneStairsHandler (E_BLOCK_RED_SANDSTONE_STAIRS); + cBlockHandler BlockRedShulkerBoxHandler (E_BLOCK_RED_SHULKER_BOX); + cBlockRedstoneLampHandler BlockRedstoneLampHandler (E_BLOCK_REDSTONE_LAMP_ON); + cBlockGlowingRedstoneOreHandler BlockRedstoneOreGlowingHandler (E_BLOCK_REDSTONE_ORE_GLOWING); + cBlockRedstoneOreHandler BlockRedstoneOreHandler (E_BLOCK_REDSTONE_ORE); + cBlockRedstoneRepeaterHandler BlockRedstoneRepeaterOffHandler (E_BLOCK_REDSTONE_REPEATER_OFF); + cBlockRedstoneRepeaterHandler BlockRedstoneRepeaterOnHandler (E_BLOCK_REDSTONE_REPEATER_ON); + cBlockRedstoneTorchHandler BlockRedstoneTorchOffHandler (E_BLOCK_REDSTONE_TORCH_OFF); + cBlockRedstoneTorchHandler BlockRedstoneTorchOnHandler (E_BLOCK_REDSTONE_TORCH_ON); + cBlockRedstoneHandler BlockRedstoneWireHandler (E_BLOCK_REDSTONE_WIRE); + cBlockCommandBlockHandler BlockRepeatingCommandBlockHandler (E_BLOCK_REPEATING_COMMAND_BLOCK); + cBlockSandHandler BlockSandHandler (E_BLOCK_SAND); + cBlockHandler BlockSandstoneHandler (E_BLOCK_SANDSTONE); + cBlockStairsHandler BlockSandstoneStairsHandler (E_BLOCK_SANDSTONE_STAIRS); + cBlockSaplingHandler BlockSaplingHandler (E_BLOCK_SAPLING); + cBlockSeaLanternHandler BlockSeaLanternHandler (E_BLOCK_SEA_LANTERN); + cBlockSignPostHandler BlockSignPostHandler (E_BLOCK_SIGN_POST); + cBlockSlimeHandler BlockSlimeBlockHandler (E_BLOCK_SLIME_BLOCK); + cBlockHandler BlockSnowBlockHandler (E_BLOCK_SNOW_BLOCK); + cBlockSnowHandler BlockSnowHandler (E_BLOCK_SNOW); + cBlockHandler BlockSoulSandHandler (E_BLOCK_SOULSAND); + cBlockSpongeHandler BlockSpongeHandler (E_BLOCK_SPONGE); + cBlockDoorHandler BlockSpruceDoorHandler (E_BLOCK_SPRUCE_DOOR); + cBlockFenceGateHandler BlockSpruceFenceGateHandler (E_BLOCK_SPRUCE_FENCE_GATE); + cBlockFenceHandler BlockSpruceFenceHandler (E_BLOCK_SPRUCE_FENCE); + cBlockStairsHandler BlockSpruceWoodStairsHandler (E_BLOCK_SPRUCE_WOOD_STAIRS); + cBlockHandler BlockStainedClayHandler (E_BLOCK_STAINED_CLAY); + cBlockGlassHandler BlockStainedGlassHandler (E_BLOCK_STAINED_GLASS); + cBlockGlassHandler BlockStainedGlassPaneHandler (E_BLOCK_STAINED_GLASS_PANE); + cBlockHandler BlockStandingBannerHandler (E_BLOCK_STANDING_BANNER); // TODO: drops correct? + cBlockLavaHandler BlockStationaryLavaHandler (E_BLOCK_STATIONARY_LAVA); + cBlockFluidHandler BlockStationaryWaterHandler (E_BLOCK_STATIONARY_WATER); + cBlockPistonHandler BlockStickyPistonHandler (E_BLOCK_STICKY_PISTON); + cBlockStairsHandler BlockStoneBrickStairsHandler (E_BLOCK_STONE_BRICK_STAIRS); + cBlockHandler BlockStoneBricksHandler (E_BLOCK_STONE_BRICKS); + cBlockButtonHandler BlockStoneButtonHandler (E_BLOCK_STONE_BUTTON); + cBlockStoneHandler BlockStoneHandler (E_BLOCK_STONE); + cBlockPressurePlateHandler BlockStonePressurePlateHandler (E_BLOCK_STONE_PRESSURE_PLATE); + cBlockSlabHandler BlockStoneSlabHandler (E_BLOCK_STONE_SLAB); + cBlockHandler BlockStructureBlockHandler (E_BLOCK_STRUCTURE_BLOCK); + cBlockHandler BlockStructureVoidHandler (E_BLOCK_STRUCTURE_VOID); + cBlockSugarcaneHandler BlockSugarcaneHandler (E_BLOCK_SUGARCANE); + cBlockTallGrassHandler BlockTallGrassHandler (E_BLOCK_TALL_GRASS); + cBlockTNTHandler BlockTntHandler (E_BLOCK_TNT); + cBlockTorchHandler BlockTorchHandler (E_BLOCK_TORCH); + cBlockTrapdoorHandler BlockTrapdoorHandler (E_BLOCK_TRAPDOOR); + cBlockChestHandler BlockTrappedChestHandler (E_BLOCK_TRAPPED_CHEST); + cBlockTripwireHandler BlockTripwireHandler (E_BLOCK_TRIPWIRE); + cBlockTripwireHookHandler BlockTripwireHookHandler (E_BLOCK_TRIPWIRE_HOOK); + cBlockVineHandler BlockVinesHandler (E_BLOCK_VINES); + cBlockHandler BlockWallBannerHandler (E_BLOCK_WALL_BANNER); // TODO: drops correct? + cBlockWallSignHandler BlockWallsignHandler (E_BLOCK_WALLSIGN); + cBlockFluidHandler BlockWaterHandler (E_BLOCK_WATER); + cBlockGlazedTerracottaHandler BlockWhiteGlazedTerracottaHandler (E_BLOCK_WHITE_GLAZED_TERRACOTTA); + cBlockHandler BlockWhiteShulkerBoxHandler (E_BLOCK_WHITE_SHULKER_BOX); + cBlockButtonHandler BlockWoodenButtonHandler (E_BLOCK_WOODEN_BUTTON); + cBlockPressurePlateHandler BlockWoodenPressurePlateHandler (E_BLOCK_WOODEN_PRESSURE_PLATE); + cBlockSlabHandler BlockWoodenSlabHandler (E_BLOCK_WOODEN_SLAB); + cBlockClothHandler BlockWoolHandler (E_BLOCK_WOOL); + cBlockWorkbenchHandler BlockWorkbenchHandler (E_BLOCK_WORKBENCH); + cBlockFlowerHandler BlockYellowFlowerHandler (E_BLOCK_YELLOW_FLOWER); + cBlockGlazedTerracottaHandler BlockYellowGlazedTerracottaHandler(E_BLOCK_YELLOW_GLAZED_TERRACOTTA); + cBlockHandler BlockYellowShulkerBoxHandler (E_BLOCK_YELLOW_SHULKER_BOX); } @@ -599,9 +656,274 @@ bool cBlockHandler::ToolHasSilkTouch(const cItem * a_Tool) -cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE aBlockType) +cBlockHandler & cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockType) { - return ::CreateBlockHandler(aBlockType); + // Switch on the block type, as an enumeration + // Clang will fail if any type is unhandled: + switch (static_cast<ENUM_BLOCK_TYPE>(a_BlockType)) + { + // Block handlers, alphabetically sorted: + case E_BLOCK_ACACIA_DOOR: return BlockAcaciaDoorHandler; + case E_BLOCK_ACACIA_FENCE: return BlockAcaciaFenceHandler; + case E_BLOCK_ACACIA_FENCE_GATE: return BlockAcaciaFenceGateHandler; + case E_BLOCK_ACACIA_WOOD_STAIRS: return BlockAcaciaWoodStairsHandler; + case E_BLOCK_ACTIVATOR_RAIL: return BlockActivatorRailHandler; + case E_BLOCK_ACTIVE_COMPARATOR: return BlockActiveComparatorHandler; + case E_BLOCK_AIR: return BlockAirHandler; + case E_BLOCK_ANVIL: return BlockAnvilHandler; + case E_BLOCK_BARRIER: return BlockBarrierHandler; + case E_BLOCK_BEACON: return BlockBeaconHandler; + case E_BLOCK_BED: return BlockBedHandler; + case E_BLOCK_BEDROCK: return BlockBedrockHandler; + case E_BLOCK_BEETROOTS: return BlockBeetrootsHandler; + case E_BLOCK_BIG_FLOWER: return BlockBigFlowerHandler; + case E_BLOCK_BIRCH_DOOR: return BlockBirchDoorHandler; + case E_BLOCK_BIRCH_FENCE: return BlockBirchFenceHandler; + case E_BLOCK_BIRCH_FENCE_GATE: return BlockBirchFenceGateHandler; + case E_BLOCK_BIRCH_WOOD_STAIRS: return BlockBirchWoodStairsHandler; + case E_BLOCK_BLACK_GLAZED_TERRACOTTA: return BlockBlackGlazedTerracottaHandler; + case E_BLOCK_BLACK_SHULKER_BOX: return BlockBlackShulkerBoxHandler; + case E_BLOCK_BLOCK_OF_COAL: return BlockBlockOfCoalHandler; + case E_BLOCK_BLOCK_OF_REDSTONE: return BlockBlockOfRedstoneHandler; + case E_BLOCK_BLUE_GLAZED_TERRACOTTA: return BlockBlueGlazedTerracottaHandler; + case E_BLOCK_BLUE_SHULKER_BOX: return BlockBlueShulkerBoxHandler; + case E_BLOCK_BONE_BLOCK: return BlockBoneBlockHandler; + case E_BLOCK_BOOKCASE: return BlockBookcaseHandler; + case E_BLOCK_BREWING_STAND: return BlockBrewingStandHandler; + case E_BLOCK_BRICK: return BlockBrickHandler; + case E_BLOCK_BRICK_STAIRS: return BlockBrickStairsHandler; + case E_BLOCK_BROWN_GLAZED_TERRACOTTA: return BlockBrownGlazedTerracottaHandler; + case E_BLOCK_BROWN_MUSHROOM: return BlockBrownMushroomHandler; + case E_BLOCK_BROWN_SHULKER_BOX: return BlockBrownShulkerBoxHandler; + case E_BLOCK_CACTUS: return BlockCactusHandler; + case E_BLOCK_CAKE: return BlockCakeHandler; + case E_BLOCK_CARPET: return BlockCarpetHandler; + case E_BLOCK_CARROTS: return BlockCarrotsHandler; + case E_BLOCK_CAULDRON: return BlockCauldronHandler; + case E_BLOCK_CHAIN_COMMAND_BLOCK: return BlockChainCommandBlockHandler; + case E_BLOCK_CHEST: return BlockChestHandler; + case E_BLOCK_CHORUS_FLOWER: return BlockChorusFlowerHandler; + case E_BLOCK_CHORUS_PLANT: return BlockChorusPlantHandler; + case E_BLOCK_CLAY: return BlockClayHandler; + case E_BLOCK_COAL_ORE: return BlockCoalOreHandler; + case E_BLOCK_COBBLESTONE: return BlockCobblestoneHandler; + case E_BLOCK_COBBLESTONE_STAIRS: return BlockCobblestoneStairsHandler; + case E_BLOCK_COBBLESTONE_WALL: return BlockCobblestoneWallHandler; + case E_BLOCK_COBWEB: return BlockCobwebHandler; + case E_BLOCK_COCOA_POD: return BlockCocoaPodHandler; + case E_BLOCK_COMMAND_BLOCK: return BlockCommandBlockHandler; + case E_BLOCK_CONCRETE: return BlockConcreteHandler; + case E_BLOCK_CONCRETE_POWDER: return BlockConcretePowderHandler; + case E_BLOCK_CROPS: return BlockCropsHandler; + case E_BLOCK_CYAN_GLAZED_TERRACOTTA: return BlockCyanGlazedTerracottaHandler; + case E_BLOCK_CYAN_SHULKER_BOX: return BlockCyanShulkerBoxHandler; + case E_BLOCK_DARK_OAK_DOOR: return BlockDarkOakDoorHandler; + case E_BLOCK_DARK_OAK_FENCE: return BlockDarkOakFenceHandler; + case E_BLOCK_DARK_OAK_FENCE_GATE: return BlockDarkOakFenceGateHandler; + case E_BLOCK_DARK_OAK_WOOD_STAIRS: return BlockDarkOakWoodStairsHandler; + case E_BLOCK_DAYLIGHT_SENSOR: return BlockDaylightSensorHandler; + case E_BLOCK_DEAD_BUSH: return BlockDeadBushHandler; + case E_BLOCK_DETECTOR_RAIL: return BlockDetectorRailHandler; + case E_BLOCK_DIAMOND_BLOCK: return BlockDiamondBlockHandler; + case E_BLOCK_DIAMOND_ORE: return BlockDiamondOreHandler; + case E_BLOCK_DIRT: return BlockDirtHandler; + case E_BLOCK_DISPENSER: return BlockDispenserHandler; + case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB: return BlockDoubleRedSandstoneSlabHandler; + case E_BLOCK_DOUBLE_STONE_SLAB: return BlockDoubleStoneSlabHandler; + case E_BLOCK_DOUBLE_WOODEN_SLAB: return BlockDoubleWoodenSlabHandler; + case E_BLOCK_DRAGON_EGG: return BlockDragonEggHandler; + case E_BLOCK_DROPPER: return BlockDropperHandler; + case E_BLOCK_EMERALD_BLOCK: return BlockEmeraldBlockHandler; + case E_BLOCK_EMERALD_ORE: return BlockEmeraldOreHandler; + case E_BLOCK_ENCHANTMENT_TABLE: return BlockEnchantmentTableHandler; + case E_BLOCK_ENDER_CHEST: return BlockEnderChestHandler; + case E_BLOCK_END_BRICKS: return BlockEndBricksHandler; + case E_BLOCK_END_GATEWAY: return BlockEndGatewayHandler; + case E_BLOCK_END_PORTAL: return BlockEndPortalHandler; + case E_BLOCK_END_PORTAL_FRAME: return BlockEndPortalFrameHandler; + case E_BLOCK_END_ROD: return BlockEndRodHandler; + case E_BLOCK_END_STONE: return BlockEndStoneHandler; + case E_BLOCK_FARMLAND: return BlockFarmlandHandler; + case E_BLOCK_FENCE: return BlockFenceHandler; + case E_BLOCK_FIRE: return BlockFireHandler; + case E_BLOCK_FLOWER_POT: return BlockFlowerPotHandler; + case E_BLOCK_FROSTED_ICE: return BlockFrostedIceHandler; + case E_BLOCK_FURNACE: return BlockFurnaceHandler; + case E_BLOCK_GLASS: return BlockGlassHandler; + case E_BLOCK_GLASS_PANE: return BlockGlassPaneHandler; + case E_BLOCK_GLOWSTONE: return BlockGlowstoneHandler; + case E_BLOCK_GOLD_BLOCK: return BlockGoldBlockHandler; + case E_BLOCK_GOLD_ORE: return BlockGoldOreHandler; + case E_BLOCK_GRASS: return BlockGrassHandler; + case E_BLOCK_GRASS_PATH: return BlockGrassPathHandler; + case E_BLOCK_GRAVEL: return BlockGravelHandler; + case E_BLOCK_GRAY_GLAZED_TERRACOTTA: return BlockGrayGlazedTerracottaHandler; + case E_BLOCK_GRAY_SHULKER_BOX: return BlockGrayShulkerBoxHandler; + case E_BLOCK_GREEN_GLAZED_TERRACOTTA: return BlockGreenGlazedTerracottaHandler; + case E_BLOCK_GREEN_SHULKER_BOX: return BlockGreenShulkerBoxHandler; + case E_BLOCK_HARDENED_CLAY: return BlockHardenedClayHandler; + case E_BLOCK_HAY_BALE: return BlockHayBaleHandler; + case E_BLOCK_HEAD: return BlockHeadHandler; + case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE: return BlockHeavyWeightedPressurePHandler; + case E_BLOCK_HOPPER: return BlockHopperHandler; + case E_BLOCK_HUGE_BROWN_MUSHROOM: return BlockHugeBrownMushroomHandler; + case E_BLOCK_HUGE_RED_MUSHROOM: return BlockHugeRedMushroomHandler; + case E_BLOCK_ICE: return BlockIceHandler; + case E_BLOCK_INACTIVE_COMPARATOR: return BlockInactiveComparatorHandler; + case E_BLOCK_INVERTED_DAYLIGHT_SENSOR: return BlockDaylightSensorHandler; + case E_BLOCK_IRON_BARS: return BlockIronBarsHandler; + case E_BLOCK_IRON_BLOCK: return BlockIronBlockHandler; + case E_BLOCK_IRON_DOOR: return BlockIronDoorHandler; + case E_BLOCK_IRON_ORE: return BlockIronOreHandler; + case E_BLOCK_IRON_TRAPDOOR: return BlockIronTrapdoorHandler; + case E_BLOCK_JACK_O_LANTERN: return BlockJackOLanternHandler; + case E_BLOCK_JUKEBOX: return BlockJukeboxHandler; + case E_BLOCK_JUNGLE_DOOR: return BlockJungleDoorHandler; + case E_BLOCK_JUNGLE_FENCE: return BlockJungleFenceHandler; + case E_BLOCK_JUNGLE_FENCE_GATE: return BlockJungleFenceGateHandler; + case E_BLOCK_JUNGLE_WOOD_STAIRS: return BlockJungleWoodStairsHandler; + case E_BLOCK_LADDER: return BlockLadderHandler; + case E_BLOCK_LAPIS_BLOCK: return BlockLapisBlockHandler; + case E_BLOCK_LAPIS_ORE: return BlockLapisOreHandler; + case E_BLOCK_LAVA: return BlockLavaHandler; + case E_BLOCK_LEAVES: return BlockLeavesHandler; + case E_BLOCK_LEVER: return BlockLeverHandler; + case E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA: return BlockLightBlueGlazedTerracoHandler; + case E_BLOCK_LIGHT_BLUE_SHULKER_BOX: return BlockLightBlueShulkerBoxHandler; + case E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA: return BlockLightGrayGlazedTerracoHandler; + case E_BLOCK_LIGHT_GRAY_SHULKER_BOX: return BlockLightGrayShulkerBoxHandler; + case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: return BlockLightWeightedPressurePHandler; + case E_BLOCK_LILY_PAD: return BlockLilyPadHandler; + case E_BLOCK_LIME_GLAZED_TERRACOTTA: return BlockLimeGlazedTerracottaHandler; + case E_BLOCK_LIME_SHULKER_BOX: return BlockLimeShulkerBoxHandler; + case E_BLOCK_LIT_FURNACE: return BlockLitFurnaceHandler; + case E_BLOCK_LOG: return BlockLogHandler; + case E_BLOCK_MAGENTA_GLAZED_TERRACOTTA: return BlockMagentaGlazedTerracottHandler; + case E_BLOCK_MAGENTA_SHULKER_BOX: return BlockMagentaShulkerBoxHandler; + case E_BLOCK_MAGMA: return BlockMagmaHandler; + case E_BLOCK_MELON: return BlockMelonHandler; + case E_BLOCK_MELON_STEM: return BlockMelonStemHandler; + case E_BLOCK_MOB_SPAWNER: return BlockMobSpawnerHandler; + case E_BLOCK_MOSSY_COBBLESTONE: return BlockMossyCobblestoneHandler; + case E_BLOCK_MYCELIUM: return BlockMyceliumHandler; + case E_BLOCK_NETHERRACK: return BlockNetherrackHandler; + case E_BLOCK_NETHER_BRICK: return BlockNetherBrickHandler; + case E_BLOCK_NETHER_BRICK_FENCE: return BlockNetherBrickFenceHandler; + case E_BLOCK_NETHER_BRICK_STAIRS: return BlockNetherBrickStairsHandler; + case E_BLOCK_NETHER_PORTAL: return BlockNetherPortalHandler; + case E_BLOCK_NETHER_QUARTZ_ORE: return BlockNetherQuartzOreHandler; + case E_BLOCK_NETHER_WART: return BlockNetherWartHandler; + case E_BLOCK_NETHER_WART_BLOCK: return BlockNetherWartBlockHandler; + case E_BLOCK_NEW_LEAVES: return BlockNewLeavesHandler; + case E_BLOCK_NEW_LOG: return BlockNewLogHandler; + case E_BLOCK_NOTE_BLOCK: return BlockNoteBlockHandler; + case E_BLOCK_OAK_DOOR: return BlockOakDoorHandler; + case E_BLOCK_OAK_FENCE_GATE: return BlockOakFenceGateHandler; + case E_BLOCK_OAK_WOOD_STAIRS: return BlockOakWoodStairsHandler; + case E_BLOCK_OBSERVER: return BlockObserverHandler; + case E_BLOCK_OBSIDIAN: return BlockObsidianHandler; + case E_BLOCK_ORANGE_GLAZED_TERRACOTTA: return BlockOrangeGlazedTerracottaHandler; + case E_BLOCK_ORANGE_SHULKER_BOX: return BlockOrangeShulkerBoxHandler; + case E_BLOCK_PACKED_ICE: return BlockPackedIceHandler; + case E_BLOCK_PINK_GLAZED_TERRACOTTA: return BlockPinkGlazedTerracottaHandler; + case E_BLOCK_PINK_SHULKER_BOX: return BlockPinkShulkerBoxHandler; + case E_BLOCK_PISTON: return BlockPistonHandler; + case E_BLOCK_PISTON_EXTENSION: return BlockPistonHeadHandler; + case E_BLOCK_PISTON_MOVED_BLOCK: return BlockPistonMovedBlockHandler; + case E_BLOCK_PLANKS: return BlockPlanksHandler; + case E_BLOCK_POTATOES: return BlockPotatoesHandler; + case E_BLOCK_POWERED_RAIL: return BlockPoweredRailHandler; + case E_BLOCK_PRISMARINE_BLOCK: return BlockPrismarineBlockHandler; + case E_BLOCK_PUMPKIN: return BlockPumpkinHandler; + case E_BLOCK_PUMPKIN_STEM: return BlockPumpkinStemHandler; + case E_BLOCK_PURPLE_GLAZED_TERRACOTTA: return BlockPurpleGlazedTerracottaHandler; + case E_BLOCK_PURPLE_SHULKER_BOX: return BlockPurpleShulkerBoxHandler; + case E_BLOCK_PURPUR_BLOCK: return BlockPurpurBlockHandler; + case E_BLOCK_PURPUR_DOUBLE_SLAB: return BlockPurpurDoubleSlabHandler; + case E_BLOCK_PURPUR_PILLAR: return BlockPurpurPillarHandler; + case E_BLOCK_PURPUR_SLAB: return BlockPurpurSlabHandler; + case E_BLOCK_PURPUR_STAIRS: return BlockPurpurStairsHandler; + case E_BLOCK_QUARTZ_BLOCK: return BlockQuartzBlockHandler; + case E_BLOCK_QUARTZ_STAIRS: return BlockQuartzStairsHandler; + case E_BLOCK_RAIL: return BlockRailHandler; + case E_BLOCK_REDSTONE_LAMP_OFF: return BlockRedstoneLampHandler; + case E_BLOCK_REDSTONE_LAMP_ON: return BlockRedstoneLampHandler; + case E_BLOCK_REDSTONE_ORE: return BlockRedstoneOreHandler; + case E_BLOCK_REDSTONE_ORE_GLOWING: return BlockRedstoneOreGlowingHandler; + case E_BLOCK_REDSTONE_REPEATER_OFF: return BlockRedstoneRepeaterOffHandler; + case E_BLOCK_REDSTONE_REPEATER_ON: return BlockRedstoneRepeaterOnHandler; + case E_BLOCK_REDSTONE_TORCH_OFF: return BlockRedstoneTorchOffHandler; + case E_BLOCK_REDSTONE_TORCH_ON: return BlockRedstoneTorchOnHandler; + case E_BLOCK_REDSTONE_WIRE: return BlockRedstoneWireHandler; + case E_BLOCK_RED_GLAZED_TERRACOTTA: return BlockRedGlazedTerracottaHandler; + case E_BLOCK_RED_MUSHROOM: return BlockRedMushroomHandler; + case E_BLOCK_RED_NETHER_BRICK: return BlockRedNetherBrickHandler; + case E_BLOCK_RED_ROSE: return BlockRedRoseHandler; + case E_BLOCK_RED_SANDSTONE: return BlockRedSandstoneHandler; + case E_BLOCK_RED_SANDSTONE_SLAB: return BlockRedSandstoneSlabHandler; + case E_BLOCK_RED_SANDSTONE_STAIRS: return BlockRedSandstoneStairsHandler; + case E_BLOCK_RED_SHULKER_BOX: return BlockRedShulkerBoxHandler; + case E_BLOCK_REPEATING_COMMAND_BLOCK: return BlockRepeatingCommandBlockHandler; + case E_BLOCK_SAND: return BlockSandHandler; + case E_BLOCK_SANDSTONE: return BlockSandstoneHandler; + case E_BLOCK_SANDSTONE_STAIRS: return BlockSandstoneStairsHandler; + case E_BLOCK_SAPLING: return BlockSaplingHandler; + case E_BLOCK_SEA_LANTERN: return BlockSeaLanternHandler; + case E_BLOCK_SIGN_POST: return BlockSignPostHandler; + case E_BLOCK_SILVERFISH_EGG: return BlockInfestedBlockHandler; + case E_BLOCK_SLIME_BLOCK: return BlockSlimeBlockHandler; + case E_BLOCK_SNOW: return BlockSnowHandler; + case E_BLOCK_SNOW_BLOCK: return BlockSnowBlockHandler; + case E_BLOCK_SOULSAND: return BlockSoulSandHandler; + case E_BLOCK_SPONGE: return BlockSpongeHandler; + case E_BLOCK_SPRUCE_DOOR: return BlockSpruceDoorHandler; + case E_BLOCK_SPRUCE_FENCE: return BlockSpruceFenceHandler; + case E_BLOCK_SPRUCE_FENCE_GATE: return BlockSpruceFenceGateHandler; + case E_BLOCK_SPRUCE_WOOD_STAIRS: return BlockSpruceWoodStairsHandler; + case E_BLOCK_STAINED_CLAY: return BlockStainedClayHandler; + case E_BLOCK_STAINED_GLASS: return BlockStainedGlassHandler; + case E_BLOCK_STAINED_GLASS_PANE: return BlockStainedGlassPaneHandler; + case E_BLOCK_STANDING_BANNER: return BlockStandingBannerHandler; + case E_BLOCK_STATIONARY_LAVA: return BlockStationaryLavaHandler; + case E_BLOCK_STATIONARY_WATER: return BlockStationaryWaterHandler; + case E_BLOCK_STICKY_PISTON: return BlockStickyPistonHandler; + case E_BLOCK_STONE: return BlockStoneHandler; + case E_BLOCK_STONE_BRICKS: return BlockStoneBricksHandler; + case E_BLOCK_STONE_BRICK_STAIRS: return BlockStoneBrickStairsHandler; + case E_BLOCK_STONE_BUTTON: return BlockStoneButtonHandler; + case E_BLOCK_STONE_PRESSURE_PLATE: return BlockStonePressurePlateHandler; + case E_BLOCK_STONE_SLAB: return BlockStoneSlabHandler; + case E_BLOCK_STRUCTURE_BLOCK: return BlockStructureBlockHandler; + case E_BLOCK_STRUCTURE_VOID: return BlockStructureVoidHandler; + case E_BLOCK_SUGARCANE: return BlockSugarcaneHandler; + case E_BLOCK_TALL_GRASS: return BlockTallGrassHandler; + case E_BLOCK_TNT: return BlockTntHandler; + case E_BLOCK_TORCH: return BlockTorchHandler; + case E_BLOCK_TRAPDOOR: return BlockTrapdoorHandler; + case E_BLOCK_TRAPPED_CHEST: return BlockTrappedChestHandler; + case E_BLOCK_TRIPWIRE: return BlockTripwireHandler; + case E_BLOCK_TRIPWIRE_HOOK: return BlockTripwireHookHandler; + case E_BLOCK_VINES: return BlockVinesHandler; + case E_BLOCK_WALLSIGN: return BlockWallsignHandler; + case E_BLOCK_WALL_BANNER: return BlockWallBannerHandler; + case E_BLOCK_WATER: return BlockWaterHandler; + case E_BLOCK_WHITE_GLAZED_TERRACOTTA: return BlockWhiteGlazedTerracottaHandler; + case E_BLOCK_WHITE_SHULKER_BOX: return BlockWhiteShulkerBoxHandler; + case E_BLOCK_WOODEN_BUTTON: return BlockWoodenButtonHandler; + case E_BLOCK_WOODEN_PRESSURE_PLATE: return BlockWoodenPressurePlateHandler; + case E_BLOCK_WOODEN_SLAB: return BlockWoodenSlabHandler; + case E_BLOCK_WOOL: return BlockWoolHandler; + case E_BLOCK_WORKBENCH: return BlockWorkbenchHandler; + case E_BLOCK_YELLOW_FLOWER: return BlockYellowFlowerHandler; + case E_BLOCK_YELLOW_GLAZED_TERRACOTTA: return BlockYellowGlazedTerracottaHandler; + case E_BLOCK_YELLOW_SHULKER_BOX: return BlockYellowShulkerBoxHandler; + + // TODO: these will be removed in 1.13+ migration + case E_BLOCK_NUMBER_OF_TYPES: + case E_BLOCK_UNFINISHED: return BlockAirHandler; + } + + UNREACHABLE("Getting handler for unexpected block type"); } @@ -1300,7 +1622,7 @@ void Temporary::RegisterAllBlockHandlers(BlockTypeRegistry & aRegistry) for (const auto & r: regs) { - std::shared_ptr<cBlockHandler> handler(::CreateBlockHandler(r.oldBlockType)); - aRegistry.registerBlockType("<built-in>", r.newBlockTypeName, handler); + // std::shared_ptr<cBlockHandler> handler(::CreateBlockHandler(r.oldBlockType)); + // aRegistry.registerBlockType("<built-in>", r.newBlockTypeName, handler); } } diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 90866fbb7..96e251f49 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -228,12 +228,12 @@ public: Helper used in many ConvertToPickups() implementations. */ static bool ToolHasSilkTouch(const cItem * a_Tool); + // Gets the blockhandler for the given block type. + static cBlockHandler & GetBlockHandler(BLOCKTYPE a_BlockType); protected: - BLOCKTYPE m_BlockType; - // Creates a new blockhandler for the given block type. For internal use only, use ::GetBlockHandler() instead. - static cBlockHandler * CreateBlockHandler(BLOCKTYPE a_BlockType); + BLOCKTYPE m_BlockType; friend class cBlockInfo; }; diff --git a/tests/Generating/Stubs.cpp b/tests/Generating/Stubs.cpp index 6fbcf70fb..2982457ab 100644 --- a/tests/Generating/Stubs.cpp +++ b/tests/Generating/Stubs.cpp @@ -406,7 +406,9 @@ void cItem::Empty() -cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) +cBlockHandler & cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockType) { - return new cBlockHandler(a_BlockType); + // Dummy handler. + static cBlockHandler Handler(E_BLOCK_AIR); + return Handler; } diff --git a/tests/LuaThreadStress/Stubs.cpp b/tests/LuaThreadStress/Stubs.cpp index db0e8826a..f921477b7 100644 --- a/tests/LuaThreadStress/Stubs.cpp +++ b/tests/LuaThreadStress/Stubs.cpp @@ -86,16 +86,15 @@ extern "C" int luaopen_lxp(lua_State * a_LuaState) -void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler) +cBlockInfo::cBlockInfo() { - delete a_Handler; } -cBlockInfo::cBlockInfo() +cBlockInfo::cBlockInfoArray::cBlockInfoArray() { } @@ -103,15 +102,9 @@ cBlockInfo::cBlockInfo() -cBlockInfo::cBlockInfoArray::cBlockInfoArray() +cBlockHandler * cBlockInfo::GetHandler(BLOCKTYPE a_Type) { - cBlockInfoArray & BlockInfos = *this; - // The piece-loading code uses the handlers for rotations, so we need valid handlers - // Insert dummy handlers: - for (size_t i = 0; i < BlockInfos.size(); i++) - { - BlockInfos[i].m_Handler.reset(new cBlockHandler(static_cast<BLOCKTYPE>(i))); - } + return nullptr; } diff --git a/tests/SchematicFileSerializer/Stubs.cpp b/tests/SchematicFileSerializer/Stubs.cpp index 93fb5f2f6..882175754 100644 --- a/tests/SchematicFileSerializer/Stubs.cpp +++ b/tests/SchematicFileSerializer/Stubs.cpp @@ -21,24 +21,17 @@ cBlockInfo::cBlockInfo() -void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler) +cBlockInfo::cBlockInfoArray::cBlockInfoArray() { - delete a_Handler; } -cBlockInfo::cBlockInfoArray::cBlockInfoArray() +cBlockHandler * cBlockInfo::GetHandler(BLOCKTYPE a_Type) { - cBlockInfoArray & BlockInfos = *this; - // The piece-loading code uses the handlers for rotations, so we need valid handlers - // Insert dummy handlers: - for (size_t i = 0; i < BlockInfos.size(); i++) - { - BlockInfos[i].m_Handler.reset(new cBlockHandler(static_cast<BLOCKTYPE>(i))); - } + return nullptr; } |