From 5b66c1d84c41f1e4862395dcc1ee184d06c4834e Mon Sep 17 00:00:00 2001 From: Disasm Date: Thu, 11 Jul 2013 00:46:40 +0400 Subject: [PATCH] Optimize getRealShipSize() --- src/cr0s/WarpDrive/EntityJump.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cr0s/WarpDrive/EntityJump.java b/src/cr0s/WarpDrive/EntityJump.java index 34b0c7b2..aff570d0 100644 --- a/src/cr0s/WarpDrive/EntityJump.java +++ b/src/cr0s/WarpDrive/EntityJump.java @@ -446,21 +446,20 @@ public class EntityJump extends Entity { */ public int getRealShipSize() { int shipSize = 0; - - for (int y = minY; y <= maxY; y++) { - for (int x = minX; x <= maxX; x++) { - for (int z = minZ; z <= maxZ; z++) { + for (int x = minX; x <= maxX; x++) { + for (int z = minZ; z <= maxZ; z++) { + for (int y = minY; y <= maxY; y++) { int blockID = worldObj.getBlockId(x, y, z); // Пропускаем пустые блоки воздуха if (blockID != 0) { shipSize++; - } - if (blockID == Block.bedrock.blockID) { - bedrockOnShip = true; - return shipSize; + if (blockID == Block.bedrock.blockID) { + bedrockOnShip = true; + return shipSize; + } } } }