summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-13 01:21:43 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-13 01:21:43 +0200
commit69afc4dbba9ea22ed53756d0ec2b8ff138ddf781 (patch)
tree237871b3c615fa6e1f96b89133d3d6df4e2360dd /src/ClientHandle.cpp
parentMerge branch 'master' into 1.8-Protocol (diff)
parentFixed friction being applied whilst airborne (diff)
downloadcuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.tar
cuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.tar.gz
cuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.tar.bz2
cuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.tar.lz
cuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.tar.xz
cuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.tar.zst
cuberite-69afc4dbba9ea22ed53756d0ec2b8ff138ddf781.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 80bd4462b..9b6151656 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1139,6 +1139,12 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
FinishDigAnimation();
+ if (!m_Player->IsGameModeCreative() && (a_OldBlock == E_BLOCK_BEDROCK))
+ {
+ Kick("You can't break a bedrock!");
+ return;
+ }
+
cWorld * World = m_Player->GetWorld();
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(m_Player->GetEquippedItem());
@@ -1466,8 +1472,20 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, e
cChunkInterface ChunkInterface(World->GetChunkMap());
NewBlock->OnPlacedByPlayer(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
- // Step sound with 0.8f pitch is used as block placement sound
- World->BroadcastSoundEffect(cBlockInfo::GetPlaceSound(BlockType), (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 1.0f, 0.8f);
+ AString PlaceSound = cBlockInfo::GetPlaceSound(BlockType);
+ float Volume = 1.0f, Pitch = 0.8f;
+ if (PlaceSound == "dig.metal")
+ {
+ Pitch = 1.2f;
+ PlaceSound = "dig.stone";
+ }
+ else if (PlaceSound == "random.anvil_land")
+ {
+ Volume = 0.65f;
+ }
+
+ World->BroadcastSoundEffect(PlaceSound, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, Volume, Pitch);
+
cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
}