summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockSeaLantern.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-22 12:08:12 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-09-23 15:34:15 +0200
commit71b96ab921bed0371d7c75ac4a2db99b94591de2 (patch)
tree618e9e37799cbf07a55f4a3950071e067358753f /src/Blocks/BlockSeaLantern.h
parentAdded dtEnvitonment to player damage text (#4925) (diff)
downloadcuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar
cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.gz
cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.bz2
cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.lz
cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.xz
cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.zst
cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockSeaLantern.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Blocks/BlockSeaLantern.h b/src/Blocks/BlockSeaLantern.h
index 1fab10a11..2ff100d85 100644
--- a/src/Blocks/BlockSeaLantern.h
+++ b/src/Blocks/BlockSeaLantern.h
@@ -6,6 +6,7 @@
+
class cBlockSeaLanternHandler :
public cBlockHandler
{
@@ -24,13 +25,13 @@ private:
{
return cItem(E_BLOCK_SEA_LANTERN, 1, 0);
}
- else
- {
- unsigned int DropNum = GetRandomProvider().RandInt<char>(2, 3 + ToolFortuneLevel(a_Tool));
- // cap the dropnum to the max amount of 5
- DropNum = std::min<unsigned int>(DropNum, 5);
- // Reset meta to 0
- return cItem(E_ITEM_PRISMARINE_CRYSTALS, DropNum, 0);
- }
+
+ // Number of crystals to drop, capped at the max amount of 5.
+ const auto Drops = std::min(
+ static_cast<char>(5),
+ GetRandomProvider().RandInt<char>(2, 3 + ToolFortuneLevel(a_Tool))
+ );
+
+ return cItem(E_ITEM_PRISMARINE_CRYSTALS, Drops);
}
} ;