diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-02 14:50:30 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-02 14:50:30 +0100 |
commit | b731dd06353bf0de6bf5c12853bdc9fda5fa5514 (patch) | |
tree | 7d13e9248c88ac1726596ea33c7903c5a42724c1 /source/Blocks | |
parent | Implement suggestions (diff) | |
download | cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.tar cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.tar.gz cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.tar.bz2 cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.tar.lz cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.tar.xz cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.tar.zst cuberite-b731dd06353bf0de6bf5c12853bdc9fda5fa5514.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Blocks/BlockFire.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source/Blocks/BlockFire.h b/source/Blocks/BlockFire.h index 6a6fb9ded..36ec6bbb3 100644 --- a/source/Blocks/BlockFire.h +++ b/source/Blocks/BlockFire.h @@ -83,16 +83,7 @@ public: // This is because the frame is a solid obsidian pillar if ((MaxY != 0) && (newY == Y + 1)) { - for (int checkBorder = newY + 1; checkBorder <= MaxY - 1; checkBorder++) // newY + 1: newY has already been checked; MaxY - 1: portal doesn't need corners - { - if (a_World->GetBlock(X, checkBorder, Z) != E_BLOCK_OBSIDIAN) - { - // Base obsidian, base + 1 obsidian, base + x NOT obsidian -> not complete portal - return 0; - } - } - // Everything was obsidian, found a border! - return -1; // Return -1 for a frame + return EvaluatePortalBorder(X, newY, Z, MaxY, a_World); } else { @@ -106,6 +97,21 @@ public: return 0; } + /// Evaluates if coords have a valid border on top, based on MaxY + int EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cWorld * a_World) + { + for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners + { + if (a_World->GetBlock(X, checkBorder, Z) != E_BLOCK_OBSIDIAN) + { + // Base obsidian, base + 1 obsidian, base + x NOT obsidian -> not complete portal + return 0; + } + } + // Everything was obsidian, found a border! + return -1; // Return -1 for a frame border + } + /// Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE) void FindAndSetPortalFrame(int X, int Y, int Z, cWorld * a_World) { |