summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-30 14:41:40 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-30 14:41:40 +0100
commitd12106ee97dcc3d414792f695c0644724ac80f87 (patch)
tree085a291ac03d7d6b0b7195abc0d31e05c3005e8f
parentPistons no longer accept power through front face (diff)
downloadcuberite-d12106ee97dcc3d414792f695c0644724ac80f87.tar
cuberite-d12106ee97dcc3d414792f695c0644724ac80f87.tar.gz
cuberite-d12106ee97dcc3d414792f695c0644724ac80f87.tar.bz2
cuberite-d12106ee97dcc3d414792f695c0644724ac80f87.tar.lz
cuberite-d12106ee97dcc3d414792f695c0644724ac80f87.tar.xz
cuberite-d12106ee97dcc3d414792f695c0644724ac80f87.tar.zst
cuberite-d12106ee97dcc3d414792f695c0644724ac80f87.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/RedstoneSimulator.cpp70
1 files changed, 8 insertions, 62 deletions
diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp
index c4da2db3a..b6e1566ef 100644
--- a/src/Simulator/RedstoneSimulator.cpp
+++ b/src/Simulator/RedstoneSimulator.cpp
@@ -854,38 +854,11 @@ bool cRedstoneSimulator::IsPistonPowered(int a_BlockX, int a_BlockY, int a_Block
if (!Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ))) { continue; }
- switch (a_Meta) // Pistons' metas are the directions they face; the source cannot be there
+ AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Meta); // Piston meta is based on what direction they face, so we can do this
+
+ if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)))
{
- case BLOCK_FACE_YM:
- {
- if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX, a_BlockY - 1, a_BlockZ))) { return true; }
- break;
- }
- case BLOCK_FACE_YP:
- {
- if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX, a_BlockY + 1, a_BlockZ))) { return true; }
- break;
- }
- case BLOCK_FACE_ZM:
- {
- if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ - 1))) { return true; }
- break;
- }
- case BLOCK_FACE_ZP:
- {
- if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ + 1))) { return true; }
- break;
- }
- case BLOCK_FACE_XM:
- {
- if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX - 1, a_BlockY, a_BlockZ))) { return true; }
- break;
- }
- case BLOCK_FACE_XP:
- {
- if (!Change.a_SourcePos.Equals(Vector3i(a_BlockX + 1, a_BlockY, a_BlockZ))) { return true; }
- break;
- }
+ return true;
}
}
@@ -895,38 +868,11 @@ bool cRedstoneSimulator::IsPistonPowered(int a_BlockX, int a_BlockY, int a_Block
if (!Change.a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ))) { continue; }
- switch (a_Meta)
+ AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Meta);
+
+ if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)))
{
- case BLOCK_FACE_YM:
- {
- if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX, a_BlockY - 1, a_BlockZ))) { return true; }
- break;
- }
- case BLOCK_FACE_YP:
- {
- if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX, a_BlockY + 1, a_BlockZ))) { return true; }
- break;
- }
- case BLOCK_FACE_ZM:
- {
- if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ - 1))) { return true; }
- break;
- }
- case BLOCK_FACE_ZP:
- {
- if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ + 1))) { return true; }
- break;
- }
- case BLOCK_FACE_XM:
- {
- if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX - 1, a_BlockY, a_BlockZ))) { return true; }
- break;
- }
- case BLOCK_FACE_XP:
- {
- if (!Change.a_MiddlePos.Equals(Vector3i(a_BlockX + 1, a_BlockY, a_BlockZ))) { return true; }
- break;
- }
+ return true;
}
}
return false; // Source was in front of the piston's front face