{
this.oneSSBlock = baseBlock.clone();
}
else
{
this.oneSSBlock = new BlockVec3(0, 64, 0);
}
}
// Find contiguous blocks using an algorithm like the oxygen sealer one
List<BlockVec3> currentLayer = new LinkedList<BlockVec3>();
List<BlockVec3> nextLayer = new LinkedList<BlockVec3>();
final List<BlockVec3> foundThrusters = new LinkedList<BlockVec3>();
this.checked.clear();
currentLayer.add(this.oneSSBlock.clone());
this.checked.add(this.oneSSBlock.clone());
Block bStart = this.oneSSBlock.getBlockID(this.worldObj);
if (bStart instanceof BlockSpinThruster)
{
foundThrusters.add(this.oneSSBlock);
}
float thismass = 0.1F; //Mass of a thruster
float thismassCentreX = 0.1F * this.oneSSBlock.x;
float thismassCentreY = 0.1F * this.oneSSBlock.y;
float thismassCentreZ = 0.1F * this.oneSSBlock.z;
float thismoment = 0F;
int thisssBoundsMaxX = this.oneSSBlock.x;
int thisssBoundsMinX = this.oneSSBlock.x;
int thisssBoundsMaxY = this.oneSSBlock.y;
int thisssBoundsMinY = this.oneSSBlock.y;
int thisssBoundsMaxZ = this.oneSSBlock.z;
int thisssBoundsMinZ = this.oneSSBlock.z;
while (currentLayer.size() > 0)
{
for (BlockVec3 vec : currentLayer)
{
if (vec.x < thisssBoundsMinX)
{
thisssBoundsMinX = vec.x;
}
if (vec.y < thisssBoundsMinY)
{
thisssBoundsMinY = vec.y;
}
if (vec.z < thisssBoundsMinZ)
{
thisssBoundsMinZ = vec.z;
}
if (vec.x > thisssBoundsMaxX)
{
thisssBoundsMaxX = vec.x;
}
if (vec.y > thisssBoundsMaxY)
{
thisssBoundsMaxY = vec.y;
}
if (vec.z > thisssBoundsMaxZ)
{
thisssBoundsMaxZ = vec.z;
}
for (int side = 0; side < 6; side++)
{
if (vec.sideDone[side])
{
continue;
}
BlockVec3 sideVec = vec.newVecSide(side);
if (!this.checked.contains(sideVec))
{
this.checked.add(sideVec);
Block b = sideVec.getBlockID(this.worldObj);
if (!(b instanceof BlockAir) && b != null)
{
nextLayer.add(sideVec);
if (bStart instanceof BlockAir)
{
this.oneSSBlock = sideVec.clone();
bStart = b;
}
float m = 1.0F;
//Liquids have a mass of 1, stone, metal blocks etc will be heavier
if (!(b instanceof BlockLiquid))