summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-06 21:39:44 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-06 21:39:44 +0100
commitcc4e4345deebd36db77ec8befea4894c4169d0ed (patch)
tree0d5ba972628b757be1c7ae6fa0a088f1d5220969 /source/cClientHandle.cpp
parentPatch with diff file created by Sebi (implemented some stuff like lava physics, drops are deleted when in lava, water is now slower, lava gives actual damage etc.). Pistons now work mostly as they should. They do not yet show the motion animation and do not emit sound. They do extend, push, and retract as they should though. Right now the only way to activate a piston is to light redstone wire adjacent to it with a redstone torch. (diff)
downloadcuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.tar
cuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.tar.gz
cuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.tar.bz2
cuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.tar.lz
cuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.tar.xz
cuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.tar.zst
cuberite-cc4e4345deebd36db77ec8befea4894c4169d0ed.zip
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r--source/cClientHandle.cpp38
1 files changed, 29 insertions, 9 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 515134683..a2597a229 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -647,6 +647,8 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
//printf("Place Dir:%i %i %i %i : %i\n", PacketData->m_Direction, PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ, PacketData->m_ItemType);
// 'use' useable items instead of placing blocks
bool bPlaceBlock = true;
+ bool UpdateRedstone = false;
+ bool AddedCurrent = false;
if( PacketData->m_Direction >= 0 )
{
ENUM_BLOCK_ID BlockID = (ENUM_BLOCK_ID)m_Player->GetWorld()->GetBlock( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ );
@@ -655,6 +657,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
case E_BLOCK_REDSTONE_REPEATER_ON:
case E_BLOCK_REDSTONE_REPEATER_OFF:
{
+ //no need to update redstone current with a repeater
//todo: Find meta value of repeater and change it to one step more.
}
break;
@@ -761,35 +764,48 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
break;
case E_BLOCK_REDSTONE_TORCH_OFF:
{
- MetaData = cTorch::DirectionToMetaData( PacketData->m_Direction );
+ MetaData = cTorch::DirectionToMetaData( PacketData->m_Direction );
//check redstone circuit:
-
//if( GetBlock( X, Y+1, Z ) == E_BLOCK_AIR )
if( g_BlockTransparent[ (int)m_Player->GetWorld()->GetBlock( PacketData->m_PosX, PacketData->m_PosY+2, PacketData->m_PosZ ) ] == true ) {//if block above is transparent
//printf("transparent above me\n");
} else {
//printf("transparent not above me\n");
}
-
- cRedstone Redstone(m_Player->GetWorld());
- Redstone.cRedstone::ChangeRedstoneTorch( PacketData->m_PosX, PacketData->m_PosY+1, PacketData->m_PosZ, true );
-
- break;
+ //PacketData->m_ItemType = E_BLOCK_REDSTONE_TORCH_ON;
+ UpdateRedstone = true;
+ AddedCurrent = true;
+ //cRedstone Redstone(m_Player->GetWorld());
+ //Redstone.cRedstone::ChangeRedstoneTorch( PacketData->m_PosX, PacketData->m_PosY+1, PacketData->m_PosZ, true );
+ break;
}
case E_BLOCK_REDSTONE_TORCH_ON:
- MetaData = cTorch::DirectionToMetaData( PacketData->m_Direction );
- break;
+ {
+ MetaData = cTorch::DirectionToMetaData( PacketData->m_Direction );
+ //PacketData->m_ItemType = E_BLOCK_REDSTONE_TORCH_ON;
+ UpdateRedstone = true;
+ AddedCurrent = false;
+ //cRedstone Redstone(m_Player->GetWorld());
+ //Redstone.cRedstone::ChangeRedstoneTorch( PacketData->m_PosX, PacketData->m_PosY+1, PacketData->m_PosZ, true );
+ break;
+ }
case E_ITEM_REDSTONE_DUST:
MetaData = 0;
PacketData->m_ItemType = E_BLOCK_REDSTONE_WIRE;
+ UpdateRedstone = true;
+ AddedCurrent = false;
break;
case E_ITEM_REDSTONE_REPEATER:
MetaData = cRedstone::RepeaterRotationToMetaData( m_Player->GetRotation() );
PacketData->m_ItemType = E_BLOCK_REDSTONE_REPEATER_OFF;
+ UpdateRedstone = true;
+ AddedCurrent = false;
break;
case E_BLOCK_PISTON:
case E_BLOCK_STICKY_PISTON:
MetaData = cPiston::RotationPitchToMetaData( m_Player->GetRotation(), m_Player->GetPitch() );
+ UpdateRedstone = true;
+ AddedCurrent = false;
break;
case E_BLOCK_COBBLESTONE_STAIRS:
case E_BLOCK_BRICK_STAIRS:
@@ -829,6 +845,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
AddDirection( X, Y, Z, PacketData->m_Direction );
m_Player->GetWorld()->SetBlock( X, Y, Z, (char)PacketData->m_ItemType, MetaData );
+ if (UpdateRedstone) {
+ cRedstone Redstone(m_Player->GetWorld());
+ Redstone.ChangeRedstoneTorch( PacketData->m_PosX, PacketData->m_PosY+1, PacketData->m_PosZ, AddedCurrent );
+ }
}
}
}