diff options
author | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-07 23:59:29 +0100 |
---|---|---|
committer | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-07 23:59:29 +0100 |
commit | a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1 (patch) | |
tree | 62167f9ff48fb895c7542e44ef5b5520172a79f4 /source/cChunk.cpp | |
parent | More updates to cPiston.cpp. Piston action will now only be broadcasted to players who have the chunk with the moving piston loaded. (diff) | |
download | cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.tar cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.tar.gz cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.tar.bz2 cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.tar.lz cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.tar.xz cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.tar.zst cuberite-a9e02cf8fa3afbdbe853e52f030e9a8c7efe46c1.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cChunk.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp index a8a579e96..ac4f69f93 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -19,10 +19,12 @@ #include "cTorch.h"
#include "cLadder.h"
#include "cPickup.h"
+#include "cRedstone.h"
#include "cItem.h"
#include "cNoise.h"
#include "cRoot.h"
#include "cCriticalSection.h"
+#include "cBlockToPickup.h"
#include "cGenSettings.h"
@@ -215,6 +217,7 @@ void cChunk::Tick(float a_Dt) unsigned int NumTickBlocks = ToTickBlocks.size();
if( NumTickBlocks > 0 ) LOG("To tick: %i", NumTickBlocks );
m_pState->m_ToTickBlocks.clear();
+ bool isRedstone = false;
for( std::map< unsigned int, int>::iterator itr = ToTickBlocks.begin(); itr != ToTickBlocks.end(); ++itr )
{
if( (*itr).second < 0 ) continue;
@@ -226,6 +229,12 @@ void cChunk::Tick(float a_Dt) char BlockID = GetBlock( index );
switch( BlockID )
{
+ case E_BLOCK_REDSTONE_REPEATER_OFF:
+ case E_BLOCK_REDSTONE_REPEATER_ON:
+ case E_BLOCK_REDSTONE_WIRE:
+ {
+ isRedstone = true;
+ }
case E_BLOCK_REEDS:
case E_BLOCK_WOODEN_PRESSURE_PLATE:
case E_BLOCK_STONE_PRESSURE_PLATE:
@@ -236,19 +245,23 @@ void cChunk::Tick(float a_Dt) case E_BLOCK_YELLOW_FLOWER:
case E_BLOCK_RED_ROSE:
case E_BLOCK_RED_MUSHROOM:
- case E_BLOCK_BROWN_MUSHROOM:
- case E_BLOCK_REDSTONE_WIRE: // Stuff that drops when block below is destroyed
+ case E_BLOCK_BROWN_MUSHROOM: // Stuff that drops when block below is destroyed
{
if( GetBlock( X, Y-1, Z ) == E_BLOCK_AIR )
{
SetBlock( X, Y, Z, 0, 0 );
- cPickup* Pickup = new cPickup( (X+m_PosX*16) * 32 + 16, (Y+m_PosY*128) * 32 + 16, (Z+m_PosZ*16) * 32 + 16, cItem( (ENUM_ITEM_ID)BlockID, 1 ) );
+ if (isRedstone) {
+ cRedstone Redstone(m_World);
+ Redstone.ChangeRedstone( X, Y, Z, false );
+ }
+ cPickup* Pickup = new cPickup( (X+m_PosX*16) * 32 + 16, (Y+m_PosY*128) * 32 + 16, (Z+m_PosZ*16) * 32 + 16, cItem( cBlockToPickup::ToPickup( (ENUM_ITEM_ID)BlockID, E_ITEM_EMPTY) , 1 ) );
Pickup->Initialize( m_World );
}
}
break;
case E_BLOCK_REDSTONE_TORCH_OFF:
case E_BLOCK_REDSTONE_TORCH_ON:
+ isRedstone = true;
case E_BLOCK_TORCH:
{
char Dir = cTorch::MetaDataToDirection( GetLight( m_BlockMeta, X, Y, Z ) );
@@ -260,7 +273,11 @@ void cChunk::Tick(float a_Dt) if( m_World->GetBlock( XX, YY, ZZ ) == E_BLOCK_AIR )
{
SetBlock( X, Y, Z, 0, 0 );
- cPickup* Pickup = new cPickup( (X+m_PosX*16) * 32 + 16, (Y+m_PosY*128) * 32 + 16, (Z+m_PosZ*16) * 32 + 16, cItem( (ENUM_ITEM_ID)BlockID, 1 ) );
+ if (isRedstone) {
+ cRedstone Redstone(m_World);
+ Redstone.ChangeRedstone( X, Y, Z, false );
+ }
+ cPickup* Pickup = new cPickup( (X+m_PosX*16) * 32 + 16, (Y+m_PosY*128) * 32 + 16, (Z+m_PosZ*16) * 32 + 16, cItem( cBlockToPickup::ToPickup( (ENUM_ITEM_ID)BlockID, E_ITEM_EMPTY) , 1 ) );
Pickup->Initialize( m_World );
}
}
|