Fixed formatting by adding bodies to all for loops.

This commit is contained in:
Virizion 2015-11-30 19:10:59 -05:00
parent ae8a10d55d
commit d24135771f
3 changed files with 70 additions and 0 deletions

View File

@ -114,11 +114,17 @@ public class SpeedBuilder extends SoloGame
Location groundMin = _buildMiddle.clone().subtract(2, 1, 2);
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
_defaultMiddleGround[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState();
}
}
for (Location loc : WorldData.GetDataLocs("LIME"))
{
_buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5)));
}
}
public void setSpeedBuilderState(SpeedBuilderState state)
@ -146,9 +152,15 @@ public class SpeedBuilder extends SoloGame
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
if (resetGround)
{
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, -1, z), _defaultMiddleGround[x][z].getType(), _defaultMiddleGround[x][z].getRawData());
}
}
}
}
public void pasteBuildInCenter(BuildData buildData)
@ -158,15 +170,25 @@ public class SpeedBuilder extends SoloGame
Location groundMin = _buildMiddle.clone().subtract(2, 1, 2);
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
MapUtil.QuickChangeBlockAt(groundMin.clone().add(x, 0, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData());
}
}
Location buildMin = _buildMiddle.clone().subtract(2, 0, 2);
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 5; y++)
{
for (int z = 0; z < 5; z++)
{
MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData());
}
}
}
}
public void spawnJudge()
@ -379,7 +401,9 @@ public class SpeedBuilder extends SoloGame
if (UtilTime.elapsed(_stateTime, 10000))
{
for (RecreationData recreation : _buildRecreations.values())
{
recreation.breakAndDropItems();
}
ItemPickup = true;
BlockPlace = true;
@ -398,7 +422,9 @@ public class SpeedBuilder extends SoloGame
for (RecreationData recreation : _buildRecreations.values())
{
for (Item item : recreation.DroppedItems)
{
item.remove();
}
recreation.DroppedItems.clear();
@ -615,10 +641,12 @@ public class SpeedBuilder extends SoloGame
ArrayList<DemolitionData> blocksForDemolition = new ArrayList<DemolitionData>(recreation.BlocksForDemolition);
for (DemolitionData demolition : blocksForDemolition)
{
if (_state != SpeedBuilderState.Building)
demolition.cancelBreak();
else
demolition.update();
}
}
}

View File

@ -14,15 +14,25 @@ public class BuildData
Location groundMin = loc.clone().add(-2, 2, -2);
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState();
}
}
Location buildMin = loc.clone().add(-2, 3, -2);
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 5; y++)
{
for (int z = 0; z < 5; z++)
{
Build[x][y][z] = buildMin.clone().add(x, y, z).getBlock().getState();
}
}
}
}
}

View File

@ -46,8 +46,12 @@ public class RecreationData
PlayerSpawn = playerSpawn;
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState();
}
}
}
public boolean inBuildArea(Block block)
@ -99,12 +103,20 @@ public class RecreationData
public void clearBuildArea(boolean resetGround)
{
for (Block block : getBlocks())
{
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
if (resetGround)
{
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), DefaultGround[x][z].getType(), DefaultGround[x][z].getRawData());
}
}
}
}
public void pasteBuildData(BuildData buildData)
@ -112,13 +124,23 @@ public class RecreationData
clearBuildArea(true);
for (int x = 0; x < 5; x++)
{
for (int z = 0; z < 5; z++)
{
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData());
}
}
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 5; y++)
{
for (int z = 0; z < 5; z++)
{
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData());
}
}
}
}
public void breakAndDropItems()
@ -140,8 +162,10 @@ public class RecreationData
public boolean isEmptyBuild()
{
for (Block block : getBlocks())
{
if (block.getType() != Material.AIR)
return false;
}
return true;
}
@ -151,10 +175,16 @@ public class RecreationData
int score = 0;
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 5; y++)
{
for (int z = 0; z < 5; z++)
{
if (buildData.Build[x][y][z].getType() == CornerA.clone().add(x, y, z).getBlock().getType() && buildData.Build[x][y][z].getRawData() == CornerA.clone().add(x, y, z).getBlock().getData())
score++;
}
}
}
return score;
}
@ -172,8 +202,10 @@ public class RecreationData
public void addToDemolition(Block block)
{
for (DemolitionData demolition : BlocksForDemolition)
{
if (demolition.Block.equals(block))
return;
}
BlocksForDemolition.add(new DemolitionData(this, block));
}