summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-10-05 12:27:14 +0200
committerGitHub <noreply@github.com>2020-10-05 12:27:14 +0200
commita9031b6bae742b333b1b390192fa590f2ecb07ea (patch)
treeb2802c81d24d339c201a0747d66ba44e9ea8b1b0 /src/Blocks
parentFixed current end generator (#4968) (diff)
downloadcuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockAir.h22
-rw-r--r--src/Blocks/BlockAnvil.h2
-rw-r--r--src/Blocks/BlockBed.h2
-rw-r--r--src/Blocks/BlockBigFlower.h2
-rw-r--r--src/Blocks/BlockBookShelf.h2
-rw-r--r--src/Blocks/BlockBrewingStand.h2
-rw-r--r--src/Blocks/BlockButton.h2
-rw-r--r--src/Blocks/BlockCactus.h2
-rw-r--r--src/Blocks/BlockCake.h2
-rw-r--r--src/Blocks/BlockCarpet.h2
-rw-r--r--src/Blocks/BlockCauldron.h2
-rw-r--r--src/Blocks/BlockChest.h2
-rw-r--r--src/Blocks/BlockCloth.h2
-rw-r--r--src/Blocks/BlockCobWeb.h2
-rw-r--r--src/Blocks/BlockCocoaPod.h2
-rw-r--r--src/Blocks/BlockCommandBlock.h2
-rw-r--r--src/Blocks/BlockComparator.h2
-rw-r--r--src/Blocks/BlockConcretePowder.h2
-rw-r--r--src/Blocks/BlockCrops.h8
-rw-r--r--src/Blocks/BlockDeadBush.h2
-rw-r--r--src/Blocks/BlockDefaultBlock.h14
-rw-r--r--src/Blocks/BlockDirt.h2
-rw-r--r--src/Blocks/BlockDoor.h2
-rw-r--r--src/Blocks/BlockDropSpenser.h2
-rw-r--r--src/Blocks/BlockEnchantingTable.h2
-rw-r--r--src/Blocks/BlockEndPortalFrame.h2
-rw-r--r--src/Blocks/BlockEnderchest.h2
-rw-r--r--src/Blocks/BlockEntity.h22
-rw-r--r--src/Blocks/BlockFarmland.h2
-rw-r--r--src/Blocks/BlockFence.h2
-rw-r--r--src/Blocks/BlockFenceGate.h2
-rw-r--r--src/Blocks/BlockFire.h2
-rw-r--r--src/Blocks/BlockFlower.h2
-rw-r--r--src/Blocks/BlockFlowerPot.h2
-rw-r--r--src/Blocks/BlockFluid.h72
-rw-r--r--src/Blocks/BlockFurnace.h2
-rw-r--r--src/Blocks/BlockGlass.h2
-rw-r--r--src/Blocks/BlockGlazedTerracotta.h18
-rw-r--r--src/Blocks/BlockGlowstone.h2
-rw-r--r--src/Blocks/BlockGrass.h2
-rw-r--r--src/Blocks/BlockGravel.h2
-rw-r--r--src/Blocks/BlockHandler.cpp182
-rw-r--r--src/Blocks/BlockHandler.h10
-rw-r--r--src/Blocks/BlockHopper.h2
-rw-r--r--src/Blocks/BlockIce.h4
-rw-r--r--src/Blocks/BlockJukebox.h2
-rw-r--r--src/Blocks/BlockLadder.h2
-rw-r--r--src/Blocks/BlockLeaves.h2
-rw-r--r--src/Blocks/BlockLever.h2
-rw-r--r--src/Blocks/BlockLilypad.h2
-rw-r--r--src/Blocks/BlockMelon.h2
-rw-r--r--src/Blocks/BlockMobHead.h2
-rw-r--r--src/Blocks/BlockMobSpawner.h2
-rw-r--r--src/Blocks/BlockMushroom.h2
-rw-r--r--src/Blocks/BlockMycelium.h2
-rw-r--r--src/Blocks/BlockNetherWart.h2
-rw-r--r--src/Blocks/BlockNetherrack.h2
-rw-r--r--src/Blocks/BlockObserver.h2
-rw-r--r--src/Blocks/BlockOre.h14
-rw-r--r--src/Blocks/BlockPackedIce.h2
-rw-r--r--src/Blocks/BlockPiston.h4
-rw-r--r--src/Blocks/BlockPlanks.h2
-rw-r--r--src/Blocks/BlockPlant.h66
-rw-r--r--src/Blocks/BlockPortal.h2
-rw-r--r--src/Blocks/BlockPressurePlate.h2
-rw-r--r--src/Blocks/BlockPumpkin.h2
-rw-r--r--src/Blocks/BlockQuartz.h2
-rw-r--r--src/Blocks/BlockRail.h2
-rw-r--r--src/Blocks/BlockRedstone.h2
-rw-r--r--src/Blocks/BlockRedstoneLamp.h2
-rw-r--r--src/Blocks/BlockRedstoneOre.h4
-rw-r--r--src/Blocks/BlockRedstoneRepeater.h2
-rw-r--r--src/Blocks/BlockRedstoneTorch.h40
-rw-r--r--src/Blocks/BlockSand.h2
-rw-r--r--src/Blocks/BlockSapling.h2
-rw-r--r--src/Blocks/BlockSeaLantern.h2
-rw-r--r--src/Blocks/BlockSideways.h2
-rw-r--r--src/Blocks/BlockSignPost.h2
-rw-r--r--src/Blocks/BlockSlab.h4
-rw-r--r--src/Blocks/BlockSlime.h2
-rw-r--r--src/Blocks/BlockSnow.h2
-rw-r--r--src/Blocks/BlockSponge.h2
-rw-r--r--src/Blocks/BlockStairs.h2
-rw-r--r--src/Blocks/BlockStems.h2
-rw-r--r--src/Blocks/BlockStone.h2
-rw-r--r--src/Blocks/BlockSugarcane.h2
-rw-r--r--src/Blocks/BlockTNT.h2
-rw-r--r--src/Blocks/BlockTallGrass.h2
-rw-r--r--src/Blocks/BlockTorch.h49
-rw-r--r--src/Blocks/BlockTrapdoor.h2
-rw-r--r--src/Blocks/BlockTripwire.h2
-rw-r--r--src/Blocks/BlockTripwireHook.h2
-rw-r--r--src/Blocks/BlockVine.h2
-rw-r--r--src/Blocks/BlockWallSign.h2
-rw-r--r--src/Blocks/BlockWorkbench.h2
-rw-r--r--src/Blocks/CMakeLists.txt7
-rw-r--r--src/Blocks/Mixins.h44
97 files changed, 405 insertions, 337 deletions
diff --git a/src/Blocks/BlockAir.h b/src/Blocks/BlockAir.h
new file mode 100644
index 000000000..529e25302
--- /dev/null
+++ b/src/Blocks/BlockAir.h
@@ -0,0 +1,22 @@
+
+#pragma once
+
+
+
+
+
+class cBlockAirHandler final :
+ public cBlockHandler
+{
+public:
+
+ using cBlockHandler::cBlockHandler;
+
+private:
+
+ virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
+ {
+ // Don't drop anything:
+ return {};
+ }
+};
diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h
index 8eaed870c..7c821e20d 100644
--- a/src/Blocks/BlockAnvil.h
+++ b/src/Blocks/BlockAnvil.h
@@ -10,7 +10,7 @@
-class cBlockAnvilHandler:
+class cBlockAnvilHandler final :
public cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>
{
using Super = cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>;
diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h
index 8aac898df..eb36ede5c 100644
--- a/src/Blocks/BlockBed.h
+++ b/src/Blocks/BlockBed.h
@@ -15,7 +15,7 @@ class cWorldInterface;
-class cBlockBedHandler :
+class cBlockBedHandler final :
public cYawRotator<cBlockEntityHandler, 0x03, 0x02, 0x03, 0x00, 0x01>
{
using Super = cYawRotator<cBlockEntityHandler, 0x03, 0x02, 0x03, 0x00, 0x01>;
diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h
index 5df20dedf..e6e7f58fa 100644
--- a/src/Blocks/BlockBigFlower.h
+++ b/src/Blocks/BlockBigFlower.h
@@ -9,7 +9,7 @@
-class cBlockBigFlowerHandler:
+class cBlockBigFlowerHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockBookShelf.h b/src/Blocks/BlockBookShelf.h
index dcc29eab0..ecd85733e 100644
--- a/src/Blocks/BlockBookShelf.h
+++ b/src/Blocks/BlockBookShelf.h
@@ -6,7 +6,7 @@
-class cBlockBookShelfHandler :
+class cBlockBookShelfHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockBrewingStand.h b/src/Blocks/BlockBrewingStand.h
index 27ba33ca7..6640dea03 100644
--- a/src/Blocks/BlockBrewingStand.h
+++ b/src/Blocks/BlockBrewingStand.h
@@ -7,7 +7,7 @@
-class cBlockBrewingStandHandler :
+class cBlockBrewingStandHandler final :
public cBlockEntityHandler
{
using Super = cBlockEntityHandler;
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index 1ce0e619a..062bd5057 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -9,7 +9,7 @@
-class cBlockButtonHandler :
+class cBlockButtonHandler final :
public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true>>
{
using Super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true>>;
diff --git a/src/Blocks/BlockCactus.h b/src/Blocks/BlockCactus.h
index 64feac77d..2e7cc7db2 100644
--- a/src/Blocks/BlockCactus.h
+++ b/src/Blocks/BlockCactus.h
@@ -7,7 +7,7 @@
-class cBlockCactusHandler :
+class cBlockCactusHandler final :
public cClearMetaOnDrop<cBlockPlant<false>>
{
using Super = cClearMetaOnDrop<cBlockPlant<false>>;
diff --git a/src/Blocks/BlockCake.h b/src/Blocks/BlockCake.h
index 639015df2..b67da5222 100644
--- a/src/Blocks/BlockCake.h
+++ b/src/Blocks/BlockCake.h
@@ -6,7 +6,7 @@
-class cBlockCakeHandler:
+class cBlockCakeHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockCarpet.h b/src/Blocks/BlockCarpet.h
index fff31d8fe..d4c172810 100644
--- a/src/Blocks/BlockCarpet.h
+++ b/src/Blocks/BlockCarpet.h
@@ -14,7 +14,7 @@
-class cBlockCarpetHandler:
+class cBlockCarpetHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h
index f5471ded7..ab9fc2d7e 100644
--- a/src/Blocks/BlockCauldron.h
+++ b/src/Blocks/BlockCauldron.h
@@ -8,7 +8,7 @@
-class cBlockCauldronHandler :
+class cBlockCauldronHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h
index e3a6fb623..88476c82d 100644
--- a/src/Blocks/BlockChest.h
+++ b/src/Blocks/BlockChest.h
@@ -9,7 +9,7 @@
-class cBlockChestHandler :
+class cBlockChestHandler final :
public cYawRotator<cClearMetaOnDrop<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05>
{
using Super = cYawRotator<cClearMetaOnDrop<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05>;
diff --git a/src/Blocks/BlockCloth.h b/src/Blocks/BlockCloth.h
index 0e24e7d37..8c0607f36 100644
--- a/src/Blocks/BlockCloth.h
+++ b/src/Blocks/BlockCloth.h
@@ -7,7 +7,7 @@
-class cBlockClothHandler :
+class cBlockClothHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockCobWeb.h b/src/Blocks/BlockCobWeb.h
index c8b0433d4..7a48c88c1 100644
--- a/src/Blocks/BlockCobWeb.h
+++ b/src/Blocks/BlockCobWeb.h
@@ -9,7 +9,7 @@
-class cBlockCobWebHandler :
+class cBlockCobWebHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockCocoaPod.h b/src/Blocks/BlockCocoaPod.h
index 557367dcf..d78164ea6 100644
--- a/src/Blocks/BlockCocoaPod.h
+++ b/src/Blocks/BlockCocoaPod.h
@@ -7,7 +7,7 @@
-class cBlockCocoaPodHandler :
+class cBlockCocoaPodHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockCommandBlock.h b/src/Blocks/BlockCommandBlock.h
index 03b20aba2..a122ce8e0 100644
--- a/src/Blocks/BlockCommandBlock.h
+++ b/src/Blocks/BlockCommandBlock.h
@@ -7,7 +7,7 @@
-class cBlockCommandBlockHandler :
+class cBlockCommandBlockHandler final :
public cBlockEntityHandler
{
using Super = cBlockEntityHandler;
diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h
index d20c70aeb..667b61c50 100644
--- a/src/Blocks/BlockComparator.h
+++ b/src/Blocks/BlockComparator.h
@@ -9,7 +9,7 @@
-class cBlockComparatorHandler :
+class cBlockComparatorHandler final :
public cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>
{
using Super = cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>;
diff --git a/src/Blocks/BlockConcretePowder.h b/src/Blocks/BlockConcretePowder.h
index 83a475b88..a69001a65 100644
--- a/src/Blocks/BlockConcretePowder.h
+++ b/src/Blocks/BlockConcretePowder.h
@@ -7,7 +7,7 @@
-class cBlockConcretePowderHandler :
+class cBlockConcretePowderHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h
index 827b26881..aab2c18cd 100644
--- a/src/Blocks/BlockCrops.h
+++ b/src/Blocks/BlockCrops.h
@@ -10,7 +10,7 @@
/** Common class that takes care of beetroots, carrots, potatoes and wheat */
template <NIBBLETYPE RipeMeta>
-class cBlockCropsHandler:
+class cBlockCropsHandler final :
public cBlockPlant<true>
{
using Super = cBlockPlant<true>;
@@ -22,10 +22,10 @@ public:
private:
/** Calculate the number of seeds to drop when the crop is broken. */
- static char CalculateSeedCount(char a_Min, char a_BaseRolls, char a_FortuneLevel)
+ static char CalculateSeedCount(char a_Min, char a_BaseRolls, unsigned char a_FortuneLevel)
{
- std::binomial_distribution Binomial(a_BaseRolls + a_FortuneLevel, 0.57);
- return a_Min + Binomial(GetRandomProvider().Engine());
+ std::binomial_distribution<> Binomial(a_BaseRolls + a_FortuneLevel, 0.57);
+ return static_cast<char>(a_Min + Binomial(GetRandomProvider().Engine()));
}
diff --git a/src/Blocks/BlockDeadBush.h b/src/Blocks/BlockDeadBush.h
index f7ae8bb96..a476e9734 100644
--- a/src/Blocks/BlockDeadBush.h
+++ b/src/Blocks/BlockDeadBush.h
@@ -7,7 +7,7 @@
-class cBlockDeadBushHandler:
+class cBlockDeadBushHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockDefaultBlock.h b/src/Blocks/BlockDefaultBlock.h
new file mode 100644
index 000000000..5aed0749b
--- /dev/null
+++ b/src/Blocks/BlockDefaultBlock.h
@@ -0,0 +1,14 @@
+
+#pragma once
+
+
+
+
+
+class cDefaultBlockHandler final :
+ public cBlockHandler
+{
+public:
+
+ using cBlockHandler::cBlockHandler;
+};
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index fade1f992..bcbf93f97 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -7,7 +7,7 @@
-class cBlockDirtHandler :
+class cBlockDirtHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index ee511a290..097bdba40 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -11,7 +11,7 @@
-class cBlockDoorHandler :
+class cBlockDoorHandler final :
public cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>
{
using Super = cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>;
diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h
index 793cc0be9..0f6863ea4 100644
--- a/src/Blocks/BlockDropSpenser.h
+++ b/src/Blocks/BlockDropSpenser.h
@@ -11,7 +11,7 @@
-class cBlockDropSpenserHandler :
+class cBlockDropSpenserHandler final :
public cPitchYawRotator<cClearMetaOnDrop<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>
{
using Super = cPitchYawRotator<cClearMetaOnDrop<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>;
diff --git a/src/Blocks/BlockEnchantingTable.h b/src/Blocks/BlockEnchantingTable.h
index 5edf9fdda..c921d8f27 100644
--- a/src/Blocks/BlockEnchantingTable.h
+++ b/src/Blocks/BlockEnchantingTable.h
@@ -11,7 +11,7 @@
-class cBlockEnchantingTableHandler :
+class cBlockEnchantingTableHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockEndPortalFrame.h b/src/Blocks/BlockEndPortalFrame.h
index 2aa0327cf..0b5e84da2 100644
--- a/src/Blocks/BlockEndPortalFrame.h
+++ b/src/Blocks/BlockEndPortalFrame.h
@@ -7,7 +7,7 @@
-class cBlockEndPortalFrameHandler:
+class cBlockEndPortalFrameHandler final :
public cMetaRotator<cBlockHandler, 0x03,
E_META_END_PORTAL_FRAME_ZM,
E_META_END_PORTAL_FRAME_XP,
diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h
index fe5835f9a..5620e9ade 100644
--- a/src/Blocks/BlockEnderchest.h
+++ b/src/Blocks/BlockEnderchest.h
@@ -6,7 +6,7 @@
-class cBlockEnderchestHandler :
+class cBlockEnderchestHandler final :
public cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>
{
using Super = cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>;
diff --git a/src/Blocks/BlockEntity.h b/src/Blocks/BlockEntity.h
index 4b9de1f12..c10f5d769 100644
--- a/src/Blocks/BlockEntity.h
+++ b/src/Blocks/BlockEntity.h
@@ -11,7 +11,7 @@
/** Wrapper for blocks that have a cBlockEntity descendant attached to them and can be "used" by the player.
Forwards the "use" event to the block entity. */
-class cBlockEntityHandler:
+class cBlockEntityHandler :
public cBlockHandler
{
using Super = cBlockHandler;
@@ -20,6 +20,10 @@ public:
using Super::Super;
+protected:
+
+ ~cBlockEntityHandler() = default;
+
private:
virtual bool OnUse(
@@ -34,12 +38,20 @@ private:
return a_ChunkInterface.UseBlockEntity(&a_Player, a_BlockPos.x, a_BlockPos.y, a_BlockPos.z);
}
-
-
-
-
virtual bool IsUseable() const override
{
return true;
}
};
+
+
+
+
+
+class cDefaultBlockEntityHandler final :
+ public cBlockEntityHandler
+{
+public:
+
+ using cBlockEntityHandler::cBlockEntityHandler;
+};
diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h
index 27ec7e89c..f7003a650 100644
--- a/src/Blocks/BlockFarmland.h
+++ b/src/Blocks/BlockFarmland.h
@@ -16,7 +16,7 @@
-class cBlockFarmlandHandler :
+class cBlockFarmlandHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockFence.h b/src/Blocks/BlockFence.h
index 13c4a6979..c6cad0198 100644
--- a/src/Blocks/BlockFence.h
+++ b/src/Blocks/BlockFence.h
@@ -10,7 +10,7 @@
-class cBlockFenceHandler:
+class cBlockFenceHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h
index 2f691790d..f52d8df9c 100644
--- a/src/Blocks/BlockFenceGate.h
+++ b/src/Blocks/BlockFenceGate.h
@@ -8,7 +8,7 @@
-class cBlockFenceGateHandler :
+class cBlockFenceGateHandler final :
public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x02, 0x03, 0x00, 0x01>>
{
using Super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x02, 0x03, 0x00, 0x01>>;
diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h
index 4227c67a0..280b24a03 100644
--- a/src/Blocks/BlockFire.h
+++ b/src/Blocks/BlockFire.h
@@ -7,7 +7,7 @@
-class cBlockFireHandler :
+class cBlockFireHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockFlower.h b/src/Blocks/BlockFlower.h
index b5bc6f957..590d00145 100644
--- a/src/Blocks/BlockFlower.h
+++ b/src/Blocks/BlockFlower.h
@@ -7,7 +7,7 @@
-class cBlockFlowerHandler:
+class cBlockFlowerHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockFlowerPot.h b/src/Blocks/BlockFlowerPot.h
index d5e37c243..6535894c4 100644
--- a/src/Blocks/BlockFlowerPot.h
+++ b/src/Blocks/BlockFlowerPot.h
@@ -5,7 +5,7 @@
-class cBlockFlowerPotHandler :
+class cBlockFlowerPotHandler final :
public cBlockEntityHandler
{
using Super = cBlockEntityHandler;
diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h
index 05a7c0d62..70aa57a0d 100644
--- a/src/Blocks/BlockFluid.h
+++ b/src/Blocks/BlockFluid.h
@@ -7,7 +7,7 @@
-class cBlockFluidHandler:
+class cBlockFluidHandler :
public cBlockHandler
{
using Super = cBlockHandler;
@@ -16,6 +16,10 @@ public:
using Super::Super;
+protected:
+
+ ~cBlockFluidHandler() = default;
+
private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
@@ -32,44 +36,13 @@ private:
{
return true;
}
-
-
-
-
-
- virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
- {
- UNUSED(a_Meta);
- if (IsBlockWater(m_BlockType))
- {
- return 12;
- }
- ASSERT(!"Unhandled blocktype in fluid/water handler!");
- return 0;
- }
-
-
-
-
-
- virtual bool CanSustainPlant(BLOCKTYPE a_Plant) const override
- {
- return (
- (a_Plant == E_BLOCK_BEETROOTS) ||
- (a_Plant == E_BLOCK_CROPS) ||
- (a_Plant == E_BLOCK_CARROTS) ||
- (a_Plant == E_BLOCK_POTATOES) ||
- (a_Plant == E_BLOCK_MELON_STEM) ||
- (a_Plant == E_BLOCK_PUMPKIN_STEM)
- );
- }
} ;
-class cBlockLavaHandler:
+class cBlockLavaHandler final :
public cBlockFluidHandler
{
using Super = cBlockFluidHandler;
@@ -173,3 +146,36 @@ private:
+
+class cBlockWaterHandler final :
+ public cBlockFluidHandler
+{
+public:
+
+ using cBlockFluidHandler::cBlockFluidHandler;
+
+private:
+
+ virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
+ {
+ UNUSED(a_Meta);
+ if (IsBlockWater(m_BlockType))
+ {
+ return 12;
+ }
+ ASSERT(!"Unhandled blocktype in fluid/water handler!");
+ return 0;
+ }
+
+ virtual bool CanSustainPlant(BLOCKTYPE a_Plant) const override
+ {
+ return (
+ (a_Plant == E_BLOCK_BEETROOTS) ||
+ (a_Plant == E_BLOCK_CROPS) ||
+ (a_Plant == E_BLOCK_CARROTS) ||
+ (a_Plant == E_BLOCK_POTATOES) ||
+ (a_Plant == E_BLOCK_MELON_STEM) ||
+ (a_Plant == E_BLOCK_PUMPKIN_STEM)
+ );
+ }
+};
diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h
index 2c88cfafd..f8b145d58 100644
--- a/src/Blocks/BlockFurnace.h
+++ b/src/Blocks/BlockFurnace.h
@@ -6,7 +6,7 @@
-class cBlockFurnaceHandler :
+class cBlockFurnaceHandler final :
public cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>
{
using Super = cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>;
diff --git a/src/Blocks/BlockGlass.h b/src/Blocks/BlockGlass.h
index 6dc82c1a5..c08265060 100644
--- a/src/Blocks/BlockGlass.h
+++ b/src/Blocks/BlockGlass.h
@@ -7,7 +7,7 @@
-class cBlockGlassHandler :
+class cBlockGlassHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockGlazedTerracotta.h b/src/Blocks/BlockGlazedTerracotta.h
new file mode 100644
index 000000000..0975f1ecd
--- /dev/null
+++ b/src/Blocks/BlockGlazedTerracotta.h
@@ -0,0 +1,18 @@
+
+#pragma once
+
+#include "Mixins.h"
+
+
+
+
+
+class cBlockGlazedTerracottaHandler final :
+ public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>
+{
+ using Super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>;
+
+public:
+
+ using Super::Super;
+};
diff --git a/src/Blocks/BlockGlowstone.h b/src/Blocks/BlockGlowstone.h
index 395233b44..e8670a71b 100644
--- a/src/Blocks/BlockGlowstone.h
+++ b/src/Blocks/BlockGlowstone.h
@@ -7,7 +7,7 @@
-class cBlockGlowstoneHandler :
+class cBlockGlowstoneHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockGrass.h b/src/Blocks/BlockGrass.h
index 4999ee27b..9d2e37899 100644
--- a/src/Blocks/BlockGrass.h
+++ b/src/Blocks/BlockGrass.h
@@ -10,7 +10,7 @@
-class cBlockGrassHandler :
+class cBlockGrassHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockGravel.h b/src/Blocks/BlockGravel.h
index 2e145f5e5..2561af094 100644
--- a/src/Blocks/BlockGravel.h
+++ b/src/Blocks/BlockGravel.h
@@ -7,7 +7,7 @@
-class cBlockGravelHandler :
+class cBlockGravelHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index a10c5e48d..8925449e6 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -5,6 +5,7 @@
#include "../World.h"
#include "../Chunk.h"
#include "BlockPluginInterface.h"
+#include "BlockAir.h"
#include "BlockAnvil.h"
#include "BlockBed.h"
#include "BlockBigFlower.h"
@@ -24,12 +25,13 @@
#include "BlockConcretePowder.h"
#include "BlockCrops.h"
#include "BlockDeadBush.h"
+#include "BlockDefaultBlock.h"
#include "BlockDirt.h"
#include "BlockDoor.h"
#include "BlockDropSpenser.h"
#include "BlockEnchantingTable.h"
-#include "BlockEnderchest.h"
#include "BlockEndPortalFrame.h"
+#include "BlockEnderchest.h"
#include "BlockEntity.h"
#include "BlockFarmland.h"
#include "BlockFence.h"
@@ -40,41 +42,38 @@
#include "BlockFluid.h"
#include "BlockFurnace.h"
#include "BlockGlass.h"
+#include "BlockGlazedTerracotta.h"
#include "BlockGlowstone.h"
#include "BlockGrass.h"
#include "BlockGravel.h"
-#include "BlockMobHead.h"
#include "BlockHopper.h"
#include "BlockIce.h"
#include "BlockJukebox.h"
#include "BlockLadder.h"
#include "BlockLeaves.h"
-#include "BlockLilypad.h"
#include "BlockLever.h"
+#include "BlockLilypad.h"
#include "BlockMelon.h"
+#include "BlockMobHead.h"
#include "BlockMobSpawner.h"
#include "BlockMushroom.h"
#include "BlockMycelium.h"
-#include "BlockNetherrack.h"
#include "BlockNetherWart.h"
+#include "BlockNetherrack.h"
#include "BlockObserver.h"
#include "BlockOre.h"
#include "BlockPackedIce.h"
#include "BlockPiston.h"
#include "BlockPlanks.h"
#include "BlockPortal.h"
-#include "BlockPumpkin.h"
#include "BlockPressurePlate.h"
+#include "BlockPumpkin.h"
#include "BlockQuartz.h"
#include "BlockRail.h"
#include "BlockRedstone.h"
#include "BlockRedstoneLamp.h"
#include "BlockRedstoneOre.h"
#include "BlockRedstoneRepeater.h"
-#include "BlockRedstoneTorch.h"
-#include "BlockTNT.h"
-#include "BlockTripwire.h"
-#include "BlockTripwireHook.h"
#include "BlockSand.h"
#include "BlockSapling.h"
#include "BlockSeaLantern.h"
@@ -88,9 +87,12 @@
#include "BlockStems.h"
#include "BlockStone.h"
#include "BlockSugarcane.h"
+#include "BlockTNT.h"
#include "BlockTallGrass.h"
#include "BlockTorch.h"
#include "BlockTrapdoor.h"
+#include "BlockTripwire.h"
+#include "BlockTripwireHook.h"
#include "BlockVine.h"
#include "BlockWallSign.h"
#include "BlockWorkbench.h"
@@ -99,12 +101,6 @@
-using cBlockGlazedTerracottaHandler = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>;
-
-
-
-
-
/*
// Tests the meta rotation and mirroring.
// Note that the cMetaRotator needs to have its assert paths disabled for this test to work!
@@ -200,12 +196,12 @@ namespace
constexpr cBlockStairsHandler BlockAcaciaWoodStairsHandler (E_BLOCK_ACACIA_WOOD_STAIRS);
constexpr cBlockRailHandler BlockActivatorRailHandler (E_BLOCK_ACTIVATOR_RAIL);
constexpr cBlockComparatorHandler BlockActiveComparatorHandler (E_BLOCK_ACTIVE_COMPARATOR);
- constexpr cBlockWithNoDrops<> BlockAirHandler (E_BLOCK_AIR);
+ constexpr cBlockAirHandler BlockAirHandler (E_BLOCK_AIR);
constexpr cBlockAnvilHandler BlockAnvilHandler (E_BLOCK_ANVIL);
- constexpr cBlockHandler BlockBarrierHandler (E_BLOCK_BARRIER);
- constexpr cBlockEntityHandler BlockBeaconHandler (E_BLOCK_BEACON);
+ constexpr cDefaultBlockHandler BlockBarrierHandler (E_BLOCK_BARRIER);
+ constexpr cDefaultBlockEntityHandler BlockBeaconHandler (E_BLOCK_BEACON);
constexpr cBlockBedHandler BlockBedHandler (E_BLOCK_BED);
- constexpr cBlockHandler BlockBedrockHandler (E_BLOCK_BEDROCK);
+ constexpr cDefaultBlockHandler BlockBedrockHandler (E_BLOCK_BEDROCK);
constexpr cBlockCropsHandler<3> BlockBeetrootsHandler (E_BLOCK_BEETROOTS); // 4 stages of growth
constexpr cBlockBigFlowerHandler BlockBigFlowerHandler (E_BLOCK_BIG_FLOWER);
constexpr cBlockDoorHandler BlockBirchDoorHandler (E_BLOCK_BIRCH_DOOR);
@@ -213,19 +209,19 @@ namespace
constexpr cBlockFenceHandler BlockBirchFenceHandler (E_BLOCK_BIRCH_FENCE);
constexpr cBlockStairsHandler BlockBirchWoodStairsHandler (E_BLOCK_BIRCH_WOOD_STAIRS);
constexpr cBlockGlazedTerracottaHandler BlockBlackGlazedTerracottaHandler (E_BLOCK_BLACK_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockBlackShulkerBoxHandler (E_BLOCK_BLACK_SHULKER_BOX);
- constexpr cBlockHandler BlockBlockOfCoalHandler (E_BLOCK_BLOCK_OF_COAL);
- constexpr cBlockHandler BlockBlockOfRedstoneHandler (E_BLOCK_BLOCK_OF_REDSTONE);
+ constexpr cDefaultBlockHandler BlockBlackShulkerBoxHandler (E_BLOCK_BLACK_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockBlockOfCoalHandler (E_BLOCK_BLOCK_OF_COAL);
+ constexpr cDefaultBlockHandler BlockBlockOfRedstoneHandler (E_BLOCK_BLOCK_OF_REDSTONE);
constexpr cBlockGlazedTerracottaHandler BlockBlueGlazedTerracottaHandler (E_BLOCK_BLUE_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockBlueShulkerBoxHandler (E_BLOCK_BLUE_SHULKER_BOX);
- constexpr cBlockHandler BlockBoneBlockHandler (E_BLOCK_BONE_BLOCK);
+ constexpr cDefaultBlockHandler BlockBlueShulkerBoxHandler (E_BLOCK_BLUE_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockBoneBlockHandler (E_BLOCK_BONE_BLOCK);
constexpr cBlockBookShelfHandler BlockBookcaseHandler (E_BLOCK_BOOKCASE);
constexpr cBlockBrewingStandHandler BlockBrewingStandHandler (E_BLOCK_BREWING_STAND);
- constexpr cBlockHandler BlockBrickHandler (E_BLOCK_BRICK);
+ constexpr cDefaultBlockHandler BlockBrickHandler (E_BLOCK_BRICK);
constexpr cBlockStairsHandler BlockBrickStairsHandler (E_BLOCK_BRICK_STAIRS);
constexpr cBlockGlazedTerracottaHandler BlockBrownGlazedTerracottaHandler (E_BLOCK_BROWN_GLAZED_TERRACOTTA);
constexpr cBlockMushroomHandler BlockBrownMushroomHandler (E_BLOCK_BROWN_MUSHROOM);
- constexpr cBlockHandler BlockBrownShulkerBoxHandler (E_BLOCK_BROWN_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockBrownShulkerBoxHandler (E_BLOCK_BROWN_SHULKER_BOX);
constexpr cBlockCactusHandler BlockCactusHandler (E_BLOCK_CACTUS);
constexpr cBlockCakeHandler BlockCakeHandler (E_BLOCK_CAKE);
constexpr cBlockCarpetHandler BlockCarpetHandler (E_BLOCK_CARPET);
@@ -233,46 +229,46 @@ namespace
constexpr cBlockCauldronHandler BlockCauldronHandler (E_BLOCK_CAULDRON);
constexpr cBlockCommandBlockHandler BlockChainCommandBlockHandler (E_BLOCK_CHAIN_COMMAND_BLOCK);
constexpr cBlockChestHandler BlockChestHandler (E_BLOCK_CHEST);
- constexpr cBlockHandler BlockChorusFlowerHandler (E_BLOCK_CHORUS_FLOWER);
- constexpr cBlockHandler BlockChorusPlantHandler (E_BLOCK_CHORUS_PLANT);
- constexpr cBlockOreHandler BlockClayHandler (E_BLOCK_CLAY);
- constexpr cBlockOreHandler BlockCoalOreHandler (E_BLOCK_COAL_ORE);
+ constexpr cDefaultBlockHandler BlockChorusFlowerHandler (E_BLOCK_CHORUS_FLOWER);
+ constexpr cDefaultBlockHandler BlockChorusPlantHandler (E_BLOCK_CHORUS_PLANT);
+ constexpr cDefaultOreHandler BlockClayHandler (E_BLOCK_CLAY);
+ constexpr cDefaultOreHandler BlockCoalOreHandler (E_BLOCK_COAL_ORE);
constexpr cBlockStoneHandler BlockCobblestoneHandler (E_BLOCK_COBBLESTONE);
constexpr cBlockStairsHandler BlockCobblestoneStairsHandler (E_BLOCK_COBBLESTONE_STAIRS);
- constexpr cBlockHandler BlockCobblestoneWallHandler (E_BLOCK_COBBLESTONE_WALL);
+ constexpr cDefaultBlockHandler BlockCobblestoneWallHandler (E_BLOCK_COBBLESTONE_WALL);
constexpr cBlockCobWebHandler BlockCobwebHandler (E_BLOCK_COBWEB);
constexpr cBlockCocoaPodHandler BlockCocoaPodHandler (E_BLOCK_COCOA_POD);
constexpr cBlockCommandBlockHandler BlockCommandBlockHandler (E_BLOCK_COMMAND_BLOCK);
- constexpr cBlockHandler BlockConcreteHandler (E_BLOCK_CONCRETE);
+ constexpr cDefaultBlockHandler BlockConcreteHandler (E_BLOCK_CONCRETE);
constexpr cBlockConcretePowderHandler BlockConcretePowderHandler (E_BLOCK_CONCRETE_POWDER);
constexpr cBlockCropsHandler<7> BlockCropsHandler (E_BLOCK_CROPS); // 8 stages of growth
constexpr cBlockGlazedTerracottaHandler BlockCyanGlazedTerracottaHandler (E_BLOCK_CYAN_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockCyanShulkerBoxHandler (E_BLOCK_CYAN_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockCyanShulkerBoxHandler (E_BLOCK_CYAN_SHULKER_BOX);
constexpr cBlockDoorHandler BlockDarkOakDoorHandler (E_BLOCK_DARK_OAK_DOOR);
constexpr cBlockFenceGateHandler BlockDarkOakFenceGateHandler (E_BLOCK_DARK_OAK_FENCE_GATE);
constexpr cBlockFenceHandler BlockDarkOakFenceHandler (E_BLOCK_DARK_OAK_FENCE);
constexpr cBlockStairsHandler BlockDarkOakWoodStairsHandler (E_BLOCK_DARK_OAK_WOOD_STAIRS);
- constexpr cBlockHandler BlockDaylightSensorHandler (E_BLOCK_DAYLIGHT_SENSOR);
+ constexpr cDefaultBlockHandler BlockDaylightSensorHandler (E_BLOCK_DAYLIGHT_SENSOR);
constexpr cBlockDeadBushHandler BlockDeadBushHandler (E_BLOCK_DEAD_BUSH);
constexpr cBlockRailHandler BlockDetectorRailHandler (E_BLOCK_DETECTOR_RAIL);
- constexpr cBlockHandler BlockDiamondBlockHandler (E_BLOCK_DIAMOND_BLOCK);
- constexpr cBlockOreHandler BlockDiamondOreHandler (E_BLOCK_DIAMOND_ORE);
+ constexpr cDefaultBlockHandler BlockDiamondBlockHandler (E_BLOCK_DIAMOND_BLOCK);
+ constexpr cDefaultOreHandler BlockDiamondOreHandler (E_BLOCK_DIAMOND_ORE);
constexpr cBlockDirtHandler BlockDirtHandler (E_BLOCK_DIRT);
constexpr cBlockDropSpenserHandler BlockDispenserHandler (E_BLOCK_DISPENSER);
constexpr cBlockDoubleSlabHandler BlockDoubleRedSandstoneSlabHandler(E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB);
constexpr cBlockDoubleSlabHandler BlockDoubleStoneSlabHandler (E_BLOCK_DOUBLE_STONE_SLAB);
constexpr cBlockDoubleSlabHandler BlockDoubleWoodenSlabHandler (E_BLOCK_DOUBLE_WOODEN_SLAB);
- constexpr cBlockHandler BlockDragonEggHandler (E_BLOCK_DRAGON_EGG);
+ constexpr cDefaultBlockHandler BlockDragonEggHandler (E_BLOCK_DRAGON_EGG);
constexpr cBlockDropSpenserHandler BlockDropperHandler (E_BLOCK_DROPPER);
- constexpr cBlockHandler BlockEmeraldBlockHandler (E_BLOCK_EMERALD_BLOCK);
- constexpr cBlockOreHandler BlockEmeraldOreHandler (E_BLOCK_EMERALD_ORE);
+ constexpr cDefaultBlockHandler BlockEmeraldBlockHandler (E_BLOCK_EMERALD_BLOCK);
+ constexpr cDefaultOreHandler BlockEmeraldOreHandler (E_BLOCK_EMERALD_ORE);
constexpr cBlockEnchantingTableHandler BlockEnchantingTableHandler (E_BLOCK_ENCHANTMENT_TABLE);
- constexpr cBlockHandler BlockEndBricksHandler (E_BLOCK_END_BRICKS);
- constexpr cBlockHandler BlockEndGatewayHandler (E_BLOCK_END_GATEWAY);
+ constexpr cDefaultBlockHandler BlockEndBricksHandler (E_BLOCK_END_BRICKS);
+ constexpr cDefaultBlockHandler BlockEndGatewayHandler (E_BLOCK_END_GATEWAY);
constexpr cBlockEndPortalFrameHandler BlockEndPortalFrameHandler (E_BLOCK_END_PORTAL_FRAME);
- constexpr cBlockHandler BlockEndPortalHandler (E_BLOCK_END_PORTAL);
- constexpr cBlockHandler BlockEndRodHandler (E_BLOCK_END_ROD);
- constexpr cBlockHandler BlockEndStoneHandler (E_BLOCK_END_STONE);
+ constexpr cDefaultBlockHandler BlockEndPortalHandler (E_BLOCK_END_PORTAL);
+ constexpr cDefaultBlockHandler BlockEndRodHandler (E_BLOCK_END_ROD);
+ constexpr cDefaultBlockHandler BlockEndStoneHandler (E_BLOCK_END_STONE);
constexpr cBlockEnderchestHandler BlockEnderChestHandler (E_BLOCK_ENDER_CHEST);
constexpr cBlockFarmlandHandler BlockFarmlandHandler (E_BLOCK_FARMLAND);
constexpr cBlockFenceHandler BlockFenceHandler (E_BLOCK_FENCE);
@@ -283,29 +279,29 @@ namespace
constexpr cBlockGlassHandler BlockGlassHandler (E_BLOCK_GLASS);
constexpr cBlockGlassHandler BlockGlassPaneHandler (E_BLOCK_GLASS_PANE);
constexpr cBlockGlowstoneHandler BlockGlowstoneHandler (E_BLOCK_GLOWSTONE);
- constexpr cBlockHandler BlockGoldBlockHandler (E_BLOCK_GOLD_BLOCK);
- constexpr cBlockOreHandler BlockGoldOreHandler (E_BLOCK_GOLD_ORE);
+ constexpr cDefaultBlockHandler BlockGoldBlockHandler (E_BLOCK_GOLD_BLOCK);
+ constexpr cDefaultOreHandler BlockGoldOreHandler (E_BLOCK_GOLD_ORE);
constexpr cBlockGrassHandler BlockGrassHandler (E_BLOCK_GRASS);
- constexpr cBlockHandler BlockGrassPathHandler (E_BLOCK_GRASS_PATH);
+ constexpr cDefaultBlockHandler BlockGrassPathHandler (E_BLOCK_GRASS_PATH);
constexpr cBlockGravelHandler BlockGravelHandler (E_BLOCK_GRAVEL);
constexpr cBlockGlazedTerracottaHandler BlockGrayGlazedTerracottaHandler (E_BLOCK_GRAY_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockGrayShulkerBoxHandler (E_BLOCK_GRAY_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockGrayShulkerBoxHandler (E_BLOCK_GRAY_SHULKER_BOX);
constexpr cBlockGlazedTerracottaHandler BlockGreenGlazedTerracottaHandler (E_BLOCK_GREEN_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockGreenShulkerBoxHandler (E_BLOCK_GREEN_SHULKER_BOX);
- constexpr cBlockHandler BlockHardenedClayHandler (E_BLOCK_HARDENED_CLAY);
+ constexpr cDefaultBlockHandler BlockGreenShulkerBoxHandler (E_BLOCK_GREEN_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockHardenedClayHandler (E_BLOCK_HARDENED_CLAY);
constexpr cBlockSidewaysHandler BlockHayBaleHandler (E_BLOCK_HAY_BALE);
constexpr cBlockMobHeadHandler BlockHeadHandler (E_BLOCK_HEAD);
constexpr cBlockPressurePlateHandler BlockHeavyWeightedPressurePHandler(E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE);
constexpr cBlockHopperHandler BlockHopperHandler (E_BLOCK_HOPPER);
- constexpr cBlockHandler BlockHugeBrownMushroomHandler (E_BLOCK_HUGE_BROWN_MUSHROOM);
- constexpr cBlockHandler BlockHugeRedMushroomHandler (E_BLOCK_HUGE_RED_MUSHROOM);
+ constexpr cDefaultBlockHandler BlockHugeBrownMushroomHandler (E_BLOCK_HUGE_BROWN_MUSHROOM);
+ constexpr cDefaultBlockHandler BlockHugeRedMushroomHandler (E_BLOCK_HUGE_RED_MUSHROOM);
constexpr cBlockIceHandler BlockIceHandler (E_BLOCK_ICE);
constexpr cBlockComparatorHandler BlockInactiveComparatorHandler (E_BLOCK_INACTIVE_COMPARATOR);
- constexpr cBlockHandler BlockInfestedBlockHandler (E_BLOCK_SILVERFISH_EGG);
- constexpr cBlockHandler BlockIronBarsHandler (E_BLOCK_IRON_BARS);
- constexpr cBlockHandler BlockIronBlockHandler (E_BLOCK_IRON_BLOCK);
+ constexpr cDefaultBlockHandler BlockInfestedBlockHandler (E_BLOCK_SILVERFISH_EGG);
+ constexpr cDefaultBlockHandler BlockIronBarsHandler (E_BLOCK_IRON_BARS);
+ constexpr cDefaultBlockHandler BlockIronBlockHandler (E_BLOCK_IRON_BLOCK);
constexpr cBlockDoorHandler BlockIronDoorHandler (E_BLOCK_IRON_DOOR);
- constexpr cBlockOreHandler BlockIronOreHandler (E_BLOCK_IRON_ORE);
+ constexpr cDefaultOreHandler BlockIronOreHandler (E_BLOCK_IRON_ORE);
constexpr cBlockTrapdoorHandler BlockIronTrapdoorHandler (E_BLOCK_IRON_TRAPDOOR);
constexpr cBlockPumpkinHandler BlockJackOLanternHandler (E_BLOCK_JACK_O_LANTERN);
constexpr cBlockJukeboxHandler BlockJukeboxHandler (E_BLOCK_JUKEBOX);
@@ -314,64 +310,64 @@ namespace
constexpr cBlockFenceHandler BlockJungleFenceHandler (E_BLOCK_JUNGLE_FENCE);
constexpr cBlockStairsHandler BlockJungleWoodStairsHandler (E_BLOCK_JUNGLE_WOOD_STAIRS);
constexpr cBlockLadderHandler BlockLadderHandler (E_BLOCK_LADDER);
- constexpr cBlockHandler BlockLapisBlockHandler (E_BLOCK_LAPIS_BLOCK);
- constexpr cBlockOreHandler BlockLapisOreHandler (E_BLOCK_LAPIS_ORE);
+ constexpr cDefaultBlockHandler BlockLapisBlockHandler (E_BLOCK_LAPIS_BLOCK);
+ constexpr cDefaultOreHandler BlockLapisOreHandler (E_BLOCK_LAPIS_ORE);
constexpr cBlockLavaHandler BlockLavaHandler (E_BLOCK_LAVA);
constexpr cBlockLeavesHandler BlockLeavesHandler (E_BLOCK_LEAVES);
constexpr cBlockLeverHandler BlockLeverHandler (E_BLOCK_LEVER);
constexpr cBlockGlazedTerracottaHandler BlockLightBlueGlazedTerracoHandler(E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockLightBlueShulkerBoxHandler (E_BLOCK_LIGHT_BLUE_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockLightBlueShulkerBoxHandler (E_BLOCK_LIGHT_BLUE_SHULKER_BOX);
constexpr cBlockGlazedTerracottaHandler BlockLightGrayGlazedTerracoHandler(E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockLightGrayShulkerBoxHandler (E_BLOCK_LIGHT_GRAY_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockLightGrayShulkerBoxHandler (E_BLOCK_LIGHT_GRAY_SHULKER_BOX);
constexpr cBlockPressurePlateHandler BlockLightWeightedPressurePHandler(E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE);
constexpr cBlockLilypadHandler BlockLilyPadHandler (E_BLOCK_LILY_PAD);
constexpr cBlockGlazedTerracottaHandler BlockLimeGlazedTerracottaHandler (E_BLOCK_LIME_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockLimeShulkerBoxHandler (E_BLOCK_LIME_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockLimeShulkerBoxHandler (E_BLOCK_LIME_SHULKER_BOX);
constexpr cBlockFurnaceHandler BlockLitFurnaceHandler (E_BLOCK_LIT_FURNACE);
constexpr cBlockSidewaysHandler BlockLogHandler (E_BLOCK_LOG);
constexpr cBlockGlazedTerracottaHandler BlockMagentaGlazedTerracottHandler(E_BLOCK_MAGENTA_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockMagentaShulkerBoxHandler (E_BLOCK_MAGENTA_SHULKER_BOX);
- constexpr cBlockHandler BlockMagmaHandler (E_BLOCK_MAGMA);
+ constexpr cDefaultBlockHandler BlockMagentaShulkerBoxHandler (E_BLOCK_MAGENTA_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockMagmaHandler (E_BLOCK_MAGMA);
constexpr cBlockMelonHandler BlockMelonHandler (E_BLOCK_MELON);
constexpr cBlockMelonStemHandler BlockMelonStemHandler (E_BLOCK_MELON_STEM);
constexpr cBlockMobSpawnerHandler BlockMobSpawnerHandler (E_BLOCK_MOB_SPAWNER);
- constexpr cBlockHandler BlockMossyCobblestoneHandler (E_BLOCK_MOSSY_COBBLESTONE);
+ constexpr cDefaultBlockHandler BlockMossyCobblestoneHandler (E_BLOCK_MOSSY_COBBLESTONE);
constexpr cBlockMyceliumHandler BlockMyceliumHandler (E_BLOCK_MYCELIUM);
constexpr cBlockFenceHandler BlockNetherBrickFenceHandler (E_BLOCK_NETHER_BRICK_FENCE);
- constexpr cBlockHandler BlockNetherBrickHandler (E_BLOCK_NETHER_BRICK);
+ constexpr cDefaultBlockHandler BlockNetherBrickHandler (E_BLOCK_NETHER_BRICK);
constexpr cBlockStairsHandler BlockNetherBrickStairsHandler (E_BLOCK_NETHER_BRICK_STAIRS);
constexpr cBlockPortalHandler BlockNetherPortalHandler (E_BLOCK_NETHER_PORTAL);
- constexpr cBlockOreHandler BlockNetherQuartzOreHandler (E_BLOCK_NETHER_QUARTZ_ORE);
- constexpr cBlockHandler BlockNetherWartBlockHandler (E_BLOCK_NETHER_WART_BLOCK);
+ constexpr cDefaultOreHandler BlockNetherQuartzOreHandler (E_BLOCK_NETHER_QUARTZ_ORE);
+ constexpr cDefaultBlockHandler BlockNetherWartBlockHandler (E_BLOCK_NETHER_WART_BLOCK);
constexpr cBlockNetherWartHandler BlockNetherWartHandler (E_BLOCK_NETHER_WART);
constexpr cBlockNetherrack BlockNetherrackHandler (E_BLOCK_NETHERRACK);
constexpr cBlockLeavesHandler BlockNewLeavesHandler (E_BLOCK_NEW_LEAVES);
constexpr cBlockSidewaysHandler BlockNewLogHandler (E_BLOCK_NEW_LOG);
- constexpr cBlockEntityHandler BlockNoteBlockHandler (E_BLOCK_NOTE_BLOCK);
+ constexpr cDefaultBlockEntityHandler BlockNoteBlockHandler (E_BLOCK_NOTE_BLOCK);
constexpr cBlockDoorHandler BlockOakDoorHandler (E_BLOCK_OAK_DOOR);
constexpr cBlockFenceGateHandler BlockOakFenceGateHandler (E_BLOCK_OAK_FENCE_GATE);
constexpr cBlockStairsHandler BlockOakWoodStairsHandler (E_BLOCK_OAK_WOOD_STAIRS);
constexpr cBlockObserverHandler BlockObserverHandler (E_BLOCK_OBSERVER);
- constexpr cBlockHandler BlockObsidianHandler (E_BLOCK_OBSIDIAN);
+ constexpr cDefaultBlockHandler BlockObsidianHandler (E_BLOCK_OBSIDIAN);
constexpr cBlockGlazedTerracottaHandler BlockOrangeGlazedTerracottaHandler(E_BLOCK_ORANGE_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockOrangeShulkerBoxHandler (E_BLOCK_ORANGE_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockOrangeShulkerBoxHandler (E_BLOCK_ORANGE_SHULKER_BOX);
constexpr cBlockPackedIceHandler BlockPackedIceHandler (E_BLOCK_PACKED_ICE);
constexpr cBlockGlazedTerracottaHandler BlockPinkGlazedTerracottaHandler (E_BLOCK_PINK_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockPinkShulkerBoxHandler (E_BLOCK_PINK_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockPinkShulkerBoxHandler (E_BLOCK_PINK_SHULKER_BOX);
constexpr cBlockPistonHandler BlockPistonHandler (E_BLOCK_PISTON);
constexpr cBlockPistonHeadHandler BlockPistonHeadHandler;
- constexpr cBlockHandler BlockPistonMovedBlockHandler (E_BLOCK_PISTON_MOVED_BLOCK);
+ constexpr cDefaultBlockHandler BlockPistonMovedBlockHandler (E_BLOCK_PISTON_MOVED_BLOCK);
constexpr cBlockPlanksHandler BlockPlanksHandler (E_BLOCK_PLANKS);
constexpr cBlockCropsHandler<7> BlockPotatoesHandler (E_BLOCK_POTATOES); // 8 stages of growth
constexpr cBlockRailHandler BlockPoweredRailHandler (E_BLOCK_POWERED_RAIL);
- constexpr cBlockHandler BlockPrismarineBlockHandler (E_BLOCK_PRISMARINE_BLOCK);
+ constexpr cDefaultBlockHandler BlockPrismarineBlockHandler (E_BLOCK_PRISMARINE_BLOCK);
constexpr cBlockPumpkinHandler BlockPumpkinHandler (E_BLOCK_PUMPKIN);
constexpr cBlockPumpkinStemHandler BlockPumpkinStemHandler (E_BLOCK_PUMPKIN_STEM);
constexpr cBlockGlazedTerracottaHandler BlockPurpleGlazedTerracottaHandler(E_BLOCK_PURPLE_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockPurpleShulkerBoxHandler (E_BLOCK_PURPLE_SHULKER_BOX);
- constexpr cBlockHandler BlockPurpurBlockHandler (E_BLOCK_PURPUR_BLOCK);
+ constexpr cDefaultBlockHandler BlockPurpleShulkerBoxHandler (E_BLOCK_PURPLE_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockPurpurBlockHandler (E_BLOCK_PURPUR_BLOCK);
constexpr cBlockDoubleSlabHandler BlockPurpurDoubleSlabHandler (E_BLOCK_PURPUR_DOUBLE_SLAB);
- constexpr cBlockHandler BlockPurpurPillarHandler (E_BLOCK_PURPUR_PILLAR);
+ constexpr cDefaultBlockHandler BlockPurpurPillarHandler (E_BLOCK_PURPUR_PILLAR);
constexpr cBlockSlabHandler BlockPurpurSlabHandler (E_BLOCK_PURPUR_SLAB);
constexpr cBlockStairsHandler BlockPurpurStairsHandler (E_BLOCK_PURPUR_STAIRS);
constexpr cBlockQuartzHandler BlockQuartzBlockHandler (E_BLOCK_QUARTZ_BLOCK);
@@ -379,12 +375,12 @@ namespace
constexpr cBlockRailHandler BlockRailHandler (E_BLOCK_RAIL);
constexpr cBlockGlazedTerracottaHandler BlockRedGlazedTerracottaHandler (E_BLOCK_RED_GLAZED_TERRACOTTA);
constexpr cBlockMushroomHandler BlockRedMushroomHandler (E_BLOCK_RED_MUSHROOM);
- constexpr cBlockHandler BlockRedNetherBrickHandler (E_BLOCK_RED_NETHER_BRICK);
+ constexpr cDefaultBlockHandler BlockRedNetherBrickHandler (E_BLOCK_RED_NETHER_BRICK);
constexpr cBlockFlowerHandler BlockRedRoseHandler (E_BLOCK_RED_ROSE);
- constexpr cBlockHandler BlockRedSandstoneHandler (E_BLOCK_RED_SANDSTONE);
+ constexpr cDefaultBlockHandler BlockRedSandstoneHandler (E_BLOCK_RED_SANDSTONE);
constexpr cBlockSlabHandler BlockRedSandstoneSlabHandler (E_BLOCK_RED_SANDSTONE_SLAB);
constexpr cBlockStairsHandler BlockRedSandstoneStairsHandler (E_BLOCK_RED_SANDSTONE_STAIRS);
- constexpr cBlockHandler BlockRedShulkerBoxHandler (E_BLOCK_RED_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockRedShulkerBoxHandler (E_BLOCK_RED_SHULKER_BOX);
constexpr cBlockRedstoneLampHandler BlockRedstoneLampHandler (E_BLOCK_REDSTONE_LAMP_ON);
constexpr cBlockGlowingRedstoneOreHandler BlockRedstoneOreGlowingHandler (E_BLOCK_REDSTONE_ORE_GLOWING);
constexpr cBlockRedstoneOreHandler BlockRedstoneOreHandler (E_BLOCK_REDSTONE_ORE);
@@ -395,35 +391,35 @@ namespace
constexpr cBlockRedstoneHandler BlockRedstoneWireHandler (E_BLOCK_REDSTONE_WIRE);
constexpr cBlockCommandBlockHandler BlockRepeatingCommandBlockHandler (E_BLOCK_REPEATING_COMMAND_BLOCK);
constexpr cBlockSandHandler BlockSandHandler (E_BLOCK_SAND);
- constexpr cBlockHandler BlockSandstoneHandler (E_BLOCK_SANDSTONE);
+ constexpr cDefaultBlockHandler BlockSandstoneHandler (E_BLOCK_SANDSTONE);
constexpr cBlockStairsHandler BlockSandstoneStairsHandler (E_BLOCK_SANDSTONE_STAIRS);
constexpr cBlockSaplingHandler BlockSaplingHandler (E_BLOCK_SAPLING);
constexpr cBlockSeaLanternHandler BlockSeaLanternHandler (E_BLOCK_SEA_LANTERN);
constexpr cBlockSignPostHandler BlockSignPostHandler (E_BLOCK_SIGN_POST);
constexpr cBlockSlimeHandler BlockSlimeBlockHandler (E_BLOCK_SLIME_BLOCK);
- constexpr cBlockHandler BlockSnowBlockHandler (E_BLOCK_SNOW_BLOCK);
+ constexpr cDefaultBlockHandler BlockSnowBlockHandler (E_BLOCK_SNOW_BLOCK);
constexpr cBlockSnowHandler BlockSnowHandler (E_BLOCK_SNOW);
- constexpr cBlockHandler BlockSoulSandHandler (E_BLOCK_SOULSAND);
+ constexpr cDefaultBlockHandler BlockSoulSandHandler (E_BLOCK_SOULSAND);
constexpr cBlockSpongeHandler BlockSpongeHandler (E_BLOCK_SPONGE);
constexpr cBlockDoorHandler BlockSpruceDoorHandler (E_BLOCK_SPRUCE_DOOR);
constexpr cBlockFenceGateHandler BlockSpruceFenceGateHandler (E_BLOCK_SPRUCE_FENCE_GATE);
constexpr cBlockFenceHandler BlockSpruceFenceHandler (E_BLOCK_SPRUCE_FENCE);
constexpr cBlockStairsHandler BlockSpruceWoodStairsHandler (E_BLOCK_SPRUCE_WOOD_STAIRS);
- constexpr cBlockHandler BlockStainedClayHandler (E_BLOCK_STAINED_CLAY);
+ constexpr cDefaultBlockHandler BlockStainedClayHandler (E_BLOCK_STAINED_CLAY);
constexpr cBlockGlassHandler BlockStainedGlassHandler (E_BLOCK_STAINED_GLASS);
constexpr cBlockGlassHandler BlockStainedGlassPaneHandler (E_BLOCK_STAINED_GLASS_PANE);
- constexpr cBlockHandler BlockStandingBannerHandler (E_BLOCK_STANDING_BANNER); // TODO: drops correct?
+ constexpr cDefaultBlockHandler BlockStandingBannerHandler (E_BLOCK_STANDING_BANNER); // TODO: drops correct?
constexpr cBlockLavaHandler BlockStationaryLavaHandler (E_BLOCK_STATIONARY_LAVA);
- constexpr cBlockFluidHandler BlockStationaryWaterHandler (E_BLOCK_STATIONARY_WATER);
+ constexpr cBlockWaterHandler BlockStationaryWaterHandler (E_BLOCK_STATIONARY_WATER);
constexpr cBlockPistonHandler BlockStickyPistonHandler (E_BLOCK_STICKY_PISTON);
constexpr cBlockStairsHandler BlockStoneBrickStairsHandler (E_BLOCK_STONE_BRICK_STAIRS);
- constexpr cBlockHandler BlockStoneBricksHandler (E_BLOCK_STONE_BRICKS);
+ constexpr cDefaultBlockHandler BlockStoneBricksHandler (E_BLOCK_STONE_BRICKS);
constexpr cBlockButtonHandler BlockStoneButtonHandler (E_BLOCK_STONE_BUTTON);
constexpr cBlockStoneHandler BlockStoneHandler (E_BLOCK_STONE);
constexpr cBlockPressurePlateHandler BlockStonePressurePlateHandler (E_BLOCK_STONE_PRESSURE_PLATE);
constexpr cBlockSlabHandler BlockStoneSlabHandler (E_BLOCK_STONE_SLAB);
- constexpr cBlockHandler BlockStructureBlockHandler (E_BLOCK_STRUCTURE_BLOCK);
- constexpr cBlockHandler BlockStructureVoidHandler (E_BLOCK_STRUCTURE_VOID);
+ constexpr cDefaultBlockHandler BlockStructureBlockHandler (E_BLOCK_STRUCTURE_BLOCK);
+ constexpr cDefaultBlockHandler BlockStructureVoidHandler (E_BLOCK_STRUCTURE_VOID);
constexpr cBlockSugarcaneHandler BlockSugarcaneHandler (E_BLOCK_SUGARCANE);
constexpr cBlockTallGrassHandler BlockTallGrassHandler (E_BLOCK_TALL_GRASS);
constexpr cBlockTNTHandler BlockTntHandler (E_BLOCK_TNT);
@@ -433,11 +429,11 @@ namespace
constexpr cBlockTripwireHandler BlockTripwireHandler (E_BLOCK_TRIPWIRE);
constexpr cBlockTripwireHookHandler BlockTripwireHookHandler (E_BLOCK_TRIPWIRE_HOOK);
constexpr cBlockVineHandler BlockVinesHandler (E_BLOCK_VINES);
- constexpr cBlockHandler BlockWallBannerHandler (E_BLOCK_WALL_BANNER); // TODO: drops correct?
+ constexpr cDefaultBlockHandler BlockWallBannerHandler (E_BLOCK_WALL_BANNER); // TODO: drops correct?
constexpr cBlockWallSignHandler BlockWallsignHandler (E_BLOCK_WALLSIGN);
- constexpr cBlockFluidHandler BlockWaterHandler (E_BLOCK_WATER);
+ constexpr cBlockWaterHandler BlockWaterHandler (E_BLOCK_WATER);
constexpr cBlockGlazedTerracottaHandler BlockWhiteGlazedTerracottaHandler (E_BLOCK_WHITE_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockWhiteShulkerBoxHandler (E_BLOCK_WHITE_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockWhiteShulkerBoxHandler (E_BLOCK_WHITE_SHULKER_BOX);
constexpr cBlockButtonHandler BlockWoodenButtonHandler (E_BLOCK_WOODEN_BUTTON);
constexpr cBlockPressurePlateHandler BlockWoodenPressurePlateHandler (E_BLOCK_WOODEN_PRESSURE_PLATE);
constexpr cBlockSlabHandler BlockWoodenSlabHandler (E_BLOCK_WOODEN_SLAB);
@@ -445,7 +441,7 @@ namespace
constexpr cBlockWorkbenchHandler BlockWorkbenchHandler (E_BLOCK_WORKBENCH);
constexpr cBlockFlowerHandler BlockYellowFlowerHandler (E_BLOCK_YELLOW_FLOWER);
constexpr cBlockGlazedTerracottaHandler BlockYellowGlazedTerracottaHandler(E_BLOCK_YELLOW_GLAZED_TERRACOTTA);
- constexpr cBlockHandler BlockYellowShulkerBoxHandler (E_BLOCK_YELLOW_SHULKER_BOX);
+ constexpr cDefaultBlockHandler BlockYellowShulkerBoxHandler (E_BLOCK_YELLOW_SHULKER_BOX);
}
@@ -647,7 +643,7 @@ unsigned char cBlockHandler::ToolFortuneLevel(const cItem * a_Tool)
if ((a_Tool != nullptr) && ItemCategory::IsTool(a_Tool->m_ItemType))
{
// Return enchantment level, limited to avoid spawning excessive pickups (crashing the server) when modified items are used:
- return std::min(8U, a_Tool->m_Enchantments.GetLevel(cEnchantments::enchFortune));
+ return static_cast<unsigned char>(std::min(8U, a_Tool->m_Enchantments.GetLevel(cEnchantments::enchFortune)));
}
// Not a tool:
diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h
index cc701ca8e..13c3a84af 100644
--- a/src/Blocks/BlockHandler.h
+++ b/src/Blocks/BlockHandler.h
@@ -66,12 +66,12 @@ public:
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface,
Vector3i a_BlockPos,
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
- ) const {};
+ ) const {}
/** Called by cPlayer::PlaceBlocks() for each block after it has been set to the world. Called after OnPlaced(). */
virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, const sSetBlock & a_BlockChange
- ) const {};
+ ) const {}
/** Called just after the player breaks the block.
The block is already dug up in the world, the original block type and meta is passed in a_OldBlockType and a_OldBlockMeta.
@@ -91,7 +91,7 @@ public:
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface,
Vector3i a_BlockPos,
BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta
- ) const {};
+ ) const {}
/** Called when a direct neighbor of this block has been changed.
The position is the block's own position, NOT the changed neighbor's position.
@@ -241,5 +241,7 @@ public:
protected:
- BLOCKTYPE m_BlockType;
+ ~cBlockHandler() = default;
+
+ const BLOCKTYPE m_BlockType;
};
diff --git a/src/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h
index 7380b8d34..915a8d8d5 100644
--- a/src/Blocks/BlockHopper.h
+++ b/src/Blocks/BlockHopper.h
@@ -7,7 +7,7 @@
-class cBlockHopperHandler :
+class cBlockHopperHandler final :
public cPitchYawRotator<cClearMetaOnDrop<cBlockEntityHandler>>
{
using Super = cPitchYawRotator<cClearMetaOnDrop<cBlockEntityHandler>>;
diff --git a/src/Blocks/BlockIce.h b/src/Blocks/BlockIce.h
index 12505b3fd..c61abef57 100644
--- a/src/Blocks/BlockIce.h
+++ b/src/Blocks/BlockIce.h
@@ -7,7 +7,7 @@
-class cBlockIceHandler :
+class cBlockIceHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
@@ -54,7 +54,7 @@ private:
}
};
- for (const auto Offset : Adjacents)
+ for (const auto & Offset : Adjacents)
{
auto Position = a_RelPos + Offset;
const auto Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(Position);
diff --git a/src/Blocks/BlockJukebox.h b/src/Blocks/BlockJukebox.h
index c2c9bda63..970f10fc1 100644
--- a/src/Blocks/BlockJukebox.h
+++ b/src/Blocks/BlockJukebox.h
@@ -8,7 +8,7 @@
-class cBlockJukeboxHandler :
+class cBlockJukeboxHandler final :
public cClearMetaOnDrop<cBlockEntityHandler>
{
public:
diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h
index 59c13a406..b4e8294b6 100644
--- a/src/Blocks/BlockLadder.h
+++ b/src/Blocks/BlockLadder.h
@@ -8,7 +8,7 @@
-class cBlockLadderHandler:
+class cBlockLadderHandler final :
public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> >
{
using Super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04>>;
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 1f726f779..f50f6abc5 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -14,7 +14,7 @@
-class cBlockLeavesHandler:
+class cBlockLeavesHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h
index d3b03bbda..2bea6a846 100644
--- a/src/Blocks/BlockLever.h
+++ b/src/Blocks/BlockLever.h
@@ -6,7 +6,7 @@
#include "BlockSlab.h"
-class cBlockLeverHandler:
+class cBlockLeverHandler final :
public cMetaRotator<cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, false>
{
using Super = cMetaRotator<cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, false>;
diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h
index 4ee0e8133..165e2d310 100644
--- a/src/Blocks/BlockLilypad.h
+++ b/src/Blocks/BlockLilypad.h
@@ -7,7 +7,7 @@
-class cBlockLilypadHandler:
+class cBlockLilypadHandler final :
public cClearMetaOnDrop<cBlockHandler>
{
using Super = cClearMetaOnDrop<cBlockHandler>;
diff --git a/src/Blocks/BlockMelon.h b/src/Blocks/BlockMelon.h
index da021830c..6a90f217a 100644
--- a/src/Blocks/BlockMelon.h
+++ b/src/Blocks/BlockMelon.h
@@ -7,7 +7,7 @@
-class cBlockMelonHandler :
+class cBlockMelonHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h
index fb81a07d8..1e1e4c8d6 100644
--- a/src/Blocks/BlockMobHead.h
+++ b/src/Blocks/BlockMobHead.h
@@ -7,7 +7,7 @@
-class cBlockMobHeadHandler :
+class cBlockMobHeadHandler final :
public cBlockEntityHandler
{
using Super = cBlockEntityHandler;
diff --git a/src/Blocks/BlockMobSpawner.h b/src/Blocks/BlockMobSpawner.h
index b9d8cd29f..a002a4eb9 100644
--- a/src/Blocks/BlockMobSpawner.h
+++ b/src/Blocks/BlockMobSpawner.h
@@ -8,7 +8,7 @@
-class cBlockMobSpawnerHandler:
+class cBlockMobSpawnerHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockMushroom.h b/src/Blocks/BlockMushroom.h
index c025f3ad5..bad4fc247 100644
--- a/src/Blocks/BlockMushroom.h
+++ b/src/Blocks/BlockMushroom.h
@@ -8,7 +8,7 @@
/** Handler for the small (singleblock) mushrooms. */
-class cBlockMushroomHandler:
+class cBlockMushroomHandler final :
public cClearMetaOnDrop<cBlockHandler>
{
using Super = cClearMetaOnDrop<cBlockHandler>;
diff --git a/src/Blocks/BlockMycelium.h b/src/Blocks/BlockMycelium.h
index bf489eed7..bb05195ff 100644
--- a/src/Blocks/BlockMycelium.h
+++ b/src/Blocks/BlockMycelium.h
@@ -7,7 +7,7 @@
-class cBlockMyceliumHandler:
+class cBlockMyceliumHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockNetherWart.h b/src/Blocks/BlockNetherWart.h
index dde6b17d4..0b0bbf2bd 100644
--- a/src/Blocks/BlockNetherWart.h
+++ b/src/Blocks/BlockNetherWart.h
@@ -8,7 +8,7 @@
-class cBlockNetherWartHandler:
+class cBlockNetherWartHandler final :
public cBlockPlant<false>
{
using Super = cBlockPlant<false>;
diff --git a/src/Blocks/BlockNetherrack.h b/src/Blocks/BlockNetherrack.h
index 4c839d5ee..dfcfeacbd 100644
--- a/src/Blocks/BlockNetherrack.h
+++ b/src/Blocks/BlockNetherrack.h
@@ -7,7 +7,7 @@
-class cBlockNetherrack : public cBlockHandler
+class cBlockNetherrack final : public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockObserver.h b/src/Blocks/BlockObserver.h
index 5c3f62fbd..b2ac955f9 100644
--- a/src/Blocks/BlockObserver.h
+++ b/src/Blocks/BlockObserver.h
@@ -5,7 +5,7 @@
#include "Mixins.h"
-class cBlockObserverHandler:
+class cBlockObserverHandler final :
public cClearMetaOnDrop<cPitchYawRotator<cBlockHandler>>
{
using Super = cClearMetaOnDrop<cPitchYawRotator<cBlockHandler>>;
diff --git a/src/Blocks/BlockOre.h b/src/Blocks/BlockOre.h
index 95bffc75e..023e149d9 100644
--- a/src/Blocks/BlockOre.h
+++ b/src/Blocks/BlockOre.h
@@ -7,7 +7,7 @@
-class cBlockOreHandler:
+class cBlockOreHandler :
public cBlockHandler
{
using Super = cBlockHandler;
@@ -16,6 +16,10 @@ public:
using Super::Super;
+protected:
+
+ ~cBlockOreHandler() = default;
+
private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
@@ -124,3 +128,11 @@ private:
+
+class cDefaultOreHandler final :
+ public cBlockOreHandler
+{
+public:
+
+ using cBlockOreHandler::cBlockOreHandler;
+};
diff --git a/src/Blocks/BlockPackedIce.h b/src/Blocks/BlockPackedIce.h
index cad82d121..a2d13005c 100644
--- a/src/Blocks/BlockPackedIce.h
+++ b/src/Blocks/BlockPackedIce.h
@@ -7,7 +7,7 @@
-class cBlockPackedIceHandler :
+class cBlockPackedIceHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h
index cbde5967e..fd8f3fe8a 100644
--- a/src/Blocks/BlockPiston.h
+++ b/src/Blocks/BlockPiston.h
@@ -15,7 +15,7 @@ class cWorld;
-class cBlockPistonHandler:
+class cBlockPistonHandler final :
public cClearMetaOnDrop<cPitchYawRotator<cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>>
{
using Super = cClearMetaOnDrop<cPitchYawRotator<cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>>;
@@ -141,7 +141,7 @@ private:
-class cBlockPistonHeadHandler:
+class cBlockPistonHeadHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockPlanks.h b/src/Blocks/BlockPlanks.h
index 158b9451d..f095f9ea3 100644
--- a/src/Blocks/BlockPlanks.h
+++ b/src/Blocks/BlockPlanks.h
@@ -7,7 +7,7 @@
-class cBlockPlanksHandler:
+class cBlockPlanksHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockPlant.h b/src/Blocks/BlockPlant.h
index e99a0b130..71890b3cf 100644
--- a/src/Blocks/BlockPlant.h
+++ b/src/Blocks/BlockPlant.h
@@ -9,7 +9,7 @@
/** Base class for plants that use light values to decide whether to grow or not.
On block update, the plant decides whether to grow, die or stay as-is, based on the CanGrow() overridable method result. */
template <bool NeedsLightToGrow>
-class cBlockPlant:
+class cBlockPlant :
public cBlockHandler
{
using Super = cBlockHandler;
@@ -18,39 +18,10 @@ public:
using Super::Super;
-private:
-
- virtual void OnUpdate(
- cChunkInterface & a_ChunkInterface,
- cWorldInterface & a_WorldInterface,
- cBlockPluginInterface & a_PluginInterface,
- cChunk & a_Chunk,
- const Vector3i a_RelPos
- ) const override
- {
- auto Action = CanGrow(a_Chunk, a_RelPos);
- switch (Action)
- {
- case paGrowth:
- {
- Grow(a_Chunk, a_RelPos);
- break;
- }
- case paDeath:
- {
- a_ChunkInterface.SetBlock(a_Chunk.RelativeToAbsolute(a_RelPos), E_BLOCK_AIR, 0);
- break;
- }
- case paStay: break; // do nothing
- }
- }
-
-
-
-
-
protected:
+ ~cBlockPlant() = default;
+
/** The action the plant can take on an update. */
enum PlantAction
{
@@ -59,10 +30,6 @@ protected:
paStay
};
-
-
-
-
/** Checks whether there is enough light for the plant to grow.
If the plant doesn't require light to grow, then it returns paGrowth.
If the plant requires light to grow and there is enough light, it returns paGrowth.
@@ -167,4 +134,31 @@ protected:
}
return FloorC(24.0f / Chance) + 1;
}
+
+private:
+
+ virtual void OnUpdate(
+ cChunkInterface & a_ChunkInterface,
+ cWorldInterface & a_WorldInterface,
+ cBlockPluginInterface & a_PluginInterface,
+ cChunk & a_Chunk,
+ const Vector3i a_RelPos
+ ) const override
+ {
+ auto Action = CanGrow(a_Chunk, a_RelPos);
+ switch (Action)
+ {
+ case paGrowth:
+ {
+ Grow(a_Chunk, a_RelPos);
+ break;
+ }
+ case paDeath:
+ {
+ a_ChunkInterface.SetBlock(a_Chunk.RelativeToAbsolute(a_RelPos), E_BLOCK_AIR, 0);
+ break;
+ }
+ case paStay: break; // do nothing
+ }
+ }
};
diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h
index 64815f38f..1a2c4ef50 100644
--- a/src/Blocks/BlockPortal.h
+++ b/src/Blocks/BlockPortal.h
@@ -7,7 +7,7 @@
-class cBlockPortalHandler:
+class cBlockPortalHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockPressurePlate.h b/src/Blocks/BlockPressurePlate.h
index 3bf0e0861..c9a72a751 100644
--- a/src/Blocks/BlockPressurePlate.h
+++ b/src/Blocks/BlockPressurePlate.h
@@ -6,7 +6,7 @@
-class cBlockPressurePlateHandler :
+class cBlockPressurePlateHandler final :
public cClearMetaOnDrop<cBlockHandler>
{
using Super = cClearMetaOnDrop<cBlockHandler>;
diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h
index d1ca23790..e627eeaee 100644
--- a/src/Blocks/BlockPumpkin.h
+++ b/src/Blocks/BlockPumpkin.h
@@ -5,7 +5,7 @@
-class cBlockPumpkinHandler :
+class cBlockPumpkinHandler final :
public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>
{
using Super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>;
diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h
index cb10cbb04..d05c05ba3 100644
--- a/src/Blocks/BlockQuartz.h
+++ b/src/Blocks/BlockQuartz.h
@@ -7,7 +7,7 @@
-class cBlockQuartzHandler:
+class cBlockQuartzHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index 513ba26c0..af85e0afc 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -16,7 +16,7 @@ enum ENUM_PURE
-class cBlockRailHandler :
+class cBlockRailHandler final :
public cClearMetaOnDrop<cBlockHandler>
{
using Super = cClearMetaOnDrop<cBlockHandler>;
diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h
index 39fdf7d2d..0ba670558 100644
--- a/src/Blocks/BlockRedstone.h
+++ b/src/Blocks/BlockRedstone.h
@@ -8,7 +8,7 @@
-class cBlockRedstoneHandler:
+class cBlockRedstoneHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h
index 3382f543b..7a98f7870 100644
--- a/src/Blocks/BlockRedstoneLamp.h
+++ b/src/Blocks/BlockRedstoneLamp.h
@@ -7,7 +7,7 @@
-class cBlockRedstoneLampHandler:
+class cBlockRedstoneLampHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockRedstoneOre.h b/src/Blocks/BlockRedstoneOre.h
index bdba531f5..82e7c618c 100644
--- a/src/Blocks/BlockRedstoneOre.h
+++ b/src/Blocks/BlockRedstoneOre.h
@@ -8,7 +8,7 @@
-class cBlockRedstoneOreHandler :
+class cBlockRedstoneOreHandler final :
public cBlockOreHandler
{
using Super = cBlockOreHandler;
@@ -60,7 +60,7 @@ public:
-class cBlockGlowingRedstoneOreHandler:
+class cBlockGlowingRedstoneOreHandler final :
public cBlockOreHandler
{
using Super = cBlockOreHandler;
diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h
index eccb497e6..b56f4ad28 100644
--- a/src/Blocks/BlockRedstoneRepeater.h
+++ b/src/Blocks/BlockRedstoneRepeater.h
@@ -11,7 +11,7 @@
-class cBlockRedstoneRepeaterHandler:
+class cBlockRedstoneRepeaterHandler final :
public cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>
{
using Super = cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>;
diff --git a/src/Blocks/BlockRedstoneTorch.h b/src/Blocks/BlockRedstoneTorch.h
deleted file mode 100644
index 9680ca0dd..000000000
--- a/src/Blocks/BlockRedstoneTorch.h
+++ /dev/null
@@ -1,40 +0,0 @@
-
-#pragma once
-
-#include "BlockTorch.h"
-
-
-
-
-
-class cBlockRedstoneTorchHandler :
- public cBlockTorchHandler
-{
- using Super = cBlockTorchHandler;
-
-public:
-
- using Super::Super;
-
-private:
-
- virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
- {
- // Always drop the ON torch, meta 0
- return cItem(E_BLOCK_REDSTONE_TORCH_ON, 1, 0);
- }
-
-
-
-
-
- virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
- {
- UNUSED(a_Meta);
- return 0;
- }
-} ;
-
-
-
-
diff --git a/src/Blocks/BlockSand.h b/src/Blocks/BlockSand.h
index 9011766c5..0c117c40f 100644
--- a/src/Blocks/BlockSand.h
+++ b/src/Blocks/BlockSand.h
@@ -7,7 +7,7 @@
-class cBlockSandHandler :
+class cBlockSandHandler final :
public cBlockHandler
{
public:
diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h
index 3bce74fb1..ee71bf1d0 100644
--- a/src/Blocks/BlockSapling.h
+++ b/src/Blocks/BlockSapling.h
@@ -8,7 +8,7 @@
-class cBlockSaplingHandler :
+class cBlockSaplingHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSeaLantern.h b/src/Blocks/BlockSeaLantern.h
index d3adc95f4..224f8872d 100644
--- a/src/Blocks/BlockSeaLantern.h
+++ b/src/Blocks/BlockSeaLantern.h
@@ -7,7 +7,7 @@
-class cBlockSeaLanternHandler :
+class cBlockSeaLanternHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h
index 95619f564..a8eb52fc6 100644
--- a/src/Blocks/BlockSideways.h
+++ b/src/Blocks/BlockSideways.h
@@ -10,7 +10,7 @@
/** Handler for blocks that have 3 orientations (hay bale, log), specified by the upper 2 bits in meta.
Handles setting the correct orientation on placement.
Additionally supports the metadata specifying block sub-type in its lower 2 bits. */
-class cBlockSidewaysHandler:
+class cBlockSidewaysHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSignPost.h b/src/Blocks/BlockSignPost.h
index 8f0a1c157..39ad6a73b 100644
--- a/src/Blocks/BlockSignPost.h
+++ b/src/Blocks/BlockSignPost.h
@@ -8,7 +8,7 @@
-class cBlockSignPostHandler:
+class cBlockSignPostHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h
index 2de4922b8..e6b1b445f 100644
--- a/src/Blocks/BlockSlab.h
+++ b/src/Blocks/BlockSlab.h
@@ -17,7 +17,7 @@
-class cBlockSlabHandler :
+class cBlockSlabHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
@@ -235,7 +235,7 @@ private:
-class cBlockDoubleSlabHandler:
+class cBlockDoubleSlabHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSlime.h b/src/Blocks/BlockSlime.h
index 87a2faa05..28b50527d 100644
--- a/src/Blocks/BlockSlime.h
+++ b/src/Blocks/BlockSlime.h
@@ -6,7 +6,7 @@
-class cBlockSlimeHandler:
+class cBlockSlimeHandler final :
public cClearMetaOnDrop<cBlockHandler>
{
public:
diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h
index 43e341e0c..d4d8bcc50 100644
--- a/src/Blocks/BlockSnow.h
+++ b/src/Blocks/BlockSnow.h
@@ -7,7 +7,7 @@
-class cBlockSnowHandler :
+class cBlockSnowHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSponge.h b/src/Blocks/BlockSponge.h
index 097b89cf9..a089bc0d0 100644
--- a/src/Blocks/BlockSponge.h
+++ b/src/Blocks/BlockSponge.h
@@ -7,7 +7,7 @@
-class cBlockSpongeHandler :
+class cBlockSpongeHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h
index be86faa1b..701ad38e1 100644
--- a/src/Blocks/BlockStairs.h
+++ b/src/Blocks/BlockStairs.h
@@ -7,7 +7,7 @@
-class cBlockStairsHandler :
+class cBlockStairsHandler final :
public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true>>
{
using Super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true>>;
diff --git a/src/Blocks/BlockStems.h b/src/Blocks/BlockStems.h
index dc30fa6ec..be64d81f8 100644
--- a/src/Blocks/BlockStems.h
+++ b/src/Blocks/BlockStems.h
@@ -11,7 +11,7 @@
ProduceBlockType is the blocktype for the produce to be grown.
StemPickupType is the item type for the pickup resulting from breaking the stem. */
template <BLOCKTYPE ProduceBlockType, ENUM_ITEM_TYPE StemPickupType>
-class cBlockStemsHandler:
+class cBlockStemsHandler final :
public cBlockPlant<true>
{
using Super = cBlockPlant<true>;
diff --git a/src/Blocks/BlockStone.h b/src/Blocks/BlockStone.h
index 846ddf5df..5309f5c41 100644
--- a/src/Blocks/BlockStone.h
+++ b/src/Blocks/BlockStone.h
@@ -6,7 +6,7 @@
-class cBlockStoneHandler:
+class cBlockStoneHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockSugarcane.h b/src/Blocks/BlockSugarcane.h
index 24c08db9f..b21f698f6 100644
--- a/src/Blocks/BlockSugarcane.h
+++ b/src/Blocks/BlockSugarcane.h
@@ -7,7 +7,7 @@
-class cBlockSugarcaneHandler :
+class cBlockSugarcaneHandler final :
public cBlockPlant<false>
{
using Super = cBlockPlant<false>;
diff --git a/src/Blocks/BlockTNT.h b/src/Blocks/BlockTNT.h
index ed478ce94..470cfa91a 100644
--- a/src/Blocks/BlockTNT.h
+++ b/src/Blocks/BlockTNT.h
@@ -7,7 +7,7 @@
-class cBlockTNTHandler :
+class cBlockTNTHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockTallGrass.h b/src/Blocks/BlockTallGrass.h
index d43d3ad04..1c679c2be 100644
--- a/src/Blocks/BlockTallGrass.h
+++ b/src/Blocks/BlockTallGrass.h
@@ -9,7 +9,7 @@
/** Handles the grass that is 1 block tall */
-class cBlockTallGrassHandler:
+class cBlockTallGrassHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h
index a3ded9369..f8b4bfa04 100644
--- a/src/Blocks/BlockTorch.h
+++ b/src/Blocks/BlockTorch.h
@@ -8,15 +8,20 @@
-class cBlockTorchHandler:
- public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2>>
+
+class cBlockTorchBaseHandler :
+ public cMetaRotator<cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2>
{
- using Super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2>>;
+ using Super = cMetaRotator<cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2>;
public:
using Super::Super;
+protected:
+
+ ~cBlockTorchBaseHandler() = default;
+
private:
virtual bool GetPlacementBlockTypeMeta(
@@ -214,3 +219,41 @@ private:
+
+class cBlockTorchHandler final :
+ public cClearMetaOnDrop<cBlockTorchBaseHandler>
+{
+ using Super = cClearMetaOnDrop<cBlockTorchBaseHandler>;
+
+public:
+
+ using Super::Super;
+};
+
+
+
+
+
+class cBlockRedstoneTorchHandler final :
+ public cBlockTorchBaseHandler
+{
+ using Super = cBlockTorchBaseHandler;
+
+public:
+
+ using Super::Super;
+
+private:
+
+ virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
+ {
+ // Always drop the ON torch, meta 0:
+ return { E_BLOCK_REDSTONE_TORCH_ON };
+ }
+
+ virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
+ {
+ UNUSED(a_Meta);
+ return 0;
+ }
+};
diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h
index 2392fc2d3..cef7fb6e9 100644
--- a/src/Blocks/BlockTrapdoor.h
+++ b/src/Blocks/BlockTrapdoor.h
@@ -8,7 +8,7 @@
-class cBlockTrapdoorHandler :
+class cBlockTrapdoorHandler final :
public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x01, 0x02, 0x00, 0x03, false>>
{
using Super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x01, 0x02, 0x00, 0x03, false>>;
diff --git a/src/Blocks/BlockTripwire.h b/src/Blocks/BlockTripwire.h
index 7fbcc678d..7a68c24be 100644
--- a/src/Blocks/BlockTripwire.h
+++ b/src/Blocks/BlockTripwire.h
@@ -7,7 +7,7 @@
-class cBlockTripwireHandler :
+class cBlockTripwireHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h
index 466ca2502..0d46da437 100644
--- a/src/Blocks/BlockTripwireHook.h
+++ b/src/Blocks/BlockTripwireHook.h
@@ -7,7 +7,7 @@
-class cBlockTripwireHookHandler :
+class cBlockTripwireHookHandler final :
public cMetaRotator<cClearMetaOnDrop<cBlockHandler>, 0x03, 0x02, 0x03, 0x00, 0x01>
{
using Super = cMetaRotator<cClearMetaOnDrop<cBlockHandler>, 0x03, 0x02, 0x03, 0x00, 0x01>;
diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h
index 5d4da0319..9738cd89b 100644
--- a/src/Blocks/BlockVine.h
+++ b/src/Blocks/BlockVine.h
@@ -6,7 +6,7 @@
-class cBlockVineHandler :
+class cBlockVineHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockWallSign.h b/src/Blocks/BlockWallSign.h
index d4b1ca59d..800781198 100644
--- a/src/Blocks/BlockWallSign.h
+++ b/src/Blocks/BlockWallSign.h
@@ -8,7 +8,7 @@
-class cBlockWallSignHandler:
+class cBlockWallSignHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/BlockWorkbench.h b/src/Blocks/BlockWorkbench.h
index 5b1e8705b..e654a6b84 100644
--- a/src/Blocks/BlockWorkbench.h
+++ b/src/Blocks/BlockWorkbench.h
@@ -9,7 +9,7 @@
-class cBlockWorkbenchHandler:
+class cBlockWorkbenchHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index 34b8276b6..d9d6e58f1 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -7,6 +7,7 @@ target_sources(
BlockPiston.cpp
ChunkInterface.cpp
+ BlockAir.h
BlockAnvil.h
BlockBed.h
BlockBigFlower.h
@@ -26,6 +27,7 @@ target_sources(
BlockConcretePowder.h
BlockCrops.h
BlockDeadBush.h
+ BlockDefaultBlock.h
BlockDirt.h
BlockDoor.h
BlockDropSpenser.h
@@ -42,6 +44,7 @@ target_sources(
BlockFluid.h
BlockFurnace.h
BlockGlass.h
+ BlockGlazedTerracotta.h
BlockGlowstone.h
BlockGrass.h
BlockGravel.h
@@ -76,21 +79,21 @@ target_sources(
BlockRedstoneLamp.h
BlockRedstoneOre.h
BlockRedstoneRepeater.h
- BlockRedstoneTorch.h
BlockSand.h
BlockSapling.h
BlockSeaLantern.h
BlockSideways.h
BlockSignPost.h
BlockSlab.h
+ BlockSlime.h
BlockSnow.h
BlockSponge.h
BlockStairs.h
BlockStems.h
BlockStone.h
BlockSugarcane.h
- BlockTallGrass.h
BlockTNT.h
+ BlockTallGrass.h
BlockTorch.h
BlockTrapdoor.h
BlockTripwire.h
diff --git a/src/Blocks/Mixins.h b/src/Blocks/Mixins.h
index a5c3e751e..0a356fe58 100644
--- a/src/Blocks/Mixins.h
+++ b/src/Blocks/Mixins.h
@@ -25,33 +25,9 @@ class cBlockLadder: public cMetaRotator<cClearMetaOnDrop, ...>
-template <class Base = cBlockHandler>
-class cBlockWithNoDrops:
- public Base
-{
-public:
-
- constexpr cBlockWithNoDrops(BLOCKTYPE a_BlockType):
- Base(a_BlockType)
- {
- }
-
-private:
-
- virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
- {
- // Don't drop anything:
- return {};
- }
-};
-
-
-
-
-
/** Mixin to clear the block's meta value when converting to a pickup. */
template <class Base>
-class cClearMetaOnDrop:
+class cClearMetaOnDrop :
public Base
{
public:
@@ -61,6 +37,10 @@ public:
{
}
+protected:
+
+ ~cClearMetaOnDrop() = default;
+
private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
@@ -78,7 +58,7 @@ private:
Inherit from this class providing your base class as Base, the BitMask for the direction bits in bitmask and the masked value for the directions in North, East, South, West.
There is also an aptional parameter AssertIfNotMatched, set this if it is invalid for a block to exist in any other state. */
template <class Base, NIBBLETYPE BitMask, NIBBLETYPE North, NIBBLETYPE East, NIBBLETYPE South, NIBBLETYPE West, bool AssertIfNotMatched = false>
-class cMetaRotator:
+class cMetaRotator :
public Base
{
public:
@@ -90,6 +70,8 @@ public:
protected:
+ ~cMetaRotator() = default;
+
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) const override
{
NIBBLETYPE OtherMeta = a_Meta & (~BitMask);
@@ -176,7 +158,7 @@ template <
NIBBLETYPE West = 0x04,
bool AssertIfNotMatched = false
>
-class cYawRotator:
+class cYawRotator :
public cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatched>
{
using Super = cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatched>;
@@ -185,8 +167,6 @@ public:
using Super::Super;
-public:
-
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer & a_Player,
const Vector3i a_BlockPos,
@@ -230,6 +210,10 @@ public:
return North;
}
}
+
+protected:
+
+ ~cYawRotator() = default;
};
@@ -259,6 +243,8 @@ public:
protected:
+ ~cPitchYawRotator() = default;
+
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface,
cPlayer & a_Player,