{
FMLLog.info("Oxygen Sealer replacing head at x" + this.head.x + " y" + (this.head.y - 1) + " z" + this.head.z);
}
if (!sealersSave.isEmpty())
{
TileEntityOxygenSealer oldHead = sealersSave.get(0);
if (!this.sealers.contains(oldHead))
{
this.sealers.add(oldHead);
}
}
this.head = newhead.clone();
otherSealer.threadSeal = this;
otherSealer.stopSealThreadCooldown = 75 + TileEntityOxygenSealer.countEntities;
checkedSave.addAll(this.checked);
break;
}
else
{
sealersDone.addAll(this.sealers);
}
checkedSave.addAll(this.checked);
}
}
// Restore sealers to what it was, if this search did not
// result in a seal
if (!this.sealed)
{
this.sealers = sealersSave;
this.torchesToUpdate = torchesSave;
}
else
{
//If the second search sealed the area, there may also be air or torches to update
if (!this.airToReplace.isEmpty() || !this.airToReplaceBright.isEmpty())
{
List<ScheduledBlockChange> changeList = new LinkedList<ScheduledBlockChange>();
Block breatheableAirID = GCBlocks.breatheableAir;
for (BlockVec3 airVec : this.airToReplace)
{
changeList.add(new ScheduledBlockChange(airVec.clone(), breatheableAirID, 0));
}
for (BlockVec3 airVec : this.airToReplaceBright)
{
changeList.add(new ScheduledBlockChange(airVec.clone(), GCBlocks.brightBreatheableAir, 0));
}
TickHandlerServer.scheduleNewBlockChange(this.world.provider.dimensionId, changeList);
}
if (!this.torchesToUpdate.isEmpty())
{
TickHandlerServer.scheduleNewTorchUpdate(this.world.provider.dimensionId, this.torchesToUpdate);
}
}
}
this.checked = checkedSave;
if (!this.sealed)
{
if (this.head.getBlockID(this.world) == GCBlocks.breatheableAir)
{
this.breatheableToReplace.add(this.head);
}
if (this.head.getBlockID(this.world) == GCBlocks.brightBreatheableAir)
{
this.breatheableToReplaceBright.add(this.head);
}
if (!this.breatheableToReplace.isEmpty() || !this.breatheableToReplaceBright.isEmpty())
{
List<ScheduledBlockChange> changeList = new LinkedList<ScheduledBlockChange>();
for (BlockVec3 checkedVec : this.breatheableToReplace)
{
changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.air, 0));
}
for (BlockVec3 checkedVec : this.breatheableToReplaceBright)
{
changeList.add(new ScheduledBlockChange(checkedVec.clone(), GCBlocks.brightAir, 0));
}
TickHandlerServer.scheduleNewBlockChange(this.world.provider.dimensionId, changeList);
}
if (!this.torchesToUpdate.isEmpty())
{
TickHandlerServer.scheduleNewTorchUpdate(this.world.provider.dimensionId, this.torchesToUpdate);
}
}
}
// Set any sealers found which are not the head sealer, not to run their
// own seal checks for a while
// (The player can control which is the head sealer in a space by
// enabling just that one and disabling all the others)
TileEntityOxygenSealer headSealer = this.sealersAround.get(this.head.clone().translate(0, -1, 0));
// If it is sealed, cooldown can be extended as frequent checks are not needed
if (headSealer != null)
{
headSealer.stopSealThreadCooldown += 75;