summaryrefslogtreecommitdiffstats
path: root/source/cRedstone.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-06 22:06:51 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-06 22:06:51 +0100
commit01577bed9d9840f48766a16095ab2b1fce8c02ff (patch)
tree4f89f1b0c2fff25b5426f439b726b2b9c704e510 /source/cRedstone.h
parentWorld storage names are now case-INsensitive (diff)
downloadcuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.tar
cuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.tar.gz
cuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.tar.bz2
cuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.tar.lz
cuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.tar.xz
cuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.tar.zst
cuberite-01577bed9d9840f48766a16095ab2b1fce8c02ff.zip
Diffstat (limited to 'source/cRedstone.h')
-rw-r--r--source/cRedstone.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/source/cRedstone.h b/source/cRedstone.h
index 44641fbdf..26e9a6319 100644
--- a/source/cRedstone.h
+++ b/source/cRedstone.h
@@ -1,5 +1,7 @@
#pragma once
+#include "Vector3i.h"
+
class cWorld;
class cRedstone
{
@@ -21,6 +23,91 @@ public:
return 0x0;
}
+ static bool IsRepeaterPointingTo( const Vector3i & a_RepeaterPos, char a_MetaData, const Vector3i & a_BlockPos )
+ {
+ switch( a_MetaData )
+ {
+ case 0x0:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i( 0, 0, 1 ) ) )
+ {
+ return true;
+ }
+ break;
+ case 0x1:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i(-1, 0, 0 ) ) )
+ {
+ return true;
+ }
+ break;
+ case 0x2:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i( 0, 0,-1 ) ) )
+ {
+ return true;
+ }
+ break;
+ case 0x3:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i( 1, 0, 0 ) ) )
+ {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ static bool IsRepeaterPointingAway( const Vector3i & a_RepeaterPos, char a_MetaData, const Vector3i & a_BlockPos )
+ {
+ switch( a_MetaData )
+ {
+ case 0x0:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i( 0, 0,-1 ) ) )
+ {
+ return true;
+ }
+ break;
+ case 0x1:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i( 1, 0, 0 ) ) )
+ {
+ return true;
+ }
+ break;
+ case 0x2:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i( 0, 0, 1 ) ) )
+ {
+ return true;
+ }
+ break;
+ case 0x3:
+ if( (a_RepeaterPos - a_BlockPos).Equals( Vector3i(-1, 0, 0 ) ) )
+ {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ static Vector3i GetRepeaterDirection( char a_MetaData )
+ {
+ switch( a_MetaData )
+ {
+ case 0x0:
+ return Vector3i( 0, 0,-1 );
+ case 0x1:
+ return Vector3i( 1, 0, 0 );
+ case 0x2:
+ return Vector3i( 0, 0, 1 );
+ case 0x3:
+ return Vector3i(-1, 0, 0 );
+ default:
+ break;
+ }
+ return Vector3i();
+ }
void CalculateRedstone( int, int, int );
void ChangeRedstone( int, int, int, bool );